1 Motivation: The Sc Project
The authors are all members or associates of the EUfunded Horizon 2020 Project SC. The overall aim of the project is to create a new research community bridging the gap between Satisfiability Checking and Symbolic Ccomputation, so that members well informed about both fields can ultimately resolve problems currently beyond the scope of either.
The project was motivated by the movement of the Satisfiability Checking community outside of the Boolean SAT problem to consider how their techniques may perform on other domains, creating the field of Satisfiability Module Theories (SMT). The main idea here is to combine the sophisticated technology built for SAT with calls to domainspecific theory solvers when information beyond the logical structure is required. Most recently SMT has started to include the domain of nonlinear polynomials over the reals, a field of study since the early days of Symbolic Computation.
However, as described in [Ábr15] it is not sufficient to call leading Computer Algebra Systems as theory solvers. Rather the algorithms need to be adapted to make them suitable for SMT. The two communities now find themselves addressing similar problems and so will share the challenge to improve their solutions to achieve applicability on complex largescale applications. For further details we refer to the project introduction paper at CICM 2016 [ABB16] and the project website: http://www.scsquare.org/CSA/welcome.html.
1.1 An Sc Goal: Extending SMTLIB
The increasing variety of the theories considered by SMT solvers created an urgent need for a common input language. The SMTLIB initiative provided this and a large and increasing number of benchmarks. Once a problem is formulated in the SMTLIB language, the user can employ any SMT solver to solve the problem. It is housed at: htpp://www.smtlib.org. The initiative has proved to spur on research, providing the basis for competitions and collaboration.
Although a proven valuable resource for the general SMT community (and far surpasses anything in Symbolic Computation), SMTLIB has been found lacking on the domains relevant to SC. There is an NRA (Nonlinear Real Arithmetic) category of the SMTLIB benchmark library with several thousand problems in, but according to [JdM12] this consists mostly of problems originating from attempts to prove termination of termrewrite systems. It has been noted in several papers how many of the problems are trivial (solved without calls to theory solvers) or come from a small number of classes and may have some hidden uniformity (see for example [ED16b]).
However, the work needed here is more than a greater variety of benchmark problems. Rather the depth of problems that can be tackled in this domain requires an extension of the SMTLIB language instead. Indeed, this is one of the specific SC goals, as described in SC [ABB16]:
Extend the SMTLIB language to cover a wider range of interests in the joint SC community. These of course include conjunctive arithmetic fragments on various (maybe mixed) domains. Among other potential extensions are: optimisation (finding a solution maximising a goal function), allowing the use of differential equation theory, simplification of formulas, quantifier elimination.
Hence, at this stage in the development of SMTLIB we consider what lessons can be learnt from the OpenMath community, and how both languages could be adapted to support the growing SC initiative.
2 Background
2.1 MathML
2.2 OpenMath
The OpenMathStandard is in [BCC04]. A new version is in preparation, but the only substantive change is to clarify the relationship with MathML. OpenMath objects are seen as trees, and can be encoded in XML or in binary — for readability we use the XML encoding here. There are various basic objects: symbols OMS
, integers OMI
, 64bit IEEE [IEE08] floating point objects OMF
, uninterpreted byte arrays OMB
, strings OMSTR
and variables OMV
, all of which are leaves of the tree; and various constructions: application OMA
, binding OMB
and the statement of bound variables OMBVAR
, errors OME
, attributes OMATTR
and attribution pairs OMATP
, and foreign objects OMFOREIGN
.
The mathematical expression would be encoded as the application of the symbol ’+’ to and :
<OMA> <OMS name="plus" cd="arith1"/> <OMV name="x"/> <OMI> 1 </OMI> </OMA>
As can be seen this is somewhat verbose. An alternative syntax, POPCORN [HR09] has been proposed, which would shorten this algorithmically to arith1.plus($x,1)
, and then, knowing about arith1
, still further to $x+1
.
2.2.1 Symbols
We have written this explicitly with the integer 1. If, however, we wanted the multiplicative identity of whatever ambient algebra we were working in, we would have used the nullary symbol <OMS name="one" cd="alg1"/>
. alg1
also defines zero
as the additive identity.
The symbol plus
comes from the Content Dictionary arith1
, which contains various basic mathematical operators, including a (not necessarily commutative) times
operator. If one wants an explicitly commutative times
operator, there is one in arith2
which has the property that , or, from the Content Dictionary, the Formal Mathematical Property in Figure 1. These Formal Mathematical Properties describe (some of) teh semantics of the OpenMath symbols.
2.2.2 Small Type System
OpenMath per se is typeagnostic. It is expected that serious type systems will build, parallel with the Content Dictionary system, a set of files describing the type system for the symbols.
There is a simple Small Type System described in [Dav00]. The entry for <OMS name="times" cd="arith2"/>
(which comes from the file arith2.sts
) is given in Figure 2: it states that the symbol is nary and associative^{1}^{1}1Both properties have to be stated: set construction is nary but not associative, for example., takes arguments from a structure which has the property AbelianSemiGroup
, and returns an answer in the same AbelianSemiGroup
.
2.2.3 Binders
2.3 SmtLib
SMTLIB specifies four languages:

