<!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>Static Types As Search Heuristics</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Hao Xu</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computer Science, University of North Carolina at Chapel Hill</institution>
          <addr-line>Chapel Hill, NC 27599</addr-line>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <fpage>130</fpage>
      <lpage>139</lpage>
      <abstract>
        <p>Static analysis techniques have been studied for many years in the functional programming community, most prominently the use of inferred types to eliminate run-time checks. In analogy, if we regard checking whether an instance is useful for a proof as run-time checks and we can find types that eliminate irrelevant instances, we may also be able to prevent proof searches from checking those irrelevant instances, thereby improving the performance. This paper introduces a method that employs types as heuristics in proof search.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>Introduction
Instance-based theorem proving techniques have been implemented in many
theorem provers: [1], [2], [3], [4], and [5], among others. Some of these provers have
been shown to prove problems in some categories faster than or comparable to
resolution-based theorem provers[6]. On the other hand, resolution-based
theorem provers continue to lead on other problem categories. While instance-based
theorem provers are believed to have a number of advantages, such as being
capable of generating models for satisfiable problems and making use of the highly
efficient SAT solvers, their run-time performance is suboptimal without guidance
from instance generation heuristics such as resolution, semantics, etc..</p>
      <p>Static analysis techniques in compilers, such as using types to eliminate
runtime checks, have been studied for many years. In analogy, if we regard
checking whether an instance is useful for a proof as run-time checks, then we may
find types that prevent proof searches from checking some irrelevant instances,
thereby improving the performance. In general, static analysis techniques
generate heuristics from the input, in contrast to various static transformation
techniques which preprocess the input. Following is a (incomplete) list of the
techniques used in static analysis:
Strategy Selection chooses a strategy that is believed to best suit the
problem. Implementation: E[7], Vampire[8], and DCTP[5], among others.
Restriction finds instances that may be pruned from the search space.
Implementation: FM-Darwin[9], Paradox[10], and OSHL-S, among others.
Ordering determines what kind of ordering can lead to contradiction faster.</p>
      <p>Implementation: E(literal ordering), among others.</p>
      <p>This paper introduces a method that employs inferred types from resolution as
heuristics in first-order logic proof search. The general idea is deriving a type
inference algorithm from a complete calculus, and using types to filter out a
subset of instances that are not generated by the calculus by searching only
welltyped instances. Properly designed types should bring some of the advantages
from one method to another.
2</p>
      <p>
        Notations
A vector is written as [a1, . . . , an], or vertically as in (
        <xref ref-type="bibr" rid="ref5">5</xref>
        ). The ith component of a
vector v is vi. We write vn to explicitly mark that v has n components. A vector
is implicitly converted to a set. For example, in v ⊂ x. Given a signature Σ and
a set of variables Var, Term is the set of terms over Σ ∪ Var; GrTerm the set of
terms over Σ. An expression is a term or a literal. Expr is the set of expressions
over Σ ∪ Var; GrExpr the set of expressions over Σ. By default, Σ = F S(S) and
Var = V S(S), given a clause set S. Constants are nullary function symbols. The
empty clause is denoted by ∅. The function f v maps an expression to a set of free
variables occurring in that expression. fv(x) is the vector constructed from f v(x)
by sorting the element lexicographically (other total orderings should also work).
A substitution is a partial function θ : Var → Term. f v(θ) = Sv∈dom(θ) f v(θ(v)).
A substitution of variables v with terms t is denoted by [t/v]. If dom(θ) ⊂ D,
the domain extension θ|D of θ to D is defined by θ|D(v) = θ(v), if v ∈ dom(θ)
and θ|D(v) = v, if v ∈ D\dom(θ). If f v(e) 6⊂ dom(θ), eθ = eθ|dom(θ)∪fv(e).
The well-formedness requirement for a substitution θ is that θ(v) = v, for all
v ∈ f v(θ) ∩ dom(θ), namely, the substitution is idempotent. The well-formedness
requirement for an mgu σ of literals L, N is that f v(σ) ⊂ dom(σ) = f v(L) ∪
f v(N ). The complement of a literal L is denoted by L.
3
3.1
      </p>
      <p>A Theory</p>
      <p>An Example
