Formal Foundations

The satisfiability modulo theories problem can be formalized in many-sorted first-order logic with equality. We briefly outline the necessary concepts here. Due to space constraints, we assume some familiarity with basic concepts and notation from mathematical logic. More details can be found in [R21], [R25].

Syntax

In first-order logic, one constructs formulas that are statements about individuals in some domain of discourse and their relationships. Many-sorted logic adds the possibility of talking about multiple, separate domains.

Signatures

The language of formulas is determined by a vocabulary of symbols, called a signature, which has three main components: sort symbols (such as \(\mathsf{Int}\), \(\mathsf{Real}\), \(\mathsf{Person}\), etc.) which name, or denote, domains of interest; function symbols (such as, \(+\), \(*\), \(\mathsf{log}\), \(\mathsf{mother}\), \(\mathsf{father}\)) which denote total functions over the domains; and relation symbols (such as, \(=\), \(<\), \(\mathsf{even}\), \(\mathsf{married}\)) which denote total relations over the domains. A signature also specifies the arity of each function symbol \(f\), which is the number of inputs \(f\) takes, as well as its rank, which consists of the sort of \(f\)’s inputs and of \(f\)’s output.[1] We say that \(f\) has arity \(n\) and rank \(\sigma_1\cdots\sigma_n\sigma\) in a signature \(\Sigma\) if \(f\) takes \(n\) inputs of respective sorts \(\sigma_1, \ldots, \sigma_n\) and returns an output of sort \(\sigma\). A function symbol of arity 0 and rank sigma (such as 0, 1, \(\mathsf{true}\), etc.) is also called a constant symbol of sort sigma. It is convenient to consider only signatures that have a distinguished sort \(\mathsf{Bool}\), for the Booleans, and treat relation symbols as function symbols whose return type is \(\mathsf{Bool}\). In addition, we assume that every signature contains a distinguished function symbol \(\approx_\sigma\) of rank \(\sigma\sigma\)\(\mathsf{Bool}\), denoting the identity relation, for each sort \(\sigma\) of \(\Sigma\).

A signature \(\Sigma\) is a subsignature of a signature \(\Omega\), and \(\Omega\) is a supersignature of \(\Sigma\), if all the sort and function symbols of \(\Sigma\) are also in \(\Omega\) and the function symbols have the same rank in \(\Omega\) as they do in \(\Sigma\).

Variables, terms and formulas

