OpenMath and SMT-LIB

OpenMath and SMT-LIB are languages with very different origins, but both "represent mathematics". We describe SMT-LIB for the OpenMath community and consider adaptations for both languages to support the growing SC-Square initiative.


page 1

page 2

page 3

page 4


CVC4-SymBreak: Derived SMT solver at SMT Competition 2019

We present CVC4-SymBreak, a derived SMT solver based on CVC4, and a non-...

Post-Training BatchNorm Recalibration

We revisit non-blocking simultaneous multithreading (NB-SMT) introduced ...

CVC4 at the SMT Competition 2018

This paper is a description of the CVC4 SMT solver as entered into the 2...

Solving the Wastewater Treatment Plant Problem with SMT

In this paper we introduce the Wastewater Treatment Plant Problem, a rea...

English-Bhojpuri SMT System: Insights from the Karaka Model

This thesis has been divided into six chapters namely: Introduction, Kar...

Non-Blocking Simultaneous Multithreading: Embracing the Resiliency of Deep Neural Networks

Deep neural networks (DNNs) are known for their inability to utilize und...

Lay-it-out: Interactive Design of Layout-Sensitive Grammars

Layout-sensitive grammars have been adopted in many modern programming l...

1 Motivation: The Sc Project

The authors are all members or associates of the EU-funded 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 domain-specific theory solvers when information beyond the logical structure is required. Most recently SMT has started to include the domain of non-linear 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 large-scale applications. For further details we refer to the project introduction paper at CICM 2016 [ABB16] and the project website:

1.1 An Sc Goal: Extending SMT-LIB

The increasing variety of the theories considered by SMT solvers created an urgent need for a common input language. The SMT-LIB initiative provided this and a large and increasing number of benchmarks. Once a problem is formulated in the SMT-LIB language, the user can employ any SMT solver to solve the problem. It is housed at: htpp:// 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), SMT-LIB has been found lacking on the domains relevant to SC. There is an NRA (Non-linear Real Arithmetic) category of the SMT-LIB benchmark library with several thousand problems in, but according to [JdM12] this consists mostly of problems originating from attempts to prove termination of term-rewrite 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 SMT-LIB language instead. Indeed, this is one of the specific SC goals, as described in SC [ABB16]:

Extend the SMT-LIB 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 SMT-LIB 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

MathML is described in [Wor14] and is usually encoded in XML. A special aspect of MathML is that there are two main strains of markup: Presentation Markup is used to display mathematical expressions while Content Markup is used to convey mathematical meaning [Wor14, §1.3].

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, 64-bit 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 :

  <OMS name="plus" cd="arith1"/>
  <OMV name="x"/>
  <OMI> 1 </OMI>

As can be seen this is somewhat verbose. An alternative syntax, POPCORN [HR09] has been proposed, which would shorten this algorithmically to$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." version="2.0"

Figure 1: Commutatiivity of times from arith2

2.2.2 Small Type System

OpenMath per se is type-agnostic. 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 associative111Both 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.">

Figure 2: Small Type System for times from arith2

2.2.3 Binders

OpenMath does not have a fixed set of binders. However, binders are introduced through a fixed syntactic marker OMBIND which enables correct recognition of free/bound variables. There is an example in Figure 1, and further discussion in [DK09].

2.3 Smt-Lib

This is described in [BFT15], though a near-final draft of the next version is in [BFT17].

SMT-LIB specifies four languages:

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

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

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

  4. 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 SMT-LIB expressions (Language 1 above) is as LISP S-expressions222An 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 SMT-LIB theory that uses them. For instance, it is possible for an SMT-LIB theory of sets to use the numerals 0 and 1 to denote respectively the empty set and universal set. Similarly, the elements of binary may denote integers modulo n in one theory and binary strings in another; the elements of decimal 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 SMT-LIB gets from 1.

2.3.1 Well-Sorted Terms

The sort declarations in SMT-LIB state the types of symbol operators, so that we can state that an SMT-LIB formula is well-sorted 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 non-empty 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 SMT-LIB makes it also possible to declare, for instance, a unary function from integer to integer that is arbitrary.

2.3.2 Binders

