180 likes | 386 Views
Presentation by Kenny Pearce CSE 391: Artificial Intelligence April 22, 2005. Automated Theorem Proving. The State of the Art. OTTER “Organized Techniques for Theorem-Proving and Effective Research” Proves theorems in first order logic with equality using resolution-based techniques
E N D
Presentation by Kenny Pearce CSE 391: Artificial Intelligence April 22, 2005 Automated Theorem Proving
The State of the Art • OTTER • “Organized Techniques for Theorem-Proving and Effective Research” • Proves theorems in first order logic with equality using resolution-based techniques • Written in C for Unix • Developed at Argonne National Lab • http://www-unix.mcs.anl.gov/AR/otter/
ResolutionRussel and Norvig 7.5 • Consider this problem (to which we will return later): • Axiom Set: {(L&W), (L->(~F))} • Theorem: (~F) • Standard Proof: • (L&W) ⊧ L (& Elimination) • {(L->(~F)), L} ⊧ (~F) (Modus Ponens) • QED
ResolutionRussel and Norvig 7.5 Consider this problem (to which we will return later): Axiom Set: {(L&W), (L->(~F))} Theorem: (~F) Resolution Proof: First, Translate into Conjunctive Normal Form, with Theorem Negated: (L&W&(~L|~F)&F) X X (L&W&~F&F) Yields an empty clause, therefore argument valid
OTTER Successes • Found a shorter single axiom for lattice theory • Found several shorter single axioms for ternary boolean algebra • Proved that all Robbins algebras are boolean • Found a shorter axiom system for two-value sentential calculus • More at http://www-unix.mcs.anl.gov/AR/new_results/
Is OTTER an AI Theorem Prover? • Uses Resolution • Guided by Heuristics • BUT relative weights of heuristics, restrictions, etc. must be customized by a human for each problem • The human has to have a good idea of what kinds of proof techniques will be useful on this problem; OTTER can't figure that out on its own.
My Approach: A Computer That Does Logic Like a Human • Resolution is not the most effective proof procedure for humans. It is easy to do, but is time consuming. • Instead, humans use truth trees or derivation systems • These proof systems are better for humans because we are good at deciding which of several possible next steps will be most useful; an AI with a sufficiently powerful heuristic should perform better with one of these systems for the same reason humans do. • My program implements a subset of the derivation system found in The Logic Book by Merrie Bergmann, James Moor, and Jack Nelson
Bergmann et al.'s Sentential Derivation System (SD) • SD Rules: • Reiteration (P ⊧ P) • Introduction and Elimination Rules for Each Operator • Rules I Implemented: • Those not requiring sub-derivations, namely: • & Elimination • ~ Elimination • & Introduction • Modus Ponens (-> and <-> Elimination) • -> Introduction • <-> Introduction • | Introduction • <-> Elimination
classSentence: def __init__(self, rep=None, sent1=None, op=None, sent2=None): if op == None: self.op = None self.sent1 = None self.sent2 = None self.rep = rep elif op == "&"or op == "|"or op == "->"or op == "<->": self.op = op self.sent1 = sent1 self.sent2 = sent2 self.rep = None elif op == "~": self.op = op self.sent1 = sent1 self.sent2 = None self.rep = None else: raise Sentence.OpException() Implementation Details:The Sentence Class (Sentence.py)
defnegate(self): """Returns the negation of this sentence""" return newComplexSentence(self, "~") defconjoin(self, other): """Returns the conjunction of this Sentence with the Sentence other""" return newComplexSentence(self, "&", other) defdisjoin(self, other): """Returns the disjunction of this Sentence with the Sentence other""" return newComplexSentence(self, "|", other) defcond(self, other): """Returns the Sentence "self -> other".""" return newComplexSentence(self, "->", other) defbicond(self, other): """Returns the Sentence "self <-> other".""" return newComplexSentence(self, "<->", other) Implementation Details:The Sentence Class (Sentence.py)
classProof(Problem): defpath_cost(self, c, state1, action, state2): addCost = 1 if state2[len(state2)-1].complexity() > self.goal.complexity(): addCost = addCost + (state2[len(state2)-1].complexity() - \ self.goal.complexity()) * 2 S = state2[len(state2)-1].atoms() dups = 0 for s in S: dups = dups + S.count(s) - 1 if s not in self.goal.atoms(): addCost = addCost + 1 addCost = addCost + dups if action.find("Intro") != -1: addCost = addCost + 3 for op in self.goal.ops(): if(action.startswith(op)): if(addCost > 1): addCost = addCost - 1 else: addCost = 1 return addCost + c Implementation Details:The Proof Class (Proof.py)
defgoal_test(self, state): return (self.goal in state or self.goal.negate() in state) defmissing_pieces(self, thm, state): """Helper function that counts the number of subcomponents of thm not in state. For use in recursive calls (see component_h below)""" if(thm in state): return 0 if(thm.sent1 == None and thm.sent2 == None): return 1 count = 1 if(thm.sent1 != None): count = count + self.missing_pieces(thm.sent1, state) if(thm.sent2 != None): count = count + self.missing_pieces(thm.sent2, state) return count defcomponent_h(self, n): """A heuristic that counts the number of subcomponents of the goal theorem which are not in the state""" val = self.missing_pieces(self.goal, n.state) return val Implementation Details:The Proof Class (Proof.py)
p2.py from Proof import * Ax1 = Sentence("L").conjoin(Sentence("W")) Ax2 = Sentence("L").cond(Sentence("F").negate()) thm = Sentence("F").negate() p2 = Proof((Ax1,Ax2), thm) Console >>> from p2 import * >>> p2.initial ((L & W), (L -> ~F)) >>> p2.goal ~F Implementation Details:Defining a Problem
Does It Work? • Yes! • Problems Solved: P1 (A* Only) Axioms: {(P&C), (T&M), (E&(I&R))} Theorem: ((P&T)&R) Solution: (P&C), (T&M), (E&(I&R)), P, T, (I&R), R, (P&T), ((P&T)&R) P2 (The one we looked at earlier) Solution: (L&W), (L->~F), L, ~F P3 Axioms: {(K<->(~E&Q)), K} Theorem: Q Solution: (K<->(~E & Q)), K, (~E&Q), Q P4 (A* Only) Axioms: {(P->(S<->(A&B))), (P&S)} Theorem: B Solution: (P->(S<->(A&B))), (P&S), S, P, (S<->(A&B)), (A&B), B
Does It Work? • Yes! • Problems Solved: P5 (A* Only) Axioms: {(S&(S->E)), (C<->E), (C<->G)} Theorem: G Solution: (S&(S->E)), (C<->E), (C<->G), S, (S->E), E, C, G P6 (A* Only) Axioms: {((A&(B&C))&D), ((B&C)->E))} Theorem: E Solution: ((A&(B&C))&D), ((B&C)->E), (A&(B&C)), (B&C), E P7 Axioms: {A, C, (C->D)} Theorem: (A&D) Solution: A, C, (C->D), D, (A&D)
Efficiency Comparison • P2 • Axioms: {(L&W), (L->~F)} • Theorem: ~F • P3 • Axioms: {(K<->(~E&Q)), K} • Theorem: Q • P7 • Axioms: {A, C, (C->D)} • Theorem: (A&D) • Format: <Calls to Successor/Goal Tests/States Expanded/Solution> Searcher P2 P3 P7 breadth_first_graph_search < 50/ 51/3221/((L > < 322/ 323/24703/((K > <2942/2943/362654/(A, > iterative_deepening_search < 3/ 54/ 91/((L > < 9/ 332/ 358/((K > < 39/2982/3051/(A, > astar_search < 8/ 9/ 345/((L > < 22/ 23/ 967/((K > < 2/ 3/ 125/(A, >
Conclusions: Automated Theorem Proving • Computers are good at it! • But not as good as people... • Resolution works best right now • But with better heuristics other methods may overtake it • Having more rules requires fewer steps, but more code and more memory, and there's more opportunity for the prover to go down the wrong track. • Even with only very simple heuristics, a computer can solve all the logic problems on your 260 homework. Hmm...
Bibliography • Argonne National Laboratory. “Automated Reasoning at Argonne”. [Cited 21 April 2005]. Available Online (http://www-unix.mcs.anl.gov/AR/). • Bergmann, Merrie, James Moor, and Jack Nelson. 1998. The Logic Book. New York: McGraw-Hill. • Boyer, Robert S. and J. Strother Moore. July 1990. “A Theorem Prover for a Computational Logic”. Keynote Address, 10th Conference on Automated Deduction. Available Online (http://www.cs.utexas.edu/users/boyer/cade90.pdf). • McCune, William. 2003. OTTER 3.3 Reference Manual. Argonne, IL: Argonne National Laboratory. Available Online (http://www-unix.mcs.anl.gov/AR/otter/otter33.pdf). • Norton, L. M., 1971. Experiments with a heuristic theorem proving program for the predicate calculus with equality. Artificial Intelligence 2:261-284. • Russell, Stuart and Peter Norvig. 2003. Artificial Intelligence: A Modern Aproach. Upper Saddle River, New Jersey: Pearson Education, Inc.