<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>cient Translation of Sequent Calculus Proofs Into Natural Deduction Proofs</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Gabriel Ebner</string-name>
          <email>gebner@gebner.org</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Matthias Schlaipfer</string-name>
          <email>mschlaipfer@forsyte.at</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>TU Wien</institution>
          ,
          <addr-line>Vienna</addr-line>
          ,
          <country country="AT">Austria</country>
        </aff>
      </contrib-group>
      <fpage>17</fpage>
      <lpage>33</lpage>
      <abstract>
        <p>We present a simple and e cient translation of the classical multi-succedent sequent calculus LK to natural deduction. This translation aims to produce few excluded middle inferences, and to keep the quanti er complexity of the instances of excluded middle low. We evaluate the translation on proofs imported from resolution-based rst-order theorem provers, and show that it achieves these goals in an e cient manner.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Program extraction realizes the computational content of mathematical proofs
as executable algorithms. These extractions, such as modi ed realizability [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]
for example, aim to transform proofs of existential statements into an e ective
procedure that computes a witness for the existential quanti er. Frameworks to
extract computational interpretations are often formulated for proofs in natural
deduction.
      </p>
      <p>
        Our particular interest lies in program extraction from classical proofs
using a method that interprets natural deduction proofs with excluded middle as
programs using exceptions [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. In this setting, the excluded middle on quanti ed
formulas is implemented by a lambda term encoding an exception mechanism.
This point of view imposes a quantitative requirement on the desired proofs in
natural deduction: the proofs do not need to be constructive, but the use of
excluded middle should be limited: on the one hand, the complexity of the formula
should be low as quanti er-free excluded middle can be interpreted e ciently.
On the other hand, the number of inferences using excluded middle should be
small because exceptions are costly and produce slow programs.
      </p>
      <p>
        GAPT [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] is an open source system implementing proof transformations in
classical rst- and higher-order logic with a strong focus on the application
of Herbrand's theorem. Proofs are mostly represented in the classical sequent
calculus LK. To extract programs from these proofs in LK, we want an e ective
translation to natural deduction in order to apply established program extraction
methods.
      </p>
      <p>Ultimately our goal is to extract programs from proofs generated by
automated classical rst-order theorem provers. GAPT can already reliably import
proofs in LK from more than half a dozen external theorem provers. In this
paper we describe the missing piece to apply program extraction: a translation to
natural deduction.</p>
      <p>
        Translations of LK to natural deduction are as old as the proof systems
themselves. However these translations often focus on the preservation of provability,
and not on quantitative and qualitative aspects of the output. For example,
Gentzen rst presented such a translation using a Hilbert-style calculus as an
intermediate step [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. The correspondence of cut-free proofs in the intuitionistic
sequent calculus LJ and normal proofs in natural deduction has been studied
by Zucker [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ]. However, given the focus of the work they only translate
singlesuccedent sequent calculus proofs. The textbook by Troelstra and
Schwichtenberg [17, Section 3.3] also only shows the translation for the single-succedent LJ;
the proof sketch for the extension to LK gives no information about the concrete
proof transformation. In general, these translations do not try to minimize the
classical content of the proofs.
      </p>
      <p>
        Closer to our emphasis on the low amount of classical content is the recent
work of Gilbert [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. He shows how to translate automatically generated proofs
in the multi-succedent sequent calculus LK to proofs in intuitionistic LJ, and
empirically measures the constructivization success of the translation. He
measures whether a complete proof is constructive or not, but does not quantify the
amount of classical content.
      </p>
      <p>
        Our translation uses a focusing approach and preserves the local shape of the
proof in a straightforward way. For example, a conjunction-right inference in LK
is typically translated to a single conjunction-introduction inference in natural
deduction. LK supports classical reasoning by allowing multiple formulas in the
succedent of a sequent, and inferences to operate on any one of these formulas.
We translate this switching between formulas in the succedent using a simulated
exchange rule that is similar in spirit to the constructor in -calculus [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ].
      </p>
      <p>We de ne the proof systems LK and natural deduction in Section 2. The
translation from LK to natural deduction is then described in Section 3. Finally,
Section 4 evaluates an implementation of the translation on real-world proofs
generated by an automated theorem prover.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Proof systems</title>
      <p>We consider rst-order formulas with standard connectives ^; _; ); :; &gt;; ?,
quanti ers 8; 9, and equality =. We denote formulas by A; B; C and D, variables by x
and y, and constant terms by s, t and u. We write capture-avoiding substitution
of x by y in A as A[y=x]. We present proofs as trees of inferences on sequents. A
sequent A1; : : : ; An ` B1; : : : ; Bm is a pair of multisets of formulas interpreted as
(Vin=1 Ai) ) Wjm=1 Bj . We denote multisets of formulas by ; ; and . We
abbreviate union using comma: e.g., ; = [ and ; A = [ fAg. Negation
of a multiset of formulas : is interpreted as f:A j A 2 g. The left-hand side of
the sequent symbol is the antecedent, and the right-hand side is the succedent of
a sequent. The sequent above the inference rule is the premise and the sequent
below the rule is the conclusion. We will also write to refer to a proof
with conclusion ` . `</p>
      <p>Figure 1 lists the inference rules of the sequent calculus LK3. The inference
rules of natural deduction (ND) are listed in sequent form in Figure 2. Our
version of ND allows classical derivations by providing a rule for the excluded
middle. We say the main formula of an inference rule in LK is the formula derived
by the rule. For instance, for the (^:r)-rule the main formula is A ^ B.
Induction rule for natural numbers: In the case of the natural numbers
(constructors 0 of arity 0 and s of arity 1) the induction rules for LK and ND reduce
to</p>
      <p>Symmetry and transitivity of equality: Even though we only include re
exivity and rewriting as inference rules for equality, symmetry and transitivity are
derivable. The sequent calculus derivation of symmetry is depicted on the left
and the natural deduction derivation on the right.</p>
      <p>(re )
` s = s (w:l)
s = t ` s = s (= :r)
s = t ` t = s
s = t ` s = t
s = t ` t = s
(ax)</p>
      <p>(= :i)
` s = s (= :e)
The derivations of transitivity are as follows|again, sequent calculus on the left
and natural deduction on the right.</p>
      <p>s = t ` s = t (ax()w:l)
ss == tt;;tt == uu `` ss == ut (= :r)
s = t ` s = t (ax) ` s = s ((==::ie))
s = t ` t = s t = u ` t = u ((a=x:)e)
s = t; t = u ` s = u
Examples: We will illustrate the proof systems using a proof of double-negation
elimination in sequent calculus on the left, and using natural deduction on the
right.</p>
      <p>A ` A (ax)
` A; :A (::r)
::A ` A (::l)
` ::A ) A ():r)</p>
      <p>:A ` :A ((a:x:e))
::::AA;; ::AA `` ?A ((e?m:e))
3 Our implementation furthermore supports de nition and theory rules which we omit
for brevity.
Cut</p>
      <sec id="sec-2-1">
        <title>Structural</title>
        <p>`
A; `
(w:l)</p>
      </sec>
      <sec id="sec-2-2">
        <title>Propositional</title>
        <p>(^:l)
A; B; `
A ^ B; `
A; ` B; `
A _ B; ; ` ;
` ; A
:A; `
(::l)
` ; A B; `
A ) B; ; ` ;</p>
      </sec>
      <sec id="sec-2-3">
        <title>Quanti cation</title>
        <p>(_:l)
():l)
A[t=x]; `
8xA; `
(8:l)</p>
        <p>A[y=x]; `
9xA; `
(9:l)
` ; A[y=x]
` ; 8xA
(8:r)
` ; A[t=x]
` ; 9xA
(9:r)
The variable y must not occur free in ,
or A.</p>
      </sec>
      <sec id="sec-2-4">
        <title>Equational</title>
        <p>s = t; A[T=s]; `
s = t; A[T=t]; `
(=:l)</p>
      </sec>
      <sec id="sec-2-5">
        <title>Induction</title>
        <p>1 2 n
S1 S2 : : : Sn
1; : : : ; n ` 1; : : : ; n; F [t] (ind)
Each equation rule replaces an arbitrary number of occurrences of T .</p>
        <p>A; A; `
A; `
(c:l)
`` ; A (w:r)
` ; A; A (c:r)
` ; A
` ; A ` ; B (^:r)
; ` ; ; A ^ B
` ; A; B
` ; A _ B (_:r)
A; `
` ; :A (::r)
A; ` ; B
` ; A ) B ():r)
s = t; ` ; A[T=s]
s = t; ` ; A[T=t] (=:r)
` &gt;
(&gt;)
` t = t (re )
? `
(?)
The induction rule applies to arbitrary algebraic data types. Let c1; : : : ; cn be
the constructors of a type and let ki be the arity of ci. Let F [x] be a formula
def
with x a free variable of the appropriate type. Then we call the sequent Si =
F [x1]; : : : ; F [xki ]; i ` i; F [ci(x1; : : : ; xki )] the i-th induction step.
`` ?A (?:e)
` 8xA
` A[t=x] (8:e)
` 9xA
Quanti cation</p>
        <p>; A ` C
