logic in computer science transparency no. 3.3-1 chapter 3 propositional logic 3.6. propositional...
Post on 20-Dec-2015
258 views
TRANSCRIPT
Logic in Computer Science
Transparency No. 3.3-1
Chapter 3
Propositional Logic
3.6. Propositional Resolution
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-2
Propositional Resolution (another Propositinal calculus)
a single rule of inference: P => Q , Q => R
--------------------------
P => R Using propositional resolution alone (without axiom schemat
a or other rules of inference), it is possible to build a theorem prover that is sound and complete for All propositional Calculus .
The search space using propositional resolution is much smaller than for standard propositional calculus (like H).
works only on expressions in clausal form. General procedure to convert wffs into clausal forms introduc
ed before.
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-3
Clausal Form revisited
A literal is either an atomic sentence or a negation of an atomic sentence. p
~p A clause is either a literal or a disjunction of literals.
p
~p
p \/ q \/ r Clauses are usually written as sets of literals.
{ p} , { ~p} , { p,q,r } A database in clausal form is a set of clauses.
{{~p,q},{r,~q}}
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-4
Empty Sets
The empty clause {} is unsatisfiable. Why: It is equivalent to an empty disjunction.
The empty database {} is valid. Why: It is equivalent to an empty conjunction.
What about a database consisting of an empty clause {{}}?
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-5
Conversion to Clausal Form
Implications out: P1 -> P2 ---> ~P1 \/ P2
P1 <-> P2 ---> (~P1 \/ P2) /\ (P1 \/ ~P2) Negations in:
~~P ---> P
~(P1 /\ P2) ---> ~P1 \/ ~P2
~(P1 \/ P2) ---> ~P1 /\ ~P2 Disjunctions in:
P1 \/ (P2 /\ P3) ---> (P1 \/ P2) /\ (P1\/ P3) Operators out:
P1 \/ P2 ---> {P1,P2}
P1 /\ P2 ---> {P1} , {P2}
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-6
Examples
Example 1: (g & (r -> f)) I (g & (~r | f)) N D O { g} , {~r,f}
Example 2: ~(g & (r -> f)) I ~(g & (~r | f)) N (~g | ~(~r | f)) (~g | (~~r & ~f)) (~g | (r & ~f)) D (~g | r) & (~g | ~f) O {~g, r} , {~g, ~f}
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-7
Propositional Resolution
General form:
{p1,..., r,...,pm} {q1,...,~r,...,qn} --------------------- {p1,...,pm,q1,...,qn}
Example: {Office, Home} {~Home,Sick} ---------------------- {Office,Sick}
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-8
Issues
Collapse: {~p,q} {p,q} ------------ {q}
Multiple Conclusions: {p,q} {~p,~q} ------------- {p,~p} {q,~q}
Single Application Only:
{p,q} {~p,~q} ------------- {} NO!
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-9
Modus Ponens: p => q {~p,q} p {p} ---------- ----------------- q {q}
Modus Tollens: p => q {~p,q} ~q {~q} ---------- ------------ ~p {~p}
Special Cases of Propositional Resolution
Chaining:
p => q {-p,q} q => r {-q,r} ---------- ------------- p => r {-p,r}
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-10
Unsatisfiability
Example:
1. {p,q} premise
2. {~p,q} premise
3. {p,~q} premise
4. {~p,~q} premise
5. {q} 1,2
6. {~q} 3,4
7. {} 5,6
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-11
True or False Questions
Theorem: T |= A iff T U {~A} is unsatisfiable.
Application: To determine whether a set T of sentences logically implies a sentence A, rewrite T U {~s} in clausal form and try to derive the empty clause.
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-12
True or False Example
{p -> q, q -> r} |= p -> r ? p -> q ==> {~p,q} q -> r ==> {~q,r} ~(p -> r) ==> {p} , {~r}
1. {~p,q} premise
2. {~q,r} premise
3. {p} negated goal
4. {~r} negated goal
5. {q} 1,3
6. {r} 2,5
7. {} 4,6
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-13
True or False Example
{p -> q,m -> p \/ q} |= m -> q?
p -> q ==> {~p,q} m -> p \/ q ==> {~m,p,q} ~ (m -> q) ==> {m} , {~q}
1. {~p,q} premise
2. {~m,p,q} premise
3. {m} negated goal
4. {~q} negated goal
5. {p,q} 2,3
6. {q} 1,5
7. {} 4,6
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-14
Incompleteness?
Theorem: Propositional Resolution is not generatively complete. I.e., the statement:
“If T |= A then there is a proof of A from T using Propositional Resolution only.”
is not true.
Pf: Show that {} |= p => (q => p) using propositional resolution.
Note since there are no premises, there are no conclusions that can be generated. QED
However it can be show that Propositional Resolution is refutation complete. Namely, if T is unsatisfiable, then there is a resolution proof of {} (contradiction) from T. Hence
T |= A iff T U {~A} is unsatisfiable iff there is a resolution proof of {} from T U {~A}.
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-15
Resolution proof of {} |= p->(q->p)
I ~(p -> (q -> p)) : ~A
N ~(~p \/ (~q \/ p))
(~~p /\ ~(~q \/ p))
(~~p /\ (~~q /\ ~p))
(p /\ (q /\ ~p))
D
O {p}, {q}, {~p}
1. {p} negated goal
2. {q} negated goal
3. {~p} negated goal
4. {} 1,3
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-16
Resolution Provability
Definition: A sentence A is provable from a set of sentences T by propositional resolution (written T |-r A) iff there is a derivation of the empty clause from the clausal form of T U {~A} using resolution rule only.
Soundness and Completeness of Resolution: Soundness Theorem: Proposition resolution is sound.
T |-r A => T |= A
Completeness Theorem: Our proof system is complete.
T |= A => T |-r A
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-17
Termination
Two finger method: 1. {P,Q} Premise 2. {~P,Q} Premise 3. {P,~Q} Premise 4. {~P,~Q} Premise 5. {Q} 1,2 6. {P} 1,3 7. {Q,~Q} 1,4; 2,3 8. {P,~P} 1,4; 2,3 9. {~P} 2,4 10. {~Q} 3,4 11. {} 6,9
Theorem: There is a resolution derivation of a conclusion from a set of premises if and only if there is a derivation using the two finger method.
Theorem: Propositional resolution using the two-finger method always terminates.
Proof: There are only finitely many clauses that can be constructed from a finite set of logical constants.
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-18
Soundness of |-r.
Let T |-rr A means there is a resolution proof of A with all premises from T.
Lemma: T |-rr A implies T |= A. pf: Let D1,D2,…Dn be a resolution proof of A. Then either A \in T and hence T |= A, or A is obtained by resolution, i.e., there is Di = {L, L1,…,Ls}, Dj = {~L, M1,…,Mt} with A = {L1,…Ls,M1,…Mt}. By Ind. Hyp. T|= Di and T|= Dj, from which T|= A by soundness of resolution. Soundness of |-r. pf: T |-r A iff T, ~A |-rr {} => T,~A |= [] => T U{~A} is unsatisfia
ble => T|= ~A.
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-19
The algorithm
input: T, A; output T |-r A ?
Let DB = the set of all clausal forms obtained from T U {~A}. Let List = [].add( DB.removeFirst()); While(! DB.isEmpty()){ Clause C = DB.removeFirst(); ForEach( D in List ) { let Result = AllResolvents(C,D); for each E in Result { if E = [] return true; if( E not in List U DB ) DB.add( E); }} List.add(C). } return false;
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-20
Termination
The algorithm must terminates.
pf: Since List and DB contains only distinct clauses and there are at most 2^ ( 2 x #atoms ) clauses that can be generated by resolutions, where
#atoms is the number of distinct atoms in T U {~A}.
Logic in Computer ScienceCh 3. Propositional Logic
Transparency No. 3.1-21
Completeness
Let T be a finite set of clauses. if T is unsatifiable, then there is a resolution deduction of {} from T.
Pf: if T contains {}, then we are done. Otherwise, the proof is by induction on the number of excess literals e =
{ #literals(C) – 1 | C in T}. if e = 0, then T is unsat iff theare two complementary unit clause {L} {~
L} in C, => T |-r {}. if e > 0 => there is a clause C = L \/ C’. Let T1 = T – {C} U {C’}; T2 = T-{C} U {{L}}. Since T is unsat, bothe T1 and T2 must be unsat. => by ind hyp. There is a resolution proof R1 (R2) of {} from T1 (T2). If R1 does not use C’, then R1 id also a proof of {} from T, and we are do
ne. Other we can construct a proof of L from R1 by replacing every occurrence of C’ in R1 by C. now by joining such proof to occurrence of
L in R2,we obtains a prrof of {} from T.