<!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>TFX: The TPTP Extended Typed First-Order Form</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Geoff Sutcliffe</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Evgenii Kotelnikov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Chalmers University of Technology</institution>
          ,
          <country country="SE">Sweden</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Miami</institution>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <fpage>72</fpage>
      <lpage>87</lpage>
      <abstract>
        <p>The TPTP world is a well established infrastructure that supports research, development, and deployment of Automated Theorem Proving systems for classical logics. The TPTP language is one of the keys to the success of the TPTP world. Originally the TPTP world supported only first-order clause normal form (CNF). Over the years support for full first-order form (FOF), monomorphic typed first-order form (TF0), rank-1 polymorphic typed first-order form (TF1), monomorphic typed higher-order form (TH0), and rank-1 polymorphic typed higherorder form (TH1), have been added. TF0 and TF1 together form the TFF language family; TH0 and TH1 together form the THF language family. This paper introduces the eXtended Typed First-order form (TFX), which extends TFF to include boolean terms, tuples, conditional expressions, and let expressions.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        The TPTP world [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] is a well established infrastructure that supports research,
development, and deployment of Automated Theorem Proving (ATP) systems
for classical logics. The TPTP world includes the TPTP problem library, the
TSTP solution library, standards for writing ATP problems and reporting ATP
solutions, tools and services for processing ATP problems and solutions, and
it supports the CADE ATP System Competition (CASC). Various parts of the
TPTP world have been deployed in a range of applications, in both academia and
industry. The web page http://www.tptp.org provides access to all components.
      </p>
      <p>
        The TPTP language is one of the keys to the success of the TPTP world. The
language is used for writing both TPTP problems and TSTP solutions, which
enables convenient communication between different systems and researchers.
Originally the TPTP world supported only first-order clause normal form (CNF)
[
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]. Over the years support for full first-order form (FOF) [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], monomorphic
typed first-order form (TF0) [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ], rank-1 polymorphic typed first-order form
(TF1) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], monomorphic typed higher-order form (TH0) [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], and rank-1
polymorphic typed higher-order form (TH1) [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], have been added. TF0 and TF1
together form the TFF language family; TH0 and TH1 together form the THF
language family. See [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] for a recent review of the TPTP.
      </p>
      <p>
        Since the inception of TFF there have been some features that have received