a language for writing terms and formulas in a sorted (i.e., typed) version of firstorder logic;

a language for specifying background theories and fixing a standard vocabulary of sort, function, and predicate symbols for them;

a language for specifying logics, suitably restricted classes of formulas to be checked for satisfiability with respect to a specific background theory;

a command language for interacting with SMT solvers via a textual interface that allows asserting and retracting formulas, querying about their satisfiability, examining their models or their unsatisfiability proofs, and so on.
Of these, Language 1 corresponds to OpenMath, Languages 2 and 3, essentially, to a typing system as in Section 2.2.2, and Language 4 more to a command system such as SCSCP [LHK13].
The syntactic encoding of SMTLIB expressions (Language 1 above) is as LISP Sexpressions^{2}^{2}2An argument for an XML encoding is made in [MJ04], but there has been little progress on this recently.:
<spec_constant> ::= <numeral>  <decimal>  <hexadecimal>  <binary>  <string> <s_expr> ::= <spec_constant>  <symbol>  <keyword>  ( <s_expr>* )
Just as in OpenMath, the mathematical expression would be encoded as the application of the symbol ’+’ to and :
(+ x 1)
where +
and 1
would be defined in the logic of the file: the logic itself would refer to a theory for arithmetic.
Their [
spec_constant
] semantics is determined locally by each SMTLIB theory that uses them. For instance, it is possible for an SMTLIB theory of sets to use the numerals0
and1
to denote respectively the empty set and universal set. Similarly, the elements ofbinary
may denote integers modulo n in one theory and binary strings in another; the elements ofdecimal
may denote rational numbers in one theory and floating point values in another.
This contrasts with OpenMath’s behaviour, as described in Section 2.2.1: OpenMath would use <OMS name="one" cd="alg1"/>
to get the effect SMTLIB gets from 1
.
2.3.1 WellSorted Terms
The sort declarations in SMTLIB state the types of symbol
operators, so
that we can state that an SMTLIB formula is wellsorted with respect to a given
sort declaration. Besides the sorts used in the theories, it is possible to
declare other sorts, whose domain is uninterpreted, that is, they can be
interpreted as any nonempty set of elements. Also, besides the functions and
predicates provided by the theories, uninterpreted functions and predicates can
be used; these can have uninterpreted sort either as a domain or as range, but
SMTLIB makes it also possible to declare, for instance, a unary function from
integer to integer that is arbitrary.
2.3.2 Binders
SMTLIB has precisely three binders: let
, forall
and exists
. The last two are sorted, in the sense that the syntax is
The semantics are those of nested unary forall
, so that, while the may be repeated, earlier occurrences are shadowed by later ones. For let
, the syntax is
equivalent to the mathematical with simultaneous substitution. Hence the must be distinct in this case.
3 Exists Uniquely
A relatively recent^{3}^{3}3A textbook usage is [Alu09, p. 3], but it is more commonly found in research papers. addition to mathematical notation is , meaning “exists uniquely”. It is, of course, not logically necessary: two alternative definitions^{4}^{4}4There are more perverse but more compact ones. are as follows:
(1) 
(2) 
Considered computationally, (1) introduces an alternation, but fewer distinct quantifiers, and fewer repetitions of than (2).
3.1 OpenMath
Since it is both useful and economical (saving the repetition of , and the human/computer needing to recognise that it is the same ), there seems no reason not to introduce it.
3.2 SmtLib
Here the argument is more finely balanced. The arguments for are the same as for OpenMath (except that an SMT solver is expected to have clever heuristics, and idiom recognition might well be one of those). The converse argument is that adding syntactic sugar is adding noise too.
4 Maxima
4.1 OpenMath
The fundamental construct in OpenMath is minmax1.max
, which returns the maximum of a set. Hence we could encode (whose value is ) as the following.
<OMA> <OMS cd="minmax1" name="max"/> <OMA> <OMS cd="set1" name="map"/> <OMBIND> <OMS cd="fns1" name="lambda"/> <OMBVAR> <OMV name="x"/> </OMBVAR> <OMA> <OMS cd="arith1" name="times"/> <OMV name="x"/> <OMA> <OMS cd="arith1" name="minus"/> <OMI> 1 </OMI> <OMV name="x"/> </OMA> </OMA> </OMBIND> <OMA> <OMS cd="interval1" name="interval_cc"/> <OMI> 0 </OMI> <OMI> 1 </OMI> </OMA> </OMA> <OMA>
This is a perfectly legitimate encoding, but one could argue that it is not very constructive, since the maximum is being taken over an uncountable set. Essentially, minmax1.max(set1.map(...))
is an idiom for “use the calculus operational semantics of ”, except of course when it isn’t. It would be more helpful to have an explicit constructor that took a set and a function. There are essentially two options here (OpenMath could, of course, adopt both).

