An explicit natural deduction Bruno
Pagano
(
[email protected])
Abstract The typed -calculus and the natural deduction are isomorph. There is a mapping (the Curry-Howard's isomorphism) between each others. This paper shows that the typed calculi with explicit substitutions are isomorph to a logical deduction system which is equivalent to the natural deduction. This logical formalism inherits the explicit substitutions properties: con uence on open terms, rst-order calculus and no PSN.
1 Introduction What is called in mathematics a proof or a demonstration is in fact a more or less informal speech which is founded on some axioms and which follows the greek logic tradition. The aim of the demonstration theory is to supply a formal framework in order to describe a raisoning; the proof becomes a rigorous object. It can be handled like any other mathematical object. In a proof, we have to distinguish what is proved from the demonstration itself. In the following, we will use formalisms where the proved objects are propositional formulas1. More precisely, in natural deduction, the basic element is a formula that we will consider under some hypothesis (which is called a sequent). A judgment is built with inference rules on these sequents. The calculus, called the cut elimination, consists in modifying a judgment by replacing an hypothesis with its proof. In the other hand, we can associate the propositional formulas with a subset of the -terms. This set can be considered as a subcalculus of the -calculus; it preserves the con uence property, and is also strongly normalizing. To resume, we have in one hand the demonstration theory which associates a proof to a logical formula and in the other hand the typed -calculus which associates a -term to the same formula. Curry and Howard have shown that the natural deduction and the typed -calculus are isomorph: i.e. each typed term may be associated to a proof (and reciprocaly). This association belongs to the reduction of both systems. Like the -calculus they modelize, the calculi with explicit substitutions can be restricted to typed subcalculi[Rio93, Hur97]. The subject of this paper is to study which the demonstration formalism is isomorph with such calculi. We treat the * -calculus[CHL96], but the results can be used with the -calculus family[ACCL90] and with other calculi with explicit substitutions. We show that the * calculus is isomorph to a kind of natural deduction where the cut elimination has become explicit. We demonstrate that this calculus is strictly equivalent to the natural deduction (the same formulas can be demonstrated in both). We will study the connections between our deduction and the Gentzen's sequent calculus. This work is related to the Herbelin's work[Her95] on the sequent calculus. The approach is slightly dierent, because he de nes a calculus with explicit substitution related to the sequent calculus. We take the opposite way, begining with a calculus, we de ne a logical deduction framework. 1
Here, formulas will only be built with variables and the symbol !
1
2 NATURAL DEDUCTION AND DE BRUIJN'S NATURALS
2
2 Natural deduction and de Bruijn's naturals
Notation 1 The propositionnal variables are denoted by X; Y; Z , the formulas by A; B; C and lists of
formulas by ?; ; . The list ? = (A; B; C) will simply be written ? = A; B; C and the concatenation of the lists ? and by ?; .
The calculus with explicit substitutions that we will study in this paper uses de Bruijn's natural to encode variables. This is why we begin by de ning a natural deduction using a mechanism similar to the DB -calculus substitution. To establish an isomorphism between the DB -calculus and the natural deduction, we consider the hypothesis in this deduction system as lists of formulas (i.e. not sets or multi-sets).
De nition 1 A sequent ? ` A is a pair of a list of formulas ? and a formula A. ? is a set of hypothesis, it is called the sequent context. The formula A is the conclusion. A judgment of ? ` A is a proof of A under the hypothesis ?.
De nition 2 The judgments of the natural deduction with naturals are inductively de ned by: a : A; ? ` B ! a : ? ` A ! B b : ? ` A !e i : A ; : : :; An ` Ai Ax a : ? ` A ! B i (a b) : ? ` B 1
Notice that the three rules de ne also the set of the typed DB -terms.
Remark 1 The inductive rules de ning the natural deduction seem to remain the same with or without de Bruijn's natural. However, it is always the rst formula of the context which occurs in the introduction rule and the elimination rule. For example, the judgment deduction but not in the deduction with naturals.
A; B ` C is a valid judgment in natural A`B!C
The usual weakening and contraction rules can not be de ned in the deduction with naturals, but we can reformulate them into lemmas.
Lemma 1 If there is a judgment of the sequent ? ` A , then for each formulas list , there is a judgment of ?; ` A. Lemma 2 If there is a judgment of the sequent ? ` A , and if is a permutation of ? then there is a judgment of ` A. Proposition 1 The natural deduction and the natural deduction with naturals are equivalent.
There is a judgment in the natural deduction of a sequent if and only if there is a judgment of this sequent in the deduction with de Bruijn's naturals.
Proof : Trivialy, a judgment with naturals can be seen as a judgment whithout naturals. So, it subsits
only one side of the equivalence to prove. This is made by induction on the last inference rule of a judgment. It is easy to do if we use the lemmas 1 and 2. 2
Cut elimination As for the natural deduction, a cut is an introduction rule succeded by an elimination
rule. The elimination of a cut is de ned by adjustments of naturals as it is performed in the substitution calculus of the DB -calculus.
De nition 3 The cut elimination is de ned by the rule : 2 1 ! b : ? ` A ! B i a : ? ` A !e (b) a : ? ` B
?!
1 [1 ! 2] b[1 ! a] : ? ` B
2 NATURAL DEDUCTION AND DE BRUIJN'S NATURALS
3
The judgment 1 [1 ! 2] is the proof 1 where the proof 2 is substituted to the axiom in the rst place of the context. In comparison with the DB -calculus, the terms become proofs and the variables
become axioms. This is the Curry-Howard isomorphism: a judgment is associated to a DB -term, a cut to a -redex and the elimination of the cut to the -reduction.
De nition 4 The judgment substitution is inductively de ned by:
A1 ; : : :; An ` Ai Ax
[i ! ]
=
[i ! ]
=
A1 ; : : :; Ai?1; Ai+1; : : :; An ` Aj Ax
1 2 !e [i ! ] = A1; : : :; An ` B 1 !i [i ! ] = A1 ; : : :; An ` B ! C
1[i ! ] 2 [i ! ] ! A1 ; : : :; Ai?1; Ai+1; : : :; An ` B e
A1 ; : : :; An ` Aj Ax
A1 ; : : :; An ` A Ax
(i;B)
1 2 !e (i;B) A1; : : :; An ` B
1[i + 1 ! (1;B) ] ! A1 ; : : :; Ai?1; Ai+1; : : :; An ` B ! C i
=
A1 ; : : :; Ai; B; Ai+1 ; : : :; An ` A Ax
=
1(i;B) 2(i;B) ! A1 ; : : :; Ai; B; Ai+1 ; : : :; An ` B e
(i;B) 1 ! i = A1 ; : : :; An ` B ! C
1(i+1;B) ! A1 ; : : :; Ai; B; Ai+1 ; : : :; An ` B ! C i
We only have transformed the meta-rules controling the substitution processus of the DB -calculus into rules on judgments. The up or down adjustments of naturals are replaced by insertions or supressions of hypothesis in contextes. The replacement of an indice by a term becomes the substitution of an axiom by a judgment.
Curry-Howard's isomorphism Theorem 1 The -calculus and the natural deduction with naturals are isomorph. Let t be a term associated to a judgment , and let u be a term associated to a judgment . The term t[1 ! u] is associated to the judgment [1 ! ]. Proof : We show by induction on t a more general property: the term t[i ! u] is associated to the judgment [i ! ]. 2 DB
1
1
1
2
2
2
This isomorphism is rather interesting to establish the natural deduction properties from the DB calculus properties: the natural deduction with de Bruijn's naturals with the cut elimination considered as a calculus, is con uent and strongly normalizing. Moreover, in computer science, this isomorphism can be used to prove programs. A -term is associated to a functional program and the type of the -term to the speci cation of the program. The isomorphism allows to write a program only by demonstrating its speci cation. In this context, the propositional logic is too poor, but isomorphisms have been demonstrated for more complex logical frameworks like the system F of Girard[Gir86, Kri90], the second order arithmetics of Krivine[Kri90] or the construction calculus of Coquand-Huet[Coq85, CH88].
3 NATURAL DEDUCTION WITH MULTISEQUENTS
4
3 Natural deduction with multisequents In this section, we recall the de nition of the typed * -calculus[CHL96, Rio93]. We induce from it, a logical deduction system which is called the multisequent calculus. De nition 5 A multisequent is a pair of two formulas lists. It is denoted by: A1 ; : : :; An ` B1 ; : : :; Bp The intuitive meaning of a multisequent is a list ofsequents which share their context: ? ` B1 ; : : :; Bn () ? ` B1 ; : : : ; ? ` B n
De nition 6 The natural deduction with multisequents and the set of the typed *-terms are de ned by: t : A; ? ` B !i t : ? ` A ! B t : ? ` A !e Ax i : A ; : : :; An ` Ai t : ? ` A ! B (t t ) : ? ` B 1
1
t : ` A s : ? ` Cut t[s] : ? ` A
2
1
2
t : ? ` A s : ? ` Cons t:s : ? ` A;
id : ? ` ? id
s1 : ` s2 : ? ` Comp s:?` * (s) : A; ? ` A; Lift s1 s2 : ? ` The judgment of the sequent ? ` A can be seen as the proof of the formula A with the hypotesis
": A; ? ` ? Weak
?. In this context, a multisequent is a list of proofs with the same set of hypothesis. So, the natural deduction with multisequents is an extension of the natural deduction where there are rules to manipulate the contextes. We comment the inference rules: The rst three rules (Ax, !intro et !elim ) are the natural deduction ones. The Cons and Id rules provide the construction of a multisequent. They act like list constructors on sequents with the same context. for instance, the multisequent ? ` A1 ; A2; A3; ? can be built with the sequents ? ` Ai following the judgment: ? ` A3 ? ` ? Id ? ` A2 ? ` A3 ; ? Cons Cons ? ` A1 ? ` A 2 ; A3 ; ? Cons ? ` A 1 ; A2 ; A3 ; ? With this example, we see that these rules only permit to enrich contextes. It is possible to create a context using an empty context, but it is not possible to destruct one. The Cut rule allows to change the context of a sequent. Its eect is like the cut of the natural deduction: .. .. .. .. .. .. .. ?`A ?` ? A; ? ` B .. A; ? ` B ? ` A; ? ?`A!B ?`A Cut ?`B ?`B The multisequents permit to express several cuts with a single Cut rule: .. .. B; C; D; ` A .. . . C; D ` B ! A .. .. ` .D ` .. . .. D`C!B!A . .. ` C ` D .. ` D ! C ! B ! A ` D ... .. ` B ` C; D .. `C!B!A ` C .. B; C; D ` A ` B; C; D `B `B !A Cut `A `A
4 CURRY-HOWARD ISOMORPHISM FOR THE MULTISEQUENT CALCULUS
5
It is also possible to consider a multisequent as a relation associating a context with another one. The Comp rule performs the composition of two relations. With ? ` and ` , we can obtain the multisequent ? ` . The Weak rule has the same comportment that a weakening rule, it permits to enrich a context
with an hypothesis. Combined with the Cut rule, it is identical to the weak rule of the natural deduction: .. .. ? ` B A; ? ` ? Weak Cut A; ? ` B
The Lift rule has also the comportment of a structural rule. It can be simulated by the other rules: .. ..
?` A; ? ` A; Lift
.. ..
? ` A; ? ` ? Weak Comp Ax A; ? ` A A; ? ` Cons A; ? ` A;
Multisequent calculus properties Lemma 3 (Weakening) If there is a judgment of the sequent ? ` A, then for each formulas list , there is a judgment of ?; ` A. If there is a judgment of the multisequent ? ` , then for each formulas list , there is a judgment of ?; ` ; . Lemma 4 (Permutation) Let ? be a context and be a permutation of ?. There is a judgment of the multisequent ? ` . Corollary 1 If there is a judgment of the sequent ? ` A, and if is a permuation of ?, then there is a judgment of ` A. Proposition 2 Let ? ` A ; : : :; An be a multisequent. If a judgment of this multisequent exists, then for eachi i, a judgment of ? ` Ai exists. 1
This proposition shows that the intuitive meaning of the multisequents, i.e. the multisequents are lists of sequents, can be demonstrated as a property of the multisequent calculus.
Theorem 2 There is a judgment of sequent in natural deduction with de Bruijn's naturals if and only if there is a judgment of this sequent in natural deduction with multisequents. Proof : The proof can be found in [Pag98]. 2 Corollary 2 If there is a judgment of the multisequent ? ` A ; : : :; An , then for each i a judgment of ? ` Ai in natural deduction with naturals exists. 1
4 Curry-Howard isomorphism for the multisequent calculus To de ne an isomorphism between the multisequent calculus and the * -calculus, it is necessary to de ne a cut elimination rule for each rewriting rules of the * -calculus. Here, we present only the main cuts rules; others are in [Pag98]. The most important cut rule is the one associated to the beta rule of the * -calculus: 2 1 1 b : A; ? ` B !i a : ? ` A id : ? ` ? Id 2 Cons = ) b : A; ? ` B a:id : ? ` A; ? b : ? ` A ! B a : ? ` A !e Cut (b) a : ? ` B b[a:id] : ? ` B
4 CURRY-HOWARD ISOMORPHISM FOR THE MULTISEQUENT CALCULUS
6
We resume the second judgment as the judgment of A; ? ` B where the judgment of ? ` A is known. We can be more precise if we remember that the order of the formulas in the context is important. In fact, the judgment signi es the judgment of A; ? ` B where the judgment of ? ` A judge the rst hypothesis of A; ?. This is expressed in deduction with naturals by: 2 1 A; ? ` B 1 ! ? ` A But, in deduction with naturals, the substitution is de ned as metarules. In multisequents calculus, the substitution is internalized in the calculus. Another dierence between the two systems is that in the multisequent calculus, the cut elimination is a local rule. The subjudgments are not modi ed as in the deduction with naturals, but they are only reorganised around new inference rules. The inference rule Cut associates the judgment of a sequent with a list of judgments. We can say that the judgment is associated to a substitution of judgments. Access rules to the list of judgments are the same as the * -calculus rules accessing to environments: 2 1 1 a : ? ` A s : ? ` Cons Ax =) 1 : A; ` A a:s : ? ` A; a : ?`A Cut 1[a:s] : ? ` A 1 2 b : ? ` B s : ? ` Cons =) n : ` A Ax s : ?2` Ax n + 1 : B; ` A b:s : ? ` B; Cut n[s] : ? ` A Cut (n + 1)[b:s] : ? ` A These rules approach the metarules governing the substitution in the deduction with naturals (see the definition 4). The composition of the two rules performing the substitution of an axiom by the corresponding judgment in a list. The spreading rules under the !e and !i are still to be de ned. The rst one is very simple, we just have to associate to each subjudgment, a copy of the judgments list. 2 1 3 b : ` A ! B a : ` A !e (b a) : ` B s:?` Cut (b a)[s] : ? ` B 3 3 1 2 b : ` A ! B s : ? ` Cut a : ` A s : ? ` Cut =) b[s] : ? ` A ! B a[s] : ? ` A ! e (b[s] a[s]) : ? ` B The second one performs a shift of the judgments list to obtain that the rst hypothesis (which is introduced by the !i rule) is not associated to a judgment; this is the Lift operation: 2 1 1 s:?` b : A; ` B !i 2 b : A; ` B * (s) : A; ? ` A; Lift = ) b : ` A ! B s : ? ` Cut b[* (s)] : A; ? ` B !i Cut (b)[s] : ? ` A ! B (b[* (s)]) : ? ` A ! B This veri cation made on the other rules of the * -calcul permits to obtain the following properties.
Proposition 3 The reduction relation of the typed closed *-calculus keeps the type of terms. Corollary 3 The typed closed *-calculus is isomorph to the multisequent calculus.
4 CURRY-HOWARD ISOMORPHISM FOR THE MULTISEQUENT CALCULUS
7
Proposition 4 Each judgment with multisequents can be reduced to a judgment without multisequent. Remark 2 The proposition 4 implies the equivalence between natural deduction and multisequent calculus (theorem 2).
We have the same results with the typed * -calculus (with terms and substitutions variables) and a multisequent calculus with metavariables. De nition 7 The set of the open judgments of the natural deduction with multisequents is de ned like
the de nition 6 and two sets of variables. Let Vt and Vs be two sets of variables. If 2 Vt , then is the judgment of a sequent. If 2 Vs , then is the judgment of a multisequent. That will be denoted by:
2 Vs denoted by ? ` Vs ? ` A Vt The judgments variables allowed to describe proofs which are not completely de ned[Hur97]. For example we can express the judgment of A ! C with the judgments of A ! B and of B ! C which are not known, representing them by variables. 2 1 `A!B A` `B !C A` A`A!B A`A A`B!C A`B A`C `A!C As for the other rewriting systems, the introduction of the rst order (i.e. metavariables), allows to describe with terms (here judgments) what is only possible to be described as \metaproperties" at the order 0. In this case, why do we not introduce metavariables in the usual natural deduction ? Because, in this case, the cut elimination is not compatible with the metavariables substitution. Moreover, the cut elimination does not keep the sequent juged by the metavariables. See the counter-example: 1 1 1 A; ? ` B 2 = 6 ?! ? ` B A; ? `B ?`A!B ?`A ?`B We have the same problems as in the higher order rewriting systems. It is not possible to perform a substition (i.e. to spread a replacement of an axiom) into a metavariable before it is instanciated. The substitution with capture and the substitution without capture (respectively the metavariable replacement and the cut elimination) are not compatible together. The explicit substitution is a solution for the calculus; in the same way, the multisequent is a solution for the natural deduction. De nition 8 The set of typed *-terms is de ned as the closed *-terms where each variable of the * 2 Vt denoted by
calculus is associated to a variable of the multisequent calculus. This is summarized by two new inference rules:
x : ?x ` Ax Vt
x : ?x ` x Vs
Proposition 5 The type *-calculus is isomorph to the opened multisequent calculus. Corollary 4 The opened multisequent calculus is con uent and weakly normalizing. Proposition 6 The natural deduction is a subcalculus of the multisequent calculus. Proof :
We show that there is a strategy in multisequent calculus which emulates the cut elimination of the natural deduction. The strategy is the one described in [CHL96] for the * -calculus. The Curry-Howard isomorphism ensures that the multisequent calculus without the rule associated to Beta is con uent and strongly normalizing. The strategy is to perform one Beta-like elimination and to normalize the judgment with the subcalculus. 2
5 CONCLUSION AND FURTHER WORKS
8
5 Conclusion and further works We have de ned an extension of the natural deduction called the multisequent calculus which is isomorph to the * -calculus. This deduction is equivalent to the natural deduction because all proovable formulas of the natural deduction are proovable with multisequents and reciprocaly. With this calculus, the cut elimination is a rst-order rewriting operation. We have shown that the natural deduction is a subcalculus of the multisequent calculus. Firstly, the proofs of the natural deduction are a subset of the proofs of deduction with multisequents. Secondly, the cut elimination of the natural deduction can be decomposed in atomical cut eliminations of the multisequents calculus. The con uence of the * -calculus permits to extend the con uence results to an open deduction, i.e. a natural deduction with metavariables of judgments. With this, we can formally express proofs using lemmas which are not yet prooved. The usual natural deduction provides only rules \working" on conclusions, but with the multisequents, there are rules performing operations on hypothesis. So, it is possible to encode with the multisequents, the sequent calculus of Gentzen[Pag98]. We can have the same framework to treat both calculi. This may be interseting to merge natural deduction rules (CoQ) and sequent calculus rules (PVS) in the same proover. We see four ways to prolongate this work: The sequent calculus encoding proposed in [Pag98] can not be prolongated to the cut elimination. We conjecture that as it has been made by Herbelin for a speci c calculus with explicit substitutions [Her95], it is possible to establish an isomorphism between sequent calculus and multisequent calculus. Relations between multisequents and others logical deduction may be explored. For example the Parigot's free deduction or proof nets. Another way is to examine the multisequent calculus in a classical logic. We know that there is an isomorphism between the Parigot's -calculus and the classical natural deduction; is there a same relation between multisequents and the Audebaud's -calcul ? The last idea is to nd extensions of multisequent calculus in adequation with extensions of the * -calculus (XRS of [Pag98]).
References [ACCL90] M. Abadi, L. Cardelli, P.-L. Curien, and J.-J. Levy. Explicit substitutions. In Conference Record of the Seventeenth Annual ACM Symposium on Principles of Programming Languages, pages 31{46, 1990. [CH88] Thierry Coquand and Gerard Huet. The calculus of constructions. Information and computation, 76:96{120, 1988. [CHL96] Pierre-Louis Curien, Therese Hardin, and Jean-Jacques Levy. Con uence properties of weak and strong calculi of explicit substitutions. Journal of the ACM, 43(2):362{397, March 1996. [Coq85] Thierry Coquand. Une theorie de constructions. PhD thesis, Universite de PARIS 7, 1985. [Gir86] J.-Y. Girard. The system F of variable types, fteen years later. Theoretical Computer Science, 45(2):159{192, 1986. [Her95] Hugo Herbelin. Sequents qu'on calcule. PhD thesis, Universite de PARIS 7, 1995. [Hur97] Cesar Augusto Mu~noz Hurtado. Un calcul de substitution pour la representation de preuves partielles en theorie des types. PhD thesis, Universite Paris 7, 1997. [Kri90] J.L. Krivine. Lambda Calcul. E ditions MASSON, 1990.
REFERENCES [Pag98] [Rio93]
9
Bruno Pagano. des calculs de substitution explicite et de leur application a la compilation des langages fonctionnels. PhD thesis, Universite Paris 6, 1998. Alejandro Rios. Contributions a l'etude des Lambda-calculs avec Substitutions Explicites. PhD thesis, Universite PARIS 7, 1993.
Apendix
De nition 9 The *-calculus term algebra is de ned by two sorts: termes a ::= xt j n j a j ( a a ) j a [ s ] substitutions s ::= xs j id j " j * (s) j a : s j s s xt and xs are metavariable of terms and substitutions, and n is a de Bruijn's natural.
De nition 10 The reduction relation (* ) on this term algebra is de ned by the set of rewriting rules gived in the gure 1 which forms the substitution relation denoted by *; and by another rule, named Beta, which performs a -like reduction: ( a) b Beta ?! a [ b : id ] a[s] (a b) [ s ] (a[s]) [ t ] n["] n[" s] 1[a:s] 1 [ * (s) ] 1 [ * (s) t ] n+1 [ a : s ] n+1 [ * (s) ] n+1 [ * (s) t ] a [ id ]
lam ?! app ?! clos ?! vs1 ?! vs2 ?! fvc ?! fvl1 ?! fvl2 ?! rvc ?! rvl1 ?! rvl2 ?! id ?!
(a [ * (s) ]) (a[s] b[s]) a[s t]
n+1 n+1 [ s ]
a
1 1[t] n[s] n[s "] n [ s ("
a
t) ]
(s t) u (a : s) t " (a : s) " * (s) " * (s) t * (s) * (t) * (s) (* (t) u) * (s) (a : t) id s s id * (id)
ass ?! map ?! sc ?! sl1 ?! sl2 ?! l1 ?! l2 ?! le ?! il ?! ir ?! li ?!
s (t u) a[t] : (s t) s s " s (" t) * (s t) * (s t) u a : (s t) s s id
Figure 1: *-calculus reduction rules The relation * is a subcalculus of * ] which is con uent and strongly normalizing.