<<

Structural Cut Elimination

Frank Pfenning∗ Department of Computer Science Carnegie Mellon University Pittsburgh, PA 15213-3891 [email protected]

Abstract which in combination are quite intimidating. Most proofs require tedious data structures (such as multi- We present new proofs of cut elimination for intu- sets) and use complex termination measures and arith- itionistic, classical, and linear calculi. In all metic reasoning. They also involve global conditions cases the proofs proceed by three nested structural in- on occurrences of parameters in sequent derivations. ductions, avoiding the explicit use of multi-sets and In this paper we present new proofs of cut elimina- termination measures on sequent derivations. This tion for intuitionistic, classical, and linear sequent cal- makes them amenable to elegant and concise imple- culi and sketch their implementations in the Elf sys- mentations in Elf, a constraint logic programming lan- tem [Pfe91] which is based on the LF Logical Frame- guage based on the LF logical framework. work [HHP93]. Multi-sets are avoided altogether in these proofs, and termination measures are replaced 1 Introduction by three nested structural inductions. Parameters are Gentzen’s sequent calculi [Gen35] for intuitionistic and treated as variables bound in derivations, thus nat- classical logic have been the central tool in many urally capturing occurrence conditions. Critical is proof-theoretical investigations and applications of the elimination of structural rules, both for the in- logic in computer science such as logic programming formal proofs and their formalizations, which leads us or automated theorem proving. The central property quite naturally to Kleene’s sequent system G3 [Kle52] of sequent calculi is cut elimination (Gentzen’s Haupt- for intuitionistic and classical logic and a variant of satz) which yields consistency of the logic as a corol- LU [Gir93] for . These formulations can lary. The algorithm for cut elimination may be inter- easily be seen to be equivalent to more traditional se- preted computationally, similarly to the way normal- quent calculi. ization for may be viewed as func- tional computation. For the case of linear logic, this The reader interested in structural cut elimination for point was made by Girard [Gir87] and later elaborated intuitionistic, classical, or linear logic, but not in its by Abramsky [Abr93]; see also [BTKP93] and [Gal93]. formalization, should be able to follow this paper by The study of various cut elimination properties and ignoring the material regarding implementation. In procedures thus plays an important role in theoretical order to understand and appreciate the representation computer science. of the sequent calculus and the proof of cut elimina- tion the reader should have a basic knowledge of the Many proofs of cut elimination have been given in the representation methodology of LF and the Elf meta- literature yet, to our knowledge, none of them have language; the interested reader is referred to [HHP93] been formalized even though this is clearly possible and [Pfe91]. in principle (see Matthews [Mat94] for a pencil-and- paper analysis of cut elimination for the (∨, ¬) frag- The principal contributions of this paper are: (1) new ment of classical propositional logic in FS0). They formulations of intuitionistic, classical, and linear se- are difficult to mechanize for a number of reasons quent calculi with proof terms, (2) direct proofs of