To build formulas, in addition to fixing a signature \(\Sigma\), we also fix a set X of sorted variables, each associated with a sort \(\sigma\) and standing for some element from (the set denoted by) \(\sigma\). We can then build terms out of variables and function symbols from \(\Sigma\). Given a signature \(\Sigma\), a well-sorted \(\Sigma\)-term, or just term for short, is defined inductively as follows: \((i)\) a variable or constant symbol of sort \(\sigma\) is a term of sort \(\sigma\); \((ii)\) if \(f\) is a function symbol of rank \(\sigma_1\cdots\sigma_n\sigma\), with \(n>0\), and \(t_1, \ldots, t_n\) are terms of sort \(\sigma_1\cdots\sigma_n\), respectively, then the expression \(f(t_1, \ldots, t_n)\) is a term of sort \(\sigma\); \((iii)\) if \(\varphi\) is a term of sort \(\mathsf{Bool}\) and \(x\) is a variable of sort \(\sigma\), then the expressions \(\exists\, x : \sigma\) \(\varphi\) and \(\forall\, x : \sigma\) \(\varphi\) are terms of sort \(\mathsf{Bool}\). We then identify formulas with terms of sort \(\mathsf{Bool}\). The distinguished symbols \(\forall\) and \(\exists\) are quantifier symbols. We say that a variable \(x\) occurs free in a formula \(\varphi\) if \(x\) occurs in \(\varphi\) and either \(\varphi\) contains no quantifier symbols or it has the form \(\exists\, y : \sigma. \varphi'\) or \(\forall\, y :\sigma. \varphi'\), for some variable \(y\), where \(x\) occurs free in \(\varphi'\).

Semantics

For each signature \(\Sigma\), the meaning of \(\sigma\)-terms is provided by mathematical structures called interpretations. A \(\Sigma\)-interpretation \(\mathcal{I}\) maps:

  • each sort \(\sigma\) of \(\Sigma\) to a non-empty set \(\sigma^\mathcal{I}\), the domain of \(\sigma\) in \(\mathcal{I}\), with \(\mathsf{Bool}^\mathcal{I}\) being the binary set \(\{\mathsf{true},\mathsf{false}\}\);

  • each variable \(x \in\) X of sort \(\sigma\) to an element \(x^\mathcal{I} \in \sigma^\mathcal{I}\);

  • each function symbol \(f\) of rank \(\sigma_1\cdots\sigma_n\sigma\) to a total function \(f^\mathcal{I}\) of type \(\sigma_1^\mathcal{I} \times \cdots \times \sigma_n^\mathcal{I} \to \sigma^\mathcal{I}\) (and, in particular, each constant symbol \(c\) of sort \(\sigma\) to an element \(c^\mathcal{I} \in \sigma^\mathcal{I}\)).

We say that \(\sigma\) (resp. \(x\), \(f\)) denotes the set \(\sigma^\mathcal{I}\) (element \(x^\mathcal{I}\), function \(f^\mathcal{I}\)) in \(\mathcal{I}\). Every \(\Sigma\)-interpretation \(\mathcal{I}\) extends from variables and function symbols to \(\Sigma\)-terms \(t\) as follows: \((i)\) a term \(f(t_1,\ldots,t_n)\) evaluates in \(\mathcal{I}\) to \(f^\mathcal{I}(t_1^\mathcal{I},\ldots,t_n^\mathcal{I})\), the value returned by function \(f^\mathcal{I}\) when applied to the elements denoted by \(t_1,\ldots,t_n\); \((ii)\) an existentially quantified formula \(\exists\, x : \sigma. \varphi\) evaluates to \(\mathsf{true}\) in \(\mathcal{I}\) if and only if \(\varphi\) evaluates to \(\mathsf{true}\) in an interpretation \(\mathcal{I}[x \mapsto a]\) that maps \(x\) to some suitable \(a \in \sigma^\mathcal{I}\) and is otherwise identical to \(\mathcal{I}\); \((iii)\) a universally quantified formula \(\forall\, x : \sigma. \varphi\) evaluates to \(\mathsf{true}\) in \(\mathcal{I}\) if and only if \(\varphi\) evaluates to \(\mathsf{true}\) in \(\mathcal{I}[x \mapsto a]\) for all possible choices of values for \(x\) in \(\sigma^\mathcal{I}\).

An interpretation \(\mathcal{I}\) satisfies a formula \(\varphi\) if \(\varphi^\mathcal{I} = \mathsf{true}\) and falsifies it if \(\varphi^\mathcal{I} = \mathsf{false}\). In the former case, we also say that \(\mathcal{I}\) is a model of \(\varphi\).

The reduct of an \(\Omega\)-interpretation \(\mathcal{I}\) to a subsignature \(\Sigma\) of \(\Omega\) is the (unique) \(\Sigma\)-interpretation that interprets the symbols of \(\Sigma\) exactly as \(\mathcal{I}\). Intuitively, the reduct is obtained by forgetting the symbols of \(\Omega\) that are not in \(\Sigma\).

In the definition of interpretation above, we have not provided a meaning for the usual Boolean connectives such as \(\lnot, \land, \lor, \Rightarrow\) and so on. In SMT, specific interpretations of function symbols are provided by a theory, as explained next.

Theories

In general, we are not interested in arbitrary interpretations of terms and formulas in a signature \(\Sigma\) but in interpretations belonging to a specific theory \(T\) that constrain the meaning of the symbols in \(\Sigma\); for instance, that interpret \(\lnot\) and \(\land\) as logical negation and conjunction, \(0, 1, 2, \ldots\) as the natural numbers, and so on. Traditionally in logic, a theory is defined by a set of formulas, called axioms: one considers only \(\Sigma\)-interpretations that satisfy all the axioms. In SMT, a theory is, more generally, a class of interpretations that can be specified axiomatically or in other ways. More precisely, a \(\Sigma\)-theory \(T\) is a pair \((\Sigma, \mathbf{I})\) where \(\Sigma\) is a signature and \(\mathbf{I}\) is a class of \(\Sigma\)-interpretations, however specified. We describe and discuss several examples of theories commonly used in SMT in the next section.

Given a theory \(T\) \(= (\Sigma, \mathbf{I})\), we consider not just \(\Sigma\)-formulas but \(\Omega\)-formulas for some supersignature \(\Omega\) of \(\Sigma\).

In the context of \(T\), we refer to the symbols of \(\Sigma\) as theory symbols and to the additional symbols in \(\Omega\) as uninterpreted symbols. For instance, in the theory of reals, we may write a formula of the form \(a + 1 > b\) where \(a\) and \(b\) are uninterpreted, or symbolic, constants of sort \(\mathsf{Real}\). Intuitively, while the meaning of \(+\) and \(1\) is fixed by the theory, the meaning of \(a\) and \(b\) is not. Hence, we consider the formula satisfiable if there are real values for \(a\) and \(b\) which make the formula evaluate to \(\mathsf{true}\). This idea is formalized in the notion of satisfiability in \(T\).

Satisfiability modulo a theory

If \(T\) is a \(\Sigma\)-theory, a \(T\)-interpretation is any \(\Omega\)-interpretation \(\mathcal{I}\) for some supersignature \(\Omega\) of \(\Sigma\) whose restriction to \(\Sigma\) differs from an interpretation of \(T\) at most in the way it interprets the variables.

An \(\Omega\)-formula \(\varphi\) is satisfiable in \(T\) if it is satisfied by some \(T\)-interpretation \(\mathcal{I}\)—which may interpret the variables of \(\varphi\) and the sort, function, and predicate symbols not in \(\Sigma\) arbitrarily. The formula is valid in \(T\) if it is satisfied by all \(T\)-interpretations. A set \(\Phi\) of \(\Omega\)-formulas entails \(\varphi\) in \(T\), written \(\Phi \models_T \varphi\), if every \(T\)-interpretation that satisfies all formulas in \(\Phi\) satisfies \(\varphi\) as well. The set \(\Phi\) is satisfiable in \(T\) if there is a \(T\)-interpretation that satisfies all of its formulas.