; ; ` C
The induction rule applies to arbitrary algebraic data types. Let c1; : : : ; cn be
the constructors of a type and let ki be the arity of ci. Let F [x] be a formula
def
with x a free variable of the appropriate type. Then we call the sequent Si =
F [x1]; : : : ; F [xki ]; i ` F [ci(x1; : : : ; xki )] the i-th induction step.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Translating LK to ND</title>
      <p>One of the main di erences between our sequent calculus and natural deduction
is that natural deduction allows just a single formula in the succedent. In order to
translate LK to ND our translation thus focuses on one formula in the succedent
of the conclusion of the LK proof. The focused formula forms the succedent of
the obtained ND proof, whereas the other formulas are negated and move to
the antecedent. If possible, our algorithm directly proves the focused formula in
ND. Otherwise, it rst exchanges the succedent formula of the ND proof with
the needed main formula via the macro rule (ex) de ned in Figure 3, and then
proves it. The translation then proceeds recursively up the LK proof tree.
; :A ` B (ex:A)
; :B ` A
(a) Exchange macro rule.</p>
      <p>A ` A
(ax)</p>
      <p>; :B ` A
(b) De nition of the exchange rule.</p>
      <p>:B ` :B</p>
      <p>(ax)
; :B; :A ` ? (?:e)
; :B; :A ` A</p>
      <p>(em)
; :A ` B
(::e)</p>
      <p>The translation function Tr takes two arguments. The rst argument is an
