The SMT-LIB Standard: Version 2.7, by Clark Barrett, Pascal Fontaine and Cesare Tinelli. The SMT-LIB Standard, Version 2.7 (release 2026-09-09), by Clark Barrett, Pascal Fontaine and Cesare Tinelli, hosted verbatim with its copyright and permission notice (page 2). BSmtLib, its Lean formalisation of the lexicon, grammar and parser, by Jan Onderka, Armin Biere and Henrik Böving, at 42b45c2 (MIT OR Apache-2.0). The links from the text to the Lean, the plain titles, the reading notes and the comparisons were made with AI and have not been reviewed by the authors. No mathematician has reviewed them. Open PDF, 114 pages
Auto select follows the paper as you scroll. Hover over a marked phrase to preview its Lean and see how the two compare. Click a phrase to keep it selected in Manual.
The SMT-LIB Standard: Version 2.7
3.1 Lexicon
The syntax rules in this chapter are given directly with respect to streams of lexical tokens from the set defined in this section. The whole set of concrete syntax rules is also available for easy reference in Appendix B. SMT-LIB source files consist of Unicode characters in any 8-bit encoding, such as UTF- 8. Most lexical tokens defined below are limited to US-ASCII printable characters, namely, characters 32dec to 126dec . The remaining printable characters, mostly used for non-English alphabet letters (characters 128dec and beyond), are allowed in string literals, quoted symbols, and comments. A comment is any character sequence not contained within a string literal or a quoted sym- bol (see later) that begins with the semi-colon character ; and ends with the first subsequent
line-breaking character, i.e., 10dec or 13dec . Both comments and consecutive white space char- acters occurring outside a string literal or a symbol (see later) are considered whitespace. The only lexical function of whitespace is to break the source text into tokens.1 The lexical tokens of the language are the parenthesis characters ( and ), the elements of the syntactic categories ⟨numeral ⟩ , ⟨decimal ⟩ , ⟨hexadecimal ⟩ , ⟨binary ⟩ , ⟨string ⟩ , ⟨symbol ⟩ , ⟨keyword ⟩ , as well as a number of reserved words, all defined below together with a few auxil- iary syntactic categories.
White Space Characters. A ⟨white_space_char ⟩ is one of the following characters: 9dec (tab), 10dec (line feed), 13dec (carriage return), and 32dec (space).
Printable Characters. A ⟨printable_char ⟩ is any character from 32dec to 126dec (US-ASCII) and from 128dec on.2
Digits. A ⟨digit ⟩ is any character from 48dec to 57dec (0 through 9)
Letters. A ⟨letter ⟩ is any character from 65dec to 90dec (English alphabet letters A through Z) and from 97dec to 122dec (English alphabet letters a through z).( 3 )
Numerals. A ⟨numeral ⟩ is the digit 0 or a non-empty sequence of digits not starting with 0 .
Decimals. A ⟨decimal ⟩ is a token of the form ⟨numeral ⟩.0∗ ⟨numeral ⟩ .
Hexadecimals. A ⟨hexadecimal ⟩ is a non-empty case-insensitive sequence of digits and letters from A to F preceded by the (case sensitive) characters #x .
Binaries. A ⟨binary ⟩ is a non-empty sequence of the characters 0 and 1 preceded by the char- acters #b .
String literals. A ⟨string ⟩ (literal) is any sequence of characters from ⟨printable_char ⟩ or ⟨white_space_char ⟩ delimited by the double quote character " (34dec ). The character " can itself occur within a string literal only if duplicated. In other words, after an initial " that starts a literal, a lexer should treat the sequence “” as an escape sequence denoting a single occurrence of " within the literal.
SMT-LIB string literals are akin to raw strings in certain programming languages. How- ever, they have only one escape sequence: “” . This means, for example and in contrast to most programming languages, that within a ⟨string ⟩ the character sequences \n, \012, \x0A, and \u0008 are not escape sequences (all denoting the new line character), but regular sequences denoting their individual characters.( 4 )
Reserved words. The language uses a number of reserved words, sequences of printable char- acters that are to be treated as individual tokens. The basic set of reserved words consists of the following:
Additionally, each command name in the scripting language defined in Section 3.11 (set-logic, set-option, . . . ) is also a reserved word.( 5 ) The syntactic category ⟨reserved ⟩ denotes any reserved word.
Symbols. A ⟨symbol ⟩ is either a simple symbol or a quoted symbol. A simple symbol is any non-empty sequence of elements of ⟨letter ⟩ and ⟨digit ⟩ and the characters ~ ! @ $ % ^ & * _ - + = < > . ? /
that does not start with a digit and is not a reserved word.3
A quoted symbol is any sequence of whitespace characters and printable characters that starts and ends with | and does not contain | or \ .( 6 )
Symbols are case sensitive. They are used mainly as operators or identifiers. Conven- tionally, arithmetic characters and the like are used, individually or in combination, as operator names; in contrast, alpha-numeric symbols, possibly with punctuation char- acters and underscores, are used as identifiers. But, as in LISP, this usage is only rec- ommended (for human readability), not prescribed. For additional flexibility, arbitrary sequences of whitespace and printable characters (except for | and \) enclosed in verti- cal bars are also allowed as symbols. Following Common Lisp’s conventions, enclosing a simple symbol in vertical bars does not produce a new symbol. This means for instance that abc and |abc| are the same symbol. Simple symbols starting with the character @ or . are reserved for solver use.4 Solvers can use them respectively as identifiers for abstract values and solver-generated function symbols other than abstract values.
Keywords. A ⟨keyword ⟩ is a token of the form :⟨simple_symbol ⟩ . Elements of this category have a special use in the language. They are used as attribute names or option names (see later).
Loading the paper…