An operator that took both a set and a function: essentially making explicit the idiom
minmax1.max(set1.map(...))
referred to above. 
A binder that took both a function body and a predicate, using the same bound variable for both.
<OMBIND> <OMS cd="minmax2" name="max"/> <OMBVAR> <OMV name="x"/> </OMBVAR> <OMS cd="arith1" name="times"/> <OMV name="x"/> <OMA> <OMS cd="arith1" name="minus"/> <OMI> 1 </OMI> <OMV name="x"/> </OMA> <OMA> <OMS cd="set1" name="in"/> <OMV name="x"/> <OMA> <OMS cd="interval1" name="interval_cc"/> <OMI> 0 </OMI> <OMI> 1 </OMI> </OMA> </OMA> <OMA>
The second one probably has the abvantage of being closer to common usage.
A further complication is the lack of distinction between and .
4.2 SmtLib
SMTLIB does not have a operator. However, OptiMathSAT’s input language [ST15] is SMTLIB extended with maximize
, minimize
“commands”. In fact, these are statements as to the nature of the goal(s), and the goal is achieved by checksat
.
4.3
A relatively recent piece of mathematical notation is , which does not have an extremely formal definition. The Wikipedia^{5}^{5}5https://en.wikipedia.org/wiki/Arg_max [20th June 2017]. definition is that these “are the points of the domain of some function at which the function values are maximized.” Hence naïvely,
Though it can be defined in terms of other objects, it might be helpful to have a argmax
constructor in OpenMath, capable of encoding (whose value is ) .
This is a perfectly sound mathematical definition, but does not really meet the requirements of SC, or computation in general. What SC really needs is a witness point, i.e. a single value such that . For the sake of mathematical notation, we term this — one important point would be that it is not necessarily deterministic. This constructor could be called argmaxone
.
The OptiMathSAT approach is, after calling checksat
, to allow (getvalue argument1)
etc. to find the values at which the maximum discovered by checksat
was achieved. This is essentially an approach. The precise details are more technical, as multiple maxima can be searched for: see Appendix A.
5 Output formats
OpenMath is agnostic about whether its formulae are input or output: it is aimed at a world where one system’s output is the next system’s input. SMTLIB, by contrast, is largelythe input language for an SMT system. The output is, curdely, either SAT
or UNSAT
. However, SAT
should have a model produced, i.e. a constructive demonstration of satisfiability.
The SMTLIB standard does not specify what a model should be. There is thus the possibility to use any term, possibly to build algebraic numbers, etc… However, the current SMTLIB requires that two terms with different expressions in the description of the model have a different value in the model. So it would be necessary to use some form of canonicalization of algebraic numbers that guarantees this.
6 Conclusions
6.1 Recommendations to OpenMath

Formalise the rôle of POPCORN in the OpenMath stable.

Consider an explicit constructor (Section 3.1).

Consider an explicit constructor that took a set and a function (Section 4.1). OpenMath would then need to decide which variant(s) to adopt.

Clarify distinction between and (Section 4.1).

Consider an explicit constructor (Section 4.3).

Consider an explicit constructor (Section 4.3).
6.2 Recommendations to SMTLIB

Consider having an operator to express quantifier elimination. This would also mean expressing the output, which could be done by reusing the input language^{6}^{6}6At least over the reals, by the Tarski–Seidenberg Theorem..

Consider an explicit constructor.

