Introduction to Theorem Proving

Presentation on theme: "Introduction to Theorem Proving"— Presentation transcript:

Introduction to Theorem Proving
Suppose p1, p2, , pn and C are propositions for which (p1 /\ p2 /\ /\ pn) -> C is a tautology. Then: p1 /\ p2 /\ /\ pn is called the premise C is called the conclusion of a syllogism. - So, a syllogism is a deductive reasoning “scheme” composed of premises and a conclusion. We also say that p1,p2, , C is a Theorem. Then we can represent the theorem as follows. p1, p2, , pn =>C Note that I switched -> to mean “implies” and => to mean a “theorem” because I could not find the “right” symbol on my keyboard for “├ ”

Checking for Theorem There are 2 “standard” ways to check for theorems using the Truth-Table: for: p1, p2, -----, pn => C Forward chaining Check to see that whenever p1, p2, , pn are all True, then C is also True Backward chaining Check to see that whenever C is False, there is at least one of the p1, p2, , pn is also False

“Strange” Example 1 So, p1, p2, C is not a theorem or p1, p2 =/=> C
Let’s try a little “strange” set of premises and conclusion. (Note that premises and conclusions are all propositions and the truth value of a compound proposition depends on that of its components.) let p1 : a printer is a device p2 : if Ram is in class, then a printer is a device C : Ram is in class p1 C p2: (C->p1) Forward chaining: p1 and p2 are T in rows 1 and 2 but C is F in row 2. T T T T T F Also Backward chaining: C is F in rows 2 and 4, but in row 2 both p1 and p2 are T. F T F F F T So, p1, p2, C is not a theorem or p1, p2 =/=> C

Rewording Example 1 So, p1, p2, C is a theorem or p1, p2 => C
Let’s reword this to a more “normal” look let p1 : Ram is in class p2 : if Ram is in class, then a printer is a device C : a printer is a device Forward chaining: p1 and p2 are T in row 1 and C is also T in row 1. There is no other row with p1 and p2 both having T value. p1 C P2: (p1 -> C) T T T F T F Also Backward chaining: C is F in rows 2 and 4. In row 2, p2 is also F, and in row 4, p1 is also F. F T T F F T So, p1, p2, C is a theorem or p1, p2 => C This is an example of : modus ponens where we have p1, p1->C => C.

Theorem Proving by Manipulating Syntax
We have used the Truth table for demonstrating tautologies, proof with forward chaining, and proof with backward chaining. Can we demonstrate an expression or set of statements to be a theorem by “manipulating the syntax” ? An expression or a set of statements is proven to be a theorem if we show that the expression is derived (using replacement rules) from a set of premises. 1) A procedure often used in derivation is : Start with a premise which may be a given axiom or a previously proven theorem Utilize a logical sequence of tautologies or previously proven theorems to arrive at the expression which needs to be proven. 2) Another procedure often used is the reverse of above: Start with the expression that needs to be proven as theorem Utilize a sequence of tautologies or previously proven theorems to arrive at a known theorem or axiom. The term “utilize a sequence of - - -” means to replace any of the expression by any statement that is logically equivalent. (a natural starting place may be modus ponens)

List of Some Tautologies
~~p <-> p p /\ q < - > q /\ p p \/ q < - > q \/ p (p /\ q) /\ r < - > p /\ (q /\ r) (associative law) (p \/ q) \/ r < - > p \/ (q \/ r) (associative law) p /\ (q \/ r) < - > (p /\ q) \/ (p/\ r) (distributive law) p \/ (q /\ r) < - > (p \/ q) /\ (p \/ r) (distributive law) ~ (p /\ q) < - > ~p \/ ~q (De Morgan) ~ (p \/ q) < - > ~p /\ ~q (De Morgan) p \/ p < - > p p /\ p < - > p p /\ q -> q p /\ q -> p p \/ False <- > p p /\ True <-> p p -> p \/ q q -> p v q Note that these are almost reversed

2. p, p- >q => q (modus ponens) 3. ~p, p \/ q = > q
List of Some Theorems 1. p, q => p/\ q (obvious: because p /\ q <-> p /\ q is a tautology ) 2. p, p- >q => q (modus ponens) 3. ~p, p \/ q = > q 4. ~q, p->q => ~p (modus tollens) 5. p \/ q, p-> r, q -> r => r 6. p –> q, q -> r => p -> r 7. p, p ->q, q -> r => r 8. p \/ ( q /\ ~ q)  p 9. p /\ ( q \/ ~q)  p 10. p -> q  ~p \/ q 11. p -> q  ~q -> ~p 12 ~ (p -> q)  p /\ ~q 13. p <-> q  (p -> q) /\ ( q -> p) 14. p<->q  (p /\ q) \/ (~p /\ ~q) 15. p -> ( q -> r)  (p /\q) ->r Note the symbolisms: => means is a theorem  means is the same or equals this is saying: (( p->q  ~q v p) -> True) is a tautology or ( p->q  ~q v p) => True

