Extensional Higher-Order Paramodulation in Leo-III

Page created by Ronnie Robbins
 
CONTINUE READING
Extensional Higher-Order Paramodulation in
                                                               Leo-III∗
                                                       Alexander Steen              Christoph Benzmüller
                                              alexander.steen@uni.lu, c.benzmueller@fu-berlin.de
arXiv:1907.11501v2 [cs.AI] 28 Feb 2021

                                                                              Abstract
                                                   Leo-III is an automated theorem prover for extensional type theory
                                               with Henkin semantics and choice. Reasoning with primitive equality is
                                               enabled by adapting paramodulation-based proof search to higher-order
                                               logic. The prover may cooperate with multiple external specialist reason-
                                               ing systems such as first-order provers and SMT solvers. Leo-III is com-
                                               patible with the TPTP/TSTP framework for input formats, reporting
                                               results and proofs, and standardized communication between reasoning
                                               systems, enabling e.g. proof reconstruction from within proof assistants
                                               such as Isabelle/HOL.
                                                   Leo-III supports reasoning in polymorphic first-order and higher-order
                                               logic, in many quantified normal modal logics, as well as in different de-
                                               ontic logics. Its development had initiated the ongoing extension of the
                                               TPTP infrastructure to reasoning within non-classical logics.
                                                   Keywords Higher-Order Logic Henkin Semantics Extensionality Leo-
                                               III Equational Reasoning Automated Theorem Proving Non-Classical Log-
                                               ics Quantified Modal Logics

                                         1     Introduction
                                         Leo-III is an automated theorem prover (ATP) for classical higher-order logic
                                         (HOL) with Henkin semantics and choice. In contrast to its predecessors, LEO
                                         and LEO-II [25, 33], that were based on resolution proof search, Leo-III imple-
                                         ments a higher-order paramodulation calculus, which aims at improved perfor-
                                         mance for equational reasoning [89]. In the tradition of the Leo prover family,
                                         Leo-III collaborates with external reasoning systems, in particular, with first-
                                         order ATP systems, such as E [85], iProver [70] and Vampire [83], and with
                                         SMT solvers such as CVC4 [14]. Cooperation is not restricted to first-order
                                         systems, and further specialized systems such as higher-order (counter-)model
                                         finders may be utilized by Leo-III.
                                             Leo-III accepts all common TPTP dialects [99] as well as their recent exten-
                                         sions to polymorphic types [44, 67]. During the development of Leo-III, careful
                                         attention has been paid to providing maximal compatibility with existing sys-
                                         tems and conventions of the peer community, especially to those of the TPTP
                                         infrastructure. The prover returns results according to the standardized TPTP
                                            ∗ This work has been supported by the DFG under grant BE 2501/11-1 (Leo-III) and by

                                         the Volkswagenstiftung (”Consistent Rational Argumentation in Politics”).

                                                                                   1
SZS ontology, and it additionally produces verifiable TPTP-compatible proof
certificates for each proof that it finds.
    The predecessor systems LEO and LEO-II pioneered the area of coopera-
tive resolution-based theorem proving for Henkin semantics. LEO (or LEO-I)
was designed as an ATP component of the proof assistant and proof planner
ΩMEGA [86] and hard-wired to it. Its successor, LEO-II, is a stand-alone HOL
ATP system based on Resolution by Unification and Extensionality (RUE) [18],
and it supports reasoning with primitive equality.
    The most recent incarnation of the Leo prover family, Leo-III, comes with
improved reasoning performance in particular for equational problems, and with
a more flexible and effective architecture for cooperation with external special-
ists.1 Reasoning in higher-order quantified non-classical logics, including many
normal modal logics, and different versions of deontic logic is enabled by an
integrated shallow semantical embedding approach [29]. In contrast to other
HOL ATP systems, including LEO-II, for which it was necessary for the user to
manually conduct the tedious and error-prone encoding procedure before pass-
ing it to the prover, Leo-III is the first ATP system to include a rich library of
these embeddings, transparent to the user [59]. These broad logic competencies
make Leo-III, up to the authors’ knowledge, the most widely applicable ATP
system for propositional and quantified, classical and non-classical logics avail-
able to date. This work has also stimulated the currently ongoing extension of
the TPTP library to non-classical reasoning.2
    Leo-III is implemented in Scala and its source code, and that of related
projects presented in this article, is publicly available under BSD-3 license on
GitHub.3 Installing Leo-III does not require any special libraries, apart from
a reasonably current version of the JDK and Scala. Also, Leo-III is readily
available via the SystemOnTPTP web interface [99], and it can be called via
Sledgehammer [41], from the interactive proof assistant Isabelle/HOL [79] for
automatically discharging user’s proof goals.
    In a recent evaluation study of 19 different first-order and higher-order ATP
systems, Leo-III was found the most versatile (in terms of supported logic for-
malisms) and best performing ATP system overall [48].
    This article presents a consolidated summary of previous conference and
workshop contributions [32, 91, 93, 94, 104] as well as contributions from the first
author’s PhD thesis [89]. It is structured as follows: §2 briefly introduces HOL
and summarizes challenging automation aspects. In §3 the basic paramodulation
calculus that is extended by Leo-III is presented, and practically motivated
extensions that are implemented in the prover are outlined. Subsequently, the
implementation of Leo-III is described in more detail in §4, and §5 presents the
technology that enables Leo-III to reason in various non-classical logics. An
evaluation of Leo-III on a heterogeneous set of benchmarks, including problems
in non-classical logics, is presented in §6. Finally, §7 concludes this article and
sketches further work.
   1 Note the different capitalization of Leo-III as opposed to LEO-I and LEO-II. This is

motivated by the fact that Leo-III is designed to be a general purpose system rather than a
subcomponent to another system. Hence, the original capitalization derived from the phrase
”Logical Engine for Omega” (LEO) is not continued.
   2 See http://tptp.org/TPTP/Proposals/LogicSpecification.html.
   3 See the individual projects related to the Leo prover family at https://github.com/

leoprover. Further information are available at http://inf.fu-berlin.de/~lex/leo3.

                                            2
2     Higher-Order Theorem Proving
The term higher-order logic refers to expressive logical formalisms that allow
for quantification over predicate and function variables; such a logic was first
studied by Frege in the 1870s [56]. An alternative and more handy formulation
was proposed by Church in the 1940s [51]. He defined a higher-order logic on
top of the simply typed λ-calculus. His particular formalism, referred to as Sim-
ple Type Theory (STT), was later further studied and refined by Henkin [64],
Andrews [2, 4, 3] and others [22, 77]. In the remainder, the term HOL is used
synonymously to Henkin’s Extensional Type Theory (ExTT) [26]; it constitutes
the foundation of many contemporary higher-order automated reasoning sys-
tems. HOL provides lambda-notation as an elegant and useful means to denote
unnamed functions, predicates and sets (by their characteristic functions), and
it comes with built-in principles of Boolean and functional extensionality as well
as type-restricted comprehension.
    A more in-depth presentation of HOL, its historical development, metathe-