LK proof with conclusion ` . The second argument is either an arbitrary
formula in the succedent , say A, or if the succedent is empty and the
argument is to be ignored. We call A the focused formula. Tr then produces an
ND proof of the corresponding sequent, where the focused formula is the single
formula in the succedent of the ND proof's conclusion:</p>
      <p>If
`
with A 2</p>
      <p>, then
and if</p>
      <p>, then
` ` ?
We de ne Tr inductively on the structure of the proof. We perform a case
distinction on the last rule of the LK proof and on which formula is focused.
Before presenting the case analysis, we revisit our example and demonstrate Tr
by applying it to the proof of double-negation elimination in Figure 4.
Inductive de nition of the translation
Axioms: The axioms form the base cases:</p>
      <p>Tr (</p>
      <p>A ` A (ax) ; A) d=ef
Tr (
` t = t (re ) ; t = t) d=ef</p>
      <p>A ` A (ax) ;
` t = t (=:i) ;</p>
      <p>Tr (
Tr (
` &gt;
? `
(&gt;) ; &gt;) d=ef
(?) ; ) d=ef
` &gt;
? ` ?
(&gt;)</p>
      <p>(ax)</p>
      <p>Tr( ; A)
; :(</p>
      <p>fAg) ` A
Tr( ; )
:
Tr
Tr</p>
      <p>(a)
A ` A (ax)
` A; :A (::r) ; A
::A ` A
` ::A ) A ():i)</p>
      <p>(c)
A ` A (ax) ; A</p>
      <p>A ` A</p>
      <p>:A ` :A ((a:x:e))
:A; A ` ? (::i)
:::AA``:AA (ex)
` ::A ) A ():i)
(e)
Tr</p>
      <p>A ` A (ax) 1
` A; :A (::r) ; AA</p>
      <p>(::l)
::A ` A
::A ` A
` ::A ) A ():i)</p>
      <p>(b)
A ` A (ax)
` A; :A (::r) ; :A
:::AA``:AA (ex)
` ::A ) A ():i)</p>
      <p>(d)
Exchange: For a right-inference rule ( :r) with 2 fc; _; ); :; 8; 9; =g, if the
focused formula B is not the main formula A0, we rst derive A0 by changing
the focus to A0 and add an exchange inference as follows:</p>
      <p>Tr
` ; A; B
0 ` ; A0; B
( :r) ; B
` ; A; B
0 ` ; A0; B
0; : ; :B ` A0
0; : ; :A0 ` B
( :r) ; A0
(ex)</p>
      <p>!
!
def
=</p>
      <p>Tr
We treat the binary rule (^:r) similarly. Let's consider the case where an
arbitrary formula C, i.e., not the main formula A^B, coming from the right subproof
r, is focused (symmetric if C comes from</p>
      <p>Tr</p>
      <p>l r
` ; A ` ; B; C (^:r) ; C
; ` ; ; A ^ B; C
!
l):
def
=</p>
      <p>l r 1
` ; A ` ; B; C (^:r) ; A ^ BA
; ` ; ; A ^ B; C
; ; : ; : ; :C ` A ^ B
; ; : ; : ; :(A ^ B) ` C (ex)
We want to point out that the use of (ex) is often not necessary, even if the
succedent contains multiple formulas|namely when the main formula is already
in focus.</p>
      <p>We now present the derivations for left-inferences with arbitrary formulas in
focus, and right-inferences with the main formula in focus4. Tr maintains the
focused formula between recursive calls and does not unnecessarily change the
focus. When we have to make a choice, we pick the rst formula in the succedent
if it is non-empty, otherwise we set the focus to . There is a choice when
translating (w:r) (when the weakening formula is in focus) and when translating
(_:r). We omit cases where the succedent is empty and the focus is to be ignored
if it does not a ect the structure of the translated proof.</p>
      <p>Structural rules: The structural rules are translated as follows:</p>
      <p>Tr
Tr</p>
      <p>Tr
Tr</p>
      <p>Tr</p>
      <p>A; ` ; B (w:l) ; B</p>
      <p>` ; B
` ; A; B (w:r) ; B
` ; A
` ; A; B (w:r) ; A
` ; A
A; A; ` ; B (c:l) ; B
A; ` ; B
` ; B; B (c:r) ; B
` ; B
!
!
!
!
!
def
=
def
=
def
=
def
=
def
=</p>
      <p>Tr( ; B)
; : ` B
A; ; : ` B (w)</p>
      <p>Tr( ; A)
; : ` A
:A; ; : `` BA ((ewx))
:B; ; :</p>
      <p>Tr( ; A)
; : ` A
:B; ; : ` A (w)</p>
      <p>Tr( ; B)
A; A; ; : ` B (c)
A; ; : ` B
B ` B (ax)</p>
      <p>Tr( ; B)
:B; ; : ` B (em)
; : ` B
Cut: The cut rule is translated as follows. The focus should be on a formula
from the right side of the cut. If the focus is instead on a formula D 2 from
4 The (w:r)-rule is a special case for which we also show the case where an arbitrary
formula is in focus.
the left side of the cut, we add an exchange inference (ex:D) after ():e).</p>
      <p>Tr</p>
      <p>l r