Consider an explicit constructor.
Acknowledgements
We are grateful to Pascal Fontaine (LORIA) for many useful comments.
We are grateful for support by the H2020FETOPEN20162017CSA project SC (712689).
References
 [Ábr15] Ábrahám, E.: Building bridges between symbolic computation and satisfiability checking. In: Proceedings ISSAC 2015. pp. 1–6. ACM (2015)
 [Alu09] Aluffi,P., Algebra: Chapter 0. American Mathematical Society, 2009.
 [ABB16] E. Ábrahám, B. Becker, A. Bigatti, B. Buchberger, C. Cimatti, J.H. Davenport, M. England, P. Fontaine, S. Forrest, D. Kroening, W. Seiler, and T. Sturm. SC: Satisfiability Checking meets Symbolic Computation (Project Paper). In Proceedings CICM 2016, pages 28–43, 2016.
 [BCC04] S. Buswell, O. Caprotti, D.P. Carlisle, M.C. Dewar, M. Gaëtano, and M. Kohlhase. The OpenMath Standard 2.0. http://www.openmath.org, 2004.
 [BFT15] C. Barrett, P. Fontaine, and C. Tinelli. The SMTLIB Standard: Version 2.5. http://smtlib.cs.uiowa.edu/papers/smtlibreferencev2.5r20150628.pdf, 2015.
 [BFT17] C. Barrett, P. Fontaine, and C. Tinelli. The SMTLIB Standard: Version 2.6 (draft 5 June 2017). http://smtlib.cs.uiowa.edu/papers/smtlibreferencev2.6draft20170605.pdf, 2017.
 [Dav00] J.H. Davenport. A Small OpenMath Type System. ACM SIGSAM Bulletin 2, 34:16–21, 2000.
 [DK09] J.H. Davenport and M. Kohlhase. Quantifiers and Big Operators in OpenMath. https://www.researchgate.net/profile/Dan_Roozemond/publication/253932330_OpenMath_in_SCIEnce_Evolving_of_Symbolic_Computation_Interaction/links/00b7d5375cc5cea0ce000000.pdf#page=119, 2009.
 [ED16b] M. England and J.H. Davenport. Experience with heuristics, benchmarks & standards for cylindrical algebraic decomposition. In Proceedings of the 1st Workshop on Satisfiability Checking and Symbolic Computation (SC 2016), number 1804 in CEUR Workshop Proceedings, 2016.

[HR09]
P. Horn and D. Roozemond.
OpenMath in SCIEnce: SCSCP and POPCORN.
In J. Carette et al., editors, Proceedings Intelligent
Computer Mathematics
, Springer Lecture Notes in Artificial Intelligence 5625, pages 474–479, 2009.

[IEE08]
IEEE.
IEEE Standard for FloatingPoint Arithmetic (7542008)
. IEEE, 2008.  [JdM12] D. Jovanovic and L. de Moura. Solving nonlinear arithmetic. In B. Gramlich, D. Miller, and U. Sattler, editors, Automated Reasoning: 6th International Joint Conference (IJCAR), volume 7364 of Lecture Notes in Computer Science, pages 339–354. Springer, 2012.
 [LHK13] S. Linton, K. Hammond, A. Konovalov, C. Brown, P.W. Trinder, H.W. Loidl, P. Horn, and D. Roozemond. Easy composition of symbolic computation software using SCSCP: A new Lingua Franca for symbolic computation. Journal of Symbolic Computation, 49:95–119, 2013.
 [MJ04] F. Marić and P. Janičić. SMTLIB in XML clothes. 2nd International Workshop on Pragmatics of Decision Procedures in Automated Reasoning (PDPAR04), pages 86–89, 2004.
 [ST15] R. Sebastiani and P. Trentin. OptiMathSAT: A Tool for Optimization Modulo Theories. In Daniel Kroening and Corina S. Păsăreanu, editors, Computer Aided Verification: 27th International Conference, CAV 2015, San Francisco, CA, USA, July 1824, 2015, Proceedings, Part I, pages 447–454, Cham, 2015. Springer International Publishing.
 [Wor14] WorldWide Web Consortium. Mathematical Markup Language (MathML) Version 3.0: second edition. http://www.w3.org/TR/2014/RECMathML320140410/, 2014.
Appendix A OptiMathSAT Example
(setoption :producemodels true) (declarefun cost () Real) (declarefun s1 () Bool) (declarefun s2 () Bool) (declarefun s3 () Bool) (declarefun s4 () Bool) (declarefun q1 () Real) (declarefun q2 () Real) (declarefun q3 () Real) (declarefun q4 () Real) ; set goods quantity (assert (= 250 (+ q1 q2 q3 q4))) ; set goods offered by each supplier (assert (or (= q1 0) (and (<= 50 q1) (<= q1 250)))) (assert (or (= q2 0) (and (<= 100 q2) (<= q2 150)))) (assert (or (= q3 0) (and (<= 100 q3) (<= q3 100)))) (assert (or (= q4 0) (and (<= 50 q4) (<= q4 100)))) ; supplier is used if sends more than zero items (assert (and (=> s1 (not (= q1 0))) (=> s2 (not (= q2 0))) (=> s3 (not (= q3 0))) (=> s4 (not (= q4 0))))) ; supply from the largest number of suppliers (assertsoft s1 :id unused_suppliers) (assertsoft s2 :id unused_suppliers) (assertsoft s3 :id unused_suppliers) (assertsoft s4 :id unused_suppliers) ; set goal (A) (minimize (+ (* q1 23) (* q2 21) (* q3 20) (* q4 10))) ; set goal (B) (minimize (+ (* q1 25) (* q2 19) (* q3 10) (* q4 20))) ; box: independent optimization (setoption :opt.priority box) (checksat) ; print model for A (setmodel 0) (getvalue (q1)) (getvalue (q2)) (getvalue (q3)) (getvalue (q4)) ; print model for B (setmodel 1) (getmodel)