little use, and hence little attention. In particular, tuples, conditional expressions
(if-then-else), and let expressions (let-defn-in) were neglected, and the latter two
were horribly formulated with variants to distinguish between their use as
formulae and terms. Recently, conditional expressions and let expressions have
become more important because of their use in software verification applications.
In an independent development, Evgenii Kotelnikov et al. introduced FOOL [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ],
an extension of many-sorted first-order logic. FOOL contains (i) an interpreted
boolean type, which allows boolean variables to be used as formulae, and
allows all formulae to be used as boolean terms, (ii) conditional expressions, and
(iii) let expressions. FOOL can be straightforwardly extended with the
polymorphic theory of tuples that defines first class tuple types and terms [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Features
of FOOL can be used to concisely express problems coming from program
analysis [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] or translated from more expressive logics. The conditional expressions
and let expressions of FOOL resemble those of the SMT-LIB language version
2 [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>The TPTP’s new eXtended Typed First-order form (TFX) language remedies
the old weaknesses of TFF, and incorporates the features of FOOL. This has been
achieved by conflating (with some exceptions) formulae and terms, removing
tuples from plain TFF, including fully expressive tuples in TFX, removing the
old conditional expressions and let expressions from TFF, and including new
elegant forms of conditional expressions and let expressions as part of TFX.
(These more elegant forms have been mirrored in THF, but that is not a topic
of this paper.) TFX is a superset of the revised TFF language. This paper
describes the extensions to the TFF language form that define the TFX language.
The remainder of this paper is organized as follows: Section 2 reviews the TFF
language, and describes FOOL. Section 3 provides technical and syntax details
of the new features of TFX. Section 4 describes the evolving software support for
TFX, and provides some examples that illustrate its use. Section 5 concludes.
2</p>
    </sec>
    <sec id="sec-2">
      <title>The TFF Language and FOOL</title>
      <p>The TPTP language is a human-readable, easily machine-parsable, flexible and
extensible language, suitable for writing both ATP problems and solutions. The
top level building blocks of the TPTP language are annotated formulae. An
annotated formula has the form language(name, role, formula, source,
useful_info). The languages supported are clause normal form (cnf), first-order
form (fof), typed first-order form (tff), and typed higher-order form (thf).
The role, e.g., axiom, lemma, conjecture, defines the use of the formula in an
ATP system. In the formula, terms and atoms follow Prolog conventions, i.e.,
functions and predicates start with a lowercase letter or are ’single quoted’,
variables start with an uppercase letter, and all contain only alphanumeric
characters and underscore. The TPTP language also supports interpreted symbols,
which either start with a $, or are composed of non-alphanumeric characters,
e.g., the truth constants $true and $false, and integer/rational/real numbers
such as 27, 43=92, 99:66. The logical connectives are !, ?, ~, |, &amp;, =&gt;, &lt;=, &lt;=&gt;,
and &lt;~&gt;, for 8, 9, :, _, ^, ), (, ,, and respectively. Equality and inequality
are expressed as the infix operators = and !=. The following is an example of an
annotated first-order formula, supplied from a file.
fof(union,axiom,
! [X,A,B] :</p>
      <p>( member(X,union(A,B))
&lt;=&gt; ( member(X,A)</p>
      <p>| member(X,B) ) ),
file(’SET006+0.ax’,union),
[description(’Definition of union’),relevance(0.9)]).
2.1</p>
      <sec id="sec-2-1">
        <title>The Typed First-order Form TFF</title>
        <p>TFF extends the FOF language with types and type declarations. The TF0
variant is monomorphic, and the TF1 variant is rank-1 polymorphic. Every function
and predicate symbol is declared before its use with a type signature that specifies
the types of the symbol’s arguments and result. Each TF0 type is one of
– the predefined types $i for (individuals) and $o for o (booleans);
– the predefined arithmetic types $int (integers), $rat (rationals), and $real
(reals); or
– user-defined types (constants).</p>
        <p>User defined types are declared before their use to be of the kind $tType, in
annotated formulae with the type role - see Figure 1 for examples. Each TF0
type signature declares either
– an individual type ; or
– a function type ( 1 * * n) &gt; ~ for n &gt; 0, where i are the argument
types, and ~ is the result type.</p>
        <p>
          The type signatures of uninterpreted symbols are declared like types, in
annotated formulae with the type role - see Figure 1 for examples. The type of =
and != is ad hoc polymorphic over all types except $o (this restriction is lifted
in TFX), with both arguments having the same type and the result type being
$o. The types of arithmetic predicates and functions are ad hoc polymorphic
over the arithmetic types; see [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ] for details. Figure 1 illustrates some TF0
formulae whose conjecture can be proved from the axioms (it’s the TPTP problem
PUZ130_1.p).
        </p>
        <p>The polymorphic TF1 extends TF0 with (user-defined) type constructors,
type variables, polymorphic symbols, and a new binder. Each TF1 type is one of
– the predefined types $i and $o;
– the predefined arithmetic types $int, $rat, and $real;
– user-defined n-ary type constructors applied to n type arguments; or
– type variables, which must be quantified by !&gt; - see the type signature forms
below.</p>
        <p>Type constructors are declared in annotated formulae with a type role before
their use, to be of the kind ($tType * * $tType) &gt; $tType. Each TF1 type
signature declares either
– an individual type ;
– a function type ( 1 * * n) &gt; ~ for n &gt; 0, where i are the argument
types and ~ is the result type; or
– a polymorphic type !&gt;[ 1: $tType, : : : , n: $tType]: &amp; for n &gt; 0, where
1; : : : ; n are distinct type variables and &amp; is a TF0 type signature.</p>
        <p>
          The !&gt; binder in the last form denotes universal quantification in the style
of calculi. It is used only at the top level in polymorphic type signatures. All
type variables must be of type $tType; more complex type variables are beyond
rank-1 polymorphism. An example of TF1 formulae can be found in [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ].
%-----------------------------------------------------------------------tff(animal_type,type, animal: $tType ).
tff(cat_type,type, cat: $tType ).
tff(dog_type,type, dog: $tType ).
tff(human_type,type, human: $tType ).
tff(cat_to_animal_type,type, cat_to_animal: cat &gt; animal ).
tff(dog_to_animal_type,type, dog_to_animal: dog &gt; animal ).
tff(garfield_type,type, garfield: cat ).
tff(odie_type,type, odie: dog ).
tff(jon_type,type, jon: human ).
tff(owner_of_type,type, owner_of: animal &gt; human ).
tff(chased_type,type, chased: ( dog * cat ) &gt; $o ).
tff(hates_type,type, hates: ( human * human ) &gt; $o ).
tff(human_owner,axiom, ! [A: animal] : ? [H: human] : H = owner_of(A) ).
tff(jon_owns_garfield,axiom, jon = owner_of(cat_to_animal(garfield)) ).
tff(jon_owns_odie,axiom, jon = owner_of(dog_to_animal(odie)) ).
tff(jon_owns_only,axiom,
! [A: animal] :
( jon = owner_of(A)
=&gt; ( A = cat_to_animal(garfield) | A = dog_to_animal(odie) ) ) ).
tff(dog_chase_cat,axiom,
! [C: cat,D: dog] :
( chased(D,C)
=&gt; hates(owner_of(cat_to_animal(C)),owner_of(dog_to_animal(D))) ) ).
tff(odie_chased_garfield,axiom, chased(odie,garfield) ).
tff(jon_hates_jon,conjecture, hates(jon,jon) ).
%-----------------------------------------------------------------------2.2
        </p>
      </sec>
      <sec id="sec-2-2">
        <title>FOOL</title>
        <p>
          FOOL [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ], standing for First-Order Logic (FOL) + bOoleans, is an extension of
many-sorted first-order logic. FOOL contains (i) an interpreted boolean type,
which allows boolean variables to be used as formulae, and allows all formulae
to be used as boolean terms, (ii) conditional expressions, and (iii) let
expressions. FOOL can be straightforwardly extended with the polymorphic theory of
tuples that defines first class tuple types and terms [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. In what follows we
consider that extension, and tuples are part of TFX. There is a model-preserving
transformation of FOOL formulae to many-sorted first-order logic [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ], so that an
implementation of the transformation makes it possible to reason in FOOL using
an existing ATP system for many-sorted first-order logic. Formulae of FOOL can
also be efficiently translated to first-order clause normal form [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]. The following
describes these features of FOOL, illustrating them using examples taken from
[
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] and [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. The complete formal semantics of FOOL is given in [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ].
        </p>
      </sec>
      <sec id="sec-2-3">
        <title>Boolean Terms and Formulae</title>
        <p>FOOL contains an interpreted two-element boolean type bool , allows
quantification over variables of type bool , and considers formulae to be terms of type bool .
This allows boolean variables to be used as formulae, and all formulae to be used
as boolean terms. For example, Formula 1 is a syntactically correct tautology in
FOOL.</p>
        <p>(8x : bool )(x _ :x)
Logical implication can be defined as a binary function imply of the type bool
bool ! bool using the axiom</p>
        <p>(8x : bool )(8y : bool )(imply (x; y) , :x _ y):
A graph P of a (partial) function of the type
!</p>
        <p>can be expressed as
(8x : )(8y : )(8z : )imply (P (x; y) ^ P (x; z); y = z)
(1)
(2)
(3)
Formula 2 can be equivalently written with = instead of ,.</p>
      </sec>
      <sec id="sec-2-4">
        <title>Tuples</title>
        <p>FOOL extended with the theory of tuples contains a type ( 1; : : : ; n) of the
nary tuple for all types 1; : : : ; n, n &gt; 0. Each type ( 1; : : : ; n) is first class, that
is, it can be used in the type of a function or predicate symbol, and in a
quantifier. An expression (t1; : : : ; tn), where t1; : : : ; tn are terms of types 1; : : : ; n,
respectively, is a tuple term of type ( 1; : : : ; n). Each tuple term is first class
and can be used as an argument to a function symbol, a predicate symbol, or
equality.</p>
        <p>Tuples are ubiquitous in mathematics and programming languages. For
example, one can use the tuple type (R; R) as the type of complex numbers. Thus
the term (2; 3) represents the complex number 2+3i. A function symbol plus that
represents addition of complex numbers has the type (R; R) (R; R) ! (R; R).</p>
      </sec>
      <sec id="sec-2-5">
        <title>Conditional Expressions</title>
        <p>FOOL contains conditional expressions of the form if then s else t, where
is a formula, and s and t are terms of the same type. The semantics of such
expressions mirrors the semantics of conditional expressions in programming
languages, and they are therefore convenient for expressing formulae coming
from program analysis. For example, consider the max function of the type
Z Z ! Z that returns the maximum of its arguments. Its definition can be
expressed in FOOL as
(8x : Z)(8y : Z)(max (x; y) = if x
y then x else y):
(4)</p>
        <p>FOOL allows conditional expressions to occur as formulae, as in the following
valid property of max .</p>
        <p>(8x : Z)(8y : Z)(if max (x; y) = x then x
y else y
x)
(5)</p>
      </sec>
      <sec id="sec-2-6">
        <title>Let Expressions</title>
        <p>FOOL contains let expressions of the form let D1; : : : ; Dk in t, where k &gt; 0,
t is either a term or a formula, and D1; : : : ; Dk are simultaneous non-recursive
definitions. FOOL allows definitions of function symbols, predicate symbols, and
tuples.</p>
        <p>The definition of a function symbol f : 1 : : : n ! has the form
f (x1 : 1; : : : ; xn : n) = s, where n 0, x1; : : : ; xn are distinct variables, and
s is a term of the type . For example, the following denotes the maximum of
three integer constants a, b, and c, using a local definition of the function symbol
max .</p>
        <p>let max (x : Z; y : Z) = if x</p>
        <p>y then x else y
in max (max (a; b); c)</p>
        <p>The definition of a predicate symbol p : 1 : : : n ! bool has the form
p(x1 : 1; : : : ; xn : n) = ', where n 0, x1; : : : ; xn are distinct variables, and
' is a formula. For example, the following denotes equivalence of two boolean
constants A and B, using a local definition of the predicate symbol imply .
let imply (x : bool ; y : bool ) = :x _ y</p>
        <p>in imply (A; B) ^ imply (B; A)</p>
        <p>The definition of a tuple has the form (c1; : : : ; cn) = s, where n &gt; 1, c1; : : : ; cn
are distinct constant symbols of the types 1; : : : ; n, respectively, and s is a term
of the type ( 1; : : : ; n). For example, the following defines addition for complex
numbers using two simultaneous local definition of tuples.</p>
        <p>(8x : (R; R))(8y : (R; R))</p>
        <p>(plus(x; y) = let (a; b) = x; (c; d) = y in (a + c; b + d))</p>
        <p>The semantics of let expressions in FOOL mirrors the semantics of
simultaneous non-recursive local definitions in programming languages. That is, none
(6)
(7)
(8)
of the definitions D1; : : : ; Dn uses function or predicate symbols created by any
other definition. In the following example, constants a and b are swapped by a
let expression, and the formula is equivalent to P (b; a).</p>
        <p>let a = b ; b = a in P (a; b)
let (a; b) = (b; a) in P (a; b)</p>
        <p>Formula 9 can be equivalently expressed by the following let expression with
a definition of a tuple.
(9)
(10)</p>
        <p>
          Let expressions with tuple definitions are convenient for expressing problems
coming from program analysis, namely modelling of assignments [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. The left
hand side of Figure 2 shows an example of an imperative if statement containing
assignments to integer variables, and an assert statement. This can be encoded
in FOOL as shown on the right hand side, using let expressions with definitions
of tuples that capture the assignments.
        </p>
        <p>if (x &gt; y) {
t := x;
x := y;
y := t;
}
assert x &lt;= y;
let (x; y; t) = if x &gt; y
then let t = x in
let x = y in
let y = t in</p>
        <p>(x; y; t)
else (x; y; t)
in x</p>
        <p>y
The TPTP TFX syntax extends the TFF syntax to provide the features of
FOOL, and at the same time some of the previous weaknesses of plain TFF
have been remedied. Formulae and terms have been conflated (with some
exceptions). Tuples have been removed from TFF, and fully expressive tuples included
in TFX. The old conditional expressions and let expressions have been removed
from TFF, and new elegant forms have been included as part of TFX. The
grammar of TFX is captured in version v7.1.0.2 of the TPTP syntax, available online
at http://www.tptp.org/TPTP/SyntaxBNF.html. In the subsections below, the
relevant excerpts of the BNF are provided, with examples and commentary.
3.1</p>
      </sec>
      <sec id="sec-2-7">
        <title>Boolean Terms and Formulae</title>
        <p>Variables of type $o can be used as formulae, and formulae can be used as terms.
The following is the relevant BNF excerpt. Formulae and terms are conflated by
including logic/atomic formulae as options for terms/unitary terms. The
distinction between formulae and terms is maintained for plain TFF.
tff(tautology,conjecture, ! [X: $o]: (X | ~X) ).</p>
        <p>The imply predicate in Formula 2 can be written in TFX as
tff(imply_type,type,imply: ($o * $o) &gt; $o ).
tff(imply_defn,axiom,</p>
        <p>! [X: $o,Y: $o]: (imply(X,Y) &lt;=&gt; (~X | Y)) ).</p>
        <p>The definition of a graph of a function in Formula 3 can be written in TFX
as
tff(s,type,s: $tType).
tff(t,type,t: $tType).
tff(p,type,p: (s * t) &gt; $o ).
tff(graph,axiom,</p>
        <p>! [X: s,Y: t,Z: s] : imply(p(X,Y) &amp; p(X,Z),Y = Z) ).</p>
        <p>A consequence of allowing formulae as terms is that the default typing of
functions and predicates supported in plain TFF (functions default to ($i *
...* $i) &gt; $i and predicates default to ($i * ...* $i) &gt; $o) is not
supported in TFX.</p>
        <p>Note that not all terms can be used as formulae. Tuples, numbers, and
“distinct objects” cannot be used as formulae.
3.2</p>
      </sec>
      <sec id="sec-2-8">
        <title>Tuples</title>
        <p>Tuples in TFX are written in [] brackets, and can contain any type of term,
including formulae and variables of type $o. Signatures can contain tuple types.
The following is the relevant BNF excerpt.
&lt;tfx_tuple_type&gt;
&lt;tff_type_list&gt;
&lt;tfx_tuple&gt;
&lt;tff_arguments&gt;
::= [&lt;tff_type_list&gt;]
::= &lt;tff_top_level_type&gt; |</p>
        <p>&lt;tff_top_level_type&gt;,&lt;tff_type_list&gt;
::= [] | [&lt;tff_arguments&gt;]
::= &lt;tff_term&gt; | &lt;tff_term&gt;,&lt;tff_arguments&gt;</p>
        <p>
          The tuple type (R; R) can be written in the TFX syntax as [$real,$real]
and the type of addition for complex numbers (R; R) (R; R) ! (R; R) can be
written as ([$real,$real] * [$real,$real]) &gt; [$real,$real]. The tuple
term (2; 3) can be written as [
          <xref ref-type="bibr" rid="ref2 ref3">2,3</xref>
          ]. Tuples can occur only as non-boolean terms
(i.e., they cannot be formulae), anywhere they are well-typed. In the following
example the predicate p takes a tuple (Z; ; o) as the first argument.
tff(p_type,type,p: ([$int,$i,$o] * $o * $int) &gt; $o ).
tff(q_type,type,q: ($int * $i) &gt; $o ).
tff(me_type,type,me: $i ).
tff(tuples_1,axiom,
        </p>
        <p>! [X: $int] : p([33,me,$true],! [Y: $i] : q(X,Y),27) ).</p>
        <p>While product types and tuple types are semantically equivalent, the two
separate syntaxes make it easy to distinguish between the following cases.
tff(n_type,type,n: [$int,$int]).
tff(f_type,type,f: [$int,$int] &gt; $int).
tff(g_type,type,g: ($int * $int) &gt; $int).
tff(h_type,type,h: ([$int,$int] * $int) &gt; $int).</p>
        <p>The first case defines n to be a tuple of two integers. The second case defines f
to be a function from a tuple of two integers to an integer. The third case defines
g to be a function from two integers to an integer. The last case defines h to be
a function from a tuple of two integers and an integer, to an integer.</p>
        <p>The tuple syntax cannot be used to simultaneously declare types of multiple
constants in an annotated formula with the type role. For example, the following
expression is not valid.
tff(ab_type,type,[a,b]: [$int,$int]).</p>
        <p>Instead, one must declare the type of each constant separately.
tff(a_type,type,a: $int).
tff(b_type,type,b: $int).
3.3</p>
      </sec>
      <sec id="sec-2-9">
        <title>Conditional Expressions</title>
        <p>Conditional expressions are polymorphic, taking a formula as the first argument,
then two formulae or terms of the same type as the second and third arguments.
The type of the conditional expression is the type of its second and third
arguments. The following is the relevant BNF excerpt.
&lt;tfx_conditional&gt;</p>
        <p>::= $ite(&lt;tff_logic_formula&gt;,&lt;tff_term&gt;,&lt;tff_term&gt;)</p>
        <p>The keyword $ite is used for conditional expressions occurring both as terms
and formulae, which is different from the old TFF syntax of if-then-else that
contained two separate keywords $ite_t and $ite_f.</p>
        <p>The definition and a property of the max function in Formulae 4 and 5 can
be expressed in TFX as
tff(max_type,type,max: ($int * $int) &gt; $int).
tff(max_defn,axiom,</p>
        <p>! [X: $int,Y: $int]: max(X,Y) = $ite($greatereq(X,Y),X,Y) ).
tff(max_property,conjecture,
! [X: $int,Y: $int]:</p>
        <p>$ite(max(X,Y) = X,$greatereq(X,Y),$greatereq(Y,X)) ).
3.4</p>
      </sec>
      <sec id="sec-2-10">
        <title>Let Expressions</title>
        <p>Let expressions in TFX contain (i) the type signatures of locally defined symbols;
(ii) the definitions of the symbols; and (iii) the term or formula in which the
definitions are used. The syntax of type signatures in let expressions is the same
as for top-level type declrations. The definitions specify how the locally defined
symbols are expanded in the term or formulae where they are used. The type
signature must include the types for all the local defined symbols. The following
is the relevant BNF excerpt.
&lt;tfx_let&gt; ::= $let(&lt;tfx_let_types&gt;,&lt;tfx_let_defns&gt;,&lt;tff_term&gt;)
&lt;tfx_let_types&gt; ::= &lt;tff_atom_typing&gt; | [&lt;tff_atom_typing_list&gt;]
&lt;tff_atom_typing_list&gt; ::= &lt;tff_atom_typing&gt; |</p>
        <p>&lt;tff_atom_typing&gt;,&lt;tff_atom_typing_list&gt;
&lt;tfx_let_defns&gt; ::= &lt;tfx_let_defn&gt; | [&lt;tfx_let_defn_list&gt;]
&lt;tfx_let_defn&gt; ::= &lt;tfx_let_LHS&gt; &lt;assignment&gt; &lt;tff_term&gt;
&lt;tfx_let_LHS&gt; ::= &lt;tff_plain_atomic&gt; | &lt;tfx_tuple&gt;
&lt;tfx_let_defn_list&gt; ::= &lt;tfx_let_defn&gt; | &lt;tfx_let_defn&gt;,&lt;tfx_let_defn_list&gt;</p>
        <p>The keyword $let is used for let expressions defining both function and
predicate symbols, regardless of whether the let expression occurs as a term or
a formula. This is different from the old TFF syntax of let expressions that
contained four separate keywords $let_tt, $let_tf, $let_ft, and $let_ff.</p>
        <p>In the following example an integer constant c is defined in a let expression.
tff(p_type,type,p: ($int * $int) &gt; $o ).
tff(let_1,axiom,$let(c: $int,c:= $sum(2,3),p(c,c)) ).</p>
        <p>The left hand side of a definition may contain pairwise distinct variables as
top-level arguments of the defined symbol, and the variables can (typically do)
also appear in the right hand side of the definition. Such variables are implicitly
universally quantified, and are of the type defined by the symbol’s type signature.
The variables’ values are supplied by unification in the defined symbol’s use. For
example, the let expression for the maximum of three integers in Formula 4 can
be expressed in TFX as
tff(a_type,type,a: $int).
tff(b_type,type,b: $int).
tff(c_type,type,c: $int).
tff(p_type,type,p: $int &gt; $o ).
tff(max_max,axiom,
$let(max: ($int * $int) &gt; $int,
max(X,Y):= $ite($greatereq(X,Y),X,Y),
p(max(max(a,b),c)) ) ).
and the let expression for the equivalence of two boolean constants in Formula 7
can be expressed in TFX as
tff(p,type,p: $o).
tff(q,type,q: $o).
tff(p_eq_q,axiom,
$let(imply: ($o * $o) &gt; $o,
imply(X,Y):= ~X | Y,
imply(p,q) &amp; imply(q,p)) ).</p>
        <p>Let expressions can use definitions of tuples. Formula 8 can be written in
TFX as follows. Notice that the let expression’s type declarations contain the
elements of both tuples in the simultaneous definition.
tff(plus,type,</p>
        <p>plus: ([$real,$real] * [$real,$real]) &gt; [$real,$real]).
tff(plus_def,axiom,
! [X: [$real,$real],Y: [$real$,$real]] :
( plus(X,Y)
= $let([a: $real,b: $real,c: $real,d: $real],
[[a,b]:= X, [c,d]:= Y],
[$sum(a,c),$sum(b,d)]) ).</p>
        <p>Sequential let expressions (let*) can be implemented by nesting let
expressions. In the following example ff and gg are defined in sequence, and the let
expression is equivalent to p(f(i,i,i,i)).
tff(i_type,type,i: $int).
tff(f_type,type,f: ($int * $int * $int * $int) &gt; $int).
tff(p_type,type,p: $int &gt; $o ).
tff(let_tuple_3,axiom,
$let(ff: ($int * $int) &gt; $int,
ff(X,Y):= f(X,X,Y,Y),
$let(gg: $int &gt; $int,
gg(Z):= ff(Z,Z),
p(gg(i)) ) ) ).</p>
        <p>Let expressions can have simultaneous local definitions with the type
declarations and the definitions given in []s (they look like tuples of declarations
and definitions, but are specified independently of tuples in the syntax). The
symbols must have distinct signatures. For example, the let expression to swap
two constants in Formula 9 can be expressed in TFX as
tff(a,type,a: $i).
tff(b,type,b: $i).
tff(p,type,p: ($i * $i) &gt; $o).
tff(pba,axiom,
$let([a: $i,b: $i],
[a:= b, b:= a],
p(a,b))).
and the equivalent let expression using a tuple in Formula 10 can be expressed
in TFX as
tff(a,type,a: $i).
tff(b,type,b: $i).
tff(p,type,p: ($i * $i) &gt; $o).
tff(pba,axiom,
$let([a: $i,b: $i],
[a,b]:= [b,a],
p(a,b))).</p>
        <p>In the following example two function symbols are defined simultaneously,
and the let expression is equivalent to p(f(i,i,f(i,i,i,i),f(i,i,i,i))).
tff(i_type,type,i: $int).
tff(f_type,type,f: ($int * $int * $int * $int) &gt; $int).
tff(p_type,type,p: $int &gt; $o ).
tff(let_tuple_2,axiom,
$let([ff: ($int * $int) &gt; $int, gg: $int &gt; $int],
[ff(X,Y):= f(X,X,Y,Y), gg(Z):= f(Z,Z,Z,Z)],
p(ff(i,gg(i)))) ).</p>
        <p>The defined symbols of a let expression have scope over the formula or term
in which the definitions are applied, shadowing any definition outside the let
expression. The right hand side of a definition can have symbols with the same
name as the defined symbol, but refer to symbols defined outside the let
expression. In the following example the local definition of the array function symbol
shadows the global declaration.
tff(array_type,type,array: $int &gt; $real).
tff(p_type,type,p: $real &gt; $o).
tff(let_3,axiom,
$let(array: $int &gt; $real,
array(I):= $ite(I = 3,5.2,array(I)),
p($sum(array(2),array(3))) ) ).</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>4 Software Support and Examples</title>
      <sec id="sec-3-1">
        <title>4.1 Software for TFX</title>
        <p>The BNF that defines TFX (and all the TPTP languages) provides the basis
for the BNFParser family of automatically generated lex/yacc parsers for TPTP
files. The parsers are available through the SystemB4TPTP online interface at
http://www.tptp.org/cgi-bin/SystemB4TPTP. At the time of writing this
paper, the TPTP4X utility is being upgraded to support TFX.</p>
        <p>
          The Vampire theorem prover [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] supports all features of FOOL. Vampire
transforms FOOL formulae into a set of first-order clauses using the VCNF
algorithm [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ], and then reasons with these clauses using its usual resolution
calculi for first-order logic. At the time of writing this paper the latest released
version of Vampire, 4.2.2, uses a syntax for FOOL that differs slightly from TFX.
Full support for the TFX syntax has been implemented in a recent revision of
the Vampire source code3, and will be available in the next release of Vampire.
        </p>
        <p>
          TFX has been used by the program verification tools BLT [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] and Voogie [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ].
BLT and Voogie read programs written in a subset of the Boogie intermediate
verification language and generate their partial correctness properties written in
the TFX syntax. BLT and Voogie generate formulae differently, but both rely on
features of FOOL, namely conditional expressions, let expressions, and tuples.
4.2
        </p>
      </sec>
      <sec id="sec-3-2">
        <title>Examples</title>
        <p>This paper has introduced the eXtended Typed First-order form (TFX) of the
TPTP’s TFF language. TFX includes boolean variables as formulae, formulae
as terms, tuple types and terms, conditional expressions, and let expressions.
3 https://github.com/vprover/vampire
%----------------------------------------------------------------------tff(x,type,x:$int).
tff(y,type,y:$int).
tff(t,type,t:$int).
tff(x_leq_y,conjecture,
$let([x: $int,y: $int,t: $int],
[x,y,t] := $ite($greater(x,y),
$let(t: $int,
t := x,
$let(x: $int,
x := y,
$let(y:$int,
y := t,
[x,y,t]))),
%----------------------------------------------------------------------tff(a_type,type, a: $i ).
tff(b_type,type, b: $i ).
tff(c_type,type, c: $i ).
tff(exactly_one_truthteller_type,type, exactly_one_truthteller: $o ).
tff(says,type, says: ( $i * $o ) &gt; $o ).
%----Each person is either a truthteller or a liar
tff(island,axiom, ! [P: $i] : ( says(P,$true) &lt;~&gt; says(P,$false) ) ).
tff(exactly_one_truthteller,axiom,</p>
        <p>( exactly_one_truthteller
&lt;=&gt; ( ? [P: $i] : says(P,$true)
&amp; ! [P1: $i,P2: $i] :
( ( says(P1,$true) &amp; says(P2,$true) )
=&gt; P1 = P2 ) ) )).
%----B said that A said that there is exactly one truthteller
tff(b_says,hypothesis, says(b,says(a,exactly_one_truthteller)) ).
%----C said that what B said is false
tff(c_says,hypothesis, says(c,says(b,$false)) ).
%----------------------------------------------------------------------TFX is useful for (at least) concisely expressing problems coming from program
analysis, and translated from more expressive logics.</p>
        <p>Now that the syntax is settled, ATP system developers will be able to
implement the new language features. It is already apparent from the SMT community
that these are useful features, and systems that can already parse and reason
using the SMT version 2 language need only new parsers to implement the features
of TFX. In parallel, version v8.0.0 of the TPTP will include problems that use
TFX, and the automated reasoning community is invited to submit problems
for inclusion in the TPTP.</p>
        <p>Acknowledgements. Thanks to our friends in the TPTP World who have
provided feedback on TFX features, starting from the TPTP Tea Party at CADE-22
in 2009. The second author was partially supported by the Wallenberg Academy
Fellowship 2014 and the Swedish VR grant D0497701.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Barrett</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stump</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tinelli</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>The SMT-LIB Standard: Version 2.0</article-title>
          . In: Gupta,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Kroening</surname>
          </string-name>
          ,
          <string-name>
            <surname>D</surname>
          </string-name>
          . (eds.)
          <source>Proceedings of the 8th International Workshop on Satisfiability Modulo Theories</source>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Blanchette</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Paskevich</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>TFF1: The TPTP Typed First-order Form with Rank-1 Polymorphism</article-title>
          . In: Bonacina, M. (ed.)
          <source>Proceedings of the 24th International Conference on Automated Deduction</source>
          . pp.
          <fpage>414</fpage>
          -
          <lpage>420</lpage>
          . No. 7898
          <source>in Lecture Notes in Artificial Intelligence</source>
          , Springer-Verlag (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Chen</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Furia</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Triggerless Happy - Intermediate Verification with a FirstOrder Prover</article-title>
          . In: Polikarpova,
          <string-name>
            <given-names>N.</given-names>
            ,
            <surname>Schneider</surname>
          </string-name>
          ,
          <string-name>
            <surname>S</surname>
          </string-name>
          . (eds.)
          <source>Proceedings of the 13th International Conference on Integrated Formal Methods</source>
          . pp.
          <fpage>295</fpage>
          -
          <lpage>311</lpage>
          . No. 10510
          <source>in Lecture Notes in Computer Science</source>
          , Springer-Verlag (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Kaliszyk</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rabe</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>TH1: The TPTP Typed Higher-Order Form with Rank-1 Polymorphism</article-title>
          . In: Fontaine,
          <string-name>
            <given-names>P.</given-names>
            ,
            <surname>Schulz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Urban</surname>
          </string-name>
          ,
          <string-name>
            <surname>J</surname>
          </string-name>
          . (eds.)
          <source>Proceedings of the 5th Workshop on the Practical Aspects of Automated Reasoning</source>
          . pp.
          <fpage>41</fpage>
          -
          <lpage>55</lpage>
          . No. 1635
          <source>in CEUR Workshop Proceedings</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Kotelnikov</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kovács</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Reger</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voronkov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>The Vampire and the FOOL</article-title>
          . In: Avigad,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Chlipala</surname>
          </string-name>
          ,
          <string-name>
            <surname>A</surname>
          </string-name>
          . (eds.)
          <source>Proceedings of the 5th ACM SIGPLAN Conference on Certified Programs and Proofs</source>
          . pp.
          <fpage>37</fpage>
          -
          <lpage>48</lpage>
          . ACM (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Kotelnikov</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kovács</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Suda</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voronkov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>A Clausal Normal Form Translation for FOOL</article-title>
          . In: Benzmüller,
          <string-name>
            <given-names>C.</given-names>
            ,
            <surname>Sutcliffe</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            ,
            <surname>Rojas</surname>
          </string-name>
          ,
          <string-name>
            <surname>R</surname>
          </string-name>
          . (eds.)
          <source>Proceedings of the 2nd Global Conference on Artificial Intelligence</source>
          . pp.
          <fpage>53</fpage>
          -
          <lpage>71</lpage>
          . No. 41 in EPiC Series in Computing (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Kotelnikov</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kovács</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voronkov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>A First Class Boolean Sort in First-Order Theorem Proving and TPTP</article-title>
          . In: Kerber,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Carette</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Kaliszyk</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            ,
            <surname>Rabe</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Sorge</surname>
          </string-name>
          , V. (eds.)
          <source>Proceedings of the International Conference on Intelligent Computer Mathematics</source>
          . pp.
          <fpage>71</fpage>
          -
          <lpage>86</lpage>
          . No. 9150
          <source>in Lecture Notes in Computer Science</source>
          , Springer-Verlag (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Kotelnikov</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kovács</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voronkov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>A FOOLish Encoding of the Next State Relations of Imperative Programs</article-title>
          . In: Galmiche,
          <string-name>
            <given-names>D.</given-names>
            ,
            <surname>Schulz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Sebastiani</surname>
          </string-name>
          ,
          <string-name>
            <surname>R</surname>
          </string-name>
          . (eds.)
          <source>Proceedings of the 9th International Joint Conference on Automated Reasoning</source>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Kovács</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voronkov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>First-Order Theorem Proving and Vampire</article-title>
          . In: Sharygina,
          <string-name>
            <given-names>N.</given-names>
            ,
            <surname>Veith</surname>
          </string-name>
          , H. (eds.)
          <source>Proceedings of the 25th International Conference on Computer Aided Verification</source>
          . pp.
          <fpage>1</fpage>
          -
          <lpage>35</lpage>
          . No. 8044
          <source>in Lecture Notes in Artificial Intelligence</source>
          , Springer-Verlag (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Smullyan</surname>
          </string-name>
          , R.:
          <article-title>What is the Name of This Book? The Riddle of Dracula and Other Logical Puzzles</article-title>
          . Prentice-Hall (
          <year>1978</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          :
          <article-title>The TPTP Problem Library</article-title>
          and
          <string-name>
            <given-names>Associated</given-names>
            <surname>Infrastructure</surname>
          </string-name>
          .
          <source>The FOF and CNF Parts, v3.5.0. Journal of Automated Reasoning</source>
          <volume>43</volume>
          (
          <issue>4</issue>
          ),
          <fpage>337</fpage>
          -
          <lpage>362</lpage>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          :
          <article-title>The TPTP World - Infrastructure for Automated Reasoning</article-title>
          . In: Clarke,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Voronkov</surname>
          </string-name>
          ,
          <string-name>
            <surname>A</surname>
          </string-name>
          . (eds.)
          <source>Proceedings of the 16th International Conference on Logic for Programming</source>
          ,
          <source>Artificial Intelligence, and Reasoning</source>
          . pp.
          <fpage>1</fpage>
          -
          <lpage>12</lpage>
          . No. 6355
          <source>in Lecture Notes in Artificial Intelligence</source>
          , Springer-Verlag (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          :
          <article-title>The TPTP Problem Library and Associated Infrastructure. From CNF to TH0</article-title>
          ,
          <source>TPTP v6.4.0. Journal of Automated Reasoning</source>
          <volume>59</volume>
          (
          <issue>4</issue>
          ),
          <fpage>483</fpage>
          -
          <lpage>502</lpage>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Benzmüller</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Automated Reasoning in Higher-Order Logic using the TPTP THF Infrastructure</article-title>
          .
          <source>Journal of Formalized Reasoning</source>
          <volume>3</volume>
          (
          <issue>1</issue>
          ),
          <fpage>1</fpage>
          -
          <lpage>27</lpage>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schulz</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Claessen</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baumgartner</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>The TPTP Typed Firstorder Form with Arithmetic</article-title>
          . In: Bjørner,
          <string-name>
            <given-names>N.</given-names>
            ,
            <surname>Voronkov</surname>
          </string-name>
          ,
          <string-name>
            <surname>A</surname>
          </string-name>
          . (eds.)
          <source>Proceedings of the 18th International Conference on Logic for Programming</source>
          ,
          <source>Artificial Intelligence, and Reasoning</source>
          . pp.
          <fpage>406</fpage>
          -
          <lpage>419</lpage>
          . No. 7180
          <source>in Lecture Notes in Artificial Intelligence</source>
          , Springer-Verlag (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Suttner</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <source>The TPTP Problem Library: CNF Release v1.2.1. Journal of Automated Reasoning</source>
          <volume>21</volume>
          (
          <issue>2</issue>
          ),
          <fpage>177</fpage>
          -
          <lpage>203</lpage>
          (
          <year>1998</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>