∗This work was supported by NSF Grant CCR-9303383 This extended abstract to appear at LICS’95 cut elimination for these systems by simple nested Γ −→ [ t/x]A Γ, ∃x. A, [a/x]A −→ C structural inductions, (3) extremely concise and ele- ∃R ∃ L a Γ −→ ∃ x. A Γ , ∃ x. A −→ C gant implementations of sequent derivations and cut elimination in the Elf meta-language. The remainder of the paper is organized as follows. In Section 2 we introduce a formulation of the intuitionis- In the ∃L rule, the parameter a must be new, that tic sequent calculus motivated from natural deduction. is,itmaynotoccurinΓ,∃x. A,orC.Theprinci- In Section 3 we give a notation for proof terms that pal formula of an inference is either the formula being record the structure of the sequent derivation. The introduced on the left or the right, or the formula oc- representation of in LF based on proof terms curring on the left and the right in an initial sequent. is shown in Section 4. The proof of admissibility of cut All other formulas are side formulas of the last infer- in the intuitionistic sequent calculus and its implemen- ence. These notions also apply to individual formula tation are the subject of Section 5. In Section 6 we occurrences. It is important that the side formulas of extend these results to a classical sequent calculus and an inference are copied to all premises. The rule of in Section 7 to a linear sequent calculus. We conclude cut then has the form with an assessment and some remarks about future work in Section 8. Full details for the intuitionistic −→ −→ and classical systems may be found in [Pfe94a]; the Γ A Γ ,A C Cut. linear system is given in [Pfe94b]. Γ −→ C 2 Intuitionistic Sequent Calculus In this section we develop a formulation of the se- Instead of taking Cut as a primitive rule, we show that quent calculus for by transcribing it is admissible, that is, whenever the premises are the process of searching for a natural deduction into an derivable then the conclusion is also derivable. From inference system. The proximity to natural deduction this, cut elimination in the sense of Gentzen follows then allows a high-level encoding of sequent deriva- by a simple induction on the structure of a derivation tions in LF. The resulting sequent calculus is basi- possibly containing Cut (see [Pfe94a]). cally Kleene’s system G3 [Kle52] which he introduced to obtain a simple decidability proof for its proposi- Our formulation of the sequent calculus has the el- −→ tional fragment. In [Pfe94a] we consider a complete ementary properties of weakening (if Γ C then −→ −→ of logical connectives and quantifiers (∧, ⊃, ∨, ¬, Γ,A C ), contraction (if Γ,A,A C then −→ >, ⊥, ∀,and∃). Here we restrict ourselves to ⊃ and ∃ Γ,A C ), and permits substitution for parame- for the sake of brevity. The notions of free and bound ters. Note that the rules have been designed so that variable are defined as usual. We identify formulas weakening and contraction do not change the struc- that differ only in the names of their bound variables ture of the derivation, only the hypotheses present in and write [t/x]A for capture-avoiding substitution of t each sequent. for x in A.WeuseA,B,andCto range over formulas. At this point we could define the size of a formula A A sequent Γ −→ C is a judgment representing the goal as the number of its connectives and quantifiers, the of deriving C from Γ. Our formulation eliminates all length of a derivation as the number of inference rules explicit structural rules (which present well-known dif- it contains, and then prove the admissibility of cut ficulties for cut elimination) by incorporating weaken- by three nested inductions over the size of the cut for- ing into initial sequents and contraction into each left mula and the lengths of the derivations of Γ −→ A and rule. Exchange remains implicit in the notation Γ,A. Γ,A−→ C . A proof along these general lines, but on We summarize the rules for the cut-free calculus G3 a different sequent calculus and with a different rule on our fragment. of cut was given by Dragalin [Dra87]. However, such a proof is not well-suited for implementation. The first Γ ,A−→ B I ⊃ R difficulty is the encoding of the sequent calculus itself Γ,A−→ A Γ −→ A ⊃ B and the notion of multi-set it requires. The second dif- ficulty is that most proof checkers or theorem provers Γ ,A⊃B −→ A Γ ,A⊃B,B −→ C use structural induction more effectively than proofs ⊃ L with termination measures. We will return to both ⊃ −→ Γ ,A B C points in the next section.

2 3 Proof Terms ing parameters introduced in D so as not to conflict with parameters in A. The proofs of the following The sequent rules as given so far do not explicitly in- properties are all immediate structural inductions. dicate the principal formula of an inference. For ex- −→ ⊃ ⊃ ample, there is only one derivation of A ( A A ) Lemma 1 (Basic Properties of Proof Terms) rather than two. If we are only interested in deriv- The intuitionistic sequent calculus with proof terms ability then this is tolerable, but not if we need to satisfies the following properties. deal with the structure of derivations (as in the case of cut elimination). We therefore endow sequent deriva- 1. (Weakening) If D :: (Γ −→ d : C ) then tions with proof terms that resolve such ambiguities. (D,h:A)::(Γ,h:A −→ d : C ) where h is a new Proof terms also play an important role in the study label. of computational properties of the sequent calculus D −→ (see [Abr93, BTKP93, Gal93]), and form a natural in- 2. (Contraction) If :: (Γ,h1:A, h2:A d : C ) D −→ termediate step toward the representation of the rules then [h1/h2] :: (Γ,h1:A [ h 1 /h2]d : C). in LF. 0 3. (Uniqueness) If D :: (Γ −→ d : C ) and D :: 0 0 0 The first step is to label hypotheses. The second is (Γ −→ d : C ) then D = D and C = C (mod- to record a proof term d on the right of the sequent ulo variable renaming). arrow. A sequent then has the form Γ −→ d : A where Γ = h1:A1,...,hn:An. We assume that all hy- 4 Sequent Derivations in LF pothesis labels in a context are distinct. In order to In this section we briefly summarize the representation avoid confusion with similar, but subtly different proof of sequent derivations in LF using the idea of higher- term notations in the literature, we systematically in- order abstract syntax applied to proof terms. Readers troduce precisely one new proof term constructor for interested primarily in the proof of cut elimination each inference rule of the sequent calculus and give may safely skip this section. each a descriptive name. Rules that introduce param- eters or hypotheses bind variables at the level of proof For the sake of brevity we show the actual code in terms—a phenomenon which should be familiar from Elf [Pfe91], an implementation of LF which permits the Curry-Howard isomorphism. The idea of higher- type declarations with implicit quantifiers. The rep- order abstract syntax (here applied to a syntax for resentation of formulas follows [HHP93]: Object lan- proof terms) is to reduce all binding operators to one, guage variables are represented by meta-language vari- namely λ. This makes it immediately syntactically ap- ables. This technique is central for this particular en- parent which variables are bound and where. We also coding; it is not available in systems based on explicit indicate the “type” of bound variables: they may bind inductive definitions. The type i stands for individu- individuals (x:i), formulas (p:o), or hypotheses (h:A). als, the type o for formulas. The rules for the fragment we consider here are given in Figure 1. Propositional parameters p are required i : type. imp : o -> o -> o. in the rules for negation which have been omitted from o : type. exists : (i -> o) -> o. this extended abstract. Before giving the signature for the sequent calculus Erasure of the proof terms from a sequent derivation we state the adequacy theorem since it is a useful in this calculus yields derivations from the rules given guide for interpreting the declarations. We use `LF in the previous section. We write D :: (J)ifDis a for derivability in LF under the signature consisting derivation of judgment J. Derivations and proof terms of the declarations yet to come. Assume we have a are closed under substitutions for parameters, renam- derivation ing bound variables as necessary to avoid clashes. If D D is a derivation with hypotheses h1:A and h2:A,we h :A ,...,h :A −→ d : C write [h1/h2]D, for the result of erasing hypothesis h2 1 1 n n on the left-hand side of every sequent occurring in D with free individual parameters among a ,...,a and and substituting h in every place where h occurs 1 k 1 2 propositional parameters among p ,...,p .Itsrep- on the right-hand side of a sequent. This may require 1 m resentation pDq is a canonical object M such that renaming some locally bound hypotheses to avoid cap- D ture of h1.Wewrite( ,h:A) for the result of adding a1:i,...,ak:i, p1:o,...pm:o, D LF hypothesis h:A to every sequent in , possibly renam- h1:hyp pA1q,...,hn:hyp pAnq ` M :concpCq,

