So far, we’ve seen how to determine entailment by model checking… which is?
Now, let’s look at showing entailment through theorem proving– wherein we apply rules of inference directly to the sentences in our \(KB\) to construct a proof, without consulting models.
If the number of models is large, but the length of the proof is short, then theorem proving can be more efficient.
Before we get into the thick of it, we have to look at some related concepts first.
First: logical equivalence
Two sentences \(\alpha\) and \(\beta\) are logically equivalent if they are true in the same set of models. Written as:
\[\alpha \equiv \beta\] CAREFUL: We use \(\equiv\) to make claims about a sentence, but \(\iff\) is part of a sentence.
Pop quiz: is \(Q \land P\) logically equivalent to \(P \land Q\)?
Prove it to me.
We can also define equivalence as follows: \[ \alpha \equiv \beta\ \textrm{if and only if}\ \alpha \models \beta\ \textrm{and}\ \beta \models \alpha \]
The next concept we need is validity.
“A sentence is valid if it is true in all models”
Example: \(P \lor \lnot P\) is valid.
Valid sentences are also sometimes called tautologies, they are necessarily true.
You may notice that all valid sentences are always true, why and what good are they?
It’s possible to prove (from the definition of entailment) the deduction theorem which was known to the ancient Greeks.
For any sentences \(\alpha\) and \(\beta\), \(\alpha \models \beta\) if and only if the sentence \((\alpha \implies \beta)\) is valid.
So… if we check if \((\alpha \implies \beta)\) is true in every model, (as we did in our inference model), or by otherwise proving that \(\alpha \implies \beta\) evaluates to \(true\), we can find if \(\alpha \models \beta\) (bang!).
Finally, let’s talk about satisfiability. Spitball me a definition
Example: Remember our \(KB\) filled with sentences \(R_n\)?
\((R_1\land R_2\land R_3\land R_4\land R_5)\) is satisfiable since there are three models in which it is true (as seen in our giant truth table).
We can check satisfiability by enumerating possible models until one is found that satisfies, easy enough… right… right?
Well, turns out, the satisfiability problem, or the SAT problem, was the first problem to be proved NP-complete. Actually, many problems in Computer Science are really satisfiability problems!
Also, validity and satisfiability are connected, \(\alpha\) is valid iff \(\lnot \alpha\) is unsatisfiable; contrapositively (wow!), \(\alpha\) is satisfiable iff \(\lnot \alpha\) is not valid:
\(\alpha \models \beta\) iff the sentence \((\alpha \land \lnot \beta)\) is unsatisfiable.
Proving \(\beta\) from \(\alpha\) by checking the unsatisfiability of \((\alpha \land \lnot \beta)\) corresponds to reductio ad absurdum (or proof by contradiction, or proof by refutation).
If we assume some sentence \(\beta\) is false and show how this leads to a contradiction with known axioms \(\alpha\), we’ve shown \((\alpha \land \lnot \beta)\) is unsatisfiable!
Let’s now talk about the inference rules that we can use to derive a proof.
The best known and most simple is Modus Ponens:
\[ \frac{\alpha \implies \beta,\ \alpha}{\beta} \] The bottom part is what can be inferred by the sentences in the top part.
Example: from \((WumpusAhead \land WumpusAlive)\implies Shoot\) and \((WumpusAhead \land WumpusAlive)\) we can infer \(Shoot\)(bang!)
Another quick and useful tool is and-elimination:
\[ \frac{\alpha \land \beta}{\alpha} \]
Standard Logical Equivalences
These are all very useful, but we have to be very careful…
Consider the consequences for biconditional elimination:
\[ \frac{\alpha \iff \beta}{(\alpha \implies \beta)\land(\beta \implies \alpha)}\ \textrm{and}\ \frac{(\alpha \implies \beta)\land(\beta \implies \alpha)}{\alpha \iff \beta} \]
Not all rules work in both directions like this
It is not the case that Modus Ponens can be run in reverse:
\[ \frac{\beta}{\alpha \implies \beta,\ \alpha} \]
Refer back to our previous sentences \(R_n\) (in slides or textbook)
Let’s look at how we can use these rules to show there is no pit in [1,2] (\(\lnot P_{1,2}\))
Any of our search algorithms we saw in Ch. 3 can be used to find a sequence of steps that constitutes a proof like this! We just need to define our problem as so:
This said, searching for proofs is an alternative to enumerating models.
In many cases, *finding a proof can be more efficient because a proof can ignore irrelevant propositions, regardless of how many of them there are. (truth tables are prone to exploding)
A final thing to mention regarding logical systems is: monotonicity… the set of entailed sentences only increases as information is added… \[ \textrm{if}\ KB\models \alpha\ \textrm{then}\ KB\land\beta\models\alpha \]
Example: knowing that there are only \(8\) pits in the world may help us find additional conclusions, but will not invalidate previous conclusions.
You can fearlessly apply inference rules when you need to, without worrying it will be invalidated by future knowledge.
(what is an example of nonmonotonic logic in the real world?)
So far, we’ve focused on the soundness of inference rules, but not the completeness of the algorithms that use them.
Search algorithms (like iterative deepening, for example) are complete insofar as they will find any reachable goal. But what if the available inference rules are inadequate?
… if we didn’t have our biconditional elimination rule, we couldn’t have done our last proof.
Let’s discuss the strategy of resolution, that yields a complete inference algorithm together with any complete search algorithm.
Remember the first steps in our Wumpus world?
Our agent returns from [2,1] to [1,1] then goes to [1,2], where it percieves a stench but no breeze.
Let’s add that to the \(KB\)
\[ R_{11}: \lnot B_{1,2}.\\ R_{12}: B_{1,2} \iff (P_{1,1}\lor P_{2,2}\lor P_{1,3}) \]
As seen before we can derive the absence of pits in [2,2] and [1,3] (and we already know about [1,1])
\[ R_{13}: \lnot P_{2,2}.\\ R_{14}: \lnot P_{1,3}. \]
Then we use biconditional elimination with Modus Ponens with \(R_5\) to obtain: \[ R_{15}: P_{1,1}\lor P_{2,2}\lor P_{3,1}. \]
Now… here comes the resolution rule: the \(P_{2,2}\) in \(R_{13}\) resolves with the literal \(P_{2,2}\) in \(R_{15}\) to give the resolvant: \[ P_{16}: P_{1,1}\lor P_{3,1}. \]
Did you see what happened?
In a similar way, the literal \(\lnot P_{1,1}\) in \(R_1\) resolves with the literal in \(R_{16}\) to give: \[ R_{17}: P_{3,1}. \]
These last two steps were examples of the unit resolution inference rule.
More generally, resolution takes two clauses and produces a new clause which contains all of the literals, except for literals which are complements (negations) of each other:
\[ \frac{P_{1,1}\lor P_{3,1},\ \lnot P_{1,1}\lor\lnot P_{2,2}}{P_{3,1}\lor\lnot P_{2,2}} \]
Technically speaking, resolution needs to produce a clause that contains one and only one of each literal, duplicates can be removed by factoring.
As it turns out, resolution forms the foundation for a family of complete inference procedures. A resolution-based theorem prover can, for any sentences \(\alpha\) and \(\beta\) in propositional logic, decide whether \(\alpha \models \beta\)
It’s important to specify that resolution only applies to disjunctions… which is great for \(KB\)s and queries of clauses, but could it be useful for all of propositional logic?
Inference using resolution works through proof by contradiction, that is: showing \((KB\land\lnot\alpha)\) is unsatisfiable to show \(KB\models\alpha\).
Resolution Algorithm
First \((KB\land\lnot\alpha)\) should be converted to CNF, then the resolution rule is applied to the result. Each pair of complementing literals is resolved which is added to the set (if not already present). This continues until…
This empty clause (a disjunction of no disjuncts) evaluates to \(false\) why?
It also only arises from two contradictory unit clauses like \(P\) and \(\lnot P\).
We can apply our resolution procedure to a simple inference in the Wumpus World: When the agent is in [1,1], there is no breeze, so there can be no pits nearby. \[ KB=R_2\land R_4 = (B_{1,1}\iff(P_{1,2}\lor P_{2,1}))\land\lnot B_{1,1} \]
We wish to prove \(\alpha\), which is \(\lnot P_{1,2}\). When converting to CNF we can continue resolution:
Resolution Resolution