CS4700 Logic3
CS4700 Logic3
Carla P. Gomes
[email protected]
Module:
Propositional Logic:
Inference
(Reading R&N: Chapter 7)
1
Proof Methods
2
Proof methods
– Model checking
• truth table enumeration (always exponential in n) we’ve talked about this approach
• improved backtracking, e.g., Davis--Putnam-Logemann-Loveland (DPLL)
• heuristic search in model space (sound but incomplete)
e.g., min-conflicts-like hill-climbing algorithms Next
module
• (including some inference rules)
Proof
The sequence of wffs (w1, w2, …, wn) is called a proof (or deduction) of w n from
a set of wffs Δ iff each wi in the sequence is either in Δ or can be inferred from a
wff (or wffs) earlier in the sequence by using a valid rule of inference.
Δ├ wn
(read: wn can be proved or inferred from Δ)
Δ├ R wn
(read: wn can be proved from Δ using the inference rules in R)
Propositional logic:
Rules of Inference or Methods of Proof
How to produce additional wffs (sentences) from other ones? What steps can we
perform to show that a conclusion follows logically from a set of hypotheses?
Example
Modus Ponens
P
PQ
______________
Q
The hypotheses (premises) are written in a column and the conclusions below the bar
The symbol denotes “therefore”. Given the hypotheses, the conclusion follows.
The basis for this rule of inference is the tautology (P (P Q)) Q)
[aside: check tautology with truth table to make sure]
In words: when P and P Q are True, then Q must be True also. (meaning of
second implication)
6
Propositional logic:
Rules of Inference or Methods of Proof
Example
Modus Ponens
P P (P Q) Addition
PQ
PQ (P Q) P Simplification
P
P [(P) (Q)] (P Q) Conjunction
Q
PQ
How to show that q logically follows from the hypotheses (p1 p2 …pn)?
Show that
(p1 p2 …pn) q is a tautology
One can use the rules of inference to show the validity of an argument.
9
Proof Tree
Proofs can also be based on partial orders – we can represent them using a
tree structure:
– Each node in the proof tree is labeled by a wff, corresponding to a wff in
the original set of hypotheses or be inferable from its parents in the tree
using one of the rules of inference;
– The labeled tree is a proof of the label of the root node.
Example:
Given the set of wffs:
P, R, PQ
Give a proof of Q R
10
Tree Proof
Given: P, P Q, R;
Prove: Q R
P PQ R
MP
Q
Conj.
But, resulting proof can be much shorter than truth table method.
Consider premises:
p_1, p_1 p_2, p_2 p_3 … p_(n-1) p_n
Key open question: Is there always a short proof for any valid
conclusion? Probably not. The NP vs. co-NP question.
Resolution in Propositional Logic
Resolution
(for CNF)
Note: Sometimes we use the notation of a set for a clause: e.g. {P,Q,R} corresponds
to the clause (PQ R); the empty clause (sometimes written as Nil or {}) is equivalent
to False;
Soundness of Resolution:
Validity of the Resolution Inference Rule
PQ resolving on P
P R Validity (Tautology): (P Q) (P R) (Q R) ;
QR
0 0 0 0 1 0 0 1
0 0 1 0 1 0 1 1
0 1 0 1 1 1 1 1
1 0 0 1 0 0 0 1
1 1 0 1 0 0 1 1
1 0 1 1 1 1 1 1
0 1 1 1 1 1 1 1
0 0 0 0 1 0 0 1
Resolution:
Special Cases
3 – Unit Resolution
P
PQ
Q
P
P Q
Q
Resolution:
Caution!
DO NOT Resolve
Resolving one pair at a time on Q and R
Resolving
P Q R Resolving P Q R P Q R
on Q on R
P W Q R P W Q R P W Q R
P R R W P Q Q W PW
True
CNF
{λ} Σ1
Σi- sets of literals i =1 ,2
Resolution { λ} Σ2
λ – atom;
Σ1 Σ 2
P (Q R)
(P S Q) (P R Q) (P P Q) (P S S)
(P R S) (P P S) (P P Q)…
How many clauses?
Resolution:
Wumpus World
P31 P2,2, P?
P2,2 P?
P31
Resolution Refutation
To show that (P R) ╞Res (P R) do: (1) negate (P R), i.e.: (P) (R) ; (2) prove that
(P R) (P) (R) is inconsistent
Propositional Logic:
Proof by refutation or contradiction:
Example:
BatIsOk
RobotMoves Show that KB ╞ BlockLiftable
BatIsOk BlockLiftable RobotMoves KB
BatIsOk
RobotMoves RobotMoves
BatIsOk BlockLiftable RobotMoves KB’ BatIsOk RobotMoves
BlockLiftable
BatIsOk BatIsOk
Nil
Resolution
Any complete search algorithm applying only the resolution rule, can derive any
conclusion entailed by any knowledge base in propositional logic – resolution can
always be used to either confirm or refute a sentence – refutation completeness (Given
A, it’s true we cannot use resolution to derive A OR B; but
we can use resolution to answer the question of whether A OR B is true.)
Resolution Closure
Definition
Let the variables in f be P1,..,Pn, and let us assume that RC(f) does not contain
the empty clause.
Therefore we can construct a model for m for f with suitable truth
values for P1,..,Pn.
Resolution (contd.)
Construction procedure:
Assume the opposite. Then, there exists a clause that evaluates to false
under m.
Wlog, we may write this clause as (ab), where b is a literal over Pi and
a is a formula over variables P1,.., Pi-1.
Note that there cannot exist another such clause where b is negated
(c¬b) as otherwise i was not minimal [consider (ac) RC(f)].
Resolution (contd.)
However, then Pi is set such that b evaluates to True, which contradicts the
assumption that the clause was not satisfied.
Therefore all the clauses are satisfied and m is indeed a model for RC(f).
QED
Resolution Refutation –
Ordering Search Strategies
BatIsOk BatIsOk
0th level resolvents
BatIsOk
RobotMoves Nil
.
Resolution Proofs of PH
And?
Definition:
A Horn clause is a clause that has at most one positive literal.
Examples:
P; P Q; P Q; P Q R;
Types of Horn Clauses:
Fact – single atom – e.g., P;
Rule – implication, whose antecendent is a conjunction
of positive literals and whose consequent consists of a single
positive literal – e.g., PQ R; Head is R; Tail is (PQ )
Set of negative literals - in implication form, the antecedent is
a conjunction of positive literals and the consequent is empty.
e.g., PQ ; equivalent to P Q.
Theorem
– Unit resolution is refutation complete for HF, i.e. if kb¬a is a HF then
unit propagation shows that kb¬a is unsatisfiable iff kb╞ a.
Proof
– If kb¬a is not satisfiable then kb¬a must contain a clause that contains
one non-negated variable only:This clause must be a unit clause.
(otherwise consider the model that sets all variables to false).
– Using unit resolution of this variable with all other clauses essentially
eliminates the variable from the formula while preserving the Horn
property.
– Continuing this process, unit propagation hits P¬P iff the formula is not
satisfiable.
Forward chaining
Idea: fire any rule whose premises are satisfied in the KB,
– add its conclusion to the KB, until query is found
AND-OR graph
Forward
Chaining
Algorithm
Forward chaining is
sound and complete
for Horn KB