ory and automation is provided by Benzmüller and Miller [26].

Syntax and Semantics. HOL is a typed logic; every term of HOL is associ-
ated a fixed and unique type, written as subscript. The set T of simple types
is freely generated from a non-empty set S of sort symbols (base types) and
juxtaposition ντ of two types τ, ν ∈ T , the latter denoting the type of func-
tions from objects of type τ to objects of type ν. Function types are assumed
to associate to the left and parentheses may be dropped if consistent with the
intended reading. The base types are usually chosen to be S := {ι, o}, where
ι and o represent the type of individuals and the type of Boolean truth values,
respectively.
    Let Σ be a typed signature and let V denote a set of typed variable sym-
bols such that there exist infinitely many variables for each type. Following
Andrews [5], it is assumed that the only primitive logical connective is equality,
denoted =τoτ τ ∈ Σ, for each type τ ∈ T (called Q by Andrews). In the exten-
sional setting of HOL, all remaining logical connectives such as disjunction ∨ooo ,
conjunction ∧ooo , negation ¬oo , etc., can be defined in terms of them. The terms
of HOL are given by the following abstract syntax (where τ, ν ∈ T are types):
                  s, t ::= cτ ∈ Σ | Xτ ∈ V | (λXτ . sν )ντ | (sντ tτ )ν
The terms are called constants, variables, abstractions and applications, respec-
tively. Application is assumed to associate to the left and parentheses may again
be dropped whenever possible. Conventionally, vector notation           fντ n ···τ 1 tiτ i is
                                                     1          n
used to abbreviate nested applications fντ n ···τ 1 tτ 1 · · · tτ n , where f is a func-
tion term and the ti , 1 ≤ i ≤ n, are argument terms of appropriate types. The
type of a term may be dropped for legibility reasons if obvious from the context.
Notions such as α-, β-, and η-conversion, denoted −→? , for ? ∈ {α, β, η}, free
variables fv(.) of a term, etc., are defined as usual [13]. The notion s{t/X}
is used to denote the (capture-free) substitution of variable X by term t in
s. Syntactical equality between HOL terms, denoted ≡? , for ? ⊆ {α, β, η}, is
defined with respect to the assumed underlying conversion rules. Terms so of
type o are formulas, and they are sentences if they are closed. By convention,
infix notation for fully applied logical connectives is used, e.g. so ∨ to instead of
(∨ooo so ) to .

                                              3
As a consequence of Gödel’s Incompleteness Theorem, HOL with standard
semantics is necessarily incomplete. In contrast, theorem proving in HOL is
usually considered with respect to so-called general semantics (or Henkin se-
mantics) in which a meaningful notion of completeness can be achieved [64, 3].
The usual notions of general model structures, validity in these structures and
related notions are assumed in the following. Note that we do not assume that
the general model structures validate choice. Intensional models have been de-
scribed by Muskens [77] and studies of further general notions of semantics have
been presented by Andrews [2] and Benzmüller et al. [22].

Challenges to HOL Automation. HOL validates functional and Boolean
extensionality principles, referred to as EXTντ and EXTo . These principles can
be formulated within HOL’s term language as

            EXTντ := ∀Fντ . ∀Gντ . (∀Xτ . F X =ν G X) ⇒ F =ντ G
             EXTo := ∀Po . ∀Qo . (P ⇔ Q) ⇒ P =o Q

These principles state that two functions are equal if they correspond on every
argument, and that two formulas are equal if they are equivalent (where ⇔ooo
denotes equivalence), respectively. Using these principles, one can infer that
two functions such as λPo . > and λPo . P ∨ ¬P are in fact equal (where > de-
notes syntactical truth), and that (λPo . λQo . P ∨ Q) = (λPo . λQo . Q ∨ P ) is a
theorem. Boolean Extensionality, in particular, poses a considerable challenge
for HOL automation: Two terms may be equal, and thus subject to generat-
ing inferences, if the equivalence of all Boolean-typed subterms can be inferred.
As a consequence, a complete implementation of non-ground proof calculi that
make use of higher-order unification procedures cannot simply use syntactical
unification for locally deciding which inferences are to be generated. In contrast
to first-order theorem proving, it is hence necessary to interleave syntactical
unification and (semantical) proof search, which is more difficult to control in
practice.
    As a further complication, higher-order unification is only semi-decidable
and not unitary [65, 60]. It is not clear how many and which unifiers produced
by a higher-order unification routine should be chosen during proof search, and
the unification procedure may never terminate on non-unifiable terms.
    In the context of first-order logic with equality, superposition-based calculi
have proven an effective basis for reasoning systems and provide a powerful no-
tion of redundancy [9, 78, 10]. Reasoning with equality can also be addressed,
e.g., by an RUE resolution approach [55] and, in the higher-order case, by reduc-
ing equality to equivalent formulas not containing the equality predicate [18],
as done in LEO. The latter approaches however lack effectivity in practical
applications of large scale equality reasoning.
    There are further practical challenges as there are only few implementation
techniques available for efficient data structures and indexing methods. This
hampers the effectivity of HOL reasoning systems and their application in prac-
tice.

HOL ATP Systems. Next to the LEO prover family [25, 33, 91], there are
further HOL ATP systems available: This includes TPS [7] as one of the earliest

                                        4
systems, as well as Satallax [47], coqATP [37], agsyHOL [72] and the higher-
order (counter)model finder Nitpick [43]. Additionally, there is ongoing work
on extending the first-order theorem prover Vampire to full higher-order reason-
ing [38, 39], and some interactive proof assistants such as Isabelle/HOL [79] can
also be used for automated reasoning in HOL. Further related systems include
higher-order extensions of SMT solvers [11], and there is ongoing work to lift
first-order ATP systems based on superposition to fragments of HOL, including
E [85, 102] and Zipperposition [53, 16].
    Further notable higher-order reasoning systems include proof assistants such
as PVS [81], Isabelle/HOL, the HOL prover family including HOL4 [61], and
the HOL Light system [63]. In contrast to ATP systems, proof assistants do
not finds proofs automatically but are rather used to formalize and verify hand-
written proofs for correctness.

Applications. The expressivity of higher-order logic has been exploited for
encoding various expressive non-classical logics within HOL. Semantical embed-
dings of, among others, higher-order modal logics [29, 59], conditional logics [20],
many-valued logics [90], deontic logic [24], free logics [31], and combinations of
such logics [19] can be used to automate reasoning within those logics using
ATP systems for classical HOL. A prominent result from the applications of
automated reasoning in non-classical logics, here in quantified modal logics,
was the detection of a major flaw in Gödel’s Ontological Argument [57, 36] as
well as the verification of Scott’s variant of that argument [35] using LEO-II
and Isabelle/HOL. Similar and further enhanced techniques were used to assess
foundational questions in metaphysics [34, 69].
    Additionally, Isabelle/HOL and the Nitpick system were used to assess the
