<!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>Shaving with Occam's Razor: Deriving Minimalist Theorem Provers for Minimal Logic</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Paul Tarau</string-name>
          <email>paul.tarau@unt.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computer Science and Engineering University of North Texas</institution>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>We derive a sequence of minimalist theorem provers for the implicational fragment of intuitionistic logic. Starting from Roy Dyckhoff's sound and complete LJT calculus we apply declarative program transformations steps, while highlighting connections, via the Curry-Howard isomorphism to type inference mechanisms for the simply typed lambda calculus. We follow a test-driven development process with testing on formulas known to be tautologies that are inferred as types of lambda terms, as well as as by using exhaustive and random formula generators. We chose Prolog as our meta-language. Being derived from essentially the same formalisms as those we are covering reduces the semantic gap and results in surprisingly concise and efficient declarative implementations. Our code is available at: https://github.com/ptarau/TypesAndProofs.</p>
      </abstract>
      <kwd-group>
        <kwd>Curry-Howard isomorphism</kwd>
        <kwd>propositional implicational intuitionistic logic</kwd>
        <kwd>type inference and type inhabitation</kwd>
        <kwd>simply typed lambda terms</kwd>
        <kwd>theorem proving</kwd>
        <kwd>declarative algorithms</kwd>
        <kwd>logic programming</kwd>
        <kwd>combinatorial search algorithms</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>The implicational fragment of propositional intuitionistic logic can be defined by two
axiom schemes:
K : A ! (B ! A)
S : (A ! (B ! C)) ! ((A ! B) ! (A ! C))
and the modus ponens inference rule:
MP : A; A ! B ` B.</p>
      <p>
        In its simplest form, the Curry-Howard isomorphism [
        <xref ref-type="bibr" rid="ref1 ref2">1, 2</xref>
        ] connects the
implicational fragment of propositional intuitionistic logic (called here minimal logic) and
types in the simply typed lambda calculus. A low polynomial type inference algorithm
associates a type (when it exists) to a lambda term. Harder (PSPACE-complete, see [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ])
algorithms associate inhabitants to a given type expression with the resulting lambda
term (typically in normal form) serving as a witness for the existence of a proof for
the corresponding tautology in minimal logic. As a consequence, a theorem prover for
minimal logic can also be seen as a tool for program synthesis, as implemented by code
extraction algorithms in proof assistants like Coq [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>Besides the syntactically identical axioms for the combinators S and K and the
axioms of the logic, an intuitive reason for this isomorphism between types and formulas
is that one can see propositions as sets of proofs on which functions, corresponding to
implications A ! B act as transformers of proofs of A into proofs of B.</p>
      <p>
        Our interest in theorem provers for this minimalist logic fragment has been triggered
by its relation, via the Curry-Howard isomorphism, to the inverse problem
corresponding to inferring types for lambda terms, type inhabitation, with direct applications to
the generation of simply typed lambda terms that meet a given specification, more
efficiently than trying out all possible terms of increasing sizes for a match [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>
        At the same time, generating large lambda terms can help test correctness and
scalability of compilers for functional languages [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ] and proof assistants. But this is
becoming increasingly difficult with size, as the asymptotic density of typable terms in
the set of closed lambda terms has been shown to converge to 0 [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. As a consequence,
even our best generators [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] based on Boltzmann samplers are limited to lambda terms
in normal form of about size 60-70, given the very large number of retries needed to
filter out untypable terms.
      </p>
      <p>
        As SAT-problems are solvable quite efficiently in practice, despite being NP-complete,
one might want to see if this extends to the typical PSPACE-complete problem of
finding proofs for intuitionistic propositional calculus formulas. If so, an alternate method
would emerge for finding types and inhabitants of comparable sizes as those obtained
from Boltzmann samplers [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
      </p>
      <p>Given the possibly subtle semantic variations between our provers, we have also
focused on setting up an extensive combinatorial and random testing framework to ensure
correctness, as well as to evaluate their scalability and performance.</p>
      <p>The paper is organized as follows. Section 2 overviews sequent calculi for
implicational propositional intuitionistic logic. Section 3 describes a direct encoding of the
LJT calculus as a Prolog program. Section 4 describes successive derivation steps
leading to simpler and/or faster programs, including nested Horn clause representations and
adaptations to support classical logic via Glivenko’s double-negation translation.
Section 5 describes our testing framework and section 6 provides performance evaluation.
Section 7 overviews related work and section 8 concludes the paper.
2</p>
      <p>
        Proof systems for implicational intuitionistic propositional logic
Initially, like for other fields of mathematics and logic, Hilbert-style axioms were
considered for intuitionistic logic. While simple and directly mapped to SKI-combinators
via the Curry-Howard isomorphism, their usability for automation is very limited. In
fact, their inadequacy for formalizing even ”hand-written” mathematics was the main
trigger of Gentzen’s work on natural deduction and sequent calculus, inspired by the
need for formal reasoning in the foundation of mathematics [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>Thus we start with Gentzen’s own calculus for intuitionistic logic, simplified here to
only cover the purely implicational fragment, given that our focus is on theorem provers
working on formulas that correspond to types of simply-typed lambda terms.
2.1</p>
      <p>
        Gentzen’s LJ calculus, restricted to the implicational fragment of
propositional intuitionistic logic
We assume familiarity with basic sequent calculus [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] notation. Gentzen’s original LJ
calculus [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] (with the equivalent notation of [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]) uses the following rules.
      </p>
      <p>As one can easily see, when trying a goal-driven implementation that uses the rules
in upward direction, the unchanged premises on left side of rule LJ3 would not
ensure termination as nothing prevents A and G from repeatedly trading places during the
inference process.
2.2</p>
      <p>
        Dyckhoff’s LJT calculus, restricted to the implicational fragment of
propositional intuitionistic logic
Motivated by problems related to loop avoidance in implementing Gentzen’s LJ
calculus, Roy Dyckhoff [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] splits rule LJ3 into LJT3 and LJT4.
      </p>
      <p>A;G ` A
