120 likes | 385 Views
Prolog and Classical Theorem Proving. Resolution theorem proving viewpoint. Natural deduction theorem proving viewpoint. Conversion to Clausal Form. Step 1: Eliminate and operators. Conversion to Clausal Form. Step 2: Move all quantifiers to the left. Conversion to Clausal Form.
E N D
Prolog and Classical Theorem Proving • Resolution theorem proving viewpoint. • Natural deduction theorem proving viewpoint.
Conversion to Clausal Form Step 1: Eliminate and operators.
Conversion to Clausal Form Step 2: Move all quantifiers to the left.
Conversion to Clausal Form Step 3: Eliminate all existential quantifiers • Those outside the scope of a universal quantifier are replaced with Skolem constants. e.g.X.happy(X) translates to happy(someone) • Those inside the scope of universal quantifiers are replaced with Skolem functions for which the arguments are the universally quantified variables. e.g. X.Y.hates(X,Y) translates to hates(X,enemy(X)) Step 4: Remove universal quantifiers as well since we can now assume all variables are universally quantified.
Conversion to Clausal Form Step 5: Drive negation inwards to predicates.
Conversion to Clausal Form Step 6: Bundle disjunctions together. Step 7: Convert each disjunction bundle to a set. Step 8: Convert top-level conjunction to a set.
Example of Clausal Form Translation X.((lecturer(X) not(logic_programmer(X)) kindly(X)) lecturer(dave) not(kindly(dave)) X.(not(lecturer(X) not(logic_programmer(X)) kindly(X)) lecturer(dave) not(kindly(dave)) X.(not(lecturer(X)) not(not(logic_programmer(X))) kindly(X)) lecturer(dave) not(kindly(dave)) X.(not(lecturer(X)) logic_programmer(X) kindly(X)) lecturer(dave) not(kindly(dave)) (not(lecturer(X)) logic_programmer(X) kindly(X)) lecturer(dave) not(kindly(dave)) { {not(lecturer(X)), logic_programmer(X),kindly(X)}, {lecturer(dave)}, {not(kindly(dave))} }
A Resolution Proof To prove logic_programmer(dave) from : { {not(lecturer(X)),logic_programmer(X),kindly(X)}, {lecturer(dave)}, {not(kindly(dave))} } {not(lecturer(X)), logic_programmer(X), kindly(X)} {not(logic_programmer(dave))} {not(lecturer(dave)), kindly(dave)} {lecturer(dave)} {not(kindly(dave))} {kindly(dave)} {} Contradiction
Prolog Viewed as Resolution Proof p(X) :- q(X), r(X). q(a). r(a). p(X) q(X) r(X). q(a). r(a). { {p(X), not(q(X)), not(r(X))} {q(a)}, {r(a)} } | ?- p(a). {not(p(a))} {p(X), not(q(X)), not(r(X))} {not(q(a)), not(r(a))} {q(a)} {not(r(a))} {r(a)} {} Contradiction yes
Prolog as a Form of Natural Deduction Sub-proofs Proof A F F true 1 F A B F A F B 2 F A F A B 3 F A B F B 4 A B F F A F B 5 plus negation as failure: F A F not(A)
A Prolog Natural Deduction Proof F= { p(a) true, p(f(X)) p(X) } F p(f(f(a))) 5 p(f(f(a))) p(f(a)) F F p(f(a)) 5 p(f(a)) p(a) F F p(a) 5 F true p(a) trueF 1
Divergences Some proof rules in classical natural deduction aren’t used in Prolog. A or B F [ A|F] C [ B|F] C F C [ A|F] B F A B but one can get similar effects by different means: g(X1,…,Xm) p(X1,…,Xn) or q(Xn+1,…,Xm) F then use g(…) instead of (p(…) or q(…)) Use equivalence of A B to not(A not(B))