correctness of concurrent C++ programs against a previously formalized mem-
ory model [45]. The higher-order proof assistant HOL Light played a key role
in the verification of Kepler’s conjecture within the Flyspeck project [62].

3    Extensional Higher-Order Paramodulation
Leo-III is a refutational ATP system. The initial, possibly empty, set of ax-
ioms and the negated conjecture are transformed into an equisatisfiable set of
formulas in clause normal form (CNF), which is then iteratively saturated until
the empty clause is found. Leo-III extends the complete, paramodulation-based
calculus EP for HOL (cf. §3.1) with practically motivated, partly heuristic
inference rules. Paramodulation extends resolution by a native treatment of
equality at the calculus level. In the context of first-order logic, it was de-
veloped in the late 1960s by G. Robinson and L. Wos [84] as an attempt to
overcome the shortcomings of resolution-based approaches to handling equality.
A paramodulation inference incorporates the principle of replacing equals by
equals and can be regarded as a speculative conditional rewriting step. In the
context of first-order theorem proving, superposition-based calculi [9, 78, 10] im-
prove the naive paramodulation approach by imposing ordering restrictions on
the inference rules such that only a relevant subset of all possible inferences are
generated. However, due to the more complex structure of the term language
of HOL, there do not exist suitable term orderings that allow a straightforward

                                         5
adaption of this approach to the higher-order setting.4 However, there is re-
cent work to overcome this situation by relaxing restrictions on the employed
orderings [15].

3.1     The EP Calculus
Higher-order paramodulation for extensional type theory was first presented
by Benzmüller [17, 18]. This calculus was mainly theoretically motivated and
extended a resolution calculus with a paramodulation rule instead of being based
on a paramodulation rule alone. Additionally, that calculus contained a rule
that expanded equality literals by their definition due to Leibniz.5 As Leibniz
equality formulas effectively enable cut-simulation [23], the proposed calculus
seems unsuited for automation. The calculus EP presented in the following,
in contrast, avoids the expansion of equality predicates but adapts the use of
dedicated calculus rules for extensionality principles from Benzmüller [18].
    An equation, denoted s ' t, is a pair of HOL terms of the same type, where
