<!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>International Workshop on Satisfiability Checking and Symbolic Computation, July</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Symbolic Computation for All the Fun</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>
        <contrib contrib-type="author">
          <string-name>Mirek Olšák</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Czech Technical University in Prague, CIIRC</institution>
          ,
          <addr-line>Czechia</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Cambridge</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2024</year>
      </pub-date>
      <volume>2</volume>
      <issue>2024</issue>
      <fpage>0000</fpage>
      <lpage>0003</lpage>
      <abstract>
        <p>Motivated by the recent 10 million dollar AIMO challenge, this paper targets the problem of finding all functions conforming to a given specification. This is a popular problem at mathematical competitions and it brings about a number of challenges, primarily, synthesizing the possible solutions and proving that no other solutions exist. Often, there are infinitely many solutions and then the set of solutions has to be captured symbolically. We propose an approach to solving this problem and evaluate it on a set of problems that appeared in mathematical competitions and olympics.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;AIMO</kwd>
        <kwd>synthesis</kwd>
        <kwd>quantifier elimination</kwd>
        <kwd>SMT</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>(2)</p>
    </sec>
    <sec id="sec-2">
      <title>2. Problems Description</title>
      <p>
        As a source for our problems we have used a collection compiled by Vít Musil [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] comprising problems
from several sources, including international competition and some (easier) problems from the Prague
Seminar in Mathematics3. We have transcribed the problems into SMT2, where each original problem
is divided into 3 types of queries.
      </p>
      <p>• The satisfiability of the specification if there is a solution (problems
find); for the example above:
∀ : R. ( + ) =  () +  ()
• The unsatisfiability of the specification together with the negation of all proposed solutions
(problems prove); for the example above:</p>
      <p>∀ : R. ( + ) =  () +  () ∧ ∃ : R. () ̸= 0
• The check that every proposed solution is indeed a solution to the specifications (problems check),
i.e., the unsatisfiability of the proposed solution together with the negation of the specification;
for the example above: 4</p>
      <p>∃ : R. ( + ) ̸=  () +  () ∧ ∀ : R. () = 0</p>
      <p>
        This way, we are asking SMT solvers to solve particular steps, although these steps do not necessarily
cover the full solution of a functional equation. We are not providing a formal description of what a
valid solution is allowed to consist of (that could be further work using for example SyGuS [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]). Rather,
we use our own method for finding the set of all solutions of a particular form, described in Section 3.
The SMT2 problems are made available as a GitHub repository5 describing 87 problems. In some cases,
the check query is split into multiple SMT2 files, if there are multiple distinct solutions.
      </p>
      <p>
        We remark that during this work we uncovered several bugs in our translation to SMT from the
source material. But also, we have found an issue in the original source material. Namely the problem
C9 (Cvičení 9) was unsatisfiable in the original [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] and we created two versions of the problem as two
diferent ways of correcting it ( C9 and C9a).
      </p>
      <sec id="sec-2-1">
        <title>2.1. Solutions of Selected Problems</title>
        <p>Section 3 describes our approach to solving the problem by trying to prove that it fits a fixed template,
in particular, we focus on functions that can be expressed as polynomials. In most cases, this is probably
not how a human would solve it. It is the subject of future work to make this connection. For comparison,
we show here three example problems together with their original (human) solutions:
• Problem U24, which is among the most interesting ones that we were able to fully solve;
• Problem C12, which we were not able to solve but it does not require any advanced technique, so
it could be feasible to solve it;
• Problem U2, which showcases a problem requiring induction to be solved, and we assume is
currently out of reach.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Example Problem U24 (Baltic Way 1998-7): Find all functions  : R → R such that for any pair</title>
      <p>of real numbers , , the following identity holds</p>
      <p>() +  () =  ( () ()).
3https://prase.cz/info/info_en.php?lang=1
4In most cases, the SMT solver can get rid of  completely by macro detection.
5https://github.com/MikolasJanota/FuncProbs
Solution: First, we notice that the image of  is closed under addition: if ,  are the values of  at
points , , then also  +  is a value of  , in particular at point  () () = . Fix arbitrary 1, and
denote  =  (1). By the previous observation, we can find also 2 and 4 such that  (2) = 2, and
 (4) = 4.</p>
      <p>
        Now, we plug into the functional equation the assignments ( = 2,  = 2), and ( = 1,  = 4).