3 Γ,h:A−→ d : B I −→ ⊃ R Γ,h:A axiom h : A Γ −→ impr (λh:A. d):A⊃B

Γ,h:A⊃B −→ d 1 : A Γ ,h:A⊃B,h2:B −→ d 2 : C ⊃ L Γ ,h:A⊃B −→ impl d1 (λh2:B. d2) h : C

Γ −→ d :[t/x]A Γ,h:∃x. A, h1:[a/x]A −→ d : C ∃R ∃ L a Γ −→ existsr td:∃x. A Γ ,h:∃x. A −→ existsl (λa:i. λh1:[a/x]A. d) h : C

Figure 1: Proof terms for intuitionistic sequent calculus where hyp and conc are type families indexed of sequent derivations can be accomplished by type- by formulas. We call the representation ade- checking their representations. It circumvents many quate if p·q is a bijection between cut-free se- of the problems that ordinarily arise in representa- quent derivations and such well-typed canonical ob- tions of the sequent calculus. Multi-sets are avoided, jects and if it is also compositional in sense that since hypotheses on the left-hand side of the sequent p[t/a]Dq =[ptq/a]pDq, p[C/p]Dq =[pCq/p]pDq,and arrow are transported into the LF context. Variable p[h1/h2]Dq =[h1/h2]pDq. naming conditions are encoded through the functional We obtain the representation by transcribing the proof representation of parametric judgments. The follow- terms into LF, taking care to distinguish between hy- ing is proved by inductions on the structure of sequent potheses and conclusions via the type families hyp derivations and canonical forms in LF, using Lemma 1. and conc. The signature below represents an ade- quate encoding of sequents in Elf. Note that % be- Theorem 2 (Adequacy of Representation) The gins a comment that extends to the end of the line, representation of intuitionistic sequent derivations in that {x:U}V is Elf’s concrete syntax for Πx:U. V ,and LF is adequate. that [x:U]M stands for λx:U. M.MostΠ-quantifiers are left implicit and are reconstructed by Elf’s front 5 Admissibility of Cut end in proper dependency order and with their most general types. The proof of cut elimination uses one principal lemma: the admissibility of cut in the cut-free system. From hyp : o -> type. % Hypotheses (left) this, cut elimination follows by a simple structural in- conc : o -> type. % Conclusion (right) duction. axiom : (hyp A -> conc A). Theorem 3 (Admissibility of Cut) impl : conc A Let D :: (Γ −→ d : A ) and E :: (Γ,h:A −→ e : C ) -> (hyp B -> conc C) -> (hyp (A imp B) -> conc C). be (cut-free) sequent derivations. Then there exists aprooftermfand a (cut-free) sequent derivation impr : (hyp A -> conc B) F :: (Γ −→ f : C ) . -> conc (A imp B). Proof: The proof proceeds by three nested structural existsl : ({a:i} hyp (A a) -> conc C) inductions on A, d,ande. In other words, we may use -> (hyp (exists A) -> conc C). the induction hypothesis for (immediate) subformulas existsr : {T:i} conc (A T) of A and arbitrary d and e,orforA, a subterm of d -> conc (exists A). and arbitrary e,andforA,d, and a subterm of e.We distinguish cases for D and E (determined by d and e) The encoding satisfies the representation theorem as which can be divided into four categories: (1) Either outlined above, which means that checking the validity D or E is initial with A as its principal formula, (2) A

