1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates 1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates Our Plan for Today Part 1a: ATP and Proof Calculi Build Your Own First-Order Prover Part 1b: Prolog Part 1a: ATP and Proof Calculi Part 2a: Implementing a Propositional Prover Jens Otten Part 2b: Implementing a First-Order Prover University of Oslo Part 3a: A Tableau Prover Part 3b: A Connection Prover Acknowledgement: The author would like to thank Pascal Fontaine for the invitation and coming up with the idea for this tutorial. Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 1 / 32 Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 2 / 32 1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates 1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates Language of Logic First-Order Logic – Syntax ◮ Terms ( s , t , u , v ) are inductively defined as follows: ◮ Propositional logic 1. Every variable ( x , y , z , ... ) and every constant ( a , b , c , ... ) is a term. (a’) Socrates is a man man(Socrates) 2. Let f (also g , h , ... ) be a function symbol and t 1 , ..., t n be terms, (a) Plato is a man man(Plato) then f ( t 1 , ..., t n ) is also a term. (b) if Plato is a man, then Plato is mortal man(Plato) → mortal(Plato) (c) Plato is mortal mortal(Plato) ◮ Atomic formulae ( P ) are defined as follows: 1. Every predicate symbol ( p , q , r ) is an atomic formula. ◮ First-order logic 2. If P is a predicate symbol and t 1 , ..., t n are terms, (a’) man(Socrates) then P ( t 1 , ..., t n ) is an atomic formula. (a) man(Plato) (b’) ∀ x ( man ( x ) → mortal ( x ) ) ◮ First-order formulae ( A , B , C , F , G ) are defined as follows: (c’) mortal(Plato) ∧ mortal(Socrates) 1. Every atomic formula P is a formula. 2. If A and B are formulae and x is a variable, then ( ¬ A ), ( A ∧ B ), ◮ First-order (predicate) logic: predicates, → , ∧ , ∨ , ¬ , ∀ x , ∃ x ( A ∨ B ), ( A → B ), ∀ x A , and ∃ x A are formulae. Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 3 / 32 Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 4 / 32
1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates 1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates Logical Consequence Logical Validity ◮ Logical validity: A formula F is valid iff F is true for all possible ◮ Given: Finite set of formulae F 1 , F 2 , . . . , F n (“axioms”), interpretations of its predicate, constant and function symbols formula F (“conjecture”) ◮ Examples of valid formulae: ◮ Question: Is F a logical consequence of F 1 , F 2 , . . . , F n ? man(Plato) ∧ ( man(Plato) → mortal(Plato) ) → mortal(Plato) man(Plato) ∧ ∀ x ( man ( x ) → mortal ( x )) → mortal(Plato) ◮ Answer: Yes, iff (if and only if) F 1 ∧ F 2 ∧ . . . ∧ F n → F is valid p ∨ ¬ p (not in intuitionistic logic!), ( (( ∃ x q ( x ) ∨¬ q ( c )) → p ) ∧ ( p → ( ∃ y q ( y ) ∧ r )) ) → ( p ∧ r ) Deduction Theorem: ◮ Tautology, i.e. deciding validity in propositional logic is ◮ Logical consequence can be reduced to validity co-NP-complete ( F ist valid iff ¬ F ist not satisfiable) ◮ Validity in first-order logic is only semi-decidable Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 5 / 32 Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 6 / 32 1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates 1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates Automated Theorem Proving Logic and ATP ◮ Philosophy (formalizing Automated Theorem Proving (ATP) is a core research area in the truth and reasoning) field of Artificial Intelligence. ◮ Computer Science (modelling, verification, Goal: automating logical reasoning in (non-)classical logics logic programming) ◮ Mathematics ◮ is a given conjecture a logical consequence of a set of axioms? (proof theory) ◮ is a given formula valid with respect to a specific logic? ◮ Engineering (modelling ICs) valid (proof) ◮ Linguistic (formalizing formula F ATP system ր semantics of language) − → (problem) (“prover”) ց ◮ Artificial Intelligence not valid (counter model) (formalizing and reasoning) ◮ main challenge: complexity, i.e. efficient proof search ◮ Complexity Theory (NP-completeness) Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 7 / 32 Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 8 / 32
1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates 1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates What is a Calculus? Proof Calculi ◮ language: first-order formulae ◮ “a particular method or system of calculation or reasoning” ◮ formula F is valid ⇔ there is a proof for F in a proof calculus ◮ formal calculus := language { w , w 1 , w 2 , ... } + axioms + rules Some popular proof calculi: A (proof) calculus consists of ◮ Natural Deduction [Gentzen 1935] (classical and intuitionistic logic, NK and NJ) ◮ axioms of the form w ◮ Sequent Calculus [Gentzen 1935] w 1 w 2 · · · w n ◮ rules of the form (classical and intuitionistic logic, LK and LJ) w ◮ Tableau Calculus [Beth 1955, Smullyan 1968] ( w 1 , . . . , w n are the premises, w is the conclusion) ◮ DPLL Calculus [Davis/Putnam 1960,Davis/Logemann/Loveland 1962] ◮ a derivation of w is a tree ◮ Resolution Calculus [Robinson 1965] ◮ whose nodes are axioms or rules of the calculus and ◮ Model Elimination [Loveland 1968] (similar to connection calculus) ◮ the premises of each inner node are conclusions of its parent nodes ◮ Connection Calculus [Bibel 1981] ◮ a proof of w is a derivation of w whose leaves are axioms ◮ Instance-based Methods [Lee & Plaisted 1992] Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 9 / 32 Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 10 / 32 1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates 1st-Order Logic ATP Proof Calculi Sequent Calculus Prolog Syntax Semantics Built-In Predicates The Sequent Calculus Sequent Calculus – Axiom A sequent has the form Γ = ⇒ ∆ with Γ = { A 1 , . . . , A n } , ∆ = { B 1 , . . . , B m } where Γ and ∆ are finite (possibly empty) multisets of formulae. ◮ the only axiom ◮ left side of sequent is the antecedent, right side is the succedent ◮ Γ ∪ { A } or ∆ ∪ { B } are usually written as Γ , A and ∆ , B , respectively axiom ◮ intuitively, a sequent represents ”provable from“ in the sense that the Γ , A = ⇒ A , ∆ formulae in Γ are assumptions for the set of formulae ∆ to be proven ◮ a sequent A 1 , . . . , A n = ⇒ B 1 , . . . , B m can be interpreted as ( A 1 ∧ . . . ∧ A n ) → ( B 1 ∨ . . . ∨ B m ) There are rules for eliminating connectives and quantifiers in sequents. ◮ a proof of formula A is a proof of the sequent = ⇒ A ◮ a formula A is provable, written ⊢ A , iff there is a proof for A Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 11 / 32 Jens Otten (UiO) Build Your Own First-Order Prover — Part 1 CADE Tutorial, August ’19 12 / 32
Recommend
More recommend