` ; A A; ` ; B (cut) ; B
; ` ; ; B
!</p>
      <p>Tr( r; B)
d=ef Tr( l; A) A; ; : ` B
; : ` A ; : ` A ) B (())::ie))
; ; : ; : ` B
Propositional rules: Next, we present the translation of the propositional rules,
starting with negation. If B is absent in the translation of the (::r)-rule (resulting
in A; ; : ` ? being the conclusion of the translation of ) we can omit the
(ax) and (::e) inferences.</p>
      <p>Tr
Tr</p>
      <p>Tr</p>
      <p>` A (::l) ;
:A; `
:A; ` ; B (::l) ; B</p>
      <p>` ; A; B
` ; :A; B (::r) ; :A
A; ` ; B
!
!
!
def
=
def
=
:A ` :A (ax)</p>
      <p>:A; ` ?</p>
      <p>Tr( ; B)
:A; ; : ` B</p>
      <p>The disjunction rules are handled next. If D is absent in the translation of
the (_:l)-rule (resulting in B; ; : ` ? being the conclusion of the translation
of r) we can omit the (ax) and (::e) inferences in the right branch of the
derivation. The case where the focus is on D instead of C is symmetric.
Tr</p>
      <p>l r
A; ` ; C B; ` ; D (_:l) ; C</p>
      <p>A _ B; ; ` ; ; C; D
!
def
=
:D ` :D ((a:x:e))
` ; A _ B (_:r) ; A _ B
` ; A; B
!</p>
      <p>The implication rules are translated as follows. The translation of ():l) works
similar to the translation of the cut rule: the focus should be on a formula from
the right subproof. If the focus is on a formula D 2 instead, we add an
exchange inference (ex:D) after the bottom-most ():e).</p>
      <p>l r
` ; A B; ` ; C ():l) ; C
A ) B; ; ` ; ; C
!
def
=</p>
      <p>Tr( l; A)
Tr
Tr
Tr
Tr
Tr
Tr
Tr</p>
      <p>A[t=x]; ` ; B (8:l) ; B
8xA; ` ; B
` ; A[y=x] (8:r) ; 8xA
` ; 8xA
A[y=x]; ` ; B (9:l) ; B
9xA; ` ; B
` ; A[t=x] (9:r) ; 9xA
` ; 9xA
!
!
!
!
def
=
def
=
def
=
def
=</p>
      <p>Tr( ; B)
A[t=x]; ; : ` B
; : ` A[t=x] ) B ():i)</p>
      <p>8xA; ; : ` B
Tr( ; A[y=x])
; : ` A[y=x]
; : ` 8xA</p>
      <p>(8:i)
9xA ` 9xA (ax)</p>
      <p>Tr( ; B)</p>
      <p>A[y=x]; ; : ` B
9xA; ; : ` B
Tr( ; A[t=x])
; : ` A[t=x]
; : ` 9xA (9:i)
8xA ` 8xA (ax)
8xA ` A[t=x] (8:e)</p>
      <p>():e)
(9:e)
Equational rules: The equational rules are translated as follows:
A ) B ` A ) B (ax)</p>
      <p>; : ` A ():e)
A ) B; ; : ` B</p>
      <p>A ) B; ; ; : ; : ` C</p>
      <p>Tr( r; C)
B; ; : ` C
; : ` B ) C (())::ie))
!
def
=
Tr
` ; A ) B ():r) ; A ) B
A; ` ; B
!
def
=</p>
      <p>Tr( ; B)
A; ; : ` B
; : ` A ) B ():i)
Quanti er rules: The quanti er rules are handled as follows:
s = t; A[T =s]; ` ; B (=:l) ; B
s = t; A[T =t]; ` ; B</p>
      <p>(ax) s = t ` s = t
A[T =t] ` A[T =t] s = t ` t = s
s = t; A[T =t] ` A[T =s]
(ax)</p>
      <p>(=:i)
` s = s (=:e)
(=:e)</p>
      <p>Tr( ; B)
ss==t;t; A; :[T =s`]; A[;T:=s] `)BB ():i)
s = t; s = t; A[T =t]; ; : ` B ():e)</p>
      <p>s = t; A[T =t]; ; : ` B (c)
Tr
s = t; ` ; A[T =s] (=:r) ; A[T =t]
s = t; ` ; A[T =t]
!
Induction rule: The induction rule is translated as</p>
      <p>Tr
1 2 n
S1 S2 : : : Sn
1; : : : ; n ` 1; : : : ; n; F [t]
(ind) ; F [t]
!
def
=
Tr( 1; F1)</p>
      <p>0
S1</p>
      <p>Tr( 2; F2)</p>
      <p>S20 : : :
1; : : : ; n; : 1; : : : ; : n ` F [t]</p>
      <p>Tr( n; Fn)</p>
      <p>Sn0 (ind)
with</p>
      <p>Si d=ef F [x1]; : : : F [xki ]; i; `</p>
      <p>i; F [ci(x1; : : : ; xki )];
Si0 d=ef F [x1]; : : : F [xki ]; i; : i ` F [ci(x1; : : : ; xki )]; and</p>
      <p>Fi d=ef F [ci(x1; : : : ; xki )]:
Lemma 1. Tr terminates and is linear in the size of the LK proof.
Proof. Tr either recurses and operates on a subproof with one less inference, or
it recurses and changes the focused formula once and then operates on a smaller
subproof. Hence Tr terminates. Each translation step is constant, hence Tr is
linear in the size of the LK proof.</p>
      <p>Optimizations: The translation of (_:r) seems inherently classical because the