4 is the principal formula of the last inference in both that we label both negative (left-hand side) and posi- D and E,(3)Ais a side formula of the last inference tive (right-hand side) formulas with variables.Aproof in D,and(4)Ais a side formula of the last inference term d then annotates the whole sequent; we write it in E. The proof is constructive and describes an algo- above the sequent arrow: rithm that computes F from D and E. The algorithm d is non-deterministic since the cases in the proof are n1:A1,...,nj:Aj −→ p 1 : C 1 ,...,pk:Ck.

not mutually exclusive. 2 As in the intuitionistic calculus, our proof terms faith- This proof is represented as a relation between fully record the structure of the sequent derivation. pAq:o, pDq:conc A, pEq:hyp A -> conc C,and We again use λ and the idea of higher-order abstract syntax to delimit scope. Due to space constraints we pFq:conc C, which is implemented by a type family only show the fragment with ∨ and ¬ in Figure 2; the development for a full complement of connectives ca : {A:o} conc A -> (hyp A -> conc C) including quantifiers may be found in [Pfe94a]. -> conc C -> type. Substitution, weakening and contraction work as in the intuitionistic case, but now apply to both sides of Each case in the proof gives rise to exactly one declara- a sequent. We elide the classical analog of Lemma 1. tion for ca; no lemmas, auxiliary type families, or the- orem proving is needed. We show some excerpts from The LF representation closely models proof terms and the signature; in the full language there are 35 cases of is thus also symmetric with respect to formulas on the comparable complexity comprising 148 lines. The dec- leftandright:BothappearinthecontextoftheLF larations for ca_axiom_l, ca_imp,andcal_existsl typing judgment. That is, a cut-free derivation implement representative cases of categories (1), (2), D and (3), respectively. d n1:A1,...,nj:Aj −→ p 1 : C 1 ,...,pk:Ck ca_axiom_l : ca A (axiom H) E (E H). with free individual parameters among a1,...,am is pDq ca_imp : represented by a term M = such that ca (A1 imp A2) (impr D2) ([h:hyp (A1 imp A2)] impl (E1 h) (E2 h) h) F a1:i,...,am:i, p q p q <- ca (A1 imp A2) (impr D2) E1 E1’ n1:neg A1 ,...,nj:neg Aj , LF <- ({h2:hyp A2} p1:pos pC1q,...,pk:pos pCkq ` M :#, ca (A1 imp A2) (impr D2) ([h:hyp (A1 imp A2)] E2 h h2) (E2’ h2)) where neg and pos are type families indexed by for- <- ca A1 E1’ D2 D2’ mulas and # is a new type, the type of derivations. <- ca A2 D2’ E2’ F. Below we show the representation of cut-free sequent derivations as an LF signature in the concrete syntax cal_existsl : of Elf. ca A (existsl D1 H) E (existsl D1’ H) <- ({a:i} {h:hyp (B1 a)} # : type. ca A (D1 a h) E (D1’ a h)). neg : o -> type. pos : o -> type. 6 Extension to Classical Logic axiom’ : (neg A -> pos A -> #). In sequent calculus, classical logic is handled by al- lowing multiple conclusions, that is, a sequent has the orr1’ : (pos A -> #) form Γ −→ ∆, where both Γ and ∆ are lists (or multi- -> (pos (A or B) -> #). sets) of formulas. For the proof of cut elimination and our representation it is important that Gentzen’s orr2’ : (pos B -> #) structural rules remain implicit: The principal formula -> (pos (A or B) -> #). of an inference must always be copied to all premises along with all side formulas. orl’ : (neg A -> #) -> (neg B -> #) The assignment of proof terms reflects the symmetry -> (neg (A or B) -> #). between the left- and right-hand sides of a sequent in

5 I axiom np Γ,n:A −→ p : A, ∆

d1 Γ −→ p 1 : A, p:A ∨ B,∆ ∨R1 orr1 (λp1 :A. d1) p d1 d2 Γ −→ p : A ∨ B,∆ Γ,n:A∨B,n1:A −→ ∆Γ,n:A∨B,n2:B −→ ∆ ∨ L d2 orl (λn1 :A. d1)(λn2 :B. d2) n Γ −→ p 2 : B,p:A ∨ B,∆ Γ ,n:A∨B −→ ∆ ∨R2 orr (λp :B. d ) p Γ 2 −→2 2 p : A ∨ B,∆

Γ ,n:A−→d p : ¬ A, ∆ Γ,n:¬A−→d p : A, ∆ ¬R ¬L notr (λn:A. d) p notr (λp:A. d) n Γ −→ p : ¬ A, ∆ Γ,n:¬A −→ ∆

Figure 2: Proof terms for classical sequent calculus notr’ : (neg A -> #) 7 Extension to Linear Logic -> (pos (not A) -> #). notl’ : (pos A -> #) In this section we apply the idea of the encoding for -> (neg (not A) -> #). the intuitionistic and classical cases to linear logic. Constructive cut elimination in a sequent formulation The representation is adequate and compositional; we is significantly harder here, since structural rules are skip the routine formulation of such a theorem. Ad- more difficult to eliminate than in the classical and in- missibility of cut is proved as in the intuitionistic cal- tuitionistic cases. Girard [Gir87] uses proof nets (in- culus, by three nested structural inductions on the cut stead of a sequent calculus) partly for that reason. formula and the left and right derivations, although Galmiche and Perrier [GP94] give a syntactic analysis there are more cases to consider. of permutabilities of rules and apply it to cut elimi- nation; our own analysis does not go quite as far, but Theorem 4 (Classical Admissibility of Cut) we have a simpler proof of cut elimination. We conjec- d e ture that their presentation could be streamlined using Let D :: (Γ −→ p : A, ∆) and E :: (Γ,n:A −→ ∆) our presentation of the linear sequent calculus. Ro- be (cut-free) derivations in the classical sequent calcu- orda [Roo91] gives a different proof of cut elimination lus G3. Then there is a proof term f and a (cut-free) f by generalizing the cut rule to multiple occurrences of sequent derivation of F :: (Γ −→ ∆). modal formulas.

Girard’s notion of a cross-cut [Gal93], though with- The main challenge is to isolate the non-linear reason- out unwieldy multiplicities, surfaces naturally in this ing and the associated structural rules. Our solution is proof: Since formulas are never discarded they must close to Andreoli’s Σ [And92] and Girard’s LU [Gir93] be eliminated explicitly from both premises of a cut in 2 in that we divide a sequent into linear and non-linear a cross-cut fashion before the essential cut reduction can take place. The proof is represented by a type zones, and that we have several forms of cut. The family structural aspects of non-linear reasoning are treated in the manner of the earlier sections. This leaves a ca’ : {A:o} (pos A -> #) -> (neg A -> #) version of dereliction as the only structural rule, and -> # -> type. it can be handled directly by the structural induction proving admissibility of cut. A proof along similar implementing the relation between A, the derivation lines, but using explicit termination measures instead D, the derivation E and the resulting derivation F. of structural induction over proof terms has been given The implementation of each case is as direct as for the by Hodas [Hod94] for L, a fragment of intuitionistic intuitionistic calculus. linear logic.

6 The following fragment is complete for classical propo- not destroy the structural induction. However, there sitional linear logic; the extension to include first- are two new phenomena: proof terms now come from order quantifiers and the remaining linear connectives a linear λ-calculus and they no longer uniquely deter- (which are all definable) is straightforward, both in mine the sequent derivation, since the side formulas of the proof and its implementation in Elf. multiplicative rules may be split differently without af- fecting the proof term. For our purposes, proof terms ⊥ for the Lolli fragment of linear logic [HM94] are suf- A ::= P | A1 ⊗ A2 | 1 | A1 & A2 |>|A |!A|?A ficient, which is important since it satisfies a stronger normal form theorem than the full calculus. In this We treat A⊥ as primitive and use two-sided sequents fragment, we have linear (-o) and intuitionistic (->) to aid in the formalization. We include ?A even implication, additive conjunction (&), and top (T)and though it is definable as (!(A⊥))⊥ due to the special corresponding proof constructors. In Figure 4 we show role of the modal operators. A sequent has the form the declarations of the constants that could be used Ψ; Γ −→ ∆; Θ to construct the linear λ-terms in the representation. Alternatively, one can think of this as a specification which may be interpreted as !Ψ, Γ −→ ∆ , ?Θ in or- in Lolli where each clause has been labelled. dinary linear sequent calculus. Thus the outer zones Lolli is first-order and has no notion of proof terms and in the sequents represent non-linear hypotheses and is thus not adequate to obtain an implementation of conclusions, the inner zones must be treated linearly. derivations in the sequent calculus, only of derivability. The calculus is defined by the rules in Figure 3. LF, on the other hand, has no notion of linearity. Thus There are three rules of cut, which we show to be ad- we approximate the proof terms as sketched above in missible, rather than taking them as primitive. These LF by interpreting -o as -> and eliminating T (top) rules take advantage of the additional structure pro- and & by currying, basically ignoring linearity restric- vided by the multi-zonal sequent, but they are pure in tions, but properly modelling dependencies and vari- the sense that do not refer directly to the exponentials able scope. This representation is not yet adequate, of linear logic. but we can recover adequacy by using a higher-level judgment lin on proof terms, checking that they are linear. This requires two auxiliary judgments checking Ψ; Γ1 −→ A, ∆1;Θ Ψ;Γ2,A−→ ∆ 2 ;Θ Cut that embedded functions are linear in their argument −→ Ψ; Γ1, Γ2 ∆ 1 , ∆ 2 ;Θ where required. We only show the declarations—the implementation is relatively straightforward. Ψ; ·−→A;Θ (Ψ,A); Γ −→ ∆; Θ Cut! Ψ; Γ −→ ∆; Θ linp : (pos A -> #) -> type. linn : (neg A -> #) -> type. −→ −→ · Ψ; Γ ∆; (A, Θ) Ψ; A ;Θ lin : # -> type. Cut? Ψ; Γ −→ ∆; Θ The resulting representation of derivations is a com- positional bijection between between LF objects of This system satisfies weakening and contraction in the type lin in an appropriate context and linear sequent non-linear zones: We can adjoin a formula to the non- derivations in LV (a precise formulation of this the- linear zones of each sequent in a derivation to achieve orem may be found in [Pfe94b]). We can prove ad- weakening, or substitute the use of one formula for an- missibility of cut by nested structural inductions as other to achieve contraction. In either case the struc- before. ture of the derivation does not change. We could now prove admissibility of these rules simul- Theorem 5 (Admissibility of Cut in LV) The teneously by three nested inductions on the complex- three rules of cut for the linear sequent calculus are ity of the cut formula, the length of the derivation of admissible. the left premise and the length of the derivation of the right premise. However, for the purpose of implemen- Proof: Let A be the cut formula and d and e the tation we would like the proof to be structural. As proof terms of the derivations of the premisses of the before, we introduce proof terms so that the required cut rules. We proceed by three nested structural in- weakening for formulas in the non-linear zones does ductions on A, d and e, simultaneously for Cut, Cut!,

7 and Cut?. Appeals to Cut! and Cut? are considered require about 2 seconds to type-check on a Dec Alpha. greater than Cut, if the cut formula A is the same. Cut elimination for linear logic adds 675 lines, which To rephrase: We may appeal to the induction hypoth- includes the algorithm comprising 73 cases. Once we esis on (1) a smaller cut formula, (2) the same cut arrived at the basic representation idea, the full im- formula, but pass from Cut! or Cut? to Cut, (3) the plementation was carried out, revised, and cleaned up same cut formula and rule, but smaller proof term d, in about 2 days each for intuitionistic, classical, and or (4) the same cut formula, rule, proof terms d, but linear sequent calculi.

smaller proof term e. 2 Once the structural proof of admissibility has been found and implemented, it is natural to ask if it The faithful and concise implementation of this proof can also be encoded in stronger frameworks such as in the spirit of the earlier encodings would require Coq [DFH+93] so that structural inductions are made a linear logical framework, which is the subject of explicit and the proof is fully formally verified. There current research. But we can implement the trans- are several aspects of our proof which make this dif- formation on proof terms as they are represented in ficult. The first is the essential use of higher-order LF. Note that the reasoning about linearity restric- abstract syntax, which is not available in a similarly tions in the structural proof is not implemented here. straightforward fashion in other candidate environ- Nonetheless, it can be executed by applying it to proof ments. The second difficulty arises from the non- terms to obtain proof terms for the result of the cut. deterministic nature of the cut elimination algorithm By meta-level reasoning (i.e., the informal proof and contained in the proof. Making it deterministic in properties of LF) we know that this will always map the form of a primitive recursion (which would be re- linear derivations to linear derivations. We only show quired for a functional framework) would lead to an the declarations and three typical cases in Figure 5. explosion in the number of cases. It appears the only 8 Conclusion way to avoid at least some of this combinatorial ex- plosion is to introduce termination measures after all, We have presented new structural proofs of cut elim- which requires a new sequence of lemmas regarding ination for intuitionistic, classical, and linear sequent sizes of formulas and derivations. We conclude that calculi. We have further shown how sequent deriva- a similarly elegant representation of cut elimination tions in all three systems can be implemented in Elf. in other systems is a non-trivial challenge which, we For the intuitionistic and classical cases, the proof of hope, others will take up. cut elimination can also be implemented in Elf, al- though the fact that this implementation models the In future work we plan to verify mechanically that the informal argument is still partly an informal property, given signatures indeed implement proofs. The proto- just like the adequacy of the LF encoding of deriva- type implementation of the schema-checker sketched tions. The implementations can be executed to trans- in [Roh94] currently accepts them, but the (meta- form sequent derivations with cut to cut-free deriva- meta-)theoretical analysis of the schema-checker itself tions. The proof representation is extremely concise is not yet complete. In other future work we plan to and much shorter than an informal proof of the same reexamine the connection between normalization and argument. We have written a program to generate La- cut elimination in the same framework. Another di- TeX source for an informal version of each case in the rection is to study cut elimination in a formulation as proof of admissibility. These “informalized” versions a higher-order rewrite system along the lines of Nip- are given in full detail in [Pfe94a]. kow [Nip91], but using dependent types. We first note that our system of rules is terminating (note that we In the case of linear logic the implementation of cut cannot permute adjacent cuts). Assuming the com- elimination captures less of the informal reasoning by pleteness of a critical pair criterion for the depen- ignoring linearity constraints, but is nonetheless oper- dently typed calculus, the system is confluent mod- ationally adequate in the sense that, given valid linear ulo Kleene’s permutations of adjacent inference rules sequent derivations, it will generate valid linear se- in the cut-free system. This means that our cut con- quent derivations. The linearity check has also been versions do not identify intuitively unrelated sequent implemented in Elf, although it is somewhat tedious. derivations, which has been a problem in other sys- The combined sources for the implementations of ad- tems as noted by Lafont (see [Gal93]). missibility of cut and cut elimination for intuitionistic and classical logic with a full complement of quanti- Finally, the representation of the linear sequent calcu- fiers and connectives comprise 739 lines of Elf code and lus and its cut elimination algorithm could be made

8 even more concise by using a linear logical frame- [HHP93] Robert Harper, Furio Honsell, and Gordon work as sketched in Section 7. In joint work with Plotkin. A framework for defining logics. Jour- I. Cervesato, we are currently designing such a linear nal of the Association for Computing Machin- refinement of LF following ideas of Miller, Plotkin and ery, 40(1):143–184, January 1993. Pym [MPP92]. [HM94] Joshua Hodas and Dale Miller. Logic program- ming in a fragment of intuitionistic linear logic. Acknowledgments. I would like to thank Iliano Information and Computation, 110(2):327–365, Cervesato, Jean Gallier, Dale Miller, Richard Statman 1994. A preliminary version appeared in the and Roberto Virga for discussions regarding the topic Proceedings of the Sixth Annual IEEE Sympo- sium on Logic in Computer Science, pages 32– of this paper and David Basin, Se´an Matthews, Ekke- 42, Amsterdam, The Netherlands, July 1991. hard Rohwedder and Anne Troelstra for comments on adraft. [Hod94] Joshua S. Hodas. Logic Programming in In- tuitionistic Linear Logic: Theory, Design, and References Implementation. PhD thesis, University of [Abr93] Samson Abramsky. Computational interpreta- Pennsylvania, Department of Computer and tions of linear logic. Theoretical Computer Sci- Information Science, 1994. ence, 111:3–57, 1993. [Kle52] Stephen Cole Kleene. Introduction to Meta- [And92] Jean-Marc Andreoli. Logic programming with mathematics. North-Holland, 1952. focusing proofs in linear logic. Journal of Logic and Computation, 2(3):197–347, 1992. [Mat94] Se´an Matthews. A theory and its metatheory [BTKP93] Val Breazu-Tannen, Delia Kesner, and Lau- in FS0. In Dov Gabbay and Franz Guenth- rence Puel. A typed pattern calculus. In ner, editors, What is a Logical System? Oxford Moshe Y. Vardi, editor, Proceedings of the University Press, 1994. To appear. Eight Annual IEEE Symposium on Logic in [MPP92] Dale Miller, Gordon Plotkin, and David Pym. Computer Science, pages 262–274, Montreal, A relevant analysis of natural deduction. Talk Canada, June 1993. given at the Workshop on Logical Frameworks, + [DFH 93] Gilles Dowek, Amy Felty, Hugo Herbelin, B˚astad, Sweden, May 1992. G´erard Huet, Chet Murthy, Catherine Par- ent, Christine Paulin-Mohring, and Benjamin [Nip91] Tobias Nipkow. Higher-order critical pairs. In Werner. The Coq proof assistant user’s guide. G. Kahn, editor, Sixth Annual IEEE Sympo- Rapport Techniques 154, INRIA, Rocquen- sium on Logic in Computer Science, pages 342– court, France, 1993. Version 5.8. 349, Amsterdam, The Netherlands, July 1991. [Dra87] A. G. Dragalin. Mathematical : In- [Pfe91] Frank Pfenning. Logic programming in the troduction to ,volume67ofTrans- LF logical framework. In G´erard Huet and lations of Mathematical Monographs.Ameri- Gordon Plotkin, editors, Logical Frameworks, can Mathematical Society, Providence, Rhode pages 149–181. Cambridge University Press, Island, 1987. 1991. [Gal93] Jean Gallier. Constructive logics Part I: A tuto- rial on proof systems and typed λ-calculi. The- [Pfe94a] Frank Pfenning. A structural proof of cut elimi- oretical Computer Science, 110:249–339, 1993. nation and its representation in a logical frame- [Gen35] Gerhard Gentzen. Untersuchungenuber ¨ das work. Technical Report CMU-CS-94-218, De- logische Schließen. Mathematische Zeitschrift, partment of Computer Science, Carnegie Mel- 39:176–210, 405–431, 1935. English transla- lon University, November 1994. tion in M. E. Szabo, editor, The Collected Pa- [Pfe94b] Frank Pfenning. Structural cut elimination in pers of Gerhard Gentzen, pages 68–131, North- linear logic. Technical Report CMU-CS-94-222, Holland, 1969. Department of Computer Science, Carnegie [Gir87] Jean-Yves Girard. Linear logic. Theoretical Mellon University, December 1994. Computer Science, 50:1–102, 1987. [Gir93] Jean-Yves Girard. On the unity of logic. An- [Roh94] Ekkehard Rohwedder. Verifying the meta- nals of Pure and Applied Logic, 59:201–217, theory of deductive systems. Thesis Proposal, 1993. February 1994. [GP94] Didier Galmiche and Guy Perrier. On proof [Roo91] Dirk Roorda. Resource Logics: Proof- normalization in linear logic. Theoretical Com- Theoretical Investigations. PhD thesis, Univer- puter Science. To appear. Available as Techni- sity of Amsterdam, September 1991. cal Report CRIN 94-R-113, Nancy, France.

9 I Ψ; A −→ A ;Θ

Ψ; Γ1 −→ A, ∆1;Θ Ψ;Γ2 −→ B,∆2;Θ Ψ; Γ,A,B −→ ∆; Θ ⊗R ⊗L Ψ; Γ1, Γ2 −→ A ⊗ B,∆1,∆2;Θ Ψ; Γ,A⊗B −→ ∆; Θ

Ψ; Γ −→ ∆; Θ 1R 1L Ψ; ·−→1; Θ Ψ; Γ, 1 −→ ∆; Θ

Ψ; Γ,A−→ ∆; Θ & L1 Ψ; Γ −→ A, ∆; Θ Ψ, Γ −→ B,∆; Θ Ψ; Γ,A&B −→ ∆; Θ & R −→ Ψ; Γ A & B,∆; Θ Ψ; Γ,B −→ ∆; Θ & L2 Ψ; Γ,A&B −→ ∆; Θ

>R > Ψ; Γ −→ > , ∆; Θ No L rule

Ψ; Γ,A−→ ∆; Θ Ψ; Γ −→ A, ∆; Θ ¬R ¬L ⊥ ⊥ Ψ; Γ −→ A , ∆; Θ Ψ; Γ,A −→ ∆; Θ

Ψ; ·−→A;Θ (Ψ,A); Γ −→ ∆; Θ !R !L Ψ; ·−→!A;Θ Ψ; (Γ, !A) −→ ∆; Θ

Ψ; Γ −→ ∆; (A, Θ) Ψ; A −→ · ;Θ ?R ?L Ψ; Γ −→ (?A, ∆); Θ Ψ; ?A −→ · ;Θ

(Ψ,A); (Γ,A)−→ ∆; Θ Ψ; Γ −→ ( A, ∆); (A, Θ) !D ?D (Ψ,A); Γ −→ ∆; Θ Ψ; Γ −→ ∆; (A, Θ)

Figure 3: Rules for LV

10 # : type. % Token for Derivations neg!: o -> type. % Modal Hypotheses (far left) neg:o->type. % Hypotheses (left) pos:o->type. % Conclusions (right) pos?: o -> type. % Modal Conclusions (far right) axiom : (neg A -o pos A -o #). timesr : (pos A -o #) timesl : (neg A -o neg B -o #) -o (pos B -o #) -o (neg (A times B) -o #). -o (pos (A times B) -o #). oner : (pos one -o #). onel:#-o(neg one -o #).

andl1 : (neg A -o #) andr : ((pos A -o #) & (pos B -o #)) -o (neg (A and B) -o #). -o (pos (A and B) -o #). andl2 : (neg B -o #) -o (neg (A and B) -o #). topr : T -o (pos (top) -o #). % no topl perpr : (neg A -o #) perpl : (pos A -o #) -o (pos (perp A) -o #). -o (neg (perp A) -o #).

!r : (pos A -o #) !l : (neg! A -> #) -> (pos (! A) -o #). -o (neg (! A) -o #).

?r : (pos? A -> #) ?l : (neg A -o #) -o (pos (? A) -o #). -> (neg (? A) -o #).

!d : (neg A -o #) ?d : (pos A -o #) -o (neg! A -> #). -o (pos? A -> #).

Figure 4: Implementation of LV

ad : {A:o} (pos A -> #) -> (neg A -> #) -> # -> type. ad! : {A:o} (pos A -> #) -> (neg! A -> #) -> # -> type. ad? : {A:o} (pos? A -> #) -> (neg A -> #) -> # -> type. ad_times : ad (A times B) ([p] timesr D1 D2 p) ([n] timesl E1 n) F <- ({n2:neg B} ad A D1 ([n1:neg A] E1 n1 n2) (E1’ n2)) <- ad B D2 E1’ F. ad!_d : ad! A D! ([n!] !d (E1 n!) n!) F <- ({n1:neg A} ad! A D! ([n!] E1 n! n1) (E1’ n1)) <- ad A D! E1’ F. adl_andr : ad A ([p] andr (D1 p) (D2 p) P) E (andr D1’ D2’ P) <- ({p1:pos B1} ad A ([p] D1 p p1) E (D1’ p1)) <- ({p2:pos B2} ad A ([p] D2 p p2) E (D2’ p2)).

Figure 5: Admissibility of cut in LV (three cases)

11