SMT-LIB 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 recent333A 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 definitions444There are more perverse but more compact ones. are as follows:


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 Smt-Lib

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.

  <OMS cd="minmax1" name="max"/>
    <OMS cd="set1" name="map"/>
      <OMS cd="fns1" name="lambda"/>
        <OMV name="x"/>
        <OMS cd="arith1" name="times"/>
        <OMV name="x"/>
          <OMS cd="arith1" name="minus"/>
          <OMI> 1 </OMI>
          <OMV name="x"/>
      <OMS cd="interval1" name="interval_cc"/>
      <OMI> 0 </OMI>
      <OMI> 1 </OMI>

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( 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).

  1. An operator that took both a set and a function: essentially making explicit the idiom minmax1.max( referred to above.

  2. A binder that took both a function body and a predicate, using the same bound variable for both.

      <OMS cd="minmax2" name="max"/>
        <OMV name="x"/>
      <OMS cd="arith1" name="times"/>
      <OMV name="x"/>
        <OMS cd="arith1" name="minus"/>
        <OMI> 1 </OMI>
        <OMV name="x"/>
        <OMS cd="set1" name="in"/>
        <OMV name="x"/>
          <OMS cd="interval1" name="interval_cc"/>
          <OMI> 0 </OMI>
          <OMI> 1 </OMI>

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 Smt-Lib

SMT-LIB does not have a operator. However, OptiMathSAT’s input language [ST15] is SMT-LIB extended with maximize, minimize “commands”. In fact, these are statements as to the nature of the goal(s), and the goal is achieved by check-sat.


A relatively recent piece of mathematical notation is , which does not have an extremely formal definition. The Wikipedia555 [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 check-sat, to allow (get-value argument1) etc. to find the values at which the maximum discovered by check-sat 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. SMT-LIB, 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 SMT-LIB 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 SMT-LIB 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

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

  2. Consider an explicit constructor (Section 3.1).

  3. 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.

  4. Clarify distinction between and (Section 4.1).

  5. Consider an explicit constructor (Section 4.3).

  6. Consider an explicit constructor (Section 4.3).

6.2 Recommendations to SMT-LIB

  1. Consider having an operator to express quantifier elimination. This would also mean expressing the output, which could be done by reusing the input language666At least over the reals, by the Tarski–Seidenberg Theorem..

  2. Consider an explicit constructor.

  3. Consider an explicit constructor.


We are grateful to Pascal Fontaine (LORIA) for many useful comments.

We are grateful for support by the H2020-FETOPEN-2016-2017-CSA project SC (712689).


  • [Á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., 2004.
  • [BFT15] C. Barrett, P. Fontaine, and C. Tinelli. The SMT-LIB Standard: Version 2.5., 2015.
  • [BFT17] C. Barrett, P. Fontaine, and C. Tinelli. The SMT-LIB Standard: Version 2.6 (draft 5 June 2017)., 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., 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 Floating-Point Arithmetic (754-2008)

    IEEE, 2008.
  • [JdM12] D. Jovanovic and L. de Moura. Solving non-linear 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ć. SMT-LIB in XML clothes. 2nd International Workshop on Pragmatics of Decision Procedures in Automated Reasoning (PDPAR-04), 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 18-24, 2015, Proceedings, Part I, pages 447–454, Cham, 2015. Springer International Publishing.
  • [Wor14] World-Wide Web Consortium. Mathematical Markup Language (MathML) Version 3.0: second edition., 2014.

Appendix A OptiMathSAT Example

(set-option :produce-models true)

(declare-fun cost () Real)
(declare-fun s1 () Bool)
(declare-fun s2 () Bool)
(declare-fun s3 () Bool)
(declare-fun s4 () Bool)
(declare-fun q1 () Real)
(declare-fun q2 () Real)
(declare-fun q3 () Real)
(declare-fun 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
(assert-soft s1 :id unused_suppliers)
(assert-soft s2 :id unused_suppliers)
(assert-soft s3 :id unused_suppliers)
(assert-soft 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
(set-option :opt.priority box)

; print model for A
(set-model 0)
(get-value (q1))
(get-value (q2))
(get-value (q3))
(get-value (q4))

; print model for B
(set-model 1)