Some Examples of proving theorems with “manipulating symbols”
~p, p v q => q [ ~p Λ ( p v q) ] -> q ~ [ ~p Λ ( p v q) ] v q p v ~(p v q) v q p v q v ~(p v q) (p v q ) v ~ (p v q) True thus [ ~p Λ ( p v q) ] -> q is a tautology p, q => ( p Λ q) p Λq -> (p Λ q) ~(p Λ q) V (p Λ q) True thus p ,q -> (p Λ q) is a tautology

More example of proving with “manipulating symbols”
14. P<->Q  (PΛQ) V (~P Λ ~Q) P<->Q (P->Q) Λ (Q->P) (~P VQ) Λ (~Q V P) [~P Λ (~Q V P)] V [Q Λ (~Q v P)] [ (~P Λ ~Q) V(~P Λ P)] V [ (Q Λ ~Q) V (Q Λ P)] [ (~P Λ ~Q) V (F) ] V [ ( F) V (Q Λ P)] [ (~P Λ ~Q) ] V [ (Q Λ P) ] (Q Λ P ) V (~P Λ ~Q) (P Λ Q ) V (~P Λ ~Q) P V (Q Λ ~Q)  P P v ( Q Λ ~Q) P v (False) P

Conjunctive Normal Form & Disjunctive Normal Form
Conjunctive Normal Form is a conjunction (AND) of expressions where each expression is a disjunction (Or) of literals. note: a literal is a proposition such as P, Q, or ~P. Example of Conjunctive Normal Form : (A V B V C) Λ (~B V C) Disjunctive Normal Form is a disjunction (OR) of expressions where each expression is a conjunction (AND) of literals. note: a literal is a proposition such as P, Q, or ~P. Example of Disjunctive Normal Form : (A Λ B Λ C) V (~B Λ C)

Can Any Logical Expression be Expressed in either Disjunctive Normal Form or Conjunctive Normal Form? Let’s look at an example with truth table: A B “Exp” Exp is true on 1, 3rd, 4th line: (A Λ B) or (~A ΛB) or (~A Λ~B) are true. T T T T F F F T T F F T Note: This is one of the 16 possible combinations. We could pick another combination We can express “Exp” with the following Disjunctive Normal Form: “Exp” = (A Λ B) V (~A ΛB) V (~A Λ~B)

Simplify the sample Disjunctive Normal Form
(A Λ B) V (~A ΛB) V (~A Λ~B) { [ A V(~A ΛB) ] Λ [ B V (~A ΛB) ] } V (~A Λ ~B) { [ (AV~A) Λ (AVB) ] Λ [ (BV~A) Λ(BVB)] } V (~A Λ~B) { [ T Λ (AVB) ] Λ [ (BV~A) Λ (B) ] } V (~A Λ~B) { [ (A V B) ] Λ [ ( B) ] } V (~A Λ~B) { (A Λ B) V (B Λ B) } V (~A Λ~B) { (A Λ B) V (B) } V (~A Λ~B) (B) V (~A Λ~B) (B V ~A) Λ (B V ~B) (B V ~A) Λ T ( B V ~ A ) which is ( ~A V B ) or A -> B or the “Exp” expression of the truth table in the previous slide We used the following absorption rules in the above derivation: (see page 46 of your text book) P V (P Λ Q ) <-> P P Λ (P V Q ) <-> P Check the absorption rules out with truth table to satisfy yourself.

Truth Table for “Absorption Rule”
Q P /\ Q P \/ (P /\ Q) PPV(P /\ Q) P \/ Q P /\ (P \/ Q) T T T T T T T T F F T T T T F T F F T T F F F F F T F F tautology

Can we turn the Disjunctive Normal Form of Exp to Conjunctive Normal Form?
Recall that from the Truth Table, Exp = (A Λ B) V (~A ΛB) V (~A Λ~B) To turn this into Conjunctive Normal Form, let’s look at using DeMorgan Law. So let’s look at ~ Exp. ~ Exp = ~ [ (A Λ B) V (~A Λ B) V (~A Λ ~B) ] = [ ~ (A Λ B) ] Λ [~ (~A Λ B) ] Λ [~ (~A Λ ~B) ] = (~A V ~B ) Λ ( A V ~B) Λ (A V B) = (~A V ~B ) Λ ( A v (~B Λ B) ) = (~A V ~B ) Λ ( A V False ) = (~A v ~B ) Λ (A) = (~A Λ A) V ( A Λ ~B) = F V ( A Λ ~B) = ( A Λ ~B) But ---- we want Exp, which is ~ (~Exp) So, Exp = ~ (A Λ ~B) Exp = ~A V B or A -> B This is the same as the truth table expression, Exp. Conjunctive Normal Form Show the replacement sequence --- Relationship of Conjunctive Normal form and Disjunctive Normal form ?

