The L-Framework Structural Proof Theory in Rewriting Logic
Total Page:16
File Type:pdf, Size:1020Kb
The L-Framework Structural Proof Theory in Rewriting Logic Carlos Olarte Joint work with Elaine Pimentel and Camilo Rocha. Avispa 25 Años Logical Frameworks Consider the following inference rule (tensor in Linear Logic): Γ ⊢ ∆ ⊢ F G i Γ; ∆ ⊢ F i G R Horn Clauses (Prolog) prove Upsilon (F tensor G) :- split Upsilon Gamma Delta, prove Gamma F, prove Delta G . Rewriting Logic (Maude) rl [tensorR] : Gamma, Delta |- F x G => (Gamma |- F) , (Delta |-G) . Gap between what is represented and its representation Rewriting Logic can rightfully be said to have “-representational distance” as a semantic and logical framework. (José Meseguer) Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 2 Where is the Magic ? Rewriting logic: Equational theory + rewriting rules a Propositional logic op empty : -> Context [ctor] . op _,_ : Context Context -> Context [assoc comm id: empty] . eq F:Formula, F:Formula = F:Formula . --- idempotency a Linear Logic (no weakening / contraction) op _,_ : Context Context -> Context [assoc comm id: empty] . a Lambek’s logics without exchange op _,_ : Context Context -> Context . The general point is that, by choosing the right equations , we can capture any desired structural axiom. (José Meseguer) Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 3 Determinism vs Non-Determinism Back to the tensor rule: Γ ⊢ F ∆ ⊢ G Γ; F1; F2 ⊢ G iR iL Γ; ∆ ⊢ F i G Γ; F1 i F2 ⊢ G Equations Deterministic (invertible) rules that can be eagerly applied. eq [tensorL] : Gamma, F1 * F2 |- G = Gamma, F1 , F2 |- G . Rules Non-deterministic (non-invertible) rules where backtracking is needed. rl [tensorR] : Gamma, Delta |- F x G => (Gamma |- F) , (Delta |-G) . Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 4 Structural Properties of Sequent Systems In good sequent systems the cut-elimination theorem holds, i.e., proofs using the cut rule can be transformed into cut-free proofs. Γ ⊢ ∆; F Γ; F ⊢ ∆ cut Γ ⊢ ∆ a Analytic proofs: (subformula property) a Consistency. a A cut-free system is more amenable for automatic reasoning. How to prove cut-elimination for a given system? It is often quite elaborated and exponentially exhaustive: a Several proof obligations showing how cut permutes down. a For that, it is useful to prove that some rules are invertible and some structural rules are admissible. Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 5 In this talk Relying on rewrite and narrowing-based reasoning we introduce sufficient conditions and procedures for proving : a admissibility of structural rules (weakening and contraction). a invertibility of inference rules. a permutability of inference rules (under certain conditions). a cut-elimination of the system. RL as a meta-logical framework in action. The L-Framework( https://carlosolarte.github.io/L-framework/) a A reflective implementation of our procedures in Maude. a General enough for proving properties of different propositional systems: intuitionistic and classical logics, linear logic, and normal modal logics. Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 6 Outline 1 Rewriting Logic 2 Sequent Systems 3 Meta-theorems of sequent systems in RL 4 Reflective Implementation and case studies 5 Concluding remarks Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 7 Rewrite Theories A rewrite theory is the specification unit in rewriting logic Definition (Rewrite Theory) A tuple R = (Σ; E < B; R) consisting of: a (Σ; E < B) is an equational theory a B is a set of structural axioms (assoc, comm, id). a R is a set of labeled conditional rewrite rules l → r if C a (Σ; E < B) specifies states and deterministic computations a R specifies dynamic, concurrent behaviors ¬ ¬ ¬ RL proves sentences of the form t → t (R ¬ t → t ) where t; t " TΣ(X). 1 →R is computable if the executability conditions hold (R is finite, equations in E are terminating and ground confluent, etc. ) Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 8 Maude a A high-performance rewriting logic engine a A system module defines a rewrite theory R. a Executes admissible system modules (confluence and termination of E, coherence of R w.r.t. E, ... ) a Several generic formal analysis tools (rewrite, search, LTL model checker,etc). a Reflective capabilities (RL as a meta-logical framework). http://maude.cs.illinois.edu/ Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 9 Plan 1 Rewriting Logic 2 Sequent Systems 3 Meta-theorems of sequent systems in RL 4 Reflective Implementation and case studies 5 Concluding remarks Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 10 Sequent Systems A sequent is an expression of the form Γ ⊢ ∆: a Γ is the the antecedent and ∆ the succedent. a According to structural properties, Γ; ∆ can be sets, multisets or lists of formulas. a ∆ can be a multiset (multi-conclusion) or restricted to one formula (single-conclusion) a When Γ is empty it is called one-sided (otherwise, two-sided). Inference Rules S1⋯Sn R S a S is the conclusion and S1⋯Sn the premises. a If the premises are empty, then R is an axiom. Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 11 An example: Intuitionistic Propositional Logic Syntax F; G ∶∶= p ¶ ã ¶ á ¶ F 1 G ¶ F 0 G ¶ F M G Some of the rules of the system G3ip (single-conclusion, two-sided): I ã Γ; p ⊢ p Γ ⊢ ã R Γ; ⊢ Γ; ⊢ F C G C Γ ⊢ F 1L i 1Ri Γ; F 1 G ⊢ C Γ ⊢ F1 1 F2 Γ; F M G ⊢ F Γ; G ⊢ C Γ; F ⊢ G M M Γ; F M G ⊢ C L Γ ⊢ F M G R Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 12 The OL in the L-Framework We shall call Object Logic (OL) to the logical system we are analyzing. Defining the syntax and inference rules of the OL is quite easy. Generic constructs from the L-Framework sort Formula . sort MSFormula . --- Multiset of Formulas op * : -> MSFormula . --- Empty multiset --- Multiset union op _;_ : MSFormula MSFormula -> MSFormula [assoc comm id: * ] . Particular instance for the OL mod G3i is ... op _/\_ : Formula Formula -> Formula . --- Inference rules rl [AndL] : F /\ G ; C |-- H => F ; G ; C |-- H . rl [AndR] : C |-- F /\ G => ( C |-- F) | ( C |-- G) . ... endm Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 13 The OL in the L-Framework A correct proof search procedure for free: Maude> search [1] in G3i : p(1) /\ p(2) |-- p(2) /\ p(1) =>* proved . Solution 1 (state 7) Maude> show path 7 . state 0, Sequent: p(1) /\ p(2) |-- p(2) /\ p(1) ===[ rl C ; F /\ G |-- H => F ; C ; G |-- H [label AndL] . ]===> state 1, Sequent: p(1) ; p(2) |-- p(2) /\ p(1) ===[ rl C |-- F /\ G => (C |-- F) | (C |-- G) [label AndR] . ]===> state 3, Goal: (p(1) ; p(2) |-- p(2)) | (p(1) ; p(2) |-- p(1)) ===[ rl P ; C |-- P => proved [label I] . ]===> state 5, Sequent: p(1) ; p(2) |-- p(1) ===[ rl P ; C |-- P => proved [label I] . ]===> state 7, Goal: proved Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 14 Properties of inference rules Definition A rule S1 ⋯ Sn R S is called: 1. admissible if S is derivable whenever S1; :::; Sn are derivable. S S 2. invertible if the rules S1; ⋯; Sn are admissible. Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 15 Proving Invertibility The proof of invertibility proceeds by induction on the height of the derivation (and then, case analysis on the last rule applied). Consider the proof o invertibility of 1L and the case MR: Γ; F 1 G; A ⊢ B MR Γ; F 1 G ⊢ A M B We can assume by induction (on a shorter derivation): a Γ; F; A ⊢ B a Γ; G; A ⊢ B and then we conclude: Γ; F; A ⊢ B Γ; G; A ⊢ B MR and MR Goal1 ∶ Γ; F ⊢ A M B Goal2 ∶ Γ; G ⊢ A M B Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 16 Admissibility of structural rules We know that MR is invertible in G3ip. However, the case ML fails: Γ; A M B ⊢ A Γ; B ⊢ F M G M Γ; A M B ⊢ F M G L We know that: a Γ; A M B ⊢ A (by hypothesis) a Γ; B; F ⊢ G (by induction) But this is not enough to complete the following figure: ?? Γ; A M B; F ⊢ A Γ; B; F ⊢ G ML Goal ∶ Γ; A M B; F ⊢ G The admissibility of weakening is missing! Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 17 Admissibility of Structural Rules The following structural rules are admissible in G3ip Γ ⊢ C Γ; F; F ⊢ C W C Γ; F ⊢ C Γ; F ⊢ C 1. Admissibility of W is proved by induction on the height of the derivation. 2. The admissibility of C requires invertibility results. Consider, e.g., the case Γ; F 1 G ; F ⊢ C Γ; F 1 G ; G ⊢ C 1L Γ; F 1 G; F 1 G ⊢ C By invertibility of 1L, we have Γ; F,F ⊢ C and, by induction, Γ; F ⊢ C as needed (the same for G). Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha. 18 Cut-Elimination The following rule is admissible in G3ip [Π] [Σ] Γ ⊢ A Γ; A ⊢ B Cut Γ ⊢ B Nested induction: on the complexity of A and subinduction on the sum of the heights of [Π] and [Σ]. Principal cases Γ ⊢ B Γ ⊢n A Γ ⊢n B Γ; A; B ⊢m C W 0R 0L Γ; A ⊢ B Γ; A; B ⊢ C ↝ Γ ⊢s(n) A 0 B Γ; A 0 B ⊢s(m) C Cut Cut Γ ⊢ A Γ; A ⊢ C Γ ⊢ C Cut Γ ⊢ C Carlos Olarte, Joint work with Elaine Pimentel and Camilo Rocha.