<!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>
      <journal-title-group>
        <journal-title>SMT</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>First-Order Instantiation using Discriminating Terms</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Chad E. Brown</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mikoláš Janota</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Czech Technical University in Prague, Czech Institute of Informatics</institution>
          ,
          <addr-line>Robotics and Cybernetics, Jugoslávských partyzánů 1580/3, 160 00 Prague 6, Dejvice</addr-line>
          ,
          <country country="CZ">Czech Republic</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <volume>19</volume>
      <fpage>18</fpage>
      <lpage>19</lpage>
      <abstract>
        <p>This paper proposes a technique to limit the number of possible terms to be considered in quantifier instantiation. One of the major hurdles that SMT solvers face when dealing with quantifiers is that there are simply too many terms to instantiate with. So even if the right set of terms is available to the solver, meaning they appear in the formula, the solver might not have enough resources to come upon the right combination. This motivates the technique presented in this paper, which instantiates only by a certain type of terms, called discriminating terms. The paper introduces a class of formulas, where the proposed technique has a considerable impact.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;SMT</kwd>
        <kwd>quantifiers</kwd>
        <kwd>instantiation</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Quantifiers represent one of the major challenges for contemporary SMT solvers and since
typically they lead to undecidability or extreme computational complexity, they are likely to
remain a challenge for times to come.</p>
      <p>
        Most commonly, the general techniques for dealing with quantifiers gradually instantiate the