premise of the rule contains multiple formulas in the succedent. However, note
that we can obtain an intuitionistic translation if the rule is preceded by a (w:r)
inference, where the weakening adds one of the disjuncts. We make use of the
following optimization, if the weakening immediately precedes the disjunction
rule (symmetric if weakening with A instead of B):</p>
      <p>Tr
` ; A
` ; A; B (w) ; A _ B
` ; A _ B (_:r)
!
def
=</p>
      <p>Tr( ; A)
; : ` A
; : ` A _ B (_:i1)</p>
      <p>Let us revisit the example in Figure 4: Notice that in the intermediate step
in Figure 4d, the proof could be completed by inferring :A ` :A via (ax).
The nave translation, as we presented it, instead continues and introduces an
indirection into the ND proof. We make use of an optimization that catches such
cases and stops the translation early by closing the proof with (ax): We check
if the conclusion of the input proof is a sequent of the form ` A; :A with focus
:A. If this is the case we simply return :A ` :A (ax) . The example proof when
using the optimization is then translated as</p>
      <p>:::AA``:AA ((eaxx))
` ::A ) A ():i)
which, after inlining the (ex) macro rule, is equivalent to the one presented in
Section 2.</p>
      <p>
        Translating constructive proofs: We want to point out that constructive LK
proofs are translated into constructive ND proofs|where constructive proofs
are proofs in intuitionistic logic. The constructive subset of LK that we
consider is essentially Gentzen's calculus LJ. The only di erence is the (_:r)-rule,
which in our calculus always has two auxiliary formulas in the succedent, and
hence requires special treatment. Other constructive subsets of LK, for example
multi-succedent calculi such as Maehara's L'J [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], are not always translated into
constructive ND proofs.
      </p>
      <p>De nition 1. An LK proof is constructive if every sequent in the proof contains
only a single formula in the succedent. The (_:r)-rule is an exception, which we
consider to be constructive if it is immediately preceded by a weakening with one
of the disjuncts.</p>
      <p>De nition 2. An ND proof is constructive if it does not contain an (em)
inference.</p>
      <p>Lemma 2. Tr translates constructive sequent calculus proofs into constructive
natural deduction proofs.</p>
      <p>Proof. We analyze the cases which lead to introduction of an (ex) or (em)
inference and show that they cannot occur: (i) The (c:r)-rule does not occur in
a constructive proof. (ii) The (w:r) and (_:r) rules only occur together in
constructive proofs and the optimization we described takes care of them. (iii) In
():l) and (cut), must be empty as we are dealing with single-succedent proofs,
therefore the case where D 2 is the focus cannot occur. (iv) Finally, the focus
never needs to be changed because we are dealing with single-succedent proofs.
4
4.1</p>
    </sec>
    <sec id="sec-4">
      <title>Experimental evaluation</title>
      <p>
        Implementation and proof import
The translation described in Section 3 is implemented in our open source5 library
for proof transformations, GAPT [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] version 2.10. Since our ultimate goal is
to extract programs from proofs generated by automated theorem provers, we
evaluated the translation on such automatically generated proofs. GAPT can
5 available at https://logic.at/gapt
interface with more than half a dozen classical rst-order provers, including
state-of-the art tools such as Vampire, E, and SPASS.
      </p>
      <p>
        The resulting proofs are imported in a multi-step process. Proof output from
the external provers is parsed and reconstructed using proof replay to obtain
resolution proofs. As the next step, we convert the resolution proofs to expansion
proofs [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], which store only the quanti er instances of the proof (as used in the
(9:r), (8:l), (9:i), and (8:e) inferences) and ignore the propositional parts of the
proof. This conversion [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] also eliminates inferences used for splitting as used by
Avatar in Vampire [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] or in SPASS [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] and subformula de nitions introduced
by our clausi cation.
      </p>
      <p>We use expansion proofs as an intermediate step for two reasons: rst, they
\clean up" the proofs considerably. Proofs produced by rst-order provers
primarily record the proof search, and are not intended to be short, beautiful, or
even constructive. Proof replay then adds additional complexity, in particular
the reconstruction of a single equational inference in the prover output often
produces several inferences in GAPT. All of this super uous complexity is
completely ignored when passing to expansion proofs.</p>
      <p>
        More importantly however, classical rst-order provers typically use
Skolemization as a preprocessing step. The freshly introduced Skolem functions are then
treated like any other function, and also equational inferences can rewrite the
arguments of the Skolem functions. In intuitionistic logic, Skolemization does not
always produce equivalid formulas: for example, the intuitionistic non-theorem
(:8x P (x)) ! 9x :P (x) is turned into the theorem (:P (c)) ! 9x :P (x) via
Skolemization. Given that we want to minimize the amount of non-constructive
reasoning, it is therefore of paramount importance to forgo Skolemization in this
sense. (It would of course also be possible to impose restrictions on the use of
Skolem terms so that they behave essentially like eigenvariables. However these
restrictions are typically not respected by the proofs produced by classical
rstorder provers. Hence either approach requires a transformation ensuring that
these restrictions are respected.) Expansion proofs allow us to straightforwardly
eliminate Skolem functions from rst-order proofs using a replacement
operation on the instance terms [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. This deskolemization procedure can theoretically
fail on proofs that use equational inferences to rewrite the arguments of Skolem
functions. As we will show in this section, this happens only rarely in practice.
We are currently investigating a preprocessing step to eliminate congruences for
Skolem functions that will extend this proof deskolemization to all proofs with
equational inferences.
      </p>
      <p>
        The expansion proofs are then converted to proofs in the sequent calculus LK
via a simple tableaux prover that reproduces the propositional parts of the proof
missing from the expansion proof. This proof import method described up to now
is not speci c to the translation to natural deduction described in this paper,
but is in parts independently used by many other applications implemented and
evaluated in GAPT, such as cut-introduction [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], inductive theorem proving [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ],
cut-elimination by resolution [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], and others.
      </p>
      <p>For our translation to natural deduction, we modify the conversion from
expansion proofs to proofs in LK slightly using a simple heuristic: usually we
want to apply the (::l)-rule as soon as possible (that is, close to the bottom)
since it is an invertible unary inference rule that simpli es the sequent. However,
it is not invertible intuitionistically|the premise may be unprovable even though
the conclusion would be an intuitionistic theorem. We hence try the (::l)-rule
last.
4.2</p>
      <p>
        Large-scale tests
For the empirical evaluation of our translation, we took the 662 problems in the
rst-order FEQ, FNE, FNN, and FNQ divisions of the CASC-26 competition whose
size was less than one megabyte after including the separate axiom les. On these
662 problems, we used the translation on proofs imported from the E theorem
prover6 [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ] version 2.1 (as submitted to CASC).
      </p>
      <p>We set a total time limit of 5 minutes for each of these problems, and 2
minutes for the rst-order prover. Of the 662 problems, GAPT fails to clausify 15 of
the problems due to excessive runtime. (These problems|e.g. HWV053+1|have
blocks of more than a thousand quanti ers.) On the remaining 647 problems, E
successfully returns 291 proofs. Using proof replay, GAPT reconstructs 285
resolution proofs, from there we get 283 expansion proofs, and then 261 proofs in LK.
The translation to natural deduction nally results in 261 proofs. (These proofs
do not contain induction inferences since E is a rst-order theorem prover.)</p>
      <p>From a performance point of view, the runtime of the translation in Section 3
is negligible compared to the rest of the proof import. Figure 5 shows the
relative runtime of the di erent proof import phases described in Section 4.1. The
translation to natural deduction only makes up 0.65% of the total proof import
time, making it practically feasible to obtain natural deduction proofs whenever
necessary.</p>
      <p>Parser CNF E replay ! exp. deskolem. ! LK ! ND
2.95% 3.58% 50.49% 12.50% 4.28% 7.89% 17.66% 0.65%</p>
      <p>One of the main goals of the translation is to minimize the amount of
nonconstructive reasoning in the produced proofs, that is, the number of the
inferences for excluded middle as well as the complexity of their auxiliary formulas.
Of the 261 natural deduction proofs produced, 154 (59%) do not contain any
use of the excluded middle, and 224 (85%) do not contain quanti ed excluded
middle, i.e., excluded middle on a formula that contains quanti ers. For
applications in program extraction, excluded middle on quanti er-free formulas is
6 We picked the highest-ranking prover in the rst-order theorem category of the
CASC-26 competition whose license allows competitive evaluation.
typically not a problem since quanti er-free formulas are often decidable. Hence,
it is important to consider the number of quanti ed excluded middle inferences.
Figure 6 shows the average number of inferences for excluded middle grouped
by the TPTP category of the problem. The problems in most categories require
little use of the excluded middle (em), except for SYO, which contains syntactic
problems that have no obvious semantic interpretation.</p>
      <p>500
400
300
n
a
e
m200
100
0
# excluded middle
# quantified excluded middle
3
6
4
8
3
1
4
6</p>
      <p>
        We can also interpret the quantitative results on excluded middle inferences
from the point of view of proof constructivization. If there are no uses of excluded
middle in the produced proof, then we have successfully converted an a priori
classical proof into an intuitionistic proof. Automated conversion of proofs
produced by classical rst-order theorem provers into intuitionistic logic has been
studied before using the Dedukti system and the Zenon prover: using a rewriting
system on natural deduction proofs [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], the authors obtain a constructivization
rate of 61.8% on proofs produced by Zenon. Another approach converts sequent
calculus proofs in LK to the intuitionistic sequent calculus LJ [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] using a
focusing strategy similar to ours. They report a constructivization rate of 85%,
again on proofs produced by Zenon. We believe that we observe a lower
constructivization here due to the choice of the classical prover and the resulting
di erent problem selection. The produced proofs are likely to di er signi cantly,
since Zenon is a tableaux prover, and E is a superposition prover. Additionally,
E can prove many more problems and nd more complicated proofs, which may
be harder to constructivize.
      </p>
      <p>
        A similar observation on the constructivity of classical proofs has been made
with the intuitionistic rst-order theorem prover ileanCoP [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. This prover rst
searches for a classical connection proof and then checks whether this proof is
intuitionistic, backtracking otherwise to guarantee completeness. In the
evaluation on TPTP problems ileanCoP found 188 proofs, of which 178 (94.6%) have
been proved without backtracking, which means that the original classical proof
was already intuitionistic modulo reordering of inferences.
      </p>
      <p>Our proof deskolemization approach can fail if there are equational inferences
that rewrite the arguments of a Skolem function. This only happens three times
in the 283 expansion proofs considered here. The corresponding TPTP problems
are GEO084+1, NUM855+2, and PRO004+1. It is not easy to pinpoint the failure
to a single responsible inference in the proof output, since the input of the
deskolemization algorithm is far away from the resolution proof and we only
know that the deskolemized deep formula is not a tautology modulo equality.</p>
      <p>In Section 3, we introduced a special case for (_:r) inferences that are directly
following a (w:r) inference. Among the 802 (_:r) inferences in total, 349 (43.5%)
directly follow a (w:r) inference, making this a worthwhile optimization. On
average, the produced proofs in natural deduction contain 2.9 times as many
inferences as the proofs in LK.
5</p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>We have presented a simple translation of the sequent calculus LK to natural
deduction. It is e cient and its cost is negligible compared to other processing
steps. The produced proofs have few excluded middle inferences, and a large part
of them are quanti er-free. A disadvantage of this translation is that it does not
produce normal proofs in natural deduction. In particular the left-inferences in
LK introduce redexes. We plan to address this issue by either normalizing the
proofs in natural deduction, or simplifying the extracted programs.</p>
      <p>As the next step we want to use the proofs generated by this translation in
program extraction, and program synthesis using proofs generated by automated
theorem provers.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Federico</given-names>
            <surname>Aschieri</surname>
          </string-name>
          and
          <string-name>
            <given-names>Margherita</given-names>
            <surname>Zorzi</surname>
          </string-name>
          .
          <article-title>On natural deduction in classical rstorder logic: Curry-Howard correspondence, strong normalization and Herbrand's theorem</article-title>
          .
          <source>Theoretical Computer Science</source>
          ,
          <volume>625</volume>
          :
          <fpage>125</fpage>
          {
          <fpage>146</fpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Matthias</given-names>
            <surname>Baaz</surname>
          </string-name>
          , Stefan Hetzl, and
          <string-name>
            <given-names>Daniel</given-names>
            <surname>Weller</surname>
          </string-name>
          .
          <article-title>On the complexity of proof deskolemization</article-title>
          .
          <source>Journal of Symbolic Logic</source>
          ,
          <volume>77</volume>
          (
          <issue>2</issue>
          ):
          <volume>669</volume>
          {
          <fpage>686</fpage>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Matthias</given-names>
            <surname>Baaz</surname>
          </string-name>
          and
          <string-name>
            <given-names>Alexander</given-names>
            <surname>Leitsch</surname>
          </string-name>
          .
          <article-title>Cut-elimination and redundancyelimination by resolution</article-title>
          .
          <source>Journal of Symbolic Computation</source>
          ,
          <volume>29</volume>
          (
          <issue>2</issue>
          ):
          <volume>149</volume>
          {
          <fpage>177</fpage>
          ,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Rapha</surname>
          </string-name>
          <article-title>el Cauderlier. A rewrite system for proof constructivization</article-title>
          . In Gilles Dowek, Daniel R. Licata, and Sandra Alves, editors,
          <source>Eleventh Workshop on Logical Frameworks and Meta-Languages: Theory and Practice</source>
          , LFMTP, pages
          <article-title>2:1{2:7</article-title>
          . ACM,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Sebastian</given-names>
            <surname>Eberhard</surname>
          </string-name>
          and
          <string-name>
            <given-names>Stefan</given-names>
            <surname>Hetzl</surname>
          </string-name>
          .
          <article-title>Inductive theorem proving based on tree grammars</article-title>
          .
          <source>Annals of Pure and Applied Logic</source>
          ,
          <volume>166</volume>
          (
          <issue>6</issue>
          ):
          <volume>665</volume>
          {
          <fpage>700</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>Gabriel</given-names>
            <surname>Ebner</surname>
          </string-name>
          .
          <article-title>Extracting expansion trees from resolution proofs with splitting</article-title>
          and de nitions.
          <year>2018</year>
          . Preprint available at https://gebner.org/pdfs/2018-01-29_ etimport.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Gabriel</given-names>
            <surname>Ebner</surname>
          </string-name>
          , Stefan Hetzl, Alexander Leitsch, Giselle Reis, and
          <string-name>
            <given-names>Daniel</given-names>
            <surname>Weller</surname>
          </string-name>
          .
          <article-title>On the generation of quanti ed lemmas</article-title>
          .
          <source>Journal of Automated Reasoning</source>
          , pages
          <volume>1</volume>
          {
          <fpage>32</fpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>Gabriel</given-names>
            <surname>Ebner</surname>
          </string-name>
          , Stefan Hetzl, Giselle Reis, Martin Riener, Simon Wolfsteiner, and
          <string-name>
            <given-names>Sebastian</given-names>
            <surname>Zivota</surname>
          </string-name>
          .
          <article-title>System description: GAPT 2.0</article-title>
          . In Nicola Olivetti and Ashish Tiwari, editors,
          <source>International Joint Conference on Automated Reasoning (IJCAR)</source>
          , volume
          <volume>9706</volume>
          of Lecture Notes in Computer Science, pages
          <volume>293</volume>
          {
          <fpage>301</fpage>
          . Springer,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>Gerhard</given-names>
            <surname>Gentzen</surname>
          </string-name>
          .
          <article-title>Untersuchungen uber das logische Schlie en</article-title>
          .
          <source>II. Mathematische Zeitschrift</source>
          ,
          <volume>39</volume>
          (
          <issue>1</issue>
          ):
          <volume>405</volume>
          {
          <fpage>431</fpage>
          ,
          <year>1935</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <given-names>Frederic</given-names>
            <surname>Gilbert</surname>
          </string-name>
          .
          <source>Automated constructivization of proofs. In Javier Esparza and Andrzej S</source>
          . Murawski, editors,
          <source>Foundations of Software Science and Computation Structures, FOSSACS</source>
          , volume
          <volume>10203</volume>
          of Lecture Notes in Computer Science, pages
          <volume>480</volume>
          {
          <fpage>495</fpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <given-names>Georg</given-names>
            <surname>Kreisel</surname>
          </string-name>
          .
          <article-title>Interpretation of analysis by means of constructive functionals of nite types</article-title>
          . In Arend Heyting, editor,
          <source>Constructivity in Mathematics</source>
          , pages
          <volume>101</volume>
          {
          <fpage>128</fpage>
          . Amsterdam: North-Holland Publishing Company,
          <year>1959</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Sho</surname>
          </string-name>
          <article-title>^ji Maehara. Eine Darstellung der intuitionistischen Logik in der Klassischen</article-title>
          .
          <source>Nagoya Mathematical Journal</source>
          ,
          <volume>7</volume>
          :
          <fpage>45</fpage>
          {
          <fpage>64</fpage>
          ,
          <year>1954</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Dale</surname>
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Miller</surname>
          </string-name>
          .
          <article-title>A compact representation of proofs</article-title>
          .
          <source>Studia Logica</source>
          ,
          <volume>46</volume>
          (
          <issue>4</issue>
          ):
          <volume>347</volume>
          {
          <fpage>370</fpage>
          ,
          <year>1987</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <given-names>Jens</given-names>
            <surname>Otten</surname>
          </string-name>
          .
          <article-title>Clausal connection-based theorem proving in intuitionistic rst-order logic</article-title>
          . In Bernhard Beckert, editor,
          <source>Automated Reasoning with Analytic Tableaux and Related Methods</source>
          , TABLEAUX, volume
          <volume>3702</volume>
          of Lecture Notes in Computer Science, pages
          <volume>245</volume>
          {
          <fpage>261</fpage>
          . Springer,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <given-names>Michel</given-names>
            <surname>Parigot</surname>
          </string-name>
          .
          <article-title>-calculus: An algorithmic interpretation of classical natural deduction</article-title>
          . In Andrei Voronkov, editor,
          <source>Logic for Programming</source>
          ,
          <source>Arti cial Intelligence and Reasoning (LPAR)</source>
          , volume
          <volume>624</volume>
          of Lecture Notes in Computer Science, pages
          <volume>190</volume>
          {
          <fpage>201</fpage>
          . Springer,
          <year>1992</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <given-names>Stephan</given-names>
            <surname>Schulz</surname>
          </string-name>
          .
          <source>System Description: E 1</source>
          .8. In Ken McMillan,
          <string-name>
            <given-names>Aart</given-names>
            <surname>Middeldorp</surname>
          </string-name>
          , and Andrei Voronkov, editors,
          <source>19th International Conference on Logic for Programming</source>
          ,
          <source>Arti cial Intelligence, and Reasoning (LPAR)</source>
          , volume
          <volume>8312</volume>
          <source>of LNCS</source>
          . Springer,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Anne</surname>
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Troelstra</surname>
            and
            <given-names>Helmut</given-names>
          </string-name>
          <string-name>
            <surname>Schwichtenberg</surname>
          </string-name>
          .
          <source>Basic Proof Theory</source>
          . Cambridge Tracts in Theoretical Computer Science. Cambridge University Press,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <given-names>Andrei</given-names>
            <surname>Voronkov</surname>
          </string-name>
          .
          <article-title>AVATAR: the architecture for rst-order theorem provers</article-title>
          .
          <source>In Armin Biere and Roderick Bloem</source>
          , editors, 26th International Conference on Computer Aided Veri cation,
          <source>CAV</source>
          <year>2014</year>
          , volume
          <volume>8559</volume>
          of Lecture Notes in Computer Science, pages
          <volume>696</volume>
          {
          <fpage>710</fpage>
          . Springer,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>Christoph</surname>
            <given-names>Weidenbach</given-names>
          </string-name>
          , Dilyana Dimova, Arnaud Fietzke, Rohit Kumar,
          <string-name>
            <given-names>Martin</given-names>
            <surname>Suda</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Patrick</given-names>
            <surname>Wischnewski</surname>
          </string-name>
          .
          <source>SPASS version 3</source>
          .5. In Renate A. Schmidt, editor,
          <source>22nd International Conference on Automated Deduction (CADE)</source>
          , volume
          <volume>5663</volume>
          of Lecture Notes in Computer Science, pages
          <volume>140</volume>
          {
          <fpage>145</fpage>
          . Springer,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <given-names>J.</given-names>
            <surname>Zucker</surname>
          </string-name>
          .
          <article-title>The correspondence between cut-elimination and normalization</article-title>
          .
          <source>Annals of Mathematical Logic</source>
          ,
          <volume>7</volume>
          (
          <issue>1</issue>
          ):1{
          <fpage>112</fpage>
          ,
          <year>1974</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>