A;G ` B
G ` A!B
A!B;G ` A B;G ` G</p>
      <p>A!B;G ` G
A;G ` A
A;G ` B
G ` A!B</p>
      <p>B;A;G ` G
A!B;A;G ` G
D!B;G ` C!D B;G !G</p>
      <p>(C!D)!B;G ` G
LJ1 :
LJ2 :
LJ3 :
LJT1 :
LJT2 :
LJT3 :
LJT4 :</p>
      <p>
        This avoids the need for loop checking to ensure termination. The rules work with
the context G being a multiset, but it has been shown later [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] that G can be a set, with
duplication in contexts eliminated.
      </p>
      <p>For supporting negation, one also needs to add LJT5 that deals with the special term
f alse. Then negation of A is defined as A ! f alse.</p>
      <p>LJT5 :</p>
      <p>f alse;G ` G</p>
      <p>
        Interestingly, as it is not unusual with logic formalisms, the same calculus has been
discovered independently in the 50’s by Vorob’ev and in the 80’s by Hudelmaier [
        <xref ref-type="bibr" rid="ref13 ref14">13,
14</xref>
        ].
3 An executable specification: Dyckhoff’s LJT calculus, literally
Roy Dyckhoff has implemented the LJT calculus as a Prolog program. We have ported
it to SWI-Prolog as a reference implementation (see https://github.com/ptarau/
TypesAndProofs/blob/master/third_party/dyckhoff_orig.pro). However, it is a fairly
large (420 lines) program, partly because it covers the full set of intuitionistic
connectives and partly because of the complex heuristics that it implements.
      </p>
      <p>This brings up the question if, in the tradition of ”lean theorem provers”, we can
build one directly from the LJT calculus, in a goal oriented style, by reading the rules
from conclusions to premises.</p>
      <p>Thus, we start with a simple, almost literal translation of rules LJT1 : : : LJT4 to
Prolog with values in the environment G denoted by the variable Vs.
lprove(T):-ljt(T,[]),!.
ljt(A,Vs):-memberchk(A,Vs),!.
ljt((A-&gt;B),Vs):-!,ljt(B,[A|Vs]).
ljt(G,Vs1):-atomic(G),
select((A-&gt;B),Vs1,Vs2),
atomic(A),
memberchk(A,Vs2),
!,
ljt(G,[B|Vs2]).
ljt(G,Vs1):select( ((C-&gt;D)-&gt;B),Vs1,Vs2),
ljt((C-&gt;D), [(D-&gt;B)|Vs2]),
!,
ljt(G,[B|Vs2]).</p>
      <p>% LJT_1
% LJT_2
% LJT_3
% LJT_4</p>
      <p>
        Note the use of select/3 to extract a term from the environment (a
nondeterministic step) and termination, via a multiset ordering based measure [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. An example of
use is:
?- lprove(a-&gt;b-&gt;a).
true.
?- lprove((a-&gt;b)-&gt;a).
false.
      </p>
      <p>Note also that integers can be used instead of atoms, flexibility that we will use as
needed.</p>
      <p>
        Besides the correctness of the bf LJT rule set (as proved in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]), given that the
prover has past our tests, it looks like being already quite close to our interest in a
”lean” prover for minimal logic. However, given the extensive test set (see section 5)
that we have developed, it is not hard to get tempted in getting it a bit simpler and faster,
knowing that the smallest error will be instantly caught.
4 Simpler, faster = better?
We start with transformations that keep the underlying implicational formula unchanged.
4.1 Concentrating nondeterminism into one place
The first transformation merges the work of the two select/3 calls into a single call,
observing that they do similar things after the call. That avoids redoing the same
iteration over candidates for reduction, in exchange for not enforcing the application of rule
LJT3 before rule LJT4.
bprove(T):-ljb(T,[]),!.
ljb(A,Vs):-memberchk(A,Vs),!.
ljb((A-&gt;B),Vs):-!,ljb(B,[A|Vs]).
ljb(G,Vs1):select((A-&gt;B),Vs1,Vs2),
ljb_imp(A,B,Vs2),
!,
ljb(G,[B|Vs2]).
ljb_imp((C-&gt;D),B,Vs):-!,ljb((C-&gt;D),[(D-&gt;B)|Vs]).
ljb_imp(A,_,Vs):-memberchk(A,Vs).
      </p>
      <p>This simpler form will facilitate our next transformations.</p>
    </sec>
    <sec id="sec-2">
      <title>4.2 Extracting the proof terms</title>
      <p>Extracting the proof terms (lambda terms having the formulas we prove as types) is
achieved by decorating in the code with application nodes a/2, lambda nodes l/2 (with
first argument a logic variable) and leaf nodes (with logic variables, same as the
identically named ones in the first argument of the corresponding l/2 nodes).</p>
      <p>
        The simplicity of the predicate bprove/1 and the fact that this is essentially the
inverse of a type inference algorithm (e.g., the one in [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]) help with figuring out how
the decoration mechanism works.
sprove(T):-sprove(T,_).
sprove(T,X):-ljs(X,T,[]),!.
ljs(X,A,Vs):-memberchk(X:A,Vs),!. % leaf variable
ljs(l(X,E),(A-&gt;B),Vs):-!,ljs(E,B,[X:A|Vs]). % lambda term
ljs(E,G,Vs1):member(_:V,Vs1),head_of(V,G),!, % fail if non-tautology
select(S:(A-&gt;B),Vs1,Vs2), % source of application
ljs_imp(T,A,B,Vs2), % target of application
!,
ljs(E,G,[a(S,T):B|Vs2]). % application
ljs_imp(E,A,_,Vs):-atomic(A),!,memberchk(E:A,Vs).
ljs_imp(l(X,l(Y,E)),(C-&gt;D),B,Vs):-ljs(E,D,[X:C,Y:(D-&gt;B)|Vs]).
head_of(_-&gt;B,G):-!,head_of(B,G).
head_of(G,G).
      </p>
      <p>Thus lambda nodes decorate implication introductions and application nodes
decorate modus ponens reductions in the corresponding calculus. Note that the two clauses
of ljs imp provide the target node T that, when seen from the type inference side,
results from cancelling the source type S and the application type S ! T . Note also that
we added in the third clause of ljs/3 a test eliminating non-tautologies, for faster
rejection of unprovable formulas and modified the second clause of ljs imp/4 to make
obvious the addition of lambda binders for assumptions C and D-&gt;B. Calling sprove/2
on the formulas corresponding to the types of the S; K and I combinators, we obtain:
?- sprove(((0-&gt;1-&gt;2)-&gt;(0-&gt;1)-&gt;0-&gt;2),X).</p>
      <p>X = l(A, l(B, l(C, a(a(A, C), a(B, C))))).
?- sprove((0-&gt;1-&gt;0),X).</p>
      <p>X = l(A, l(B, A)).
?- sprove((0-&gt;0),X).</p>
      <p>X = l(A, A).
% S
% K
% I</p>
      <p>Note also the addition of the predicate head of that eliminates non-tautologies by
making sure that in the third clause of ljs, the goal G is the last element of at least one
implication chain. More on why this works, in subsection 4.4.</p>
    </sec>
    <sec id="sec-3">
      <title>4.3 From multiset to set contexts</title>
      <p>Replacing the multiset context with sets eliminates repeated computations. The larger
the terms, the more likely this is to be useful. It combines simplicity of bprove and
duplicate avoidance via the add new/3 predicate.
pprove(T):-ljp(T,[]),!.
ljp(A,Vs):-memberchk(A,Vs),!.
ljp((A-&gt;B),Vs1):-!,add_new(A,Vs1,Vs2),ljp(B,Vs2).
ljp(G,Vs1):- % atomic(G),
select((A-&gt;B),Vs1,Vs2),
ljp_imp(A,B,Vs2),
!,
add_new(B,Vs2,Vs3),
ljp(G,Vs3).
ljp_imp(A,_,Vs):-atomic(A),!,memberchk(A,Vs).
ljp_imp((C-&gt;D),B,Vs1):add_new((D-&gt;B),Vs1,Vs2),
ljp((C-&gt;D),Vs2).
add_new(X,Xs,Ys):-memberchk(X,Xs),!,Ys=Xs.
add_new(X,Xs,[X|Xs]).
4.4 Implicational formulas as nested Horn Clauses
Given the equivalence between: B1 ! B2 : : : Bn ! H and (in Prolog notation) H
:B1; B2; : : : ; Bn, where we chose H is to be the atomic formula ending a chain of
implications, we can recursively transform an implicational formula into one built form nested
clauses, as follows.
toHorn((A-&gt;B),(H:-Bs)):-!,toHorns((A-&gt;B),Bs,H).
toHorn(H,H).
toHorns((A-&gt;B),[HA|Bs],H):-!,toHorn(A,HA),toHorns(B,Bs,H).
toHorns(H,[],H).</p>
      <p>Note also that the transformation is reversible and that lists (instead of Prolog’s
conjunction chains) are used to collect the elements of the body of a clause.
?- toHorn(((0-&gt;1-&gt;2)-&gt;(0-&gt;1)-&gt;0-&gt;2),R).</p>
      <p>
        R = (2:-[(2:-[
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ]), (1:-[0]), 0]).
?- toHorn(((0-&gt;1-&gt;2-&gt;3-&gt;4)-&gt;(0-&gt;1-&gt;2)-&gt;0-&gt;2-&gt;3),R).
      </p>
      <p>
        R = (3:-[(4:-[
        <xref ref-type="bibr" rid="ref1 ref2 ref3">0, 1, 2, 3</xref>
        ]), (2:-[
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ]), 0, 2]).
      </p>
      <p>This suggests transforming provers for implicational formulas into equivalent provers
working on nested Horn clauses.
hprove(T0):-toHorn(T0,T),ljh(T,[]),!.
ljh(A,Vs):-memberchk(A,Vs),!.
ljh((B:-As),Vs1):-!,append(As,Vs1,Vs2),ljh(B,Vs2).
ljh(G,Vs1):- % atomic(G), G not on Vs1
memberchk((G:-_),Vs1), % if non-tautology, we just fail
select((B:-As),Vs1,Vs2), % outer select loop
select(A,As,Bs), % inner select loop
ljh_imp(A,B,Vs2), % A is in the body of B
!,trimmed((B:-Bs),NewB), % trim empty bodies
ljh(G,[NewB|Vs2]).
ljh_imp(A,_B,Vs):-atomic(A),!,memberchk(A,Vs).
ljh_imp((D:-Cs),B,Vs):- ljh((D:-Cs),[(B:-[D])|Vs]).
trimmed((B:-[]),R):-!,R=B.
trimmed(BBs,BBs).</p>
      <p>Note that we have also added a second select/3 call to the third clause of ljh, to
give ljh imp more chances to succeed and commit. Basically, the nested Horn clause
form of implicational logic helps bypassing some intermediate steps, by focusing on the
head of the Horn clause, which corresponds to the last atom in a chain of implications.
This can also be used to speed up non-tautology rejection, by checking in the third
clause of ljh that the goal G is actually the head of at least one of the clauses in the
environment Vs1.</p>
      <p>In fact, it might be worth formalizing and studying the properties of this nested
Horn-clause prover directly, as a new calculus, given also its significant speed-up (as
shown in section 6), relative to all the other provers.
4.5 A lifting to classical logic, via Glivenko’s transformation
The simplest way to turn a propositional intuitionistic theorem prover into a classical
one is to use Glivenko’s translation that prefixes a formula with its double negation. By
adding the atom f alse, to the language of the formulas and a rewriting of the negation
of x into x ! f alse, we obtain, after adding the special handling of false as the first
line of ljk/2:
:- op(425, fy, ~ ). % negation
gprove(T0):-dneg(T0,T),kprove(T).
kprove(T0):-expand_neg(T0,T),ljk(T,[]),!.
ljk(_,Vs):-memberchk(false,Vs),!.
ljk(A,Vs):-memberchk(A,Vs),!.
ljk((A-&gt;B),Vs):-!,ljk(B,[A|Vs]).
ljk(G,Vs1):select((A-&gt;B),Vs1,Vs2),
ljk_imp(A,B,Vs2),
!,
ljk(G,[B|Vs2]).
ljk_imp((C-&gt;D),B,Vs):-!,ljk((C-&gt;D),[(D-&gt;B)|Vs]).
ljk_imp(A,_,Vs):-memberchk(A,Vs).
expand_neg(A,R):-atomic(A),!,R=A.
expand_neg(~A,R):-!,expand_neg(A,B),R=(B-&gt;false).
expand_neg((A-&gt;B),(X-&gt;Y)):-expand_neg(A,X),expand_neg(B,Y).</p>
      <p>Note that the predicate kprove/1 simply extends implicational propositional
calculus, as implemented by bprove/1, with the negation operator ~/1, while the predicate
gprove/1 prefixes a classical formula with double negation.
5</p>
      <sec id="sec-3-1">
        <title>The testing framework</title>
        <p>Correctness can be checked by identifying false positives or false negatives. A false
positive is a non-tautology that the prover proves, breaking the soundness property. A
false negative is a tautology that the prover fails to prove, breaking the completeness
property.</p>
        <p>While classical tautologies are easily tested (at small scale against truth tables, at
medium scale with classical propositional provers and at larger scale with a SAT solver),
intuitionistic provers require a more creative approach.</p>
        <p>As a first bootstrapping step, assuming that no ”gold standard” prover is available
one can look at the other side of the Curry-Howard isomorphism, and rely on
generators for (typable) lambda terms and generators of formulas for implicational logic
expressions, with results being checked against a trusted type inference algorithm.</p>
        <p>As a next step, a trusted prover can be used as a gold standard to test both for false
positives and negatives.
5.1</p>
        <p>Finding false negatives by generating the set of simply typed normal forms
of a given size
A false negative is identified if our prover fails on a type expression known to have an
inhabitant. Via the Curry-Howard isomorphism, such terms are the types inferred for
lambda terms, generated by increasing sizes.</p>
        <p>
          We refer to [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ] for a detailed description of efficient algorithms generating pairs
of simply typed lambda terms in normal form together with their principal types. The
variant of the code we use here is at: https://github.com/ptarau/TypesAndProofs/
blob/master/allTypedNFs.pro
5.2
        </p>
        <p>Finding false positives by generating all well-formed type expressions of a
given size
A false positive is identified if the prover succeeds finding an inhabitant for a type
expression that does not have one.</p>
        <p>
          We obtain type expressions by generating all binary trees of a given size, extracting
their leaf variables and then iterating over the set of their set partitions, while unifying
variables belonging to the same partition. We refer to [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ] for a detailed description of
the algorithms.
        </p>
        <p>The code describing the all-tree and set partition generation as well as their
integration as a type expression generator is at:
https://github.com/ptarau/TypesAndProofs/blob/master/allPartitions.pro.</p>
        <p>We tested the predicate lprove/1 as well as all other provers derived from it for
false negatives against simple types of terms up to size 15 (with size defined as 2 for
applications, 1 for lambdas and 0 for variables) and for false positives against all type
expressions up to size 7 (with size defined as the number of internal nodes).
5.3 Testing against a trusted reference implementation
Assuming we trust an existing reference implementation (e.g., after it passes our
generatorbased tests), it makes sense to use it as a ”gold standard”. In this case, we can identify
both false positives and negatives directly, as follows:
gold_test(N,Generator,Gold,Silver, Term,
Res):call(Generator,N,Term),
gold_test_one(Gold,Silver,Term, Res),</p>
        <p>Res\=agreement.
gold_test_one(Gold,Silver,T,
Res):( call(Silver,T) -&gt; \+ call(Gold,T),</p>
        <p>Res = wrong_success
; call(Gold,T) -&gt; % \+ Silver</p>
        <p>Res = wrong_failure
; Res = agreement
).</p>
        <p>When specializing to a generator for all well-formed implication expressions, and
using Dyckhoff’s dprove/1 predicate as a gold standard, we have:
gold_test(N, Silver, Culprit,
Unexpected):gold_test(N, allImpFormulas, dprove, Silver, Culprit, Unexpected).</p>
        <p>To test the tester, we design a prover that randomly succeeds or fails.
badprove(_) :- 0 =:= random(2).</p>
        <sec id="sec-3-1-1">
          <title>We can now test lprove/1 and badprove/1 as follows:</title>
          <p>?- gold_test(6,lprove,T,R).
false. % indicates that no false positive or negative is found
?- gold_test(6,badprove,T,R).</p>
          <p>T = (0-&gt;1-&gt;0-&gt;0-&gt;0-&gt;0-&gt;0),
R = wrong_failure ;
...
?- gold_test(6,badprove,T,wrong_success).</p>
          <p>T = (0-&gt;1-&gt;0-&gt;0-&gt;0-&gt;0-&gt;2) ;
T = (0-&gt;0-&gt;1-&gt;0-&gt;0-&gt;0-&gt;2) ;
T = (0-&gt;1-&gt;1-&gt;0-&gt;0-&gt;0-&gt;2) ;
...</p>
          <p>More complex implicit correctness tests can be designed, by comparing the behavior
of a prover that handles false, with Glivenko’s double negation transformations that
turns an intuitionistic propositional prover into a classical prover, working on classical
formulas containing implication and negation operators.</p>
          <p>After defining:
gold_classical_test(N,Silver,Culprit,Unexpected):gold_test(N,allClassFormulas,tautology,Silver, Culprit,Unexpected).</p>
          <p>
            We can run it against the provers gprove/1 and kprove/1, using Melvin Fitting’s
classical tautology prover [
            <xref ref-type="bibr" rid="ref16">16</xref>
            ] tautology/1 as a gold standard.
?- gold_classical_test(7,gprove,Culprit,Error).
false. % no false positive or negative found
?- gold_classical_test(7,kprove,Culprit,Error).
          </p>
          <p>Culprit = ((false-&gt;false)-&gt;0-&gt;0-&gt;((1-&gt;false)-&gt;false)-&gt;1),
Error = wrong_failure ;
Culprit = ((false-&gt;false)-&gt;0-&gt;1-&gt;((2-&gt;false)-&gt;false)-&gt;2),
Error = wrong_failure .
...</p>
          <p>While gprove/1, implementing Glivenko’s translation, passes the test, kprove/1 that
handles intuitionistic tautologies (including negated formulas) will fail on classical
tautologies that are not also intuitionistic tautologies.
6</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>Performance and scalability testing</title>
        <p>
          Once passing correctness tests, our provers need to be tested against large random terms.
The mechanism is similar to the use of all-term generators.
6.1 Random simply-typed terms, with Boltzmann samplers
We generate random simply-typed normal forms, using a Boltzmann sampler along
the lines of that described in [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]. The code variant, adapted to our different term-size
definition is at:
https://github.com/ptarau/TypesAndProofs/blob/master/ranNormalForms.pro.
        </p>
        <p>It works as follows:
?- ranTNF(10,XT,TypeSize).</p>
        <p>XT = l(l(a(a(s(0), l(s(0))), 0))) : (((A-&gt;B)-&gt;B-&gt;C)-&gt;B-&gt;C).</p>
        <p>TypeSize = 5.
?- ranTNF(60,XT,TypeSize),nv(XT).</p>
        <p>XT = l(l(a(a(0, l(a(a(0, a(0, l(...))), s(s(0))))),</p>
        <p>l(l(a(a(0, a(l(...), a(..., ...))), l(0)))))))
:
(A-&gt;((((A-&gt;A)- ...)-&gt;D)-&gt;D)-&gt;M)-&gt;M),
TypeSize = 34.</p>
        <p>
          Interestingly, partly due to the fact that there’s some variation in the size of the terms
Boltzmann sampler generate and more to the fact that the distribution of types favors
(as seen in the second example) the simple tautologies where an atom identical to the
last one is contained in the implication chain leading to it [
          <xref ref-type="bibr" rid="ref17 ref8">17, 8</xref>
          ], if we want to use these
for scalability tests, additional filtering mechanisms need to be used to statically reject
type expressions that are large but easy to prove as intuitionistic tautologies.
6.2 Random implicational formulas
The generation of random implicational formulas is more intricate.
        </p>
        <p>
          Our code combines an implementation of Re´my’s algorithm [
          <xref ref-type="bibr" rid="ref18">18</xref>
          ], along the lines of
Knuth’s algorithm R in [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ] for the generation of random binary trees at
https://github.com/ptarau/TypesAndProofs/blob/master/RemyR.pro, with code to
generate random set partitions using an urn-based algorithm (see [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ]) at
https://github.com/ptarau/TypesAndProofs/blob/master/ranPartition.pro.
        </p>
        <p>
          We refer to [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ] for a declarative implementation of a variant of Re´my’s algorithm
in Prolog with code adapted for this paper at:
https://github.com/ptarau/TypesAndProofs/blob/master/RemyP.pro.
        </p>
        <p>
          As automatic Boltzmann sampler generation is limited to fixed numbers of
equivalence classes from which a CF- grammar can be given, we build our the random set
partition generator that groups logical variables in leaf position into equivalence classes
by using an urn-algorithm described in [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ].
        </p>
        <p>Once a random binary tree of size N is generated with the -&gt;/2 constructor
labeling internal nodes, the N + 1 leaves of the tree are decorated with logic variables. As
variables sharing a name define equivalence classes on the set of variables, each choice
of them corresponds to a set partition of the N + 1 nodes.</p>
        <p>The combined generator, that generates in a few seconds terms of size 1000, works
as follows:
?- ranImpFormula(20,F).</p>
        <p>F = (((0-&gt;(((1-&gt;2)-&gt;1-&gt;2-&gt;2)-&gt;3)-&gt;2)-&gt;4-&gt;(3-&gt;3)-&gt;</p>
        <p>(5-&gt;2)-&gt;6-&gt;3)-&gt;7-&gt;(4-&gt;5)-&gt;(4-&gt;8)-&gt;8) .
?- time(ranImpFormula(1000,_)). % includes tabling large Stirling numbers
% 37,245,709 inferences,7.501 CPU in 7.975 seconds (94% CPU, 4965628 Lips)
?- time(ranImpFormula(1000,_)). % much faster now, thanks to tabling
% 107,163 inferences,0.040 CPU in 0.044 seconds (92% CPU, 2659329 Lips)
Note that we use Prolog’s tabling (a form of automated dynamic programming) to avoid
costly recomputation of the (very large) Sterling numbers.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>6.3 Testing with large random terms</title>
      <p>Testing for false positives and false negatives for random terms proceeds in a similar
manner to exhaustive testing with terms of a given size.</p>
      <p>Assuming Roy Dyckhoff’s prover as a gold standard, we can find out that our nested
Horn Clause prover hprove/1 can handle 100 terms of size 50 as well as the gold
standard.
?- gold_ran_imp_test(50,100,hprove, Culprit, Unexpected).
false. % indicates no differences with the gold standard</p>
      <p>In fact, the size of the random terms handled by hprove/1 makes using provers
an appealing alternative to random lambda term generators in search for very large
lambda term simple type pairs. Interestingly, on the side of random simply typed terms,
limitations come from their vanishing density, while on the other side they come from
the known PSPACE-complete complexity of the proof procedures.
6.4</p>
      <p>Can lean provers actually be fast? A quick performance evaluation</p>
      <sec id="sec-4-1">
        <title>Our benchmarking code is at:</title>
        <p>https://github.com/ptarau/TypesAndProofs/blob/master/benchmarks.pro.</p>
        <p>The following table compares several provers on exhaustive ”all-terms”
benchmarks, derived from our correctness test. First, we run them on the types inferred on
all lambda terms of a given size. Next we run them on all implicational formulas of a
given size (set to be about half of the former, as the number of these grows much faster).</p>
        <p>Note that the size of the implicational formulas in the case of the ”Mix of examples”
is half of the size of the lambda terms whose type are used in the case of ”Positive
examples”</p>
        <p>The nested Horn clauses based hprove/1 turns out to be a clear winner. Most likely,
this comes from concentrating its non-deterministic choices in the two select/3 calls.
These calls happen in constant space and replace with a faster ”shallow backtracking”
loop, the ”deep backtracking” the other provers might need to cover the same search
space.</p>
        <p>In fact, hprove/1 seems to also scale well on larger formulas, following closely the
increase in the numbers of test formulas. Note that ”pos” marks formulas known to be
tautologies, generated by typable lambda terms of sizes 16,17 and 18 and ”mix” marks
implicational formulas of sizes 8, 8 and 9.
??- forall(between(16,18,N),bm(N,hprove)).
[prog=hprove,size=16,pos=90.257,mix=30.411,total=120.668]
[prog=hprove,size=17,pos=425.586,mix=32.214,total=457.8]
[prog=hprove,size=18,pos=2108.01,mix=657.807,total=2765.818]</p>
        <p>Testing exhaustively on small formulas, while an accurate indicator for average
speed, might not favor provers using more complex heuristics or extensive
preprocessing. But if that happens, one would expect it to result in a constant factor ratio,
rather than a fast increasing gap as it happens, for instance between Dyckhoff’s original
dprove and our best prover hprove.
7</p>
        <sec id="sec-4-1-1">
          <title>Related work</title>
          <p>The related work derived from Gentzen’s LJ calculus is in the hundreds if not in the
thousands of papers and books. Space constraints limit our discussion to the most
closely related papers, directly focusing on algorithms for implicational intuitionistic
propositional logic.</p>
          <p>
            Among them the closest are [
            <xref ref-type="bibr" rid="ref11 ref12">11, 12</xref>
            ] that we have used as starting points for
deriving our provers. We have chosen to implement the LJT calculus directly rather than
deriving our programs from Roy Dyckhoff’s Prolog code.
          </p>
          <p>
            Similar calculi, key ideas of which made it into the Coq proof assistant’s code, are
described in [
            <xref ref-type="bibr" rid="ref22">22</xref>
            ].
          </p>
          <p>
            On the other side of the Curry-Howard isomorphism [
            <xref ref-type="bibr" rid="ref23">23</xref>
            ], described in full detail in
[
            <xref ref-type="bibr" rid="ref24">24</xref>
            ] finds and/or counts inhabitants of simple types in long normal form.
          </p>
          <p>
            Using hypothetical implications in Prolog, although all with a different semantics
than Gentzen’s LJ calculus or its LJT variant, go back as early as [
            <xref ref-type="bibr" rid="ref25">25</xref>
            ], followed by
a series of Lambda-Prolog and linear logic-related books and papers, e.g., [
            <xref ref-type="bibr" rid="ref26">26</xref>
            ]. The
similarity to the propositional subsets of N-Prolog [
            <xref ref-type="bibr" rid="ref25">25</xref>
            ] and l -Prolog [
            <xref ref-type="bibr" rid="ref26">26</xref>
            ] comes from
their close connection to intuitionistic logic, although neither derive implementations
from a pure LJ-based calculus or have termination properties implemented along the
lines the LJT calculus. In [
            <xref ref-type="bibr" rid="ref27">27</xref>
            ] backtrackable linear and intuitionistic assumptions that
mimic the implication introduction rule are used, but they do not involve arbitrarily
deep nested implicational formulas.
          </p>
          <p>
            Overviews of closely related calculi, using the implicational subset of propositional
intuitionistic logic are [
            <xref ref-type="bibr" rid="ref12 ref28">28, 12</xref>
            ].
8
          </p>
        </sec>
        <sec id="sec-4-1-2">
          <title>Conclusions and future work</title>
          <p>Our empirically oriented approach has found variants of lean propositional intuitionistic
provers that are comparable to their more complex peers, derived from similar calculi.
Among them, the nested Horn clause prover might be worth formalizing as a calculus
and subject to deeper theoretical analysis. Given that it shares its main data structures
with Prolog, it seems interesting to optimize it via partial evaluation or compilation to
Prolog.</p>
          <p>Our renewed interest in finding lightweight implementations of these classic
theoretically hard (PSPACE-complete) combinatorial search problems, is also motivated by
the possibility of parallel implementations using multi-core and GPU algorithms.</p>
          <p>We plan future work in formalizing the nested Horn-clause prover in sequent-calculus
and explore compilation techniques and parallel algorithms for it.</p>
          <p>A generalization to nested Horn clauses with universally quantified variables seems
also promising to explore, with either grounding techniques as used by SAT and ASPm
solvers or via compilation to Prolog.</p>
        </sec>
        <sec id="sec-4-1-3">
          <title>Acknowledgement</title>
          <p>This research has been supported by NSF grant 1423324.</p>
        </sec>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Howard</surname>
            ,
            <given-names>W.:</given-names>
          </string-name>
          <article-title>The Formulae-as-types Notion of Construction</article-title>
          . In Seldin, J.,
          <string-name>
            <surname>Hindley</surname>
          </string-name>
          , J., eds.:
          <string-name>
            <surname>To H.B. Curry</surname>
          </string-name>
          : Essays on Combinatory Logic,
          <source>Lambda Calculus and Formalism</source>
          . Academic Press, London (
          <year>1980</year>
          )
          <fpage>479</fpage>
          -
          <lpage>490</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Wadler</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Propositions as types</article-title>
          .
          <source>Commun. ACM</source>
          <volume>58</volume>
          (
          <year>2015</year>
          )
          <fpage>75</fpage>
          -
          <lpage>84</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Statman</surname>
          </string-name>
          , R.:
          <article-title>Intuitionistic Propositional Logic is Polynomial-Space Complete</article-title>
          .
          <source>Theor. Comput. Sci. 9</source>
          (
          <year>1979</year>
          )
          <fpage>67</fpage>
          -
          <lpage>72</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <article-title>4. The Coq development team: The Coq proof assistant reference manual</article-title>
          .
          <source>(2018) Version 8.8.0.</source>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Tarau</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>On Type-directed Generation of Lambda Terms</article-title>
          . In De Vos,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Eiter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            ,
            <surname>Lierler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            ,
            <surname>Toni</surname>
          </string-name>
          , F., eds.
          <source>: 31st International Conference on Logic Programming (ICLP</source>
          <year>2015</year>
          ), Technical Communications, Cork, Ireland,
          <string-name>
            <surname>CEUR</surname>
          </string-name>
          (
          <year>September 2015</year>
          ) available online at http://ceurws.org/Vol-
          <volume>1433</volume>
          /.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Palka</surname>
            ,
            <given-names>M.H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Claessen</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Russo</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hughes</surname>
          </string-name>
          , J.:
          <article-title>Testing an optimising compiler by generating random lambda terms</article-title>
          .
          <source>In: Proceedings of the 6th International Workshop on Automation of Software Test. AST'11</source>
          , New York, NY, USA, ACM (
          <year>2011</year>
          )
          <fpage>91</fpage>
          -
          <lpage>97</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Fetscher</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Claessen</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Palka</surname>
            ,
            <given-names>M.H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hughes</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Findler</surname>
          </string-name>
          , R.B.:
          <article-title>Making random judgments: Automatically generating well-typed terms from the definition of a type-system</article-title>
          .
          <source>In: Programming Languages and Systems - 24th European Symposium on Programming, ESOP</source>
          <year>2015</year>
          ,
          <article-title>Held as Part of the European Joint Conferences on Theory and Practice of Software</article-title>
          ,
          <source>ETAPS</source>
          <year>2015</year>
          , London, UK, April
          <volume>11</volume>
          -
          <issue>18</issue>
          ,
          <year>2015</year>
          . Proceedings. (
          <year>2015</year>
          )
          <fpage>383</fpage>
          -
          <lpage>405</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Kostrzycka</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zaionc</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Asymptotic densities in logic and type theory</article-title>
          .
          <source>Studia Logica</source>
          <volume>88</volume>
          (
          <issue>3</issue>
          ) (
          <year>2008</year>
          )
          <fpage>385</fpage>
          -
          <lpage>403</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Bendkowski</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grygiel</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tarau</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Random generation of closed simply typed l -terms: A synergy between logic programming and Boltzmann samplers</article-title>
          .
          <source>TPLP</source>
          <volume>18</volume>
          (
          <issue>1</issue>
          ) (
          <year>2018</year>
          )
          <fpage>97</fpage>
          -
          <lpage>119</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Szabo</surname>
            ,
            <given-names>M.E.</given-names>
          </string-name>
          :
          <article-title>The Collected Papers of Gerhard Gentzen</article-title>
          .
          <source>Philosophy of Science</source>
          <volume>39</volume>
          (
          <issue>1</issue>
          ) (
          <year>1972</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Dyckhoff</surname>
          </string-name>
          , R.:
          <article-title>Contraction-free sequent calculi for intuitionistic logic</article-title>
          .
          <source>Journal of Symbolic Logic</source>
          <volume>57</volume>
          (
          <issue>3</issue>
          ) (
          <year>1992</year>
          )
          <fpage>795807</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Dyckhoff</surname>
          </string-name>
          , R.:
          <article-title>Intuitionistic Decision Procedures Since Gentzen</article-title>
          . In Kahle, R.,
          <string-name>
            <surname>Strahm</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Studer</surname>
          </string-name>
          , T., eds.
          <source>: Advances in Proof Theory, Cham</source>
          , Springer International Publishing (
          <year>2016</year>
          )
          <fpage>245</fpage>
          -
          <lpage>267</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Hudelmaier</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>A PROLOG Program for Intuitionistic Logic</article-title>
          .
          <article-title>SNS-Bericht-</article-title>
          .
          <source>Universita¨t Tu¨bingen (</source>
          <year>1988</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Hudelmaier</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>An O(n log n)-Space Decision Procedure for Intuitionistic Propositional Logic</article-title>
          .
          <source>Journal of Logic and Computation</source>
          <volume>3</volume>
          (
          <issue>1</issue>
          ) (
          <year>1993</year>
          )
          <fpage>63</fpage>
          -
          <lpage>75</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Tarau</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>A Hiking Trip Through the Orders of Magnitude: Deriving Efficient Generators for Closed Simply-Typed Lambda Terms and Normal Forms</article-title>
          . In Hermenegildo, M.V., LopezGarcia, P., eds.
          <source>: Logic-Based Program Synthesis and Transformation: 26th International Symposium, LOPSTR</source>
          <year>2016</year>
          ,
          <article-title>Edinburgh</article-title>
          ,
          <string-name>
            <surname>UK</surname>
          </string-name>
          ,
          <source>Revised Selected Papers</source>
          , Springer LNCS, volume
          <volume>10184</volume>
          (
          <year>September 2017</year>
          )
          <fpage>240</fpage>
          -
          <lpage>255</lpage>
          , Best paper award.
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Fitting</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>leanTAP Revisited</article-title>
          .
          <source>Journal of Logic and Computation</source>
          <volume>8</volume>
          (
          <issue>1</issue>
          ) (
          <year>1998</year>
          )
          <fpage>33</fpage>
          -
          <lpage>47</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Genitrini</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kozik</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zaionc</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Intuitionistic vs</article-title>
          .
          <source>Classical Tautologies</source>
          ,
          <article-title>Quantitative Comparison</article-title>
          . In Miculan,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Scagnetto</surname>
          </string-name>
          ,
          <string-name>
            <given-names>I.</given-names>
            ,
            <surname>Honsell</surname>
          </string-name>
          , F., eds.:
          <article-title>Types for Proofs and Programs</article-title>
          , International Conference,
          <source>TYPES 2007, Cividale del Friuli</source>
          , Italy, May 2-
          <issue>5</issue>
          ,
          <year>2007</year>
          ,
          <string-name>
            <given-names>Revised</given-names>
            <surname>Selected</surname>
          </string-name>
          <article-title>Papers</article-title>
          . Volume
          <volume>4941</volume>
          of Lecture Notes in Computer Science., Springer (
          <year>2007</year>
          )
          <fpage>100</fpage>
          -
          <lpage>109</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18. Re´my,
          <string-name>
            <surname>J.L.</surname>
          </string-name>
          : Un proce´de´ ite´ratif de de´
          <article-title>nombrement d'arbres binaires et son application a` leur ge´ne´ration ale´atoire</article-title>
          .
          <source>RAIRO - Theoretical Informatics and Applications - Informatique The´orique et Applications</source>
          <volume>19</volume>
          (
          <issue>2</issue>
          ) (
          <year>1985</year>
          )
          <fpage>179</fpage>
          -
          <lpage>195</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>Knuth</surname>
            ,
            <given-names>D.E.</given-names>
          </string-name>
          :
          <article-title>The Art of Computer Programming</article-title>
          , Volume
          <volume>4</volume>
          ,
          <string-name>
            <surname>Fascicle</surname>
            <given-names>4</given-names>
          </string-name>
          :
          <article-title>Generating All Trees-History of Combinatorial Generation (Art of Computer Programming)</article-title>
          .
          <source>AddisonWesley Professional</source>
          (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>Stam</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Generation of a random partition of a finite set by an urn model</article-title>
          .
          <source>Journal of Combinatorial Theory, Series A</source>
          <volume>35</volume>
          (
          <issue>2</issue>
          ) (
          <year>1983</year>
          )
          <fpage>231</fpage>
          -
          <lpage>240</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <surname>Tarau</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Declarative Algorithms for Generation, Counting and Random Sampling of Term Algebras</article-title>
          .
          <source>In: Proceedings of SAC'18, ACM Symposium on Applied Computing</source>
          , PL track, Pau, France, ACM (April
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <string-name>
            <surname>Herbelin</surname>
          </string-name>
          , H.:
          <article-title>A Lambda-Calculus Structure Isomorphic to Gentzen-Style Sequent Calculus Structure</article-title>
          .
          <source>In: Selected Papers from the 8th International Workshop on Computer Science Logic. CSL '94</source>
          , London, UK, UK, Springer-Verlag (
          <year>1995</year>
          )
          <fpage>61</fpage>
          -
          <lpage>75</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23.
          <string-name>
            <surname>Ben-Yelles</surname>
            ,
            <given-names>C.B.</given-names>
          </string-name>
          :
          <article-title>Type assignment in the lambda-calculus: Syntax and semantics</article-title>
          .
          <source>PhD thesis</source>
          , University College of Swansea (
          <year>1979</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          24.
          <string-name>
            <surname>Hindley</surname>
            ,
            <given-names>J.R.</given-names>
          </string-name>
          :
          <source>Basic Simple Type Theory</source>
          . Cambridge University Press, New York, NY, USA (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          25.
          <string-name>
            <surname>Gabbay</surname>
            ,
            <given-names>D.M.:</given-names>
          </string-name>
          <article-title>N-prolog: An extension of prolog with hypothetical implication. ii. logical foundations, and negation as failure</article-title>
          .
          <source>The Journal of Logic Programming</source>
          <volume>2</volume>
          (
          <issue>4</issue>
          ) (
          <year>1985</year>
          )
          <fpage>251</fpage>
          -
          <lpage>283</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          26.
          <string-name>
            <surname>Miller</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nadathur</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          :
          <article-title>Programming with Higher-Order Logic</article-title>
          . Cambridge University Press, New York, NY, USA (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          27.
          <string-name>
            <surname>Tarau</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dahl</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fall</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Backtrackable State with Linear Affine Implication and Assumption Grammars</article-title>
          . In Jaffar, J.,
          <string-name>
            <surname>Yap</surname>
          </string-name>
          , R.H., eds.: Concurrency and Parallelism, Programming,
          <source>Networking, and Security. Lecture Notes in Computer Science 1179</source>
          , Berlin Heidelberg, Springer (December
          <year>1996</year>
          )
          <fpage>53</fpage>
          -
          <lpage>64</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref28">
        <mixed-citation>
          28.
          <string-name>
            <surname>Gabbay</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Olivetti</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          :
          <article-title>Goal-oriented deductions</article-title>
          .
          <source>In: Handbook of Philosophical Logic</source>
          . Springer (
          <year>2002</year>
          )
          <fpage>199</fpage>
          -
          <lpage>285</lpage>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>