Example 1. S = {{P (X ), Q(f (X )}, {¬P (f (Y )), ¬Q(Y )}, {Q(a)}, {¬Q(f (f (a))}}.
Since S is unsatisfiable, there exists a minimal (but not necessarily minimum)
set S1 of ground instances of S that is unsatisfiable. By minimality of the
instances in S1, for all ground literals N ∈ S S1, N ∈ S S1. For example,
S1 = {{P (f (a)), Q(f (f (a))}, {¬P (f (a)), ¬Q(a)}, {Q(a)}, {¬Q(f (f (a)))}}. If we
use a brute force method to find S1, then both X and Y are initiated to terms in
x = {a, f (a), f (f (a)), . . .}. Our goal is to restrict the instantiation of variables
to proper subsets of x given by a instantiation function I : Term → P (GrTerm).
We establish a similar minimality requirement for I: for any literal N ∈ S and
any ground instance N1 in I(N ), there exists L s.t. N1 ∈ I(L). Rewriting this
requirement as an inequality of sets, we obtain:
[ I(L) ⊃</p>
      <p>[ I(L)
L∈S S</p>
      <p>L∈S S
Informally speaking, all instances of literals in S should be resolvable. In the
example, the only literal in S that is unifiable with P (X ) is ¬P (f (Y )). Therefore,
any instance of P (X ) must have a complement, which must be an instance of
¬P (f (Y )). Hence I(¬P (f (Y ))) ⊃ I(P (X ))). If I(e) = {e[t/v]|ti ∈ I(vi), v =
fv(e)}, then {f (t)|t ∈ I(Y )} ⊃ I(X ). We restrict the proof search by
instantiating any variable v to elements of I(v), which we refer to as the semantics of the
type of the variable v.
3.2</p>
      <p>Algebra V
In this section, we introduce an algebra V. The motivation of V is to enable
simultaneously manipulating functions and sets, as in linear algebra. There are
several groups of notations used in this paper. Algebra V: ρ, τ type; v variable;
X term of the form [vi]in=1; A, A, B, F, G, H, T , T term. Mathematics: D
domain; x, y set; f, g function; a, b, v vector; l, m, n, o, p natural number. Logic:
u, v, X, Y variable; t term; e expression; L, N literal; C, D clause; S clause set;
a, c, f function symbol.</p>
    </sec>
    <sec id="sec-2">
      <title>Definition 1. The types are: set of vectors of length n {n} ; function τ → τ ′.</title>
      <p>Types are mainly used to define what terms are meaningful in V. To avoid the
complexity of recursive domain equations, we define families of constructors
indexed by natural numbers. The indices do not affect the mapping of the function
that a term denotes, but the domain and range of that function.
Definition 2. T : τ denotes that T is a term of type τ . τm,n = {m} → {n}.
∅n : {n}
∪n : {n} → {n} → {n}
∩n : {n} → {n} → {n}
[] : {0}</p>
      <p>p = m + n
•m,n : {m} → {n} → {p}
pi/n : {n} → {1}</p>
      <p>v ⊃ f v(e)
Λvn.e : {n} → {1}</p>
      <p>v ⊃ f v(e)
Λ−1vn.e : {1} → {n}</p>
      <sec id="sec-2-1">
        <title>SumUnit λvn.∅m : {n} → {m} FSumUnit</title>
        <p>Sum ⊔m,n : τm,n → τm,n → τm,n FSum
Inter ⊓m,n : τm,n → τm,n → τm,n FInter</p>
      </sec>
      <sec id="sec-2-2">
        <title>ProdUnit λvn.[] : {n} → {0} FProdUnit</title>
        <p>p = m + n
l,m,n : τl,m → τl,n → τl,p
◦m,n,p : τm,n → τn,p → τm,p Comp</p>
        <sec id="sec-2-2-1">
          <title>Prod</title>
        </sec>
        <sec id="sec-2-2-2">
          <title>Proj</title>
        </sec>
        <sec id="sec-2-2-3">
          <title>TFunc</title>
          <p>v : {1}</p>
        </sec>
        <sec id="sec-2-2-4">
          <title>RTFunc</title>
          <p>T : ρ → τ
T T ′ : τ
T ′ : ρ</p>
        </sec>
        <sec id="sec-2-2-5">
          <title>FProd Var App</title>
          <p>We use parentheses to delimit terms when ambiguous. We omit subscripts and
superscripts indicating vector length and type indices when not ambiguous.
There are two kinds of terms used in the paper: a term in the set Term and
a term in V. We refer to the latter as a term of V to disambiguate only when
necessary. T F unc is called a term function; RT F unc a reverse term function.</p>
          <p>Let us now switch context to mathematical objects. As in domain theory,
we say that a function f is continuous if x0 ⊂ x1 ⊂ . . . implies Si∞=0 f (xi) =
f (Si∞=0 xi). Define ambn = [a1, . . . , am, b1, . . . , bn], x × y = {ambn|am ∈ x, bn ∈
y}, Qin=1 xi = x1 × (. . . × xn × {[]}), Si=1 xi = x1 ∪ . . . ∪ xn, Ti=1 xi = x1 ∩
n n
. . . ∩ xn, and [xi]in=1 = [x1, . . . , xn]. For example, [a][f (a)] = [a, f (a)], {[a], [a′]} ×
{[f (a)]} = {[a, f (a)], [a′, f (a)]}. If we define Dn = {[xi]in=1|xi ∈ GrExpr}, then
the domains Dτ are defined as follows, where [Dρ → Dτ ] is the set of functions
from Dρ to Dτ .</p>
          <p>D{n} = P(Dn) Dρ→τ = [Dρ → Dτ ]</p>
        </sec>
        <sec id="sec-2-2-6">
          <title>Definition 3. An interpretation is a partial function I : Var → P(GrTerm). An</title>
          <p>interpretation is trivial if I(v) = ∅ for some variable v.</p>
          <p>Given an interpretation I, the semantic function ()I∗ maps a term T : τ of V to
an element of Dτ .</p>
          <p>Definition 4. The semantic function ()I∗ is defined as follows. The semantics
of function terms are given by partial evaluation.</p>
          <p>(∅n)I∗ = ∅
(∪n)I∗(x)(y) = x ∪ y
(∩n)I∗(x)(y) = x ∩ y</p>
          <p>([])I∗ = {[]}
(•m,n)I∗(x)(y) = x × y
(pi/n)I∗(xn) = xi
(Λv.e)I∗(x) = {e[t/v]|t ∈ x}
(Λ−1v.e)I∗(x) = {t|e[t/v] ∈ x}</p>
          <p>(λv.∅n)I∗(x) = ∅
(⊔m,n)I∗(f )(g)(x) = f (x) ∪ g(x)
(⊓m,n)I∗(f )(g)(x) = f (x) ∩ g(x)</p>
          <p>(λv.[])I∗(x) = {[]}
( l,m,n)I∗(f )(g)(x) = f (x) × g(x)
(◦m,n,p)I∗(f )(g)(x) = f (g(x))</p>
          <p>(v)I∗ = I(v)
(F T )I∗ = (F )I∗((T )I∗)
Notations such as ∅, ∪, ∩ are reused as both set-theoretical notations and terms
of V. A term is variable-free if there is no subterm that is a variable. Since
the denotations of variable-free terms are independent of I, we usually make
I implicit when the term is variable-free. For example, (Λ[v1].f (v1))∗{[a]} =
{[f (a)]}, (Λ−1[v1].f (v1))∗{[f (a)]} = {[a]}, (p1/2)∗{[a, f (a)]} = {[f (a)]}.</p>
          <p>I |= T = T ′ if and only if (T )I∗ = (T ′)∗. T = T ′ if and only if it holds for all
I
I. A subset order is defined on set terms: I |= T ⊏ T ′ if and only if (T )I∗ ⊂ (T ′)∗.
I
The order is extended to functions I |= F ⊏ G if and only if for all terms T ,
I |= F T ⊏ GT . T ⊏ T ′ if and only if it holds for all I. The reverse is denoted
by ⊐. F is continuous if and only if (F )I∗ is continuous for all I.</p>
          <p>We write [Ti]in=1 = [T1, . . . , Tn] = T1 • . . . • Tn • [], [Fi]in=1 = [F1, . . . , Fn] =
T1 . . . Tn λv.[]. We usually want to convert a vector to a term of the form
[vi]in=1 and conversely, which we call algebraify and dealgebraify. If v is a vector
of variables, then Av is a term v1 • . . . • vn • []; if X is a term of the form [vi]in=1,
then A−1X = v. As a convention, we have X = Av and v = A−1X.</p>
          <p>We make the following auxiliary definitions, where ve = fv(e), f is a function
symbol of arity o, vf = [v1, . . . , vo], and Fn : {n} → {n} for some natural number
n. Fn0 , ∪n∅n. Fnk+1 , FnFnk. f −1 , (Λ−1vf .f (v1, . . . , vo)). e , (Λve.e)Xe.
I(e) , (Λve.e)∗I(ve). I(vn) , Qin=1 I(vi). For example, if f is binary, then
f (X, Y ) = (Λ[X, Y ].f (X, Y ))[X, Y ], f −1 = Λ−1[X, Y ].f (X, Y ). We write binary
functions as infix, for example, ⊔F G is written as F ⊔ G except for composition
where we write ◦F G as F G.</p>
          <p>It can be proved that (a) if F ⊐ G and F ⊐ H, then F ⊐ G⊔H; (b) F ⊔G ⊐ F
and F ⊔ G ⊐ G; (c) (F ⊔ G)H = F H ⊔ GH; (d) F (G ⊔ H) = F G ⊔ F H; (e)
[Fi]in=1T = [FiT ]in=1 (f) (λv.∅)F = λv.∅; (g) pi[Tk]k=1 = Ti, where i ∈ {1, . . . , n}.
n
3.3</p>
          <p>Constraints</p>
        </sec>
        <sec id="sec-2-2-7">
          <title>Definition 5. (a) An instantiation set of an expression e is a set of ground</title>
          <p>substitutions Θ s.t. for every θ ∈ Θ,dom(θ) ⊃ f v(e). The instance set of e w.r.t.
Θ is {xθ|θ ∈ Θ}. (b) An instantiation set of v induced by an interpretation I s.t.
dom(I) ⊃ v is the set {[t/v]|t ∈ I(v)}. (c) An instantiation set is complete for a
clause set S if the instances obtained from it are inconsistent. An interpretation
is complete if the induced instantiation set is complete.</p>
          <p>In this section we formalize the ideas discussed in Section 3.1 in terms of V . In
the following discussion, S is a set of clauses s.t. ∅ ∈/ S and for any C, D ∈ S,
f v(C) ∩ f v(D) = ∅.</p>
          <p>Suppose that L, N ∈ S S and that σ is a well-formed mgu of L, N . We require
that for every v ∈ f v(L), σ(v) 6= v, t = σ(v), v = fv(t)
and for every u ∈ f v(L), σ(u) 6= u, t = σ(u), v = fv(t), v = vi,</p>
          <p>I |= v ⊐ (Λv.t)X
I |= v ⊐ pi(Λ−1v.t)u</p>
          <p>
            I |= v ⊐ c
(
            <xref ref-type="bibr" rid="ref2">2</xref>
            )
(
            <xref ref-type="bibr" rid="ref3">3</xref>
            )
(
            <xref ref-type="bibr" rid="ref4">4</xref>
            )
          </p>
          <p>
            The apparent minimum solution to (
            <xref ref-type="bibr" rid="ref1">1</xref>
            ) is the constant function I(v) = ∅ for
any variable v. Therefore, we add the following constraints to ensure that the
solution is complete for S. Given an arbitrary partial function g : Var → GrTerm
s.t. dom(g) ⊃ f v(S), for all v ∈ f v(S), c = g(v),
In effect, (
            <xref ref-type="bibr" rid="ref4">4</xref>
            ) pins down a specific class of inconsistent sets of instances which are
generated by instantiating a resolution proof to a ground resolution proof.
          </p>
          <p>
            The algorithm for constraints generation (
            <xref ref-type="bibr" rid="ref2">2</xref>
            ), (
            <xref ref-type="bibr" rid="ref3">3</xref>
            ), and (
            <xref ref-type="bibr" rid="ref4">4</xref>
            ) is shown as follows.
Algorithm 1. (Constraints Generation)
          </p>
        </sec>
        <sec id="sec-2-2-8">
          <title>1. Given a set of nonempty clauses S, rename so that any two clauses have no</title>
          <p>common variables.</p>
        </sec>
        <sec id="sec-2-2-9">
          <title>2. For every clause C, every literal L in C, every clause D in S, and every</title>
          <p>
            literal N in D such that N and L are unifiable by mgu σ, generate constraint
(
            <xref ref-type="bibr" rid="ref2">2</xref>
            ) and (
            <xref ref-type="bibr" rid="ref3">3</xref>
            ).
          </p>
        </sec>
        <sec id="sec-2-2-10">
          <title>3. For all variable X generate constraint (4).</title>
          <p>Denote the constraints generated by a clause set S by cons(S). If I makes a
constraint true, then we say that I is a solution to the constraint. If any solution
to constraints K is also a solution to constraints K′ and vice versa, then we say
that K ≡ K′.</p>
          <p>Next, we look at an example.
Example 2. We choose g(X ) = f (a), g(Y ) = a and generate constraints for
Example 1. Because P (X ) is unifiable with ¬P (f (Y )) with mgu [f (Y )/X ], the
algorithm generates the following constraints I |= X ⊐ f (Y ), I |= Y ⊐ p1f −1X .
Other constraints are generated similarly. We usually write the constraints in an
equivalent but more compact form. I |= X ⊐ f (Y ) ∪ p1f −1(Y ) ∪ f (a), I |= Y ⊐
f (X ) ∪ p1f −1(X ) ∪ a. We also make I implicit when not ambiguous.
Sometimes it is more compact to present a theory if we write inequality
constraints in a vector normal form. For example, the constraints in Example 2 can
be rewritten in the vector form:</p>
          <p>I |= X ⊐
Λv.f (Y ) ⊔ p1Λ−1v.f (X )p2 ⊔ Λv.f (a)
Λv.f (X ) ⊔ p2Λ−1v.f (Y )p1 ⊔ Λv.a</p>
          <p>X , where X =</p>
          <p>
            X
Y
(
            <xref ref-type="bibr" rid="ref5">5</xref>
            )
Definition 6. A normal form of constraints is I |= X ⊐ AX, where X is of the
form [vi]in=1 and A is of the form [Ai]in=1, where Ai is produced by the following
grammar A → λv.∅| Λv.t|p(Λ−1v.t)p′ ∗,⊔ where t ∈ Term, v ⊂ Var, p and p′
are P roj, there is no repeated terms in A, and the terms in A are ordered in a
certain total order.
In this section, we look at a few theorems. Theorem 1 shows that X ⊐ AX is
solvable. Theorem 2 shows that a solution to constraints cons(S) is complete for
S, which is the main result of this section. Lemma 1 shows that resolution does
not affect the solution of the constraints. If we assume that the semantics of S
is given by resolution, then Lemma 1 is analogous to preservation (or subject
reduction) of a type system.
          </p>
        </sec>
      </sec>
      <sec id="sec-2-3">
        <title>Theorem 1. The minimum solution I to an inequality X ⊐ AX is given by</title>
        <p>I(v) = Si∞=0(Ai)∗∅. The rhs is a fixpoint of the function f (x) = (A)∗(x).</p>
        <sec id="sec-2-3-1">
          <title>Lemma 1. Given a set of clauses S s.t. for any clauses C, D ∈ S, f v(C) ∩</title>
          <p>f v(D) = ∅, the binary resolvent D of two clauses C1 and C2 in S by some
well-formed mgu, cons(S) ≡cons(S ∪ {D}).</p>
        </sec>
        <sec id="sec-2-3-2">
          <title>Theorem 2. Given a set of clauses S s.t. for any clauses C, D ∈ S, f v(C) ∩</title>
          <p>f v(D) = ∅, any solution I to cons(S) is complete for S.
4</p>
          <p>Context Free Type
Generally speaking, I may have complicated structures. We need to find a finite
representation for these sets that facilitates enumeration of terms, as one of the
purposes of types is generating terms. By Theorem 1, A is a finite representation
of the minimum solution of the constraint, but it is not very efficient as it includes
1 A long version of this paper can be found at http://cs.unc.edu/~xuh/oshls.
RT F uncs which require pattern matching. Besides, it is also hard to generate
terms in certain order, say, the size-lexicographic order. The approach introduced
in this section converts the constraints into a grammar that produces a solution
without RT F uncs.</p>
          <p>Given a F P rod A = [Ai]in=1 in the normal form, for any component A of A,
we denote the F Sum of T F unc or F SumU nit by A→, and the F Sum of other
n
terms (which contain RT F uncs) by A←, for example, A→ = Si=1(Λv.ti) and
n
A← = Si=1 pi(Λ−1v.ti)pi. Using this notation, an inequality can be written in
the following form.</p>
          <p>
            X ⊐ (A→ ⊔ A←)X
(
            <xref ref-type="bibr" rid="ref6">6</xref>
            )
Example 3. Suppose (
            <xref ref-type="bibr" rid="ref5">5</xref>
            ). A→ = ΛΛv.vf.(fY( X)⊔)⊔ΛvΛ.vf.(aa) . A← = pp12ΛΛ−−11vv..ff((XY))pp12 .
A←A→ = p2pΛ1Λ−−1v1v.f.f(Y(X)Λ)Λv.vf.(fY( X)⊔)⊔p2pΛ1−Λ1−v1.vf.(fY(X)Λ)vΛ.vf.(aa) = Λv.ΛYv⊔.XΛv.a ,
by equations pi(Λ−1v.f (vi))Λv.f (t) = Λv.t
          </p>
          <p>piΛ−1v.f (vi)Λv.a = λv.∅ .</p>
          <p>We generalize the idea illustrated in Example 3. A←A→ can be expanded to
an F P rod of F Sum of terms of the form pk(Λ−1v.t)(Λv.t′) or λv.∅. In general,
not all terms of the form pk(Λ−1v.t)(Λv.t′) can be converted to a simpler, equal
term. The inequalities shown as follows, where ll′ ∈ Pos, l ∈ Pos, can be used to
simplify them to simpler terms.</p>
          <p>pk(Λ−1v.t′′)pk′ σ = mgu(t′, t), σ(vk) = vk,


pk(Λ−1v.t)(Λv.t′) ⊏ </p>
          <p>vk ∈ f v(t′′), t′′ = σ(vk′ ) ∈/ Var
Λv.t′′


λv.∅
σ = mgu(t′, t), σ(vk) = t′′
t′, t not unifiable
For example, if v = [X, Y ], then p1(Λ−1v.f (f (X)))(Λv.f (Y )) ⊏ p1(Λ−1v.f (X))p2,
p1(Λ−1v.f (X))(Λv.f (f (Y ))) ⊏ Λv.f (Y ), p1(Λ−1v.f (f (X)))(Λv.a) ⊏ λv.∅. If
two simplifications are applicable simultaneously, then we choose one
arbitrarily. The reduced term can be rearranged into an equal normal form. If the
original term is T, then we denote the normal form of the reduced term by s(T).
s(T) ⊐ T for any T.</p>
        </sec>
      </sec>
      <sec id="sec-2-4">
        <title>Algorithm 2. (CFT) Given an inequality X ⊐ AX, compute Bk as follows.</title>
        <p>B0 = A
Bk+1 = Bk ⊔ s(Bk←Bk→)</p>
      </sec>
      <sec id="sec-2-5">
        <title>Theorem 3. (Termination) For any constraint X ⊐ AX, there is an integer N</title>
        <p>s.t. BN = BN+1.</p>
        <p>Lemma 2. Si∞=0(BiN )∗∅ = Si∞=0((BN→)i)∗∅.</p>
        <p>Theorem 4. (Soundness) If I(v) = Si∞=0((BN→)i)∗∅, then I |= X ⊐ AX.
Unlike A, B→ does not contain RT F uncs. Constraint X ⊐ B→X can be</p>
        <p>
          N N
straightforwardly converted to BNF productions by syntactically converting "∪"
to "|" and "⊐" to "→". The resulting grammar generates the solution I.
Example 4. Suppose (
          <xref ref-type="bibr" rid="ref5">5</xref>
          ). B0 = A. s(A←A→) is shown in (b). B1 is shown in
(a). s(B1←B1→) ⊏ B1. Therefore, we may choose N = 1. X ⊐ B1→X is shown
in (c). A grammar is generated as shown in (d). The solution generated by this
grammar is I(v) = {[f (a)], [f (f (f (a)))], . . .} × {[a], [f (f (a))], . . .}.
        </p>
        <p>Λv.X
Λv.Y ⊔ Λv.a
(b)
p1Λ−1v.f (X )p2 ⊔ Λv.f (Y ) ⊔ Λv.f (a) ⊔ Λv.X
p2Λ−1v.f (Y )p1 ⊔ Λv.f (X ) ⊔ Λv.a ⊔ Λv.Y</p>
        <p>(a)
X ⊐ f (Y ) ∪ f (a) ∪ X
Y f (X ) ∪ a ∪ Y
(c)</p>
        <p>X → f (Y )|f (a)|X
Y → f (X )|a|Y
(d)
5</p>
        <p>Related Work
The (Inst-Gen) rule introduced in [11] uses unification as guide for instance
generation. The algorithms presented in [12] also make use of unification to
find blockages. [13] shows that using a proper semantics for OSHL is implicitly
performing unification. One of the differences between our approach and others
is that we infer types before proof search, which divides a theorem proving
algorithm into the static analysis stage and the run-time stage. About clause
linking, we have the following observation(probably others also have the same
observation): in order for any instance Cσ of C to be useful, each literal Lσ
in Cσ should be resolvable with some other literals. Given a set of clauses S,
a clause C, and a literal L in C, we may decompose C on L w.r.t. S to a set
of instances of C, {Cσi|i ∈ {1, 2, . . . , n}}, s.t. for any literal N in S, σi is an
mgu of L and N for some i ∈ {1, 2, . . . , n} without affecting the completeness.
Our approach generates criteria inspired by this observation. For a survey of
instance-base methods, refer to [14].</p>
        <p>Sort inference algorithms are implemented in some finite model finders such
as Paradox[10] and FM-Darwin[9]. Sorted unification[15] uses sets of unary
predicates as sorts. A key difference between our approach and multi-sorted logic is
that the types are inferred from S, instead of being part of the logic itself.
Therefore, we need to guarantee that the types inferred are backward compatible with
the untyped version S. Theorems in this paper is essential for our approach
but irrelevant to a multi-sorted logic without inferred sort. Our approach can
be viewed as a type system[16] that is equipped with a type inference
algorithm. The difference between our type system and those that are usually found
in programming languages is that our type system is used to restrict instance
generation while type systems in programming languages are usually used to
eliminate expressions whose reduction leads to errors. In advanced compilers,
some type systems are also used to guide optimization, in which sense it is
similar to our type system. The presentation of this paper makes (very primitive)
use of domains[17] and is loosely related to a type theory[18] in the sense that a
type system is related to a type theory.</p>
        <p>A closely related concept to grammar is tree grammar, where the rhs is
composed of trees instead of sequences. The choice of grammar reflects the fact
that terms can be internally represented by sequences instead of trees.
6</p>
        <p>
          Discussion
It is possible to refine the constraints (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) and (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) by transforming them into
F Inters. We denote the F Sum of rhs of all constraints (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) and (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) generated
by L by ALX. With this notation, we can combine multiple constraints (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) and
(
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) generated by L into one constraint: for every L ∈ C, C ∈ S, v ∈ f v(L),
I |= vL ⊐ ⊓L∈CALX.
        </p>
        <p>The granularity of types is the key to the efficacy of these types. CFT is useful
for some problems as shown in Table 1.2 Finer granularity may be achieved by
using enhanced grammars. These grammars are useful when a variable occurs
twice in a literal, for example, P (f (X, X)). If we have a literal ¬P (Y ), then
productions produced by CFT include Y → f (X, X) which does not reflect the
correlation between the two occurrences of X. If we make use of an enhanced
grammar to mark that X should always be instantiated to the same term, then
we have better approximation to the minimum solution. A possible solution is
adding correlation markers to correlated variables.</p>
        <p>
          The constraints generated by CFT may have redundancy which affects the
time and space complexity of the term generator. We implemented the following
algorithms to reduce redundancy. Suppose that X ⊐ T, where X = [vk]k=1, T =
n
[Tk]kn=1, Ti = Ssm=1 Ti,s, i ∈ {1, 2, . . . , n}. In each iteration of Algorithm 2, if
Ti,o = vj and Tj,p = vi, then put vi, vj into an equivalence class; choose a
representative for each equivalence class; for every representative vi and vj 6= vi
in the equivalence class, set Ti to Ti ∪ Tj and Tj to vi and replace vj by vi in
T; and for every Ti s.t. Ti,o = vi for some o, remove vi from Ti. A variable is
nontrivial if the rhs of its production contains a term containing only variables
that are nontrivial. We slightly modify constraint (
          <xref ref-type="bibr" rid="ref4">4</xref>
          ): for some T = [Ti]in=1,
2 Problem sets: TPTP 3.2.0, unsatisfiable or theorem only. Time limit: 30s. Running
environment: P4 2.4GHz, 512M, Windows XP, Sun JDK 6.0, OSHL-S 0.5.0,
ProverTools. Website for the prover and tools: http://cs.unc.edu/~xuh/oshls/.
where Ti = c or ∅, for i ∈ {1, 2, . . . , n} so that there is no trivial variable, X ⊐
T. To find a minimal T, first mark all trivial variables; then, break a chain of
trivial variables by adding a constant to one of them; repeat the process until
there is no trivial variable. Other optimizations include inlining productions that
contain no variable and removing redundant terms.
        </p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Plaisted</surname>
            ,
            <given-names>D.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zhu</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          :
          <article-title>Ordered semantic hyper linking</article-title>
          .
          <source>In: J. Autom. Reason</source>
          . (
          <year>2000</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Baumgartner</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fuchs</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tinelli</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Darwin: A theorem prover for the model evolution calculus</article-title>
          . In Schulz, S.,
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tammet</surname>
          </string-name>
          , T., eds.:
          <article-title>IJCAR ESFOR (aka S4)</article-title>
          .
          <source>Electronic Notes in Theoretical Computer Science</source>
          (
          <year>2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Claessen</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>Equinox, a new theorem prover for full first-order logic with equality</article-title>
          .
          <source>Presentation at Dagstuhl Seminar 05431 on Deduction and Applications (October</source>
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Korovin</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>iProver - an instantiation-based theorem prover for first-order logic (system description)</article-title>
          .
          <source>In: Proc. IJCAR '08</source>
          , Berlin, Heidelberg, Springer-Verlag (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Letz</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stenz</surname>
          </string-name>
          , G.:
          <article-title>DCTP: A disconnection calculus theorem prover</article-title>
          . In Goré, R.,
          <string-name>
            <surname>Leitsch</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nipkow</surname>
          </string-name>
          , T., eds.
          <source>: Proc. IJCAR-2001</source>
          , Siena, Italy. Volume 2083 of LNAI., Springer, Berlin (
          <year>June 2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Sutcliffe</surname>
          </string-name>
          , G.:
          <article-title>CASC-J4 the 4th IJCAR ATP system competition</article-title>
          .
          <source>In: Proc. IJCAR '08</source>
          , Berlin, Heidelberg, Springer-Verlag (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Schulz</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <source>System abstract: E 0.81. In: Proc. 2nd IJCAR</source>
          . Volume
          <volume>3097</volume>
          of LNAI., Springer (
          <year>2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Riazanov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voronkov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>The design and implementation of vampire</article-title>
          .
          <source>AI Commun</source>
          .
          <volume>15</volume>
          (
          <issue>2-3</issue>
          ) (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Baumgartner</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fuchs</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          , de Nivelle, H.,
          <string-name>
            <surname>Tinelli</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Computing finite models by reduction to function-free clause logic</article-title>
          .
          <source>Journal of Applied Logic</source>
          <volume>7</volume>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Claessen</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>New techniques that improve mace-style finite model finding</article-title>
          .
          <source>In: Proceedings of the CADE-19 Workshop:</source>
          Model Computation - Principles, Algorithms, Applications. (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Ganzinger</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Korovin</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>New directions in instantiation-based theorem proving</article-title>
          .
          <source>LICS</source>
          (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Hooker</surname>
            ,
            <given-names>J.N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rago</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chandru</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shrivastava</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Partial instantiation methods for inference in first-order logic</article-title>
          .
          <source>J. Autom. Reason</source>
          .
          <volume>28</volume>
          (
          <issue>4</issue>
          ) (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Plaisted</surname>
            ,
            <given-names>D.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Miller</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>The relative power of semantics and unification</article-title>
          . In Andreas Podelski,
          <string-name>
            <given-names>A.V.</given-names>
            ,
            <surname>Wilhelm</surname>
          </string-name>
          , R., eds.: Workshop on Programming Logics in memory of Harald Ganzinger, Saarbruecken, Germany (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Jacobs</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Waldmann</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          :
          <article-title>Comparing instance generation methods for automated reasoning</article-title>
          .
          <source>J. Autom. Reason</source>
          .
          <volume>38</volume>
          (
          <issue>1-3</issue>
          ) (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Weidenbach</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>First-order tableaux with sorts</article-title>
          .
          <source>Logic Journal of the IGPL</source>
          <volume>3</volume>
          (
          <issue>6</issue>
          ) (
          <year>1995</year>
          )
          <fpage>887</fpage>
          -
          <lpage>906</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Pierce</surname>
            ,
            <given-names>B.C.</given-names>
          </string-name>
          :
          <article-title>Types and programming languages</article-title>
          . MIT Press, Cambridge, MA, USA (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Abramsky</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jung</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Domain theory</article-title>
          . In: Handbook of Logic in Computer Science, Clarendon Press (
          <year>1994</year>
          )
          <fpage>1</fpage>
          -
          <lpage>168</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Coquand</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Type theory</article-title>
          . In Zalta, E.N., ed.:
          <source>The Stanford Encyclopedia of Philosophy. (Spring</source>
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>