4 =  (2) +  (2) =  ( (2) (2)) =  (42)
5 =  (1) +  (4) =  ( (1) (4)) =  (42)
We conclude 4 = 5, and consequently  = 0. Since we started with arbitrary  () = , the function
must be constant zero, which indeed satisfies the equation. For this problem, the SMT solver cvc5 was
able to demonstrate that  must be constantly 0 by the enumerative strategy [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. The proof found is
analogous to the human proof.6 It does not contain the general observation that the domain is closed
under addition, which is possible because this property is only needed for the points appearing in the
proof. The proof is also far less legible because it does not denote subexpressions by new constants
(such as  =  (1)).
      </p>
      <p>Example Problem C12 (IMO 1992-2): Find all functions  : R → R such that for any pair of real
numbers , , the following identity holds</p>
      <p>(2 +  ()) =  +  ()2.</p>
      <p>Solution: Setting  = 0 gives  ( ()) =  +  (0)2. The right-hand side  +  (0)2 is a bijection, so
also the left-hand side  ∘  is a bijection R → R, and that can only happen when  itself is a bijection.</p>
      <p>Since  is a bijection, we can consider an argument  such that  () = 0. Let us substitute ( =
,  = 0) and ( = − ,  = 0) to the original equation.</p>
      <p>0 = 0 +  ()2 =  (2 +  (0)) =  ((− )2 +  (0)) = 0 +  (− )2 =  (− )2.</p>
      <p>We obtained  (− ) = 0. By injectivity, −  = , so  = 0, and  (0) = 0. This also simplifies our first
observation to  ( ()) = .</p>
      <p>Now we prove that the function is increasing. Any pair of numbers  &lt;  can be expressed as
 =  (),  = 2 +  () for some , ,  ̸= 0. Combining the original equation with the same equation
having substituted  = 0, we get</p>
      <p>() =  ( ()) =  &lt;  +  ()2 =  (2 +  ()) =  (),
concluding that  is increasing.</p>
      <p>Consider any  where  ≤  (). Since  is increasing, also  () ≤  ( ()) = . Analogously, if
 () ≤ , we obtain  =  ( ()) ≤  (). Thus the statements  ≤  () and  () ≤  are equivalent
for any , leaving the only option  () = , which is a function satisfying the given equation.</p>
    </sec>
    <sec id="sec-4">
      <title>Example Problem U2 (Cauchy equation): Find all increasing functions  : R → R such that for</title>
      <p>any pair of real numbers , , the following identity holds</p>
      <p>() +  () =  ( + ).
6To obtain instantiations from cvc5, use –no-e-matching –enum-inst –dump-instantiations –produce-proof.
Proof sketch: By setting  = 0, , 2, 3, . . ., we obtain by induction that  () =  () for every
non-negative integer , in particular  (0) = 0, and if we fix  = 1 and denote  (1) = , we obtain the
following equation for all non-negative integers .</p>
      <p>() = .
( )
♣
We gradually extend the domain for which we know this equation. First, substitution ( = ,  = − )
into the original equation gives  () = −  (− ) which extends (♣) to all integers . Let  be an
arbitrary number satisfying (♣), and  be a positive integer. Then
leading to
  =  ︁(  )︁ .</p>
      <p>Therefore, (♣) holds for any rational number .</p>
      <p>Finally, we show that (♣) must be satisfied by every real number. Suppose on the contrary that for
some , we have for example  () &lt; , or  () &gt; . We discuss here the first option, the other one
is analogous. If  () &lt; , there is a rational number  such that () &lt;  &lt;  (note  &gt; 0 since  is

assumed to be increasing). Then  &lt;  but  () &lt;  =  () contradicting that  is increasing.</p>
      <p>
        This proof goes beyond the abstraction level of SMT solvers. Notably, it uses induction, which SMT
solvers can do [
        <xref ref-type="bibr" rid="ref10 ref11 ref9">9, 10, 11</xref>
        ] but the induction here is over a subdomain (natural numbers) vs. reals, where
it cannot be applied directly.
      </p>
    </sec>
    <sec id="sec-5">
      <title>3. Template-and-QE</title>
      <p>One could see the problem as quantifier elimination in the theory of uninterpreted functions,
accompanied by the theory required for describing the problem itself — in our case, the theory of reals or
rationals. Due to the undecidability of such a problem, quantifier elimination algorithms cannot be used
directly. A possible approach would be to synthesize one function adhering to the specification and
then strengthen the specification so that the individual solution is not admitted any more. Then, one
would have to repeat this process with the hope that there are finitely many solutions, or, observe the
solutions and generalize them into a more compact description. All these steps are highly nontrivial.
Instead, we propose an approach that tries a fixed template and then performs quantifier elimination:
template-and-QE, which comprises the following subtasks.</p>
      <p>1. Identify a template for the solution, e.g.  () ≜  + .
2. Prove that all solutions must fall into this template (template verification )
3. Perform quantifier elimination over input variables of the function(s).</p>
      <p>Note that in the case of reals, all tasks are computable, except for task 2. The remainder of this section
elaborates on the individual steps.</p>
      <sec id="sec-5-1">
        <title>3.1. Template Verification</title>
        <p>
          We run cvc5 [
          <xref ref-type="bibr" rid="ref12">12</xref>
          ], Z3 [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ], Vampire [14] and Waldmeister [15] to attempt to prove all solutions to
a problem necessarily fit a certain template. Since Waldmeister does not support theories directly,
it needs special treatment and we elaborate on this below. The other solvers support natively the
SMT2 syntax [16] enabling us to use the combination of quantified non-linear reals with uninterpreted
functions.7
        </p>
        <p>We consider the following set of templates for solutions: constant, (monomial) linear, (monomial)
quadratic. All these are subclasses of the quadratic form but we consider these to simplify the task for
7The standard does not list UFNRA as one of the logics, therefore the files indicate AUFNIRA as the closest superset.
the solvers—it is conceivable that it is easier to prove that the function must be constant than to prove
that it must be arbitrary quadratic. Since the set of templates is small, we always try all of them.</p>
        <p>In order to ask an SMT solver if all solutions must be linear, we add the assertion that the function is
not linear. An obvious way to state that  is linear is via the formula ∃ : R.∀ : R. () =  + .
We call the problem resulting from including the properties of the original problem along with the
negation of ∃ : R.∀ : R. () =  +  the first variant of the linear template verification . We had
more success using a diferent test for linearity. A function  is linear if and only if ∀ : R. () =
( (1) −  (0)) +  (0). Note that this formulation avoids the use of existential quantifiers. We call the
problem resulting from including the properties of the original problem along with the negation of
∀ : R. () = ( (1) −  (0)) +  (0) the second variant of the linear template verification . If any SMT
solver can determine either variant is unsatisfiable, then we know all solutions must be linear.</p>
        <p>We likewise have two variants for each of the other templates. The formulations for the first variants
simply use existential quantification for the coeficients. For the second variants, we use the following
properties:
• constant: ∀ : R. () =  (0)
• monomial linear: ∀ : R. () =  (1)
• linear: ∀ : R. () = ( (1) −  (0)) +  (0)
• monomial quadratic: ∀ : R. () =  (1)2
• quadratic: ∀ : R.2 () = (( (1) +  (− 1)) − 2 (0))2 + ( (1) −  (− 1)) + 2 (0)</p>
        <sec id="sec-5-1-1">
          <title>3.1.1. Using Waldmeister</title>
          <p>In addition to using SMT solvers, we also used Waldmeister [15]. Waldmeister is an automated theorem
prover specializing in first-order unit equality. Unlike SMT solvers, Waldmeister has no information
about integers or reals. Consequently, in order to ask Waldmeister if all functions  satisfying some
properties must be contained within the class given by a template, we first declare a sort  along with
constants 0, 1 :  and operations +, − , · satisfying properties of a commutative ring with identity. Each
of these properties is given by a unit equation. We purposely use rings instead of fields (although R is a
ifeld). This allows us to ignore division since the side condition that the denominator is not zero would
result in a clause that is not a unit equation. We only generate such a problem for Waldmeister when
all the properties stated for  in the problem are unit equations, only quantify over reals (as opposed to
integers), and do not use division. Furthermore, we require that all specific real numbers mentioned in
the properties correspond to integers (e.g., 0.0, 1.0, -1.0, etc.). These restrictions allow us to formulate a
unit equation to give Waldmeister corresponding to each property of  given in the problem.</p>
          <p>In addition to the assumed unit equations, Waldmeister expects a unit equation as a goal to prove. The
goal varies based on the template we are targeting and corresponds to the second variant of the problems
for the SMT solver. In each case we fix a constant  of type  (not mentioned in the assumptions). For
each template, the goal unit equation is as follows:
• constant:  () =  (0)
• monomial linear:  () =  (1)
• linear:  () = ( (1) −  (0)) +  (0)
• monomial quadratic:  () =  (1)2
• quadratic: 2 () = (( (1) +  (− 1)) − 2 (0))2 + ( (1) −  (− 1)) + 2 (0)
Waldmeister uses Knuth-Bendix style completion [17] on the assumed unit equations finding a proof of
the goal when both sides of the goal rewrite to a common term.</p>
          <p>For 8 of the problems, Waldmeister can prove all solutions are within the expected class. Two of
these problems were not covered by SMT solvers: U25 and U87. In both of these problems, the least
template class is linear monomials. We briefly discuss these two problems.</p>
          <p>
            The problem U25 asks for all real functions  satisfying  ( () +  ()) =  +  ()2. Musil [
            <xref ref-type="bibr" rid="ref7">7</xref>
            ]
gives a proof that the only two solutions are  () =  and  () = − . Waldmeister’s goal is to prove
 () =  (1) from the ring identities and the equation above. It is dificult to directly compare the
aforementioned human proof to the proof found by Waldmeister. However, there are some interesting
common intermediate results. Both proofs prove  is involutive (i.e.,  ( ()) = ),  ()2 = 2 and
 (0) = 0. On the other hand, there are several identities in each proof that do not appear in the other.
Musil’s proof [
            <xref ref-type="bibr" rid="ref7">7</xref>
            ] proves  is surjective and uses this fact, while the Waldmeister proof cannot directly
represent the concept of surjectivity.
          </p>
          <p>
            Waldmeister also proves all solutions to the problem U87 are linear monomials. The problem U87 asks
for all real functions  satisfying  ( + 2 + ) =  ( ()) +  () +  (). The (only) two solutions
are  () =  and  () = 0. In this case, there is no corresponding proof by Musil [
            <xref ref-type="bibr" rid="ref7">7</xref>
            ] as a point of
comparison. A number of intermediate identities derived by Waldmeister stand out, e.g.,  ( (0)) = 0
and  ( ()) =  ().
          </p>
        </sec>
      </sec>
      <sec id="sec-5-2">
        <title>3.2. Quantifier Elimination</title>
        <p>Quantifier elimination (QE) is a method to take a general formula in a theory and produce an equivalent
quantifier-free formula. So for instance, in ∃ ∈ R. &lt;  &lt; , the quantified variable  is eliminated
as  &lt; . In many cases, quantifier elimination serves as a theoretical tool to show that a theory is
decidable but also has a long tradition of improvements at the algorithmic level [18, 19, 20, 21, 22, 23, 24].
In our work, QE is used to reveal the particular solutions within a class given by a template.</p>
        <p>We assume the original problem only has one uninterpreted function,  , and it is a unary function
from reals to reals. If we want to determine all functions  of the form  () =  + , we can simply
inline  in the properties, replacing each occurrence  () by  + . The resulting problem has no
uninterpreted functions and is usually in the theory of the reals. (Exceptional cases are when the
properties mention integers as well as reals.) When the problem and template result in such an inlined
problem in the theory of reals, we can apply quantifier elimination.</p>
        <p>
          We have made use of two implementations of quantifier elimination for the reals: Z3 [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ] and
Tarski [25]. In Z3, QE is invoked by applying the qe tactic, with the qe-nonlinear parameter turned
on. The Tarski system is highly configurable but since QE is not a bottle-neck for us, we use the
qepcad-qe [26] function in its default setting. For each system, quantifier elimination should result in
a quantifier-free formula involving the uninterpreted constants (e.g., the coeficients  and  of the linear
template  + ). One might expect this formula to be in a solved form, e.g.,  = 1 ∨  = 0 ∧  = 1, from
which one can read of the precise class of linear functions satisfying the original property. However,
this is generally not the case. A separate postprocessing step attempts to convert the quantifier-free
formula into such a solved form. In practice the postprocessing does not always succeed. In the case
of Z3, we also call the tactics simplify and propagate-values to have Z3 simplify the formula before
applying the postprocessing to attempt to find a solved form.
        </p>
        <p>Problem U91 asks for all functions satisfying  (( − )2) =  ()2 − 2 () + 2. Using the
techniques of Section 3.1, we can prove all solutions  must be linear. After replacing  () with
 +  and calling Z3 to do quantifier elimination, we obtain the quantifier-free formulas  = 1 and
 = 0 ∨  = 1. In general, Z3 represents the result of QE as a conjunction of several subformulas. The
formula  = 1 ∧ ( = 0 ∨  = 1) is almost in solved form, and we can easily obtain the two solutions
 () =  and  () =  + 1 via postprocessing. Tarski’s quantifier elimination returns the more
complicated formula</p>
        <p>− 1 +  = 0 ∧  ≥ 0 ∧ − 1 +  ≤ 0 ∧ ( = 0 ∨ − 1 +  = 0).</p>
        <p>The postprocessor is also able to obtain the two solutions from this formula.</p>
        <p>Sometimes there is a parameterized class of solutions. Problem U3, for example, asks for all functions
satisfying  ( + ) =  () + . The techniques of Section 3.1 determine all solutions are linear. After
inlining  () =  + , we call quantifier elimination. Both Z3 and Tarski produce the formula
− 1 +  = 0. From this the postprocessor can determine  = 1 and  is unconstrained. This gives the
class of solutions  () =  +  where  is a real number. Indeed, this is the class of all solutions, as
desired.</p>
      </sec>
      <sec id="sec-5-3">
        <title>3.3. Postprocessor to Obtain Solved Forms</title>
        <p>We say a quantifier-free formula is in solved form8 if it is a disjunctive normal form where all the literals
are of the form  =  where  is a coeficient of the template and  is a real number. We call a formula
of the form  =  an assignment atom. The postprocessor is given a list of formulas  (thought of
conjuctively) and attempts to generate a solved form equivalent to  1 ∧ · · · ∧  . As auxiliary values, a
list  of equations of the form  =  and a list  of other literals are generated, so that generally we are
working with a triple (, ,  ) of lists of formulas, with  and  initially empty. Suppose  is nonempty,
with  1 being the first formula on the list. If  1 is a conjunction or a disjunction, we can simply make
recursive calls to the preprocessor to ask for solved forms of the decomposed formulas. In the case of
disjunction, we make two recursive calls (one for each disjunct) and combine the results as a disjunction
of the two solved forms (or fail if one call fails). If  1 is an equation  = , we add this to the equation
list  . If  1 is of the form  ≤ ,  ≥ ,  &lt;  or  &gt; , then we add this to the other list  . In every other
case for  1, we simply fail to return a solved form. We are nfially left with the case where there are
no remaining formulas in  . The hope in this case is that  contains suficient information to obtain
assignment atoms, and we only need to verify that the assignments satisfy the other formulas from  .
If the assignment atoms satisfy the other formulas, the conjunction of the assignment atoms will be
the solved form. If the assignment atoms do not satisfy the other formulas, the empty disjunction ⊥
will be the solved form. It is also possible (e.g., if 2 = 1 is in the list  ) a solved form with more than
one disjunct. At this point, the algorithm transforms a triple (, ,  ) where  is the list of assignment
atoms (initially empty). We will also call  an assignment.</p>
        <p>We say a term  can be evaluated under an assignment  if every constant occurring in  is associated
with a real number via  . We say an atom  = ,  ≤ ,  ≥ ,  &lt;  or  &gt;  can be evaluated under an
assignment  if both terms  and  can be evaluated under an assignment  . Clearly, if a term can be
evaluated under an assignment  , the term evaluates to a specific real number. Likewise, if an atom can
be evaluated under an assignment  , the atom evaluates to true or false.</p>
        <p>Assume  is nonempty and  =  is the first equation on  . We consider the following cases (in order),
dropping the equation from  :
1. Assume both  and  can be evaluated under  . We drop the equation if they evaluate to the same
reals and return ⊥ otherwise.
2. Assume  is a coeficient  and  can be evaluated to the real . We add  =  to  .
3. Assume  can be evaluated under  and  is one of a number of special forms which make use of
an unassigned coeficient  and all other subterms  that can be evaluated under  . Examples of
these special forms are 1 + , 1 + 2 and 2. In each case we solve for values  of  and add
 =  to  (or fail). If there are no solutions, we return ⊥. If there are multiple solutions, we
recursively call with both assignments and return the disjunction of the resulting solved forms.
4. Assume the first equation  =  is of the form  + 1 =  and there is a second equation ′ = ′
on the list  of the form  +  = ′ where  and  are unassigned coeficients and 1,  and ′ can
all be evaluated under  . Then we solve these two linear equations for  and  (if possible) and
add these to the assignment  , dropping both equations from  .</p>
        <p>We finally assume  is empty. If some formula in  cannot be evaluated via the assignment  , then
we fail to return a solved form. Assume every  can be evaluated via the assignment  . If every 
evaluates to true, then we return the conjunction of the assignment atoms in  as the solved form.
Otherwise, we return ⊥ as the solved form.</p>
        <p>The postprocessor included suficiently many cases to obtain a solved form from either the output
of Z3 or Tarski (or preferably both) in each of the problems we considered. There are many cases in
which it will fail to compute a solved form. Easy examples are 3 = 1 and 2 +  = 2 ∧  +  = 1.
8One may imagine loosening the concept but the general idea is to provide a specific solution as possible.</p>
        <sec id="sec-5-3-1">
          <title>3.3.1. Lazy Verification</title>
          <p>We now briefly consider an alternative to the approach outlined above. When considering a template,
we do not need to verify that all solutions are in the template class in advance. Instead, we could use
QE to find a class of solutions for a fixed template and then prove there are no other solutions. The
advantage of this approach is illustrated by the following example. Problem C1 asks for all functions 
such that the following holds</p>
          <p>( + ) + 2 ( − ) − 4 () +  () = 32 − 2 − 2 + 2.</p>
          <p>The only solution is  () = 2.</p>
          <p>In this case, the solvers listed in Section 3.1 are unable to prove that all solutions are a monomial
quadratic (or that they must be quadratic). However, we can still apply quantifier elimination to find
all monomial quadratic solutions. For this example, Z3 timed out even when given 10 minutes. On
the other hand, Tarski returned the formula − 1 +  = 0 (yielding the solution  = 1, i.e., 2) in less
than a second. Since we were unable to prove all solutions must belong to the monomial quadratic
template class, it is still possible there are more solutions outside the monomial quadratic template
class. However, now that we have the specific solution  () = 2 we can ask an SMT solver to prove
this is the only solution by assuming the equation and also the negation of ∀ : R. () = 2. The
solver cvc5 is easily able to show this is unsatisfiable, so we know that  () = 2 is the only solution.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>4. Experiments</title>
      <p>We report the results of the template-and-qe method (Section 3) on the benchmark presented in Section 2.
The lazy extension of our approach (Section 3.3.1) was left for future work. The template verification
(Section 3.1) has proven to be the most dificult task. Table 1a summarizes the obtained results for
template verification. For all these, we were able to solve the QE task. Thirteen instances were solved
completely by the automated method. Out of these thirteen, two can be traced to a competition event.
Problem U24 comes from Baltic Way competition—see Section 2 for “human” solution. Problem U71
comes from The Prague Seminar (PraSe-18-6-1). In both cases, the only solution is a function that is
constantly 0.</p>
      <p>The verification tasks results often in satisfiable problems, namely if there exists a solution outside of
the proposed template (the × symbol in Table 1a). These satisfiable problems are nontrivial because they
involve creating a counterexample to the template. For this purpose, we also ran the SyGuS approach
of cvc5 (option –sygus-inference) and its linear model builder [27].</p>
      <p>We also report on the verification of the correctness of the handwritten solutions, which comprises
two components: prove — show that all possible solutions are covered by the suggested solutions;
check — check that all suggested solutions are indeed solutions to the problem (see Section 2). Table 1b
summarizes the obtained results. Sixty-five of the provided handwritten solutions were successfully
checked, i.e., the individual solutions satisfy the original specifications. Twenty of the handwritten
solutions were shown to cover all the individual solutions. Unsurprisingly, the proving task is harder
than the checking task. We remark that checking solutions for U79 is trivial because there are no
individual solutions. More detailed results can be found on the authors’ web page [28].</p>
    </sec>
    <sec id="sec-7">
      <title>5. Conclusions and Future Work</title>
      <p>This paper joins the efort of rising to the challenge of making computers as powerful as the golden
medalists at the International Math Olympics (IMO). Eforts such as AlphaGeometry [ 29], show that
machine learning models are useful for the task but at the same time, further research shows that they
benefit from existing symbolic methods [ 30]. Here we show that symbolic methods are indeed already
powerful in solving a highly nontrivial task of finding all functions fulfilling a certain specification.
Besides the task leading to undecidable questions, its dificulty also lies in the fact it is not a decision
problem but the response is a description of a class of mathematical objects.</p>
      <p>The method we employ is anchored in templates, which is a well-known technique in function and
program synthesis [31]. The templates we consider are rather simple and they could be made more
powerful by adding conditionals (if-then-else). However, the templates need to be kept simple if we
wish to be able to apply quantifier elimination.</p>
      <p>
        An alternative to templates would be to attempt extending diferent synthesis approaches, e.g., such
as those that are realized in saturation-based solvers [
        <xref ref-type="bibr" rid="ref2 ref3">2, 3</xref>
        ] or inside SMT solvers [32, 33, 34] or inductive
logic programming [35]. The challenge here would be how to come up with all the solutions.
      </p>
    </sec>
    <sec id="sec-8">
      <title>Acknowledgments</title>
      <p>The results were supported by the Ministry of Education, Youth and Sports within the dedicated program
ERC CZ under the project POSTMAN no. LL1902 and co-funded by the European Union under the
project ROBOPROX (reg. no. CZ.02.01.01/00/22_008/0004590). C. Brown was supported by CORESENSE:
the European Union’s Horizon Europe research and innovation programme under grant agreement
no. 101070254 CORESENSE. This 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.
[14] L. Kovács, A. Voronkov, First-order theorem proving and Vampire, in: N. Sharygina, H. Veith
(Eds.), Computer Aided Verification - 25th International Conference, CAV, volume 8044 of LNCS,
Springer, 2013, pp. 1–35. doi:10.1007/978-3-642-39799-8\_1.
[15] T. Hillenbrand, B. Löchner, The next Waldmeister loop, in: A. Voronkov (Ed.), Automated
Deduction - CADE-18, 18th International Conference on Automated Deduction, volume 2392 of
Lecture Notes in Computer Science, 2002, pp. 486–500. doi:10.1007/978-3-540-45085-6_27.
[16] C. Barrett, P. Fontaine, C. Tinelli, The SMT-LIB Standard: Version 2.6, Technical Report, Department
of Computer Science, The University of Iowa, 2017. Available at www.SMT-LIB.org.
[17] L. Bachmair, N. Dershowitz, D. A. Plaisted, Completion without failure, in: Rewriting Techniques,</p>
      <p>Elsevier, 1989, pp. 1–30.
[18] G. E. Collins, Quantifier elimination for real closed fields by cylindrical algebraic decompostion,
in: H. Brakhage (Ed.), Automata Theory and Formal Languages, Springer, Berlin, Heidelberg, 1975,
pp. 134–183.
[19] D. C. Cooper, Theorem proving in arithmetic without multiplication, Machine intelligence 7 (1972)
300.
[20] J. Ferrante, C. Rackof, A decision procedure for the first order theory of real addition with order,</p>
      <p>SIAM Journal on Computing 4 (1975) 69–76. doi:10.1137/0204006.
[21] R. Loos, V. Weispfenning, Applying linear quantifier elimination, Comput. J. 36 (1993) 450–462.</p>
      <p>doi:10.1093/COMJNL/36.5.450.
[22] J. H. Davenport, Y. Siret, E. Tournier, Computer algebra - systems and algorithms for algebraic
computation (2. ed.), Academic Press, 1993.
[23] A. R. Bradley, Z. Manna, The calculus of computation - decision procedures with applications to
verification, Springer, 2007. doi: 10.1007/978-3-540-74113-8.
[24] N. S. Bjørner, M. Janota, Playing with quantified satisfaction, in: LPAR, EasyChair, 2015, pp. 15–27.</p>
      <p>doi:10.29007/VV21.
[25] F. Vale-Enriquez, C. W. Brown, Polynomial constraints and unsat cores in Tarski, in: J. H. Davenport,
M. Kauers, G. Labahn, J. Urban (Eds.), Mathematical Software - ICMS - 6th International Conference,
volume 10931 of LNCS, Springer, 2018, pp. 466–474. doi:10.1007/978-3-319-96418-8\_55.
[26] G. E. Collins, H. Hong, Partial cylindrical algebraic decomposition for quantifier elimination, J.</p>
      <p>Symb. Comput. 12 (1991) 299–328. doi:10.1016/S0747-7171(08)80152-6.
[27] M. Janota, B. Piotrowski, K. Chvalovský, Towards learning infinite SMT models, 2023. URL:
http://people.ciirc.cvut.cz/~janotmik/, 25th International Symposium on Symbolic and Numeric
Algorithms for Scientific Computing, SYNASC.
[28] M. Janota, 2024. URL: https://sat.inesc-id.pt/~mikolas/sc2_2024/.
[29] T. H. Trinh, Y. Wu, Q. V. Le, H. He, T. Luong, Solving olympiad geometry without human
demonstrations, Nature 625 (2024) 476–482. doi:10.1038/s41586-023-06747-5.
[30] S. Sinha, A. Prabhu, P. Kumaraguru, S. Bhat, M. Bethge, Wu’s method can boost symbolic AI to
rival silver medalists and AlphaGeometry to outperform gold medalists at IMO geometry, 2024.
arXiv:2404.06405.
[31] S. Srivastava, S. Gulwani, J. S. Foster, Template-based program verification and program synthesis,</p>
      <p>Int. J. Softw. Tools Technol. Transf. 15 (2013) 497–518. doi:10.1007/S10009-012-0223-4.
[32] A. Reynolds, V. Kuncak, C. Tinelli, C. W. Barrett, M. Deters, Refutation-based synthesis in SMT,</p>
      <p>Formal Methods Syst. Des. 55 (2019) 73–102. doi:10.1007/S10703-017-0270-2.
[33] A. Abate, H. Barbosa, C. W. Barrett, C. David, P. Kesseli, D. Kroening, E. Polgreen, A. Reynolds,
C. Tinelli, Synthesising programs with non-trivial constants, J. Autom. Reason. 67 (2023) 19.
doi:10.1007/S10817-023-09664-4.
[34] H. Barbosa, A. Reynolds, D. Larraz, C. Tinelli, Extending enumerative function synthesis via
SMT-driven classification, in: C. W. Barrett, J. Yang (Eds.), Formal Methods in Computer Aided
Design, FMCAD, IEEE, 2019, pp. 212–220. doi:10.23919/FMCAD.2019.8894267.
[35] D. M. Cerna, A. Cropper, Generalisation through negation and predicate invention, in: Proceedings
of the AAAI Conference on Artificial Intelligence, volume 38, 2024, pp. 10467–10475. doi: 10.1609/
aaai.v38i9.28915.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>R.</given-names>
            <surname>Alur</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Bodik</surname>
          </string-name>
          , G. Juniwal,
          <string-name>
            <surname>M. M. K. Martin</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Raghothaman</surname>
            ,
            <given-names>S. A.</given-names>
          </string-name>
          <string-name>
            <surname>Seshia</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Singh</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>SolarLezama</surname>
            , E. Torlak,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Udupa</surname>
          </string-name>
          ,
          <article-title>Syntax-guided synthesis</article-title>
          , in: 2013 Formal Methods in Computer-Aided Design,
          <year>2013</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>8</lpage>
          . doi:
          <volume>10</volume>
          .1109/FMCAD.
          <year>2013</year>
          .
          <volume>6679385</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P.</given-names>
            <surname>Hozzová</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Kovács</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Norman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Voronkov</surname>
          </string-name>
          ,
          <article-title>Program synthesis in saturation</article-title>
          , in: B.
          <string-name>
            <surname>Pientka</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          Tinelli (Eds.),
          <source>Automated Deduction - CADE 29 - 29th International Conference on Automated Deduction</source>
          , volume
          <volume>14132</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2023</year>
          , pp.
          <fpage>307</fpage>
          -
          <lpage>324</lpage>
          . doi:
          <volume>10</volume>
          .1007/ 978-3-
          <fpage>031</fpage>
          -38499-8\_
          <fpage>18</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>P.</given-names>
            <surname>Hozzová</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Amrollahi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Hajdu</surname>
          </string-name>
          ,
          <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>
            <given-names>E. M.</given-names>
            <surname>Wagner</surname>
          </string-name>
          ,
          <article-title>Synthesis of recursive programs in saturation</article-title>
          ,
          <source>in: International Joint Conference on Automated Reasoning IJCAR</source>
          ,
          <year>2024</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>S.</given-names>
            <surname>Ratschan</surname>
          </string-name>
          ,
          <article-title>Deciding predicate logical theories of real-valued functions</article-title>
          , in: J.
          <string-name>
            <surname>Leroux</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Lombardy</surname>
          </string-name>
          , D. Peleg (Eds.),
          <source>48th International Symposium on Mathematical Foundations of Computer Science (MFCS</source>
          <year>2023</year>
          ), volume
          <volume>272</volume>
          of LIPIcs, Schloss Dagstuhl - Leibniz-Zentrum für Informatik, Dagstuhl, Germany,
          <year>2023</year>
          , pp.
          <volume>76</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>76</lpage>
          :
          <fpage>15</fpage>
          . doi:
          <volume>10</volume>
          .4230/LIPIcs.MFCS.
          <year>2023</year>
          .
          <volume>76</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>A. R.</given-names>
            <surname>Bradley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Manna</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H. B.</given-names>
            <surname>Sipma</surname>
          </string-name>
          ,
          <article-title>What's decidable about arrays?</article-title>
          , in: Verification,
          <string-name>
            <given-names>Model</given-names>
            <surname>Checking</surname>
          </string-name>
          , and Abstract Interpretation Conference, VMCAI, volume
          <volume>3855</volume>
          , Springer,
          <year>2006</year>
          , pp.
          <fpage>427</fpage>
          -
          <lpage>442</lpage>
          . doi:
          <volume>10</volume>
          .1007/11609773\_
          <fpage>28</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Ge</surname>
          </string-name>
          , L. M. de Moura,
          <article-title>Complete instantiation for quantified formulas in satisfiabiliby modulo theories</article-title>
          , in: Computer Aided Verification CAV, volume
          <volume>5643</volume>
          , Springer,
          <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="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>V.</given-names>
            <surname>Musil</surname>
          </string-name>
          , Funkcionální rovnice,
          <year>2024</year>
          . URL: https://prase.cz/library/FunkcionalniRovniceVM/ FunkcionalniRovniceVM.pdf,
          <source>downloaded 8 March</source>
          <year>2024</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>M.</given-names>
            <surname>Janota</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>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          ,
          <article-title>Fair and adventurous enumeration of quantifier instantiations, in: Formal Methods in Computer-Aided Design</article-title>
          , IEEE,
          <year>2021</year>
          , pp.
          <fpage>256</fpage>
          -
          <lpage>260</lpage>
          . doi:
          <volume>10</volume>
          . 34727/2021/ISBN.978-3-
          <fpage>85448</fpage>
          -046-4\_
          <fpage>35</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>P.</given-names>
            <surname>Hozzová</surname>
          </string-name>
          ,
          <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>
          ,
          <article-title>Integer induction in saturation</article-title>
          , in: A.
          <string-name>
            <surname>Platzer</surname>
          </string-name>
          , G. Sutclife (Eds.),
          <source>Automated Deduction - CADE 28 - 28th International Conference on Automated Deduction</source>
          , volume
          <volume>12699</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2021</year>
          , pp.
          <fpage>361</fpage>
          -
          <lpage>377</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>030</fpage>
          -79876-5\_
          <fpage>21</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>M.</given-names>
            <surname>Hajdú</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Hozzová</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Kovács</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Reger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Voronkov</surname>
          </string-name>
          ,
          <article-title>Getting saturated with induction</article-title>
          ,
          <source>CoRR abs/2402</source>
          .18954 (
          <year>2024</year>
          ). doi:
          <volume>10</volume>
          .48550/ARXIV.2402.18954. arXiv:
          <volume>2402</volume>
          .
          <fpage>18954</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>A.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Kuncak</surname>
          </string-name>
          ,
          <article-title>Induction for SMT solvers</article-title>
          , in: D.
          <string-name>
            <surname>D'Souza</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Lal</surname>
            , K. G. Larsen (Eds.), Verification,
            <given-names>Model</given-names>
          </string-name>
          <string-name>
            <surname>Checking</surname>
          </string-name>
          , and
          <string-name>
            <surname>Abstract</surname>
          </string-name>
          Interpretation - 16th International Conference, VMCAI, volume
          <volume>8931</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2015</year>
          , pp.
          <fpage>80</fpage>
          -
          <lpage>98</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>662</fpage>
          -46081-8\_5.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>H.</given-names>
            <surname>Barbosa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. W.</given-names>
            <surname>Barrett</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Brain</surname>
          </string-name>
          , G. Kremer,
          <string-name>
            <given-names>H.</given-names>
            <surname>Lachnitt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Mann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Mohamed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Mohamed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Niemetz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Nötzli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ozdemir</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Preiner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Sheng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Tinelli</surname>
          </string-name>
          ,
          <string-name>
            <surname>Y. Zohar,</surname>
          </string-name>
          <article-title>cvc5: A versatile and industrial-strength SMT solver, in: Tools and Algorithms for the Construction and Analysis of Systems, TACAS</article-title>
          , volume
          <volume>13243</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2022</year>
          , pp.
          <fpage>415</fpage>
          -
          <lpage>442</lpage>
          . doi:
          <volume>10</volume>
          .1007/ 978-3-
          <fpage>030</fpage>
          -99524-9\_
          <fpage>24</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <surname>L. M. de Moura</surname>
          </string-name>
          , N. Bjørner,
          <article-title>Z3: an eficient SMT solver, in: Tools and Algorithms for the Construction and Analysis of Systems</article-title>
          , 14th International Conference,
          <string-name>
            <surname>TACAS</surname>
          </string-name>
          <year>2008</year>
          , volume
          <volume>4963</volume>
          , Springer,
          <year>2008</year>
          , pp.
          <fpage>337</fpage>
          -
          <lpage>340</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>540</fpage>
          -78800-3\_
          <fpage>24</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>