Proof Search in Minimal Logic Helmut Schwichtenberg Mathematisches Institut, Universit¨ at M¨ unchen 1
Motivation Proof carrying code (Lee, Necula) Why? Proofs are machine checkable (easily) Here: “code carrying proofs” Prospects: Program development by proof transformation (adapt to special cases, computed function can change). Algorithms in constructive and even some classical proofs. Useful: proof search, in minimal logic 2
Example of a non-constructive proof There are irrational numbers a, b such that a b is rational. √ √ √ √ 2 rational. Let a = 2 2 and b = 2. Then both Case a, b are irrational, and by assumption a b is rational. √ √ √ √ √ 2 irrational. Let a = 2 and b = 2 2 2. Then by Case assumption a, b are irrational, and 2 � √ √ 2 � √ � √ � 2 a b = 2 = 2 = 2 is rational. 3
I. Minimal, intuitionistic and classical logic Johansson (1937): “Der Minimalkalk¨ ul, ein reduzierter intuitionistischer Formalismus” First order language, with → , ∀ , ⊥ . For simplicity no ∧ . ∃ will be discussed separately. Negation, classical disjunction, and the classical existential quantifier are defined by ¬ A := A → ⊥ , A ∨ cl B := ¬ A → ¬ B → ⊥ , ∃ cl xA := ¬∀ x ¬ A. 4
Natural deduction Assumption: u : A Intrduction and elimination rules for → : [ u : A ] | M | N | M A → B A → − B B → + u A → B 5
Natural deduction (ctd.) Intrduction and elimination rules for ∀ : | M | M ∀ xA r ∀ − A ∀ + x ∀ xA A [ x := r ] 6
Proof terms u B (assumptions) | axioms | ( λu A M B ) A → B | ( M A → B N A ) B | ( λxM A ) ∀ xA | ( M ∀ xA t ) A [ x := t ] ∈ FV ( B ) for all B with u B ∈ FA ( M ). where in λxM A , x / ⊢ denotes derivability in minimal logic. 7
Axiom schemes for ∃ and ⊥ The introduction axiom is ∃ + : A → ∃ xA and the elimination axiom is ∃ − : ( ∀ x.A → B ) → ∃ xA → B ( x not free in B ) . For ⊥ , the elimination axiom (“ex-falso-quodlibet”) is ⊥ − : ⊥ → A. This clearly is derivable from its instances ⊥ → R� x , for every relation symbol R . 8
Rules for ∃ The introduction rule is | M r A [ x := r ] ∃ + ∃ xA and the elimination rule is [ u : A ] | M | N ∃ xA B ∃ − x, u (var.cond.) B 9
Classical logic Add “stability”, or the principle of indirect proof: Stab := { ∀ � x. ¬¬ R� x → R� x | R relation symbol � = ⊥ } . From Stab R we can easily derive ⊢ c ¬¬ A → A, for every formula A of our language (based on → , ∀ , ⊥ ). Call A classically derivable (written ⊢ c A ) if there is a derivation of A from Stab R . 10
Negative translation ( R� := ¬¬ R� t ) g ( R distinct from ⊥ ) t ⊥ g := ⊥ , ( A → B ) g := A g → B g , ( ∀ xA ) g := ∀ xA g . odel-Gentzen translation g ). For all A , Theorem (G¨ • ⊢ c A ↔ A g , • Γ ⊢ c A iff Γ g ⊢ A g , where Γ g := { B g | B ∈ Γ } . 11
II. Normalization Turing, Prawitz: Every derivation term can be tranformed into a “normal form”. A derivation in normal form does not make “detours”, or more precisely, it cannot occur that an elimination rule immediately follows an introduction rule. This entails the “subformula property”. The presence of ∃ -rules makes it necessary to allow “permutative conversions” (Prawitz), to retain the subformula property. 12
∃ -conversion | M | M [ u : A ] A [ x := r ] | N r A [ x := r ] �→ ∃ + | N ′ ∃ xA B ∃ − x, u B B 13
∃ -perm conversion | M | N | K ∃ xA B �→ B C E-rule D | N | K | M B C E-rule ∃ xA D D 14
Normal versus non-normal derivations Statman and Orevkov (1979) gave examples of formulas C k which are easily derivable with non-normal derivations (whose number of nodes is linear in k ), but which require a non-elementary (in k ) number of nodes in any normal derivation. The example is related to Gentzens proof of transfinite induction up to ω k in arithmetic. There the function y ⊕ ω x plays a crucial role, and also the assignment of a “lifting”-formula A + to any formula A , by A + := ∀ y. ( ∀ z ≺ y ) A [ z/x ] → ( ∀ z ≺ y ⊕ ω x ) A [ z/x ] . 15
Normal versus non-normal derivations (ctd.) Idea: Axiomatize R ( y, x, z ), to “mean” y + 2 x = z . Hyp 1 : ∀ y R ( y, 0 , s ( y )) Hyp 2 : ∀ y, x, z, z 1 .R ( y, x, z ) → R ( z, x, z 1 ) → R ( y, s ( x ) , z 1 ) C k := ∃ cl z k , . . . , z 0 .R (0 , 0 , z k ) ∧ R (0 , z k , z k − 1 ) ∧ . . . ∧ R (0 , z 1 , z 0 ) . Lemma 1. C k is derivable with a non-normal derivation whose number of nodes is linear in k . Lemma 2. Any normal derivation of C k from Hyp 1 and Hyp 2 has at least 2 k nodes. 16
Normal versus non-normal derivations (ctd.) Searching for normal proofs in minimal logic can be complex. Moral: Break up your problem into auxiliary lemmata, each of which has a short normal proofs. 17
III. Proof search Based on Miller (1991) Complete for the →∧∀ -language, in the sense that if there is a proof which uses each hypothesis at most m of times, then proof search w.r.t. this parameter m will find a proof. Presence of the existential quantifier ∃ poses a problem, for ∃ has been introduced by means of axiom schemata. Then the problem is which of such schemata to use in proof search, given a goal G and a set P of clauses. 18
Patterns We work in a fragment of the simply typed λ -calculus: every higher order variable Y appears in a context Y � x , where � x are distinct bound variables in the scope of the operator binding Y . In first order logic: no restriction (no higher order vars). However, when designing a proof search algorithm for first order logic, one is naturally led into this fragment of higher order logic, where the algorithm works as well. 19
Pattern unification algorithm Let Q denote a prefix ∀ � x ∃ � y ∀ � z , with distinct variables. We call � x signature, � y flexible and � z forbidden variables of Q . r is a Q -term iff all its free variables are in Q , and for every subterm y� r of r with y free in r and flexible in Q , the � r are distinct vars either λ -bound in r or forbidden in Q . 20
Q -goals, Q -clauses • If � r are Q -terms, then P� r is a Q -goal and a Q -clause. • D Q -clause and G Q -goal ⇒ D → G Q -goal. • G Q -goal and D Q -clause ⇒ G → D Q -clause. • If G is a Q ∀ x -goal, then ∀ xG is a Q -goal. • If D [ y := Y � z ] is a ∀ � x ∃ � y, Y ∀ � z -clause, then ∀ yD is a ∀ � x ∃ � y ∀ � z -clause. 21
Pattern unification algorithm (ctd.) Hence: A formula A is a Q -goal iff its free vars are in Q , and for every subterm y� r of A with y either existentially bound or free in A and flexible in Q , the � r are distinct vars either λ - or universally bound or free in A and forbidden in Q . A unification problem U consists of a ∀∃∀ -prefix Q and a � n conjunction � i =1 r i = s i of equations between Q -terms. A solution to a unification problem U is a Q -substitution ϕ such that for every i , r i ϕ = s i ϕ holds (same normal form). 22
Pattern unification algorithm (ctd.) Given: unification problem U = QC . Returns: substitution ρ , and another unification problem U ′ = Q ′ C ′ , such that • ρ defined on flexible variables of Q only; value terms have no free occurrences of forbidden variables from Q , • if G is a Q -goal, then Gρ is a Q ′ -goal, and • whenever ϕ ′ is a U ′ -solution, then ( ρ ◦ ϕ ′ ) ↾ Q ∃ is a U -solution. 23
Correctness Lemma. Given a unification problem U = QC , either ⇒ ρ U ′ , • the unification algorithm makes a transition U = and Φ ′ : U ′ -solutions → U -solutions ϕ ′ �→ ( ρ ◦ ϕ ′ ) ↾ Q ∃ is well-defined and we have Φ: U -solutions → U ′ -solutions such that Φ ′ is inverse to Φ, i.e. Φ ′ (Φ ϕ ) = ϕ , or else • the unification algorithm fails, and there is no U -solution. 24
Corollary Given a unification problem U = QC , the unif. algorithm • either fails, and there is no U -solution, or else • returns a pair ( Q ′ , ρ ) with a “transition” substitution ρ and a prefix Q ′ (i.e. a unification problem U ′ with no unification pairs) such that for any Q ′ -substitution ϕ ′ , ( ρ ◦ ϕ ′ ) ↾ Q ∃ is an U -solution, and every U -solution can be obtained in this way. Since ε is a Q ′ -substitution, ρ ↾ Q ∃ is a “most general” U -solution. 25
Proof search A Q -sequent has the form P ⇒ G , where P is a list of Q -clauses and G is a Q -goal. We write M [ P ] to indicate that all assumption variables in the derivation M are assumptions of clauses in P . Write ⊢ n S for a set S of sequents if there are derivations M G i i [ P i ] in long normal form for all ( P i ⇒ G i ) ∈ S such that � dp ( M i ) ≤ n . Let ⊢ <n S mean ∃ m<n ⊢ m S . 26
Context lemma x. � Let Q be a ∀∃∀ -prefix, and {P ⇒ ∀ � D → A } ∪ S be x, � Q -sequents with � D not both empty. Then for every substitution ϕ : x. � ϕ is a Q -subst such that ⊢ n � � {P ⇒ ∀ � D → A } ∪ S ϕ if and only if {P ∪ � x -subst such that ⊢ <n � � ϕ is a Q ∀ � D ⇒ A } ∪ S ϕ . 27
Recommend
More recommend