Recapture the Steps From the Truth Table Expression, Exp, pick all the rows where the Exp has the value True. Express each of those True rows as an expression of conjunction of the literals, based on the truth values of the literals for that row. The disjunction of the expressions formulate the Disjunctive Normal Form of that Exp. To obtain the Conjunctive Normal Form we need to apply the DeMorgan Law to convert Exp to ~Exp.

Introduction to Resolution Theorem
A Popular Theorem used in A.I. is the Resolution Theorem ( a simplified version) p \/ r, q \/ ~r => p \/ q Let’s look at the first term , p \/ r. Start with the known theorem, p->r is equal to ~p \/ r, thus we have (~p) -> r  ~(~p) \/ r Using the tautology, ~~p <-> p, we can convert the above to the (~p) -> r  p \/ r. So we can replace the p \/ r with (~p) ->r in the original expression. Next, q \/ ~r is the same as ~r \/ q from one of the known tautologies. And ~r \/ q can be replaced with r -> q from the same earlier theorem. Now we have : (~p) -> r, r -> q => p v q Finally replace p \/ q with ~p -> q and we have : (~p) -> r, r -> q => ~p -> q which is the same as one of the earlier known theorem (-> is transitive) in the form of p -> q, q -> r => p -> r Thus p \/ r, q \/ ~r => p \/ q.

General Resolution Theorem
The General form of Resolution theorem states that there may be any number of disjuncts, including the case of just one, in either of the two expressions. The only requirements is that one expression must have a disjunct that is the negation of a disjunct in the other. E1 \/ E2 \/ \/ Ek \/ En, E1 \/ E2 \/ \/ ~Ek - - -\/ En => E1 \/ E \/ En Note that the Ek is the disjunct that is dropped. Special Case 1: E1, ~E1 \/ E2 => E2 this is the same as E1, E1 -> E2 => E2 (modus ponens) Special Case 2: ~E1 \/ E2, ~E2 => ~E1 This is the same as E1 -> E2, ~E2 => ~E1 (modus tollens) Note that we are dealing with Conjunctive Normal Form

Refutation Principle or Proof by Contradiction
AI and many other fields use a method called Refutation Principle together with the Resolution Theorem. Show that the negation of the conclusion is inconsistent with the premise(s). Example : (premise) local database \/ remote database prove : local database v remote database, ~(local database) => remote database Proof: 1. Assume : (~ remote database) is true (negation of conclusion) 2. (local database \/ remote database) is true (premise) 3. (~ local database) is true (premise from the prove statement) 4. local database \/ remote database, ~local database is true (combine 2 and 3 above) 5. remote database is true (4 above and resolution theorem) 6. remote database, ~remote base is true (1 and 5 above contradiction) 7. empty (or False) ( 6 above and resolution theorem or (a Λ ~a) is F )

General Approach to Utilizing Refutation Principle
1. Express the premises and conclusion in disjunctive form . 2. Assume the negation of the conclusion and show inconsistency via utilizing the Resolution Theorem. Show that the negation of the conclusion leads to inconsistency (False), thus the conclusion must be True

Resolution-Refutation Tree with Modus Ponens
- The familiar modus ponens: A -> B A B - Express the premise in disjunctive form along with negation of conclusion: ~A V B A V False Assume ~B ~ A V B A V False ~B B V False False The Resolution-Refutation tree shows that ~B assumption is False; thus B must be True

Example of a Resolution-Refutation Tree used in A.I.
Prove: A->B, B->C, C->D => A->D Assume ~( A -> D) ~A\/B, ~B\/C, ~C\/D => ~(~A \/ D) We have 3 disjunctive terms and 1 conjunctive term ~A\/B, ~B\/C, ~C\/D, ~~A /\ ~D ~A\/B, ~B\/C, ~C\/D, A /\ ~D ~A\/B, ~B\/C, ~C\/D, A, ~D Place these on a “reverse” tree Process using Resolution Theorem ~A\/B ~B\/C ~C\/D ~A\/C A ~A\/D D ~D Again, note that ~D is (~D \/ False) Empty (False)