' is assumed to be symmetric (i.e., s ' t represents both s ' t and t ' s). A
literal ` is a signed equation, written [s ' t]α , where α ∈ {tt, ff} is the polarity
of `. Literals of form [so ]α are shorthand for [so ' >]α , and negative literals
[s ' t]ff are also referred to as unification constraints. A negative literal ` is
called a flex-flex unification constraint if ` is of the form [X si ' Y tj ]ff , where
X, Y are variables. A clause C is a multiset of literals, denoting its disjunction.
For brevity, if C, D are clauses and ` is a literal, C ∨ ` and C ∨ D denote the
multi-union C ∪ {`} and C ∪ D, respectively. s|π is the subterm of s at position
π, and s[r]π denotes the term that is obtained by replacing the subterm of s at
position π by r; α-conversion is applied implicitly whenever necessary to avoid
variable capture.
    The EP calculus can be divided into four groups of inference rules:
Clause normalization. The clausification rules of EP are mostly standard,
    cf. Fig. 1. Every non-normal clause is transformed into an equisatisfiable
    set of clauses in CNF. Multiple conclusions are written one below the
    other. Note that the clausification rules are proper inference rules rather
    than a dedicated meta operation. This is due to the fact that non-CNF
    clauses may be generated from the application of the remaining inferences
    rules, hence renormalization during proof search may be necessary. In the
    following we use CNF to refer to the entirety of the CNF rules.
   4 As a simple counterexample, consider a (strict) term ordering  for HOL terms that

satisfies the usual properties from first-order superposition (e.g., the subterm property) and
is compatible with β-reduction. For any nonempty signature Σ, c ∈ Σ, the chain c ≡β
(λX. c) c  c can be constructed, implying c  c and thus contradicting irreflexivity of .
Note that (λX. c) c  c since the right-hand side is a proper subterm of the left-hand side
(assuming an adequately lifted definition of subterm property to HO terms).
   5 The Identity of Indiscernibles (also known as Leibniz’s law) refers to a principle first

formulated by Gottfried Leibniz in the context of theoretical philosophy [71]. The principle
states that if two objects X and Y coincide on every property P , then they are equal, i.e.
∀Xτ . ∀Yτ . (∀Poτ .P X ⇔ P Y ) ⇒ X = Y , where ”=” denotes the desired equality predicate.
Since this principle can easily be formulated in HOL, it is possible to encode equality in
higher-order logic without using the primitive equality predicate. An extensive analysis of the
intricate differences between primitive equality and defined notions of equality is presented by
Benzmüller et al. [22] to which the authors refer for further details.

                                               6
Clausification rules

     C ∨ [(lτ = rτ ) ' >]α                                       C ∨ [¬so ]α
                                    (LiftEq)                                     (CNFNeg)
        C ∨ [lτ ' rτ ]α                                          C ∨ [so ]α

                                                             C ∨ [so ∨ to ]ff
        C ∨ [so ∨ to ]tt                                                            (CNFConj)
                                (CNFDisj)                         C ∨ [so ]ff
       C ∨ [so ]tt ∨ [to ]tt
                                                                  C ∨ [to ]ff
       C ∨ [∀Xτ . so ]tt                                  C ∨ [∀Xτ . so ]ff
                                (CNFAll)†                                               (CNFExists)‡
      C ∨ [so {Z/X}]tt                              C ∨ [so {sk fv(C)/X}]ff
        †: where Zτ is fresh for C               ‡: where sk is a new constant of appropriate type

  Primary inference rules

                           C ∨ [sτ ' tτ ]α             D ∨ [lν ' rν ]tt             †
                                                                           (Para)
                               [s[r]π '   t]α   ∨ C ∨ D ∨ [s|π ' l]ff

                                C ∨ [sτ ' tτ ]α ∨ [uτ ' vτ ]α
                                                                                (EqFac)
                        C ∨ [sτ ' tτ ]α ∨ [sτ ' uτ ]ff ∨ [tτ ' vτ ]ff

                                                          {¬,∨}∪{Πν , =ν | ν∈T }
                     C ∨ [Hτ siτ i ]α            G ∈ GBτ
                                                                                        (PS)
                                   C ∨ [Hτ siτ i ]α ∨ [H ' G]ff

                                                             †: if s|π is of type ν and fv(s|π ) ⊆ fv(s)

              Figure 1: Extensionality and unification rules of EP.

     For the elimination of existential quantifiers, see rule (CNFExists) in
     Fig. 1, the sound Skolemization technique of Miller [75, 76] is assumed.

Primary inferences. The primary inference rules of EP are paramodulation
    (Para), equality factoring (EqFac) and primitive substitution (PS), cf.
    Fig. 1.
     The paramodulation rule (Para) replaces subterms of literals within clauses
     by (potentially) equal terms given from a positive equality literal. Since
     the latter clause might not be a unit clause, the rewriting step can be con-
     sidered conditional where the remaining literals represent the respective
     additional conditions. Factorization (EqFac) contracts two literals that
     are semantically overlapping (i.e., one is more general than the other)
     but not syntactically equal. This reduces the size of the clause, given
     that the unification of the respective two literals is successful. These
     two rules introduce unification constraints that are encoded as negative
     equality literals: A generating inference is semantically justified if the uni-
     fication constraint(s) can be solved. Since higher-order unification is not
     decidable, these constraints are explicitly encoded into the result clause
     for subsequent analysis. Note that a resolution inference between clauses
     C ≡ C 0 ∨ [p]tt and D ≡ D0 ∨ [p]ff can be simulated by the (Para) rule

                                                      7
as the literals [p]α are actually shorthands for [p ' >]α and the clause
      [> ' >]ff ∨ C 0 ∨ D0 ∨ [p ' p]ff , which eventually simplifies to C 0 ∨ D0 , is
      generated.
      Moreover, note that both (Para) and (EqFac) are unordered and produce
      numerous redundant clauses. In practice, Leo-III tries to remedy this
      situation by using heuristics to restrict the number of generated clauses,
      including a higher-order term ordering, cf. §4. Such heuristics, e.g., pre-
      vent redundant paramodulation inferences between positive propositional
      literals in clauses C ∨ [p]tt and D ∨ [q]tt .
      The primitive substitution inference (PS) approximates the logical struc-
      ture of literals with flexible heads. In contrast to early attempts that
      blindly guessed a concrete instance of head variables, (PS) uses so-called
      general bindings, denoted GB tτ [33, §2], to step-wise approximate the in-
      stantiated term structure and hence limit the explosive growth of primitive
      substitution. Nevertheless, (PS) still enumerates the whole universe of
      terms but, in practical applications, often few applications of the rule are
      sufficient to find a refutation. An example where primitive substitution is
      necessary is the following: Consider a clause C given by C ≡ [Po ]tt where P
      is a Boolean variable. This clause corresponds to the formula ∀Po . P which
      is clearly not a theorem. Neither (Para) nor (EqFac) or any other calculus
      rules presented so far or further below (except for (PS)) allow to con-
      struct a derivation to the empty clause. However, using (PS), there exists
      a derivation [P ]tt `(PS),(Bind) [¬P 0 ]tt `CNFNeg [P 0 ]ff . Note that {¬P 0 /P } is
                                                                          τ  τ
      a substitution applying a general binding from GB o{¬,∨}∪{Π ,= | τ ∈T } that
      approximates logical negation. Now, a simple refutation involving [P ]tt
      and [P 0 ]ff can be found.
Extensionality rules. The rules (NBE) and (PBE) – for negative resp. posi-
    tive Boolean extensionality – as well as (NFE) and (PFE) – for negative
    resp. positive functional extensionality – are the extensionality rules of
    EP, cf. Fig. 2.
      While the functional extensionality rules gradually ground the literals to
      base types and provide witnesses for the (in-)equality of function symbols
      to the search space, the Boolean extensionality rules enable the application
      of clausification rules to the Boolean-typed sides of the literal, thereby
      lifting them into semantical proof search. These rules eliminate the need
      for explicit extensionality axioms in the search space, which would enable
      cut-simulation [23] and hence drastically hamper proof search.
Unification. The unification rules of EP are a variant of Huet’s unification
     rules and presented in Fig. 2. They can be eagerly applied to the unifica-
     tion constraints in clauses. In an extensional setting, syntactical search for
     unifiers and semantical proof search coincide, and unification transforma-
     tions are regarded proper calculus rules. As a result, the unification rules
     might only partly solve (i.e., simplify) unification constraints and unifi-
     cation constraints themselves are eligible to subsequent inferences. The
     bundled unification rules are referred to as UNI.
A set Φ of sentences has a refutation in EP, denoted Φ ` , iff the empty clause
can be derived in EP. A clause is the empty clause, written , if it contains no

                                            8
Extensionality rules

             C ∨ [so ' to ]tt                                        C ∨ [so ' to ]ff
                                      (PBE)                                                 (NBE)
            C ∨ [so ]tt ∨ [to ]ff                                   C ∨ [so ]tt ∨ [to ]tt
            C ∨ [so ]ff ∨ [to ]tt                                   C ∨ [so ]ff ∨ [to ]ff

         C ∨ [sντ ' tντ ]tt                                       C ∨ [sντ ' tντ ]ff
                                      (PFE)†                                                (NFE)‡
        C ∨ [s Xτ ' t Xτ ]tt                                   C ∨ [s skτ ' t skτ ]ff

   †: where Xτ is fresh for C           ‡: where skτ is a new Skolem term for C ∨ [sντ ' tντ ]ff

  Unification rules

             C ∨ [sτ ' sτ ]ff                                       C ∨ [Xτ ' sτ ]ff
                              (Triv)                                                   (Bind)†
                    C                                                    C{s/X}

                                      C ∨ [c si ' c ti ]ff
                                                                        (Decomp)
                           C∨   [s1   ' t1 ]ff ∨ . . . ∨ [sn ' tn ]ff
                                                                        {c}
                    C ∨ [Xνµ si ' cντ tj ]ff              gνµ ∈ GBνµ
                                                                              (FlexRigid)
                        C ∨ [Xνµ si ' cντ tj ]ff ∨ [X ' g]ff
                                                                        {h}
                   C ∨ [Xνµ si ' Yντ tj ]ff               gνµ ∈ GBνµ
                                                                              (FlexFlex)‡
                        C ∨ [Xνµ si ' Yντ tj ]ff ∨ [X ' g]ff

                                         †: where Xτ ∈
                                                     / fv(s)              ‡: where h ∈ Σ is a constant

      Figure 2: Primary inference rules and extensionality rules of EP.

or only flex-flex unification constraints. This is motivated by the fact that flex-
flex unification problems can always be solved, and hence any clause consisting
of only flex-flex constraints is necessarily unsatisfiable [64].
Theorem 1 (Soundness and Completeness of EP). EP is sound and refuta-
tionally complete for HOL with Henkin semantics.
Proof. Soundness is guaranteed by [89, Theorem 3.8]. For completeness, the
following argument is used (cf. [89, §3] for the detailed definitions and notions):
By [89, Lemma 3.24] the set of sentences that cannot be refuted in EP is an
abstract consistency class [89, Def. 3.11], and by [89, Lemma 3.17] this abstract
consistency class can be extended to a Hintikka set. The existence of a Henkin
model that satisfies this Hintikka set is guaranteed by [92, Theorem 5].
   An example for a refutation in EP is given in the following:
Example 1 (Cantor’s Theorem). Cantor’s Theorem states that, given a set
A, the power set of A has a strictly greater cardinality than A itself. The core
argument of the proof can be formalized as follows:

                                ¬∃foιι . ∀Yoι . ∃Xι . f X = Y                                        (C)

Formula C states that there exists no surjective function f from a set to its power
set. A proof of C in EP makes use of functional extensionality, Boolean exten-

                                                     9
sionality, primitive substitution as well as nontrivial higher-order pre-unification;
it is given below.
    By convention, the application of a calculus rule (or of a compound rule)
is stated with the respective premise clauses enclosed in parentheses after the
rule name. For rule (PS), the second argument describes which general binding
was used for the instantiation; e.g., PS(C, GB tτ ) denotes an instantiation with
an approximation of term t for goal type τ .6

  CNF(¬C) :              C1 :      [sk 1   (sk 2 X 1 ) ' X 1 ]tt
  PFE(C1 ) :             C2 :      [sk 1   (sk 2 X 1 ) X 2 ' X 1 X 2 ]tt
  PBE(C2 ) :             C3 :      [sk 1   (sk 2 X 1 ) X 2 ]tt ∨ [X 1 X 2 ]ff
                         C4 :      [sk 1   (sk 2 X 3 ) X 4 ]ff ∨ [X 3X 4 ]tt
  PS(C3 , GB ¬
             oι ), CNF : C5 :      [sk 1    sk 2 (λZι . ¬(X 5 Z)) X 2 ]tt ∨ [X 5 X 2 ]tt
  PS(C4 , GB ¬
             oι ), CNF : C6 :      [sk 1    sk 2 (λZι . ¬(X 6 Z)) X 4 ]ff ∨ [X 6 X 4 ]ff
                                   [sk 1    sk 2 λZι . ¬(sk 1 Z Z) sk 2 λZι . ¬(sk 1 Z Z)]tt
                                                                                          
  EqFac(C5 ), UNI :      C7 :
  EqFac(C6 ), UNI :      C8 :      [sk 1    sk 2 λZι . ¬(sk 1 Z Z) sk 2 λZι . ¬(sk 1 Z Z) ]ff
  Para(C7 , C8 ), UNI : 

The Skolem symbols sk 1 and sk 2 used in the above proof have type oιι and ι(oι),
respectively and the X i denote fresh free variables of appropriate type. A unifier
σC7 generated by UNI for producing C7 is given by (analogously for C8 ):
                   n                                                  o
             σC7 ≡ sk 2 λZι . ¬(sk 1 Z Z) /X 2 , λZι . sk 1 Z Z /X 5
                                                               

                                                     
Note that, together with the substitution σC3 ≡ λZι . ¬(X 5 Z)/X 1 generated
by approximating ¬oo via (PS) on C3 , the free variable X 1 in C1 is instantiated
by σC7 ◦ σC3 (X 1 ) ≡ λZι . ¬(sk 1 Z Z). Intuitively, this instantiation encodes the
diagonal set of sk 1 , given by {x | x ∈
                                       / sk 1 (x)}, as used in the traditional proofs
of Cantor’s Theorem; see, e.g., Andrews [8].
   The TSTP representation of Leo-III’s proof for this problem is presented in
Fig. 6.

3.2      Extended Calculus
As indicated further above, Leo-III targets automation of HOL with Henkin
semantics and choice. The calculus EP from §3.1, however, does not address
choice. To this end, Leo-III implements several additional calculus rules that
either accommodate further reasoning capabilities (e.g. reasoning with choice)
or address the inevitable explosive growth of the search space during proof search
(e.g. simplification routines). The latter kind of rules are practically motivated,
partly heuristic, and hence primarily target technical issues that complicate
   6 The set GB t of approximating/partial bindings parametric to a type τ = βαn . . . α1 (for
                  τ
n ≥ 0) and to a constant t of type βγ m . . . γ 1 (for m ≥ 0) is defined as follows (for further
details see also [88]): Given a “name” k (where a name is either a constant or a variable)
of type βγ m . . . γ 1 , the term l having form λXα 1 . . . . λX n .(k r 1 . . . r m ) is a partial binding
                                                     1          αn
            n       1
of type βα . . . α and head k. Each r       i≤m  has form H i Xα  1 . . . X n where H i≤m are fresh
                                                                   1         αn
variables typed γ i≤m αn . . . α1 . Projection bindings are partial bindings whose head k is one of
X i≤l . Imitation bindings are partial bindings whose head k is identical to the given constant
symbol t in the superscript of GBtτ . GBtτ is the set of all projection and imitation bindings
modulo type τ and constant t. In our example derivation we twice use imitation bindings of
form λXι .¬(Hoι Xι ) from GB¬     oι .

                                                   10
effective automation in practice. Note that no completeness claims are made
for the extended calculus with respect to HOL with choice. Furthermore, some
of the below features of Leo-III are unsound with respect to HOL without choice.
Since, however, Leo-III is designed as a prover for HOL with choice, this is not
a concern here.
    The additional rules address the follows aspects (see an earlier paper [91]
and Steen’s doctoral thesis [89] for details and examples):

Improved clausification. Leo-III employs definitional clausification [106] to
    reduce the number of clauses created during clause normalization. More-
    over, miniscoping is employed prior to clausification.

Clause contraction. Leo-III implements equational simplification procedures,
    including subsumption, destructive equality resolution, heuristic rewriting
    and contextual unit cutting (simplify-reflect) [85].
Defined equalities. Common notions of defined equality predicates (Leibniz
     equality, Andrews equality) are heuristically replaced with primitive equal-
     ity predicates.
Choice. Leo-III implements additional calculus rules for reasoning with choice.
Function synthesis. If plain unification fails for a set of unification constraints,
    Leo-III may try to synthesize functions that meet the specifications rep-
    resented by the unification constraint. This is done using special choice
    instances that simulate if-then-else terms which explicitly enumerate the
    desired input output relation of that function. In general, this rule tremen-
    dously increases the search space, but it also enables Leo-III to solve some
    hard problems with TPTP rating 1.0 that were not solved by any ATP
    system before.

Injective functions. Leo-III addresses improved reasoning with injective func-
     tions by postulating the existence of left inverses for function symbols that
     are inferred to be injective, see also below.
Further rules. Prior to clause normalization, Leo-III might instantiate univer-
     sally quantified variables with heuristically chosen terms. This includes
     the exhaustive instantiation of finite types (such as o, oo, etc.) as well as
     partial instantiation for other interesting types (such as oτ for some type
     τ ).

The addition of the above calculus rules to EP in Leo-III enables the system to
solve various problems that can otherwise not be solved (in reasonable resource
limits). An example problem that could not be solved by any higher-order ATP
system before is the following, cf. [6, Problem X5309]:

Example 2 (Cantor’s Theorem, revisited). Another possibility to encode Can-
tor’s theorem is by using a formulation based on injectivity:

                                                                       (C0 )
                                                                
                 ¬ ∃fι(oι) . ∀Xoι . ∀Yoι . (f X = f Y ) ⇒ X = Y

Here, the nonexistence of an injective function from a set’s power set to the
original set is postulated. This conjecture can easily be proved using Leo-III’s

                                        11
injectivity rule (INJ) that, given a fact stating that some function symbol f is
injective, introduces the left inverse of f , say f inv , as fresh function symbol to
the search space. The advantage is that f inv is then available to subsequent in-
ferences and can act as an explicit evidence for the (assumed) existence of such
a function which is then refuted. The full proof of C0 is as follows:

CNF(¬C0 ) :                  C0 :   [sk X 1 ' sk X 2 ]ff ∨ [X 1 ' X 2 ]tt
PFE(C0 ) :                   C1 :   [sk X 1 ' sk X 2 ]ff ∨ [X 1 X 3 ' X 2 X 3 ]tt
INJ(C0 ) :                   C2 :   [sk inv (sk X 4 ) ' X 4 ]tt
PFE(C2 ) :                   C3 :   [sk inv (sk X 4 ) X 5 ' X 4 X 5 ]tt
Para(C3 , C1 ) :             C4 :   [sk X 1 ' sk X 2 ]ff ∨ [X 1 X 3 ' X 4 X 5 ]tt ∨
                                    [sk inv (sk X 4 ) X 5 '      2   3 ff
                                                             X 6 X 3]
                                        inv
UNI(C4 ) :                   C5 :   [sk      sk (X X ) (X X ) ' X 7 X 3 (X 6 X 3 )]tt
                                                    7   3
                                        inv
PBE(C3 ) :                   C6 :   [sk     (sk X 4 ) X 5 ]ff ∨ [X 4 X 5 ]tt
PS(C6 , GB ¬
           oι ), CNF :       C7 :   [sk inv
                                            (sk (λZι . ¬(X 6 Z))) X 5 ]ff ∨ [X 6 X 5 ]ff
                                        inv
                                             sk λZι . ¬(sk inv Z Z) sk λZι . ¬(sk inv Z Z)]ff
                                                                                           
EqFac(C7 ), UNI, CNF :       C8 :   [sk
Para(C5 , C8 ), UNI, CNF :   C9 :   [sk inv sk λZι . ¬(sk inv Z Z) sk λZι . ¬(sk inv Z Z) ]tt
Para(C9 , C8 ), UNI :        
The introduced Skolem symbol sk is of type ι(oι) and its (assumed) left inverse,
denoted sk inv of type oιι, is inferred by (INJ) based on the injectivity specification
given by clause C0 . The inferred property of sk inv is given by C2 . The injective
Cantor Theorem is part of the TPTP library as problem SYO037^1 and could
not be solved by any existing HO ATP system before.

4     System Architecture and Implementation
As mentioned before, the main goal of the Leo-III prover is to achieve effective
automation of reasoning in HOL, and, in particular, to address the shortcom-
ings of resolution-based approaches when handling equality. To that end, the
implementation of Leo-III uses the complete EP calculus presented in §3 as a
starting point, and furthermore implements the rules from §3.2. Although EP is
still unordered and Leo-III therefore generally suffers from the same drawbacks
as experienced in first-order paramodulation, including state space explosions
and a prolific proof search, the idea is to use EP anyway as a basis for Leo-
III and to pragmatically tackle the problems with additional calculus rules (cf.
§3.2), and optimizations and heuristics on the implementation level. As a fur-
ther technical adjustment, the term representation data structures of Leo-III
do not assume primitive equality to be the only primitive logical connective.
While this is handy from a theoretical point of view, an explicit representation
of further primitive logical connectives is beneficial from a practical side.
     An overview of Leo-III’s top level architecture is displayed in Fig. 3. After
parsing the problem statement, a symbol-based relevance filter adopted from
Meng and Paulson [74] is employed for premise selection. The input formulas
that pass the relevance filter are translated into polymorphically typed λ-terms
(Interpreter) and are then passed to the Proof Search component. In this com-
ponent, the main top-level proof search algorithm is implemented. Subsequent
to initial pre-processing, this algorithm repeatedly invokes procedures from a
dedicated component, denoted Control, that acts as a facade to the concrete
calculus rules, and moreover manages, selects and applies different heuristics

                                                12
Figure 3: Schematic diagram of Leo-III’s architecture. The arrows indicate
directed information flow. The external reasoners are executed asynchronously
(non-blocking) as dedicated processes of the operating system.

that may restrict or guide the application of the calculus rules. These decisions
are based on current features of the proof search progress and user-provided
parameter values; such information is bundled in a dedicated State object. If
the proof search is successful, the Proof Search component may output a proof
object that is constructed by the Control module on request. Indexing data
structures are employed for speeding up frequently used procedures.
    Note that the proof search procedure itself does not have direct access to the
Calculus module in Fig. 3: Leo-III implements a layered multi-tier architecture
in which lower tiers (e.g. the Calculus component) are only accessed through
a higher tier (e.g. the Control). This allows for a modular and more flexible
structure in which single components can be replaced or enriched without ma-
jor changes to others. It furthermore improves maintainability as individual
components implement fewer functionality (separation of concerns). Following
this approach, the Calculus component merely implements the inference rules
of Leo-III’s calculus but it does not specify when to apply them, nor does it
provide functionality to decide whether individual calculus rules should be ap-
plied in a given situation (e.g. with respect to some heuristics). The functions
provided by this module are low-level; invariantly, there are approximately as
many functions in the Calculus module as there are inference rules. The Con-
trol component, in contrast, bundles certain inference rule applications with
simplification routines, indexing data structure updates, and heuristic decision
procedures in single high-level procedures. These procedures are then invoked
by the Proof Search which passes its current search state as an argument to the
calls. The State component is then updated accordingly by the Proof Search
using the results of such function calls. The Proof Search module implements a
saturation loop that is discussed further below.
    Leo-III makes use of external (mostly first-order) ATP systems for discharg-
ing proof obligations. If any external reasoning system finds the submitted proof
obligation to be unsatisfiable, the original HOL problem is unsatisfiable as well
and a proof for the original conjecture is found. Invocation, translation and
utilization of the external results are also bundled by the Control module, cf.

                                       13
further below for details.

4.1    Proof search
The overall proof search procedure of Leo-III consists of three consecutive phases:
preprocessing, saturation and proof reconstruction.
    During preprocessing, the input formulas are transformed into a fully
Skolemized βη-normal clausal normal form. In addition, methods including def-
inition expansion, simplification, miniscoping, replacement of defined equalities,
and clause renaming [106] are applied, cf. Steen’s thesis for details [89].
    Saturation is organized as a sequential procedure that iteratively saturates
the set of input clauses with respect to EP (and its extensions) until the empty
clause is derived. The clausal search space is structured using two sets U and P
of unprocessed clauses and processed clauses, respectively. Initially, P is empty
and U contains all clauses generated from the input problem. Intuitively, the
algorithm iteratively selects an unprocessed clause g (the given clause) from U .
If g is the empty clause, the initial clause set is shown to be inconsistent and
the algorithm terminates. If g is not the empty clause, all inferences involving
g and (possibly) clauses in P are generated and inserted into U . The resulting
invariant is that all inferences between clauses in P have already been performed.
Since in most cases the number of clauses that can be generated during proof
search is infinite, the saturation process is limited artificially using time resource
bounds that can be configured by the user.
    Leo-III employs a variant of the DISCOUNT [54] loop that has its intellectual
roots in the E prover [85]. Nevertheless, some modifications are necessary to
address the specific requirements of reasoning in HOL. Firstly, since formulas
can occur within subterm positions and, in particular, within proper equalities,
many of the generating and modifying inferences may produce non-CNF clauses
albeit having proper clauses as premises. This implies that, during a proof loop
iteration, potentially every clause needs to be renormalized. Secondly, since
higher-order unification is undecidable, unification procedures cannot be used as
an eager inference filtering mechanism (e.g., for paramodulation and factoring)
nor can they be integrated as an isolated procedure on the meta-level as done
in first-order procedures. As opposed to the first-order case, clauses that have
unsolvable unification constraints are not discarded but nevertheless inserted
into the search space. This is necessary in order to retain completeness.
    If the empty clause was inferred during saturation and the user requested a
proof output, a proof object is generated using backwards traversal of the respec-
tive search subspace. Proofs in Leo-III are presented as TSTP refutations [97],
cf. §4.4 for details.

4.2    Polymorphic Reasoning
Proof assistants such as Isabelle/HOL [79] and Coq [37] are based on type sys-
tems that extend simple types with, e.g., polymorphism, type classes, dependent
types and further type concepts. Such expressive type systems allow structuring
knowledge in terms of reusability and are of major importance in practice.
   Leo-III supports reasoning in first-order and higher-order logic with rank-1
polymorphism. The support for polymorphism has been strongly influenced by
the recent development of the TH1 format for representing problems in rank-1

                                         14
polymorphic HOL [67], extending the standard THF syntax [100] for HOL. The
extension of Leo-III to polymorphic reasoning does not require modifications
of the general proof search process as presented further above. Also, the data
structures of Leo-III are already expressive enough to represent polymorphic
formulas, cf. technical details in earlier work [94].
    Central to the polymorphic variant of Leo-III’s calculus is the notion of type
unification. Type unification between two types τ and ν yields a substitution
σ such that τ σ ≡ νσ, if such a substitution exists. The most general type
unifier is then defined analogously to term unifiers. Since unification on rank-1
polymorphic types is essentially a first-order unification problem, it is decidable
and unitary, i.e., it yields a unique most general unifier if one exists. Intuitively,
whenever a calculus rule of EP requires two premises to have the same type, it
then suffices in the polymorphic extension of EP to require that the types are
unifiable. For a concrete inference, the type unification is then applied first to
the clauses, followed by the standard inference rule itself.
    Additionally, Skolemization needs to be adapted to account for free type
variables in the scope of existentially quantified variables. As a consequence,
Skolem constants that are introduced, e.g., during clausification are polymor-
phically typed symbols sk that are applied to the free type variables αi followed
by the free term variables X i , yielding the final Skolem term (sk αi X i ), where
sk is the fresh Skolem constant. A similar construction is used for general bind-
ings that are employed by primitive substitution or projection bindings during
unification. A related approach is employed by Wand in the extension of the
first-order ATP system SPASS to polymorphic types [103].
    A full investigation of the formal properties of these calculus extensions to
polymorphic HOL is further work.

4.3    External Cooperation
Leo-III’s saturation procedure periodically requests the invocation of external
reasoning systems at the Control module for discharging proof obligations that
originate from its current search space. Upon request the Control module checks,
among other things, whether the set of processed clauses P changed significantly
since the last request. If this is the case and the request is granted, the search
space is enqueued for submission to external provers. If there are no external
calls awaiting to be executed, the request is automatically granted. This process
is visualized in Fig. 4. The invocation of an external ATP system is executed
asynchronously (non-blocking), hence the internal proof search continues while
awaiting the result of the external system. Furthermore, as a consequence of
the non-blocking nature of external cooperation, multiple external reasoning
systems (or multiple instances of the same) may be employed in parallel. To that
end, a dedicated I/O driver is implemented that manages the asynchronous
calls to external processes and collects the incoming results.
    The use of different external reasoning systems is also challenging from a
practical perspective: Different ATP systems support different logics and fur-
thermore different syntactical fragments of these logics. This is addressed in Leo-
III using an encoding module (cf. Encoder in Fig. 3 resp. Fig. 4) that translates
the polymorphically typed higher-order clauses to monomorphic higher-order
formulas, or to polymorphic or monomorphic typed first-order clauses. It also
removes unsupported language features and replaces them with equivalent for-

                                         15
Figure 4: Invocation of external reasoning systems during proof search. The
solid arrows denote data flow through the respective modules of Leo-III. A
dotted line indicates indirect use of auxiliary information. Postponed calls are
selected by the I/O driver after termination of outstanding external calls.

mulations. Fig. 5 displays the translation pipeline of Leo-III for connecting
to external ATP systems. The Control module of Leo-III will automatically
select the encoding target to be the most expressive logical language that is
still supported by the external system [95]. The translation process combines
heuristic monomorphization [46, 42] steps with standard encodings of higher-
order language features [73] in first-order logic. For some configurations there
are multiple possible approaches (e.g., either monomorphize from TH1 to TH0
and then encode to TF1, or encode directly to TF1), in these cases a default is
fixed but the user may chose otherwise via command-line parameters.
     While LEO-II relied on cooperation with untyped first-order provers, Leo-
III aims at exploiting the relatively young support of simple types in first-
order ATP systems. As a consequence, the translation of higher-order proof
obligations does not require the encoding of types as terms, e.g., by type guards
or type tags [52, 42]. This approach reduces clutter and hence promises more
effective cooperation. Cooperation within Leo-III is by no means limited to first-
order provers. Various different systems, including first-order and higher-order
ATP systems and model finders, can in fact be used simultaneously, provided
that they comply with some common TPTP language standard. Supported
TPTP languages for external cooperation include the TPTP dialects TF0 [101],
TF1 [44], TH0 [100] and TH1 [67].

4.4    Input and Output
Leo-III accepts all common TPTP dialects [99], including untyped clause normal
form (CNF), untyped and typed first-order logic (FOF and TFF, respectively)
and, as primary input format, monomorphic higher-order logic (THF) [100].
Additionally, Leo-III is one of the first higher-order ATP systems to support
reasoning in rank-1 polymorphic variants of these logics using the TF1 [44] and
TH1 [67] languages.
    Leo-III rigorously implements the machine-readable TSTP result stan-
dard [97] and hence outputs appropriate SZS ontology values [98]. The use
of the TSTP output format allows for simple means of communication and ex-

                                       16
Figure 5: Translation process in the encoder module of Leo-III. Depending on
the supported logic fragments of the respective external reasoner, the clause set
is translated to different logic formalism: Polymorphic HOL (TH1), monomor-
phic HOL (TH0), polymorphic first-order logic (TF1) or monomorphic (many-
sorted) first-order logic (TF0).

change of reasoning results between different reasoning tools and, consequently,
eases the employment of Leo-III within external tools. Novel to the list of sup-
ported SZS result values for the Leo prover family is ContradictoryAxioms [98],
which is reported if the input axioms were found to be inconsistent during the
proof run (i.e., if the empty clause could be derived without using the conjecture
even once). Using this simple approach, Leo-III identified 15 problems from the
TPTP library to be inconsistent without any special setup.
    Additional to the above described SZS result value, Leo-III produces ma-
chine readable proof certificates if a proof was found and such a certificate has
been requested. Proof certificates are an ASCII encoded, linearized, directed
acyclic graph (DAG) of inferences that refutes the negated input conjecture by
ultimately generating the empty clause. The root sources of the inference DAG
are the given conjecture (if any) and all axioms that have been used in the refu-
tation. The proof output records all intermediate inferences. The representation
again follows the TSTP format and records the inferences using annotated THF
formulas. Due to the fine granularity of Leo-III proofs, it is often possible to
verify them step-by-step using external tools such as GDV [96]. A detailed de-
scription of Leo-III’s proof output format and the information contained therein
can be found in Steen’s PhD thesis [89, §4.5]. An example of such a proof output
is displayed in Fig. 6.

4.5    Data Structures
Leo-III implements a combination of term representation techniques; term data
structures are provided that admit expressive typing, efficient basic term oper-
ations and reasonable memory consumption [32]. Leo-III employs a so-called
spine notation [50], which imitates first-order-like terms in a higher-order set-
ting. Here, terms are either type abstractions, term abstractions or applications
of the form f ·(s1 ; s2 ; . . .), where the head f is either a constant symbol, a bound
variable or a complex term, and the spine (s1 ; s2 ; . . .) is a linear list of arguments
that are, again, spine terms. Note that if a term is β-normal, f cannot be a com-
plex term. This observation leads to an internal distinction between β-normal
and (possibly) non-β-normal spine terms. The first kind has an optimized rep-
resentation, where the head is only associated with an integer representing a
constant symbol or variable.

                                           17
% SZS status Theorem for sur_ cantor_ th1 . p
% SZS output start CNFRefutation for sur_ cantor_t h1 . p
thf ( skt1_type , type , skt1 : $tType ).
thf ( sk1_type , type , sk1 : ( skt1 > ( skt1 > $o ))).
thf ( sk2_type , type , sk2 : (( skt1 > $o ) > skt1 )).
thf (1 , conjecture , ! [ T : $tType ]: (
                                         ~ ( ?[ F : T > ( T > $o )]: (
                                                 ![ Y : T > $o ]: ?[ X : T ]: (( F @ X ) = Y ) ) )) ,
      file ( ’ s ur_canto r_th1 .p ’ , sur_cantor ) ).
thf (2 , negated_conjecture , ~ ! [ T : $tType ]: (
                                         ~ ( ?[ F : T > ( T > $o )]: (
                                                 ![ Y : T > $o ]: ?[ X : T ]: (( F @ X ) = Y ) ) )) ,
      inference ( neg_conjecture ,[ status ( cth )] ,[1]) ).
thf (4 , plain ,! [ A : skt1 > $o ]: ( sk1 @ ( sk2 @ A ) = A ) ,
      inference ( cnf ,[ status ( esa )] ,[2]) ).
thf (6 , plain ,! [ B : skt1 , A : skt1 > $o ]: (( sk1 @ ( sk2 @ A ) @ B ) = ( A @ B )) ,
      inference ( func_ext ,[ status ( esa )] ,[4])).
thf (8 , plain ,! [ B : skt1 , A : skt1 > $o ]: (( sk1 @ ( sk2 @ A ) @ B ) | ~ ( A @ B )) ,
      inference ( bool_ext ,[ status ( thm )] ,[6])).
thf (272 , plain ,! [ B : skt1 , A : skt1 > $o ]: ( sk1 @ ( sk2 @ A ) @ B ) |
                                        (( A @ B ) != ~ ( sk1 @ ( sk2 @ A ) @ B )) | ~ $true ) ,
      inference ( eqfactor_ordered ,[ status ( thm )] ,[8])).
thf (294 , plain , sk1 @ ( sk2 @ (^ [ A : skt1 ]: ~ ( sk1 @ A @ A )))
                          @ ( sk2 @ (^ [ A : skt1 ]: ~ ( sk1 @ A @ A ))) ,
      inference ( pre_uni ,[ status ( thm )] ,[272:[
                    bind (A , $thf (^ [ C : skt1 ]: ~ ( sk1 @ C @ C ))) ,
                    bind (B , $thf ( sk2 @ (^ [ C : skt1 ]: ~ ( sk1 @ C @ C ))))]])).
thf (7 , plain ,! [ B : skt1 , A : skt1 > $o ]: (~ ( sk1 @ ( sk2 @ A ) @ B )) | ( A @ B )) ,
      inference ( bool_ext ,[ status ( thm )] ,[6])).
thf (17 , plain ,! [ B : skt1 , A : skt1 > $o ]: ( (~ ( sk1 @ ( sk2 @ A ) @ B )) |
                                     (( A @ B ) != (~ ( sk1 @ ( sk2 @ A ) @ B ))) | ~ $true ) ,
      inference ( eqfactor_ordered ,[ status ( thm )] ,[7])).
thf (33 , plain ,~ ( sk1 @ ( sk2 @ (^ [ A : skt1 ]: ~ ( sk1 @ A @ A )))
                             @ ( sk2 @ (^ [ A : skt1 ]: ~ ( sk1 @ A @ A )))) ,
      inference ( pre_uni ,[ status ( thm )] ,[17:[
                    bind (A , $thf (^ [ C : skt1 ]: ~ ( sk1 @ C @ C ))) ,
                    bind (B , $thf ( sk2 @ (^ [ C : skt1 ]: ~ ( sk1 @ C @ C ))))]])).
thf (320 , plain , $false , inference ( rewrite ,[ status ( thm )] ,[294 ,33])).
% SZS output end CNFRefutation for sur_can tor_th1 . p

Figure 6: Proof output of Leo-III for the polymorphic variant (TH1 syntax) of
the surjective variant of Cantor’s theorem.

    Additionally, the term representation incorporates explicit substitutions [1].
In a setting of explicit substitutions, substitutions are part of the term language
and can thus be postponed and composed before being applied to the term. This
technique admits more efficient β-normalization and substitution operations as
terms are traversed only once, regardless of the number of substitutions applied.
    Furthermore, Leo-III implements a locally nameless representation using de
Bruijn indices [49]. In the setting of polymorphism [94], types may also contain
variables. Consequently, the nameless representation of variables is extended
to type variables [68]. The definition of de Bruijn indices for type variables is
analogous to the one for term variables. In fact, since only rank-1 polymorphism
is used, type indices are much easier to manage than term indices. This is
due to the fact that there are no type quantifications except for those on top
level. One of the most important advantages of nameless representations over
representations with explicit variable names is that α-equivalence is reduced to
syntactical equality, i.e., two terms are α-equivalent if and only if their nameless
representations are equal.
    Terms are perfectly shared within Leo-III, meaning that each term is only
constructed once and then reused between different occurrences. This reduces

                                                 18
You can also read