quantified part of the formula with ground terms until the resulting ground formula becomes
unsatisfiable. The terms to be used in instantiations may be chosen either by syntactic properties
(E-matching [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]) or semantic properties (e.g. model-based quantifier instantiation [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]).
Interestingly, it has been shown that these techniques do not always pay of and simple enumeration of
terms gives better results in some cases [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>This is where this paper comes in. We propose a technique to limit the set of terms to
enumerate. Roughly speaking, in the context of first order logic with equality, a term is labeled
as discriminating if it participates in a disequality.</p>
      <p>
        We have modified the enumeration instantiation algorithm in CVC4 [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] so that only
discriminating terms are considered. We further construct a family of formulas where this approach
demonstrably helps.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. A Class of Problems</title>
      <p>
        Kaminski and Smolka [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] consider an identity that holds over the booleans:  ( ( ())) =  ().
Here  is a boolean and  is a unary function on booleans. It is easy to informally see why this
identity holds by considering all four possible interpretations of  . Obviously the identity also
holds if the domain of interest has only one element. Hence one can make an easy first-order
problem by including an axiom
      </p>
      <p>∀. =  ∨  =  ∨  = 
stating there are at most two elements and making the conclusion  ( ( ())) =  (). A
formal proof would proceed by equational reasoning after instantiating the quantifiers using
the subterms of the conjecture: ,  (),  ( ()) and  ( ( ())). This problem can be made
slightly more dificult by including  unary functions 0, . . . , − 1 and writing the conclusion
as  ( ( (0(· · · − 1() · · · )))) =  (0(· · · − 1() · · · )). The modified problem has  + 4
subterms instead of only 4. The subterms of the form (· · · − 1() · · · ) with  &gt; 0 are red
herrings. The four subterms  (0(· · · − 1() · · · )) with  ∈ {0, 1, 2, 3} are suficient to use
as instantiations to complete the proof.</p>
      <p>
        The problems can also be made more dificult in a diferent way. Following a proof from [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
we will argue that for each natural number  &gt; 0 there are natural numbers 1 &gt; 0 and
2 ≥ 0 such that  1+2 () =  2 () if the domain of interest has at most  elements. If
 = 2, we can take 1 = 2 and 2 = 1 as above. More generally, we choose 2 as  − 1
and 1 is the least common multiple (lcm) of the sequence 2, . . . , . The reason behind these
choices are explored in the following subsection.
      </p>
      <p>To construct the family of formulae in question, define atmost to be the first-order formula
∀0 · · · .</p>
      <p>⋁︁
0≤ &lt;≤ 
 = 
and let kam be the first-order formula</p>
      <p>
        atmost ∧  lcm({2,...,})+− 1(0(· · · − 1() · · · )) ̸=  − 1(0(· · · − 1() · · · )).
2.1. Unsatisfiability of kam
Following the proof (and terminology) of Theorem 7 in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] we show that for an interpretation
of size at most  the following identity holds:
      </p>
      <p>lcm({2,...,})+− 1() =  − 1()</p>
      <p>The intuition for the equality is as follows. The sequence ,  (), . . . ,  (), . . . must
eventually repeat. Both sides of the equation will be in the part that repeats and the length of the
repeating part will be a number at most . Since this length divides lcm({2, . . . , }) we will
be able to conclude</p>
      <p>lcm({2,...,})( − 1()) =  − 1()
Let us now expand this idea more carefully.</p>
      <p>
        Consider an arbitrary interpretation of the function  and the constant  assuming that
the universe has at most  elements. For the purpose of this subsection, we abuse notation
by writing  (· · · ) for the value of  under such interpretation and write  for the value of
 under the interpretation. By the pigeonhole principle there must exist 1 and 2 such that
0 ≤ 2 &lt; 1 ≤  such that  1 () =  2 (). Let 1 and 2 be the least numbers with this
property. Following [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] we call 1 the size and 2 the prefix . We also call the positive number
1 − 2 the lasso and say  () is in the lasso if  ≥ 2. The sequence can be written as follows:
      </p>
      <p>lcm({2,...,})( − 1()) =  − 1()
as desired.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Quasidiscriminating Terms</title>
      <p>
        The tableau calculus from [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] restricts first-order quantifier instantiation to so-called
discriminating terms, i.e., terms that occur on one side of a disequation on the branch. A consequence of
the completeness proof for the tableau calculus is a refinement of Herbrand’s theorem indicating
that (in the presence of the tableau calculus rules or analogous rules) instantiating with members
of the universe of discriminating terms is suficient to lead to an inconsistency, if the branch is
inconsistent.
      </p>
      <p>
        The change of setting from the tableau calculus of [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] to SMT means discriminating terms
are not always suficient. As a simple example we consider kam20. Assume we have clause
normalized so that there is one quantified formula
      </p>
      <p>
        ∀. =  ∨  =  ∨  = 
and one disequation  ( ( ())) ̸=  (). There are only two discriminating terms:  3() and
 (). Instantiating ,  and  with these two terms will always lead to at least two of ,  and 
being the same term so that the resulting disjunction will always have a literal that is trivial by
reflexivity. In the calculus of [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] there is a decomposition rule that would add  ( ()) ̸=  to
the branch since  3() ̸=  () is on the branch. This new disequation means there are now four
discriminating terms. As discussed above, these four terms are suficient to use as instantiations
to derive a contradiction.
      </p>
      <p>
        One option would be to extend CVC4 to behave in ways that simulate the additional rules
of [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. In the example above, this would mean when the current propositional model sets the
literal  3() =  () to false, CVC4 could mimic the decomposition rule by adding a propositional
discriminating
enumeration
z3
default
0
100
200
      </p>
      <p>300
instances
400
500
clause corresponding to  3() =  () ∨  2() ̸= . Further tableau rules that would need to
have a similar counterpart are the mating and confrontation rules.</p>
      <p>We have chosen a simpler, heuristic approach without attempting to maintain completeness.
However, a heuristic that restricts to discriminating terms without simulating the tableau rules
would be far too restrictive. An intermediate heuristic is to restrict to terms that would be
discriminating if the decomposition rule were included. We call these quasidiscriminating terms.</p>
      <p>As a technical definition, we say a pair (, ) is a discriminating pair if the literal  =  is
assigned false by the propositional model. We recursively define quasidiscriminating pairs (, ) as
follows: Every discriminating pair is a quasidiscriminating pair. If ( (1, . . . , ),  (1, . . . , ))
is a quasidiscriminating pair, then (, ) is a quasidiscriminating pair for each  ∈ {1, . . . , }
where  and  are not the same term. A term  is quasidiscriminating if there is some  such
that (, ) or (, ) is a quasidiscriminating pair.</p>
      <p>
        We have modified the enumeration instantiation algorithm in CVC4 [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] so that only
quasidiscriminating terms are considered.
      </p>
    </sec>
    <sec id="sec-4">
      <title>4. Results</title>
      <p>The problems used for evaluation are the formulas kam as defined above. The parameters
were chosen as follows. The parameter  ranges between 4..10 and the value of  ranges
between 0..99 for  ∈ 4..8 and it ranges between 0..9 for  ∈ 9..10. Recall that the parameter
 represents the domain size and  the number of the “dummy” terms .</p>
      <p>For the comparison we considered the default version of CVC4, CVC4 run only in the
enumeration mode, and Z3. Figure 1 shows a cactus plot for the experiment results under
5-minute timeout (300s). Table 1 breaks down the number of solved instances by the domain
size, i.e. by the parameter .
domain
4
5
6
7
8
9
10
Total (520)</p>
      <p>
        Our strategy using discriminating terms solved all the considered benchmarks very quickly
except for the largest ones. CVC4’s enumerative is also performing quite well but the time starts
to increase much more quickly and eventually it times out on the largest problems. The default
version of CVC4 performs rather poorly; our explanation for this is that the conflict-based
instantiation [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] is taking up too much time because of the deep terms. The results for Z3 are
surprising because it can successfully solve the largest instances but tends to fail on the smaller
ones in a somewhat nonuniform fashion. We have also tried running Vampire [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] but that has
timed out on all the considered problems.
      </p>
    </sec>
    <sec id="sec-5">
      <title>5. Summary and Future Work</title>
      <p>This paper proposes a way to restrict possible candidates term for quantifier instantiation by
looking at syntactic properties of the given formula. In particular, we consider only terms
that participate in a disequality. We construct a family of formulas where this technique has
demonstrably the best results.</p>
      <p>The presented techniques opens a number of avenues for future work. Since the presented
technique disregards theories, a natural generalization would be to include theory-specific
predicates, other than just disequality. For instance, in the context of arithmetic strict comparisons
(&lt;) imply disequality and therefore could be used in a similar fashion. While the technique is
clearly performing well on the constructed family of formulas, as of now we don’t have any
dividends that is helpful on general formulas. We conjecture that this might happen in problems
with many function nesting but also, careful integration with other techniques will be needed.
A natural next step to take would be to run the modified CVC4 over the problem sets in the
SMT-LIB to obtain data for how often the quasi-discriminating terms technique is helpful and
how often it is not.</p>
      <p>The family of formulas proposed here is interesting on its own, if only because they are easy
to understand and yet present a challenge to existing SMT solvers and first-order automated
theorem provers. In general, it is unclear whether it is better to instantiate with deeper terms
or with more shallow terms. In the provided family, the outermost terms are actually the right
ones and the inner ones are “red herrings.” But one can envision scenarios where the opposite
is true. So the question is, how to distinguish scenarios like these.
The results were supported by the Ministry of Education, Youth and Sports within the dedicated
program ERC CZ under the project POSTMAN no. LL1902. This scientific article is part of the
RICAIP project that has received funding from the European Union’s Horizon 2020 research
and innovation programme under grant agreement No 857306.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>D.</given-names>
            <surname>Detlefs</surname>
          </string-name>
          , G. Nelson,
          <string-name>
            <given-names>J. B.</given-names>
            <surname>Saxe</surname>
          </string-name>
          ,
          <article-title>Simplify: a theorem prover for program checking</article-title>
          ,
          <source>J. ACM</source>
          <volume>52</volume>
          (
          <year>2005</year>
          )
          <fpage>365</fpage>
          -
          <lpage>473</lpage>
          . doi:
          <volume>10</volume>
          .1145/1066100.1066102.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Ge</surname>
          </string-name>
          , L. M. de Moura,
          <article-title>Complete instantiation for quantified formulas in satisfiability modulo theories</article-title>
          , in: Computer Aided Verification, 21st International Conference, CAV,
          <year>2009</year>
          , pp.
          <fpage>306</fpage>
          -
          <lpage>320</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>642</fpage>
          -02658-4\_
          <fpage>25</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>A.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Barbosa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Fontaine</surname>
          </string-name>
          ,
          <article-title>Revisiting enumerative instantiation, in: Tools and Algorithms for the Construction and Analysis of Systems</article-title>
          , volume
          <volume>10806</volume>
          ,
          <year>2018</year>
          , pp.
          <fpage>112</fpage>
          -
          <lpage>131</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>319</fpage>
          -89963-3\_7.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>C. W.</given-names>
            <surname>Barrett</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. L.</given-names>
            <surname>Conway</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Deters</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Hadarean</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Jovanovic</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>King</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          , C. Tinelli, CVC4, in: G. Gopalakrishnan, S. Qadeer (Eds.), Computer Aided Verification - 23rd International Conference, CAV, volume
          <volume>6806</volume>
          , Springer,
          <year>2011</year>
          , pp.
          <fpage>171</fpage>
          -
          <lpage>177</lpage>
          . doi:
          <volume>10</volume>
          . 1007/978-3-
          <fpage>642</fpage>
          -22110-1\_
          <fpage>14</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>M.</given-names>
            <surname>Kaminski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Smolka</surname>
          </string-name>
          ,
          <article-title>A finite axiomatization of propositional type theory in pure lambda calculus, in: Reasoning in Simple Type Theory: Festschrift in Honor of Peter B</article-title>
          .
          <source>Andrews on His 70th Birthday</source>
          , College Publications,
          <year>2008</year>
          , pp.
          <fpage>243</fpage>
          -
          <lpage>258</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M. P.</given-names>
            <surname>Bonacina</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. A.</given-names>
            <surname>Lynch</surname>
          </string-name>
          , L. de Moura,
          <article-title>On deciding satisfiability by theorem proving with speculative inferences</article-title>
          ,
          <source>Journal of Automated Reasoning</source>
          <volume>47</volume>
          (
          <year>2011</year>
          )
          <fpage>161</fpage>
          -
          <lpage>189</lpage>
          . doi:
          <volume>10</volume>
          . 1007/s10817-010-9213-y.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>C. E.</given-names>
            <surname>Brown</surname>
          </string-name>
          , G. Smolka,
          <article-title>Analytic tableaux for simple type theory and its first-order fragment</article-title>
          ,
          <source>Logical Methods in Computer Science</source>
          <volume>6</volume>
          (
          <year>2010</year>
          ). doi:
          <volume>10</volume>
          .2168/LMCS-6(
          <issue>2</issue>
          :3)
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>A.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Tinelli</surname>
          </string-name>
          , L. M. de Moura,
          <article-title>Finding conflicting instances of quantified formulas in SMT, in: Formal Methods in Computer-Aided Design</article-title>
          ,
          <string-name>
            <surname>FMCAD</surname>
          </string-name>
          <year>2014</year>
          , Lausanne, Switzerland,
          <source>October 21-24</source>
          ,
          <year>2014</year>
          , IEEE,
          <year>2014</year>
          , pp.
          <fpage>195</fpage>
          -
          <lpage>202</lpage>
          . doi:
          <volume>10</volume>
          .1109/FMCAD.
          <year>2014</year>
          .
          <volume>6987613</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>L.</given-names>
            <surname>Kovács</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Voronkov</surname>
          </string-name>
          ,
          <string-name>
            <surname>First-Order Theorem</surname>
          </string-name>
          Proving and Vampire, in: International Conference on Computer Aided Verification, volume
          <volume>8044</volume>
          ,
          <year>2013</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>35</lpage>
          . doi:
          <volume>10</volume>
          .1007/ 978-3-
          <fpage>642</fpage>
          -39799-
          <issue>8</issue>
          _
          <fpage>1</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>