Model Completeness, Uniform Interpolants and Superposition Calculus

Uniform interpolants have been largely studied in non-classical propositional logics since the nineties; a successive research line within the automated reasoning community investigated uniform quantifier-free interpolants (sometimes referred to as “covers”) in first-order theories. This further research line is motivated by the fact that uniform interpolants offer an effective solution to tackle quantifier elimination and symbol elimination problems, which are central in model checking infinite state systems. This was first pointed out in ESOP 2008 by Gulwani and Musuvathi, and then by the authors of the present contribution in the context of recent applications to the verification of data-aware processes. In this paper, we show how covers are strictly related to model completions, a well-known topic in model theory. We also investigate the computation of covers within the Superposition Calculus, by adopting a constrained version of the calculus and by defining appropriate settings and reduction strategies. In addition, we show that computing covers is computationally tractable for the fragment of the language used when tackling the verification of data-aware processes. This observation is confirmed by analyzing the preliminary results obtained using the mcmt tool to verify relevant examples of data-aware processes. These examples can be found in the last version of the tool distribution.


Introduction
Uniform interpolants were originally studied in the context of non-classical logics, starting from the pioneering work by Pitts [55]. We briefly recall what uniform interpolants are. We fix a logic or a theory T and a suitable fragment L (propositional, first-order quantifier-free, etc.) of its language. Given an L-formula φ(x, y) (where x, y are the variables occurring free in φ), a uniform interpolant of φ (w.r.t. y) is an L-formula φ (x) where only variables x occur free, and that satisfies the following two properties: (i) φ(x, y) T φ (x); (ii) for any further L-formula ψ(x, z) such that φ(x, y) T ψ(x, z), we have φ (x) T ψ(x, z). Whenever uniform interpolants exist, one can compute an interpolant for an entailment like φ(x, y) T ψ(x, z) in such a way that this interpolant is independent of ψ.
The existence of uniform interpolants is an exceptional phenomenon, which is however not so infrequent; it has been extensively studied in non-classical logics starting from the nineties, as witnessed by a large literature, including for instance [7,22,[33][34][35]43,58,62,63]). The main results from the above papers are that uniform interpolants exist for intuitionistic logic and for some modal systems (like the Gödel-Lob system and the S4.Grz system); they do not exist for instance in S4 and K 4, whereas for the basic modal system K they exist for the local consequence relation but not for the global consequence relation.
In the last decade, also the automated reasoning community developed an increasing interest in uniform interpolants, with particular focus on quantifier-free fragments of firstorder theories. This is witnessed by various talks and drafts by Kapur presented in many conferences and workshops (FloC 2010, ISCAS 2013-14, SCS 2017 [41]), as well as by the paper presented in ESOP 2008 authored by Gulwani and Musuvathi [37]. In this last paper uniform interpolants were renamed as covers, a terminology we shall adopt in this paper too. In these contributions, examples of cover computations were supplied and also some algorithms were sketched. The first formal proof about the existence of covers in EUF was however published only in [14] by the present authors; such a proof was equipped with powerful semantic tools (see the Cover-by-Extensions Lemma 3.1 below) obtained thanks to interesting connections with model completeness [56], and came with an algorithm for computing covers that is based on a constrained variant of the Superposition Calculus [54]. Both the model-theoretic tools and the algorithm are detailed in the present paper. Two simple additional algorithms, which exploit DAG representations of terms, are studied in [26,27].
The usefulness of covers in model checking was already stressed in [37] and further motivated by our recent line of research on the verification of data-aware processes (also called 'database driven applications' in this paper) [12,13,15,17]. Notably, this is also operationally mirrored in the MCMT model checker [32] starting from version 2.8 (database driven module). The need for incorporating this algorithm within MCMT is due to the following reason. Declarative approaches to infinite state model checking [57] need to manipulate logical formulae in order to represent sets of reachable states. To prevent divergence, various abstraction strategies have been adopted, ranging from interpolation-based [47] to sophisticated search via counterexample elimination [38]. Precise computations of the set of reachable states require some form of quantifier elimination and hence are subject to two problems, namely that quantifier elimination might not be available at all and that, when available, it is computationally very expensive. To cope with the first problem, Gulwani and Musuvathi [37] introduced the notion of cover and showed that covers can be used as an alternative to quantifier elimination and yield a precise computation of reachable states. Concerning the second problem, again in [37] it was observed (as a side remark) that computing the cover of a conjunction of literals becomes tractable when only free unary function symbols occur in the signature. We show here (see Sect. 6 below) that the same observation applies when also free relational symbols occur.
In [11,13] we propose a new formalism for representing read-only database schemas towards the verification of integrated models of processes and data [10] (called data-aware processes henceforth), in particular so-called artifact systems [8,20,44,61]; this formalism (briefly recalled in Sect. 4.1 below) precisely uses signatures comprising unary function symbols and free n-ary relations. In [11,13,17] we apply model completeness techniques for verifying transition systems based on read-only databases, in a framework where such systems employ both individual and higher order variables.
In this paper we show (see Sect. 3 below) that covers (alias uniform interpolants) are strictly related to model completions, thus creating a bridge that links different research areas. In particular, we prove that computing covers for a theory is equivalent to eliminating quantifiers in its model completion. This connection reproduces, in a first-order setting, an analogous well-known connection for propositional logics: the connection between propositional uniform interpolants and model completions of equational theories axiomatizing the varieties corresponding to propositional logics, which was first stated in [36] and further developed in [33,43,62]. Interestingly, model completeness has other well-known applications in computer science. It has been applied: (i) to reveal interesting connections between temporal logic and monadic second-order logic [29,30]; (ii) in automated reasoning to design complete algorithms for constraint satisfiability in combined theories over non-disjoint signatures [1,23,31,[49][50][51]; (iii) again in automated reasoning in relationship with interpolation and symbol elimination [59,60]; (iv) in modal logic and in software verification theories [24,25], to obtain combined interpolation results. This paper is organized as follows. After some preliminaries in Sect. 2, we first state the formal connection between uniform quantifier-free interpolation and model completions in Sect. 3. Then, in Sect. 4 we report our applications (mostly taken from [17]) concerning verification of data-aware processes. We begin the second part of the paper by proving (Sect. 5 below) that covers for EUF can be computed through a constrained version of the Superposition Calculus [54] equipped with appropriate settings and reduction strategies; the related completeness proof requires a careful analysis of the constrained literals generated during the saturation process. Complexity bounds for the fragment used in data-aware processes verification are investigated in Sect. 6; an extension of our constrained Superposition Calculus that handles a schema of additional constraints (useful for our applications) is provided in Sect. 7; in Sect. 8 we give some details about our first implementation in our tool mcmt. This paper is the extended version of [14]: apart from containing more basic preliminary material, a thorough account of model-checking applications, full proofs and detailed examples, in Sects. 6 and 7 this paper covers additional new results on complexity analysis and extensions.

Preliminaries
We adopt the usual first-order syntactic notions of signature, term, atom, (ground) formula, and so on; our signatures are multi-sorted and include equality for every sort. This implies that variables are sorted as well. For simplicity, most basic definitions in this section will be supplied for single-sorted languages only. However, the adaptation to multi-sorted languages is straightforward: for example, a multi-sorted signature Σ must contain not only constant, function and relation symbols, but also sorts. We compactly represent a tuple x 1 , . . . , x n of variables as x. The notation t(x), φ(x) means that the term t, the formula φ has free variables included in the tuple x. Our tuples are assumed to be formed by distinct variables, thus we underline that, writing e.g. φ(x, y), we mean that the tuples x, y are made of distinct variables that are also disjoint from each other.
We assume that a function arity can be deduced from the context. Whenever we build terms and formulae, we always assume that they are well-typed, in the sense that the sorts of variables, constants, and function sources/targets match. A formula is said to be universal (resp., existential) if it has the form ∀x(φ(x)) (resp., ∃x(φ(x))), where φ is a quantifier-free formula. Formulae with no free variables are called sentences.
From the semantic side, we use the standard notion of a Σ-structure M and of truth of a formula in a Σ-structure under a free variables assignment. The support of a structure M is the disjoint union of the interpretations of the Σ-sorts in M and is indicated with |M|.
A Σ-theory T is a set of Σ-sentences; a model of T is a Σ-structure M where all sentences in T are true. We use the standard notation T | φ to say that φ is true in all the models of T for every assignment to the variables occurring free in φ. We say that φ is T -satisfiable iff there is a model M of T and an assignment to the variables occurring free in φ making φ true in M.
A Σ-formula φ is a Σ-constraint (or just a constraint) iff it is a conjunction of literals, i.e. of atomic formulae and their negations.
The constraint satisfiability problem for T is the following: we are given a constraint (equivalently, a quantifier-free formula) φ(x) and we are asked whether there exist a model M of T and an assignment I to the free variables x such that M, I | φ(x).
A theory T has quantifier elimination iff for every formula φ(x) in the signature of T there is a quantifier-free formula φ (x) such that T | φ(x) ↔ φ (x). It is well-known (and easily seen) that quantifier elimination holds in case we can eliminate quantifiers from primitive formulae, i.e. from formulae of the kind ∃y φ(x, y), where φ is a constraint. Since we are interested in effective computability, we assume that when we talk about quantifier elimination, an effective procedure for eliminating quantifiers is given.
We recall also some basic definitions and notions from model theory.
Let Σ be a first-order signature. The signature obtained from Σ by adding to it a set a of new constants (i.e., 0-ary function symbols) is denoted by Σ a . Analogously, given a Σstructure M, the signature Σ can be expanded to a new signature Σ |M| := Σ ∪{ā | a ∈ |M|} by adding a set of new constantsā (the name for a), one for each element a in M, with the convention that two distinct elements are denoted by different "name" constants. M can be expanded to a Σ |M| -structure just interpreting the additional constants over the corresponding elements. From now on, we confuse M and this expanded structure and we do not distinguish from an element of |M| and its name. Thus we employ notations like M | φ(a) to mean that the sentence φ(a) (obtained by replacing the free variables x of φ(x) by the names of some tuple a from |M|) is true in M, once M is canonically expanded to a Σ |M| -structure as explained above. Notice that this is the same as saying that φ(x) is true in M under the assignment mapping the x to the a.
A Σ-embedding [18] (or, simply, an embedding) between two Σ-structures M and N is a map μ : |M| −→ |N | among the support sets |M| of M and |N | of N satisfying the condition (M | ϕ ⇒ N | ϕ) for all Σ |M| -literals ϕ (M is regarded as a Σ |M| -structure, by interpreting each additional constant a ∈ |M| into itself and N is regarded as a Σ |M| -structure by interpreting each additional constant a ∈ |M| into μ(a)). If μ : M −→ N is an embedding that is just the identity inclusion |M| ⊆ |N |, we say that M is a substructure of N or that N is an extension of M. We recall that a substructure preserves and reflects validity of ground formulae, in the following sense: given a Σ- Let M be a Σ-structure. The diagram of M, written Δ Σ (M) (or just Δ(M)), is the set of ground Σ |M| -literals that are true in M. An easy but important result, called Robinson Diagram Lemma [18], says that, given any Σ-structure N , the embeddings μ : M −→ N are in bijective correspondence with expansions of N to Σ |M| -structures which are models of Δ Σ (M). The expansions and the embeddings are related in the obvious way:ā is interpreted as μ(a). The typical use of the Robinson Diagram Lemma is the following: suppose we want to show that some structure M can be embedded into a structure N in such a way that some set of sentences Δ are true. Then, by the Lemma, this turns out to be equivalent to the fact that the set of sentences Δ(M) ∪ Δ is consistent: thus, the Diagram Lemma can be used to transform an embeddability problem into a consistency problem (the latter is a problem of a logical nature, to be solved for instance by appealing to the compactness theorem for first-order logic).
Amalgamation is a classical algebraic concept. We give the formal definition: Using the definition of Res(∃e φ), we have N | θ(a, b), since θ(y, z) ∈ Res(∃x φ). Since M is a substructure of N and θ is quantifier-free, M | θ(a, b) as well, as required.
Suppose that ψ(y) is a cover. The definition of residue implies condition (i). To show condition (ii) we have to prove that, given a model M of T , for every tuple a of elements from |M|, if M | ψ(a), then there exists a model N of T such that M embeds into N and N | ∃x φ(x, a). Using Robinson Diagram Lemma, we can reformulate the latter embeddability statement into a consistency statement: so what we need to prove is that Δ(M) ∪ {∃x φ(x, a)} is a T -consistent Σ |M| -set of sentences (Σ is the signature of T ). By reduction to absurdity, suppose that this is not the case: by compactness, there is a finite number of literals 1 (a, b), ..., m (a, b) (for some tuple b of elements from |M|) such that M | i (a, b) (for all i = 1, . . . , m) and Now, the constants a, b do not occur in the axioms of T and do not belong to Σ, hence we can replace them by variables y, z in the T -proof witnessing ( * ): indeed, since they do not occur in the axioms of T , they are generic from the point of view of T . As a consequence, we then get By definition of residue, clearly (¬ 1 (y, z) ∨ · · · ∨ ¬ m (y, z)) ∈ Res(∃x φ); then, since ψ(y) is a cover, T | ψ(y) → (¬ 1 (y, z) ∨ · · · ∨ ¬ m (y, z)). Replacing back the variables y, z by the constants a, b and recalling that M | ψ(a), this implies that M | ¬ j (a, b) for some j = 1, . . . , m, which is a contradiction. Thus, ψ(y) satisfies conditions (ii) too.
We say that a theory T has uniform quantifier-free interpolation iff every existential formula ∃e φ(e, y) (equivalently, every primitive formula ∃e φ(e, y)) has a T -cover. It is clear that if T has uniform quantifier-free interpolation, then it has ordinary quantifier-free interpolation [9], in the sense that if we have T | φ(e, y) → φ (y, z) (for quantifier-free formulae φ, φ ), then there is a quantifier-free formula θ(y) such that T | φ(e, y) → θ(y) and T | θ(y) → φ (y, z). In fact, if T has uniform quantifier-free interpolation, then the interpolant θ is independent on φ : indeed, the same θ(y) can be used as interpolant for all entailments T | φ(e, y) → φ (y, z), varying φ .
We say that a universal theory T has a model completion iff there is a stronger theory T * ⊇ T (still within the same signature Σ of T ) such that (i) every Σ-constraint that is satisfiable in a model of T is satisfiable in a model of T * ; (ii) T * eliminates quantifiers. Other equivalent definitions are possible [18]: for instance, (i) is equivalent to the fact that T and T * prove the same quantifier-free formulae or again to the fact that every model of T can be embedded into a model of T * . We recall that the model completion, if it exists, is unique and that its existence implies the amalgamation property for T [18]. The relationship between uniform interpolation in a propositional logic and the model completion of the equational theory of the variety algebraizing it was extensively studied in [33]. In the context of first-order theories, we prove an even more direct connection: Theorem 3.2 Suppose that T is a universal theory. Then T has a model completion T * iff T has uniform quantifier-free interpolation. If this happens, T * is axiomatized by the infinitely many sentences ∀y (ψ(y) → ∃e φ(e, y)) where ∃e φ(e, y) is a primitive formula and ψ is a cover of it.
Proof Suppose first that there is a model completion T * of T and let ∃e φ(e, y) be a primitive formula. Since T * eliminates quantifiers, we have T * | ∃e φ(e, y) ↔ ψ(y) for some quantifier-free formula ψ(y). Since T and T * prove the same quantifier-free formulae, from the left-to-right side T * | φ(e, y) → ψ(y) we have that ψ(y) ∈ Res(∃e φ). If θ(y, z) ∈ Res(∃e φ), then we have T | φ(e, y) → θ(y, z); the same entailment holds in T * too, where we have T * | ψ(y) → θ(y, z). Since ψ(y) → θ(y, z) is quantifier-free, we have also T | ψ(y) → θ(y, z), showing that ψ is a cover of ∃e φ(e, y). Thus T has uniform interpolation, because we found a cover for every primitive formula. Suppose vice versa that T has uniform interpolation. Let T * be the theory axiomatized by all the formulae (1) above.
From (i) of Lemma 3.1 and (1) above, we clearly get that T admits quantifier elimination: in fact, in order to prove that a theory enjoys quantifier elimination, it is sufficient to eliminate quantifiers from primitive formulae (then the quantifier elimination for all formulae can be easily shown by an induction over their complexity). This is exactly what is guaranteed by (i) of Lemma 3.1 and (1).
Let M be a model of T . By using a chain argument [17] (see [18], Lemma 3.5.7 for an almost identical construction), we show that there exists a model M of T such that M embeds into M .
Consider the set of all pairs (a, ∃e φ(e, a)) where a is a tuple from |M|, ∃e φ(e, y) is a primitive formula and M | ψ(a) (here ψ is a cover of φ). By Zermelo's Theorem, the set of such pairs (a, ∃e φ(e, a)) can be well-ordered: let {(a i , ∃e i φ i (e i , a i ))} i∈I be such a well-ordered set of pairs, where I is some ordinal. 1 By transfinite induction on this wellorder, we define M 0 := M and, for each i ∈ I , M i as an extension of j<i M j such that M i | ∃e i φ i (e i , a i ), which exists for (ii) of Lemma 3.1 since j<i M j | ψ i (a i ) (remember that validity of ground formulae is preserved passing through substructures and superstructures, and M 0 | ψ i (a i )). Now we take the chain union M 1 := i∈I M i : since T is universal, M 1 is again a model of T . Thanks to this construction, we added, for every pair (a i , ∃e i φ i (e i , a i )) (with a i ∈ M and M | ψ i (a i )), a corresponding tuple b i such that M 1 | φ i (b i , a i ); however, this only guarantees that such a tuple b i exists for every pair (a i , ∃e i φ i (e i , a i )) such that the tuple a i is from |M|, whereas nothing is said for the pairs where the tuple a is in |M 1 | \ |M|. Then, we iteratively repeat the chain construction above for these new a. Indeed, it is possible to construct, by an analogous chain argument, a model M 2 as done above, starting from M 1 instead of M. Clearly, we get M 0 := M ⊆ M 1 ⊆ M 2 by construction.
At this point, we iterate the same argument countably many times, so as to define a new chain of models of T : Defining M := n M n , we trivially get that M is a model of T such that M ⊆ M and satisfies all the sentences of type (1): the last fact is immediate, recalling that truth of ground formulae (in expanded languages with names from support sets) is preserved by substructures and extensions. After ω steps we are done, because every tuple a ∈ |M | occurs after finitely many steps, and its corresponding b in the construction are added at the immediately subsequent step.
To sum up, Theorem 3.2 states that, thanks to Formulae (1), the T -uniform interpolant (or cover) ψ of the formula ∃e φ(e, y) is exactly the T * -equivalent quantifier-free formula that eliminates the quantified variables e from ∃e φ(e, y): this means that computing covers in T is equivalent to eliminating quantifiers in its model completion T * .

Model-Checking Applications
In this section we supply old and new motivations for investigating covers and model completions in view of model-checking applications. We first report the considerations from [11,13,17,37] on symbolic model-checking via model completions (or, equivalently, via covers) in the basic case where system variables are represented as individual variables; for more advanced applications where system variables are both individual and higher order variables, see [11,13,17]. Similar ideas (i.e., 'to use quantifier elimination in the model completion even if T does not allow quantifier elimination') were used in [59] for interpolation and symbol elimination.

Definition 4.1 A (quantifier-free) transition system is a tuple
A safety formula for a transition system S is a further quantifier-free formula υ(x) describing undesired states of S. We say that S is safe with respect to υ if the system has no finite run is satisfiable in M (here x i 's are renamed copies of x). The safety problem for S is the following: given υ, decide whether S is safe with respect to υ. Suppose now that the theory T mentioned in Definition 4.1 (i) is universal, has decidable constraint satisfability problem and admits a model completion T * . Algorithm 1 describes the backward reachability algorithm for handling the safety problem for S (the dual algorithm working via forward search is described in equivalent terms in [37]). An integral part of the algorithm is to compute preimages. For that purpose, for any ϕ 1 (x, x ) and ϕ 2 (x) (where x are renamed copies of x), we define Pre(ϕ 1 , ϕ 2 ) to be the formula ∃x (ϕ 1 (x, x ) ∧ ϕ 2 (x )).

Algorithm 1: Backward reachability algorithm
The preimage of the set of states described by a state formula φ(x) is the set of states described by Pre(τ, φ). The subprocedure QE(T * , φ) in Line 6 applies the quantifier elimina-tion algorithm of T * to the existential formula φ. Without the application of this subprocedure, the existential prefix generated by the computation of preimages would grow in an unlimited way and some decidability results (see, e.g., the locally finite case mentioned below) would be compromized. Algorithm 1 computes iterated preimages of υ (storing their disjunction into the variable B) and applies to them quantifier elimination, until a fixpoint is reached or until a set intersecting the initial states (i.e., satisfying ι) is found. Inclusion (Line 2) and disjointness (Line 3) tests produce proof obligations that can be discharged because T has decidable constraint satisfiability problem.
The proof of Proposition 4.2 (which is a slight variant of a similar result for Simple Artifact Systems (SASs) in [17]) consists just in the observation that the formulae (2) are quantifierfree and that a quantifier-free formula is satisfiable in a model of T iff so is it in a model of T * : thus, if an unsafe trace exists at all, it arises in a model of T * , so that the subprocedure QE(T * , φ) in Line 6 does not introduce overapproximations and consequently no spurious trace can be produced during the search performed by our algorithm.

Proposition 4.2 Suppose that the universal Σ-theory T has decidable constraint satisfiability problem and admits a model completion T * . For every transition system
the backward search algorithm is effective and partially correct for solving safety problems for S. 2 Despite its simplicity, Proposition 4.2 is a crucial fact. Notice that it implies decidability of the safety problems in some interesting cases: this happens, for instance, when in T there are only finitely many quantifier-free formulae in which x occur, as in case T has a purely relational signature or, more generally, T is locally finite 3 . Since a theory is universal iff it is closed under substructures [18] and since a universal locally finite theory has a model completion iff it has the amalgamation property [45,64], it follows that Proposition 4.2 can be used to cover the decidability result stated in Theorem 5 of [8] (once restricted to transition systems over a first-order definable class of Σ-structures).

Database Schemas
In this subsection, we provide a new application for the above explained model-checking techniques [13,17]. The application relates to the verification of integrated models of business processes and data [10], referred to as artifact systems [61], where the behavior of the process is influenced by data stored in a relational database (DB) with constraints. The data contained therein are read-only: they can be queried by the process and stored in a working memory, which in the context of this paper is constituted by a set of system variables. In this context, safety amounts to checking whether the system never reaches an undesired property, irrespectively of what is contained in the read-only DB.
We define next the two key notions of (read-only) DB schema and instance, by relying on an algebraic, functional characterization.

Definition 4.3
A DB schema is a pair Σ, T , where: (i) Σ is a DB signature, that is, a finite multi-sorted signature whose function symbols are all unary; (ii) T is a DB theory, that is, a set of universal Σ-sentences.
Given a DB signature Σ, we denote by Σ srt the set of sorts, by Σ fun the set of functions in Σ and by Σ rel the set of relations in Σ. We associate to a DB signature Σ a characteristic (directed) graph G(Σ) capturing the dependencies induced by functions over sorts. Specifically, G(Σ) is an edge-labeled graph whose set of nodes is Σ srt , and with a labeled edge The leaves of Σ are the nodes of G(Σ) without outgoing edges. These terminal sorts are divided in two subsets, respectively representing unary relations and value sorts. Non-value sorts (i.e., unary relations and non-leaf sorts) are called id sorts, and are conceptually used to represent (identifiers of) different kinds of objects. Value sorts, instead, represent datatypes such as strings, numbers, clock values, etc. We denote the set of id sorts in Σ by Σ ids , and that of value sorts by Σ val , hence Before giving the formal definition of DB instance, we show an interesting example of DB signature inspired by concrete business processes.

Example 4.1 ([17])
The human resource (HR) branch of a company stores the following information inside a relational database: (i) users registered to the company website, who are potentially interested in job positions offered by the company; (ii) the different, available job categories; (iii) employees belonging to HR, together with the job categories they are competent in (in turn indicating which job applicants they could interview).
To formalize these different aspects, we make use of a DB signature Σ hr consisting of: (i) four id sorts, used to respectively identify users, employees, job categories, and the competence relationship connecting employees to job categories; (ii) one value sort containing strings used to name users and employees, and describe job categories. In addition, Σ hr contains five function symbols mapping: (i) user identifiers to their corresponding names; (ii) employee identifiers to their corresponding names; (iii) job category identifiers to their corresponding descriptions; (iv) competence identifiers to their corresponding employees and job categories.
The characteristic graph of Σ hr is shown in Fig. 1 (left part).
We now focus on extensional data conforming to a given DB schema.
We respectively denote by S M , f M , and c M the interpretation in M of the sort S (this is a set), of the function symbol f (this is a set-theoretic function), and of the constant c (this is an element of the interpretation of the corresponding sort). Obviously, f M and c M must match the sorts declared in Σ. For instance, if the source and the target of f are, respectively, S and U , then the function f M has domain S M and range U M .
One might be surprised by the fact that signatures in our DB schemas contain unary function symbols, beside relational symbols. As shown in [11,13,17], the algebraic, functional characterization of DB schema and instance can be actually reinterpreted in the classical, relational model so as to reconstruct the requirements posed in [44]. In this last work, the schema of the read-only database must satisfy the following conditions: (i) each relation schema has a single-attribute primary key; (ii) attributes are typed; (iii) attributes may be foreign keys referencing other relation schemas; (iv) the primary keys of different relation schemas are pairwise disjoint. We now discuss why these requirements are matched by DB schemas. Definition 4.3 naturally corresponds to the definition of relational database schema with single-attribute primary and foreign keys. To see this, we adopt the named perspective, where each relation schema is defined by a signature containing a relation name and a set of typed attribute names. Let Σ, T be a DB schema. Each sort S from Σ corresponds to a dedicated relation R S with the following attributes: (i) one identifier attribute id S with type S; (ii) one dedicated attribute a f with type S for every function symbol f from Σ of the form The fact that R S is constructed starting from functions in Σ naturally induces corresponding functional dependencies within R S , and inclusion dependencies from R S to other relation schemas. In particular, for each non-id attribute a f of R S , we get a functional dependency from id S to a f . Altogether, such dependencies witness that id S is the primary key of R S . In addition, for each non-id attribute a f of R S whose corresponding function symbol f has id sort S as image, we get an inclusion dependency from a f to the id attribute id S of R S . This captures that a f is a foreign key referencing R S . This view is shown in the following example. We close our discussion by focusing on DB theories. Notice that EUF suffices to handle the sophisticated setting of artifact systems from [13,17] (e.g., key dependencies). The role of a non-empty DB theory is to encode background axioms to express additional constraints. We illustrate a typical background axiom, required to handle the possible presence of undefined identifiers/values in the different sorts. This, in turn, is essential to capture artifact systems whose working memory is initially undefined, in the style of [21,44]. To accommodate this, we add to every sort S of Σ a constant undef S (written by abuse of notation just undef from now on), used to specify an undefined value. Then, for each function symbol f of Σ, we can impose additional constraints involving undef, for example by adding the following axioms to the DB theory: This axiom states that the application of f to the undefined value produces an undefined value, and it is the only situation for which f is undefined. A slightly different approach may handle many undefined values for each sort; the reader is referred to [11,13,17] for examples of concrete database instances formalized in our framework. We just point out that in most cases the kind of axioms that we need for our DB theories T are just one-variable universal axioms (like Axioms 3), so that they fit the hypotheses of Proposition 4.5 below.
We are interested in applying the algorithm of Proposition 4.2 to a (non-deterministic) version of Simple Artifact Systems (SASs) [17], i.e. transition systems T is a DB schema in the sense of Definition 4.3. To this aim, it is sufficient to identify a suitable class of DB theories having a model completion and whose constraint satisfiability problem is decidable. A first result in this sense is given below. Given the characteristic graph G(Σ) of a DB signature Σ, we recall that Σ is said to be acyclic if G(Σ) is so.

Proposition 4.5 [17] A DB theory T has decidable constraint satisfiability problem and admits a model completion in case it is axiomatized by finitely many universal one-variable formulae and Σ is acyclic.
We omit the proof of the above proposition, because the proposition does not play a role in the following: the proof can be easily obtained by well-known facts from the literature and is nevertheless reported in full detail in [17]. We only report here the algorithm for quantifier elimination in T * suggested by that proof: given a primitive formula ∃e φ(e, y), the output ψ(y) of the algorithm is simply the conjunction of the set of all quantifier-free χ(y)-formulae such that φ(e, y) → χ(y) is a logical consequences of T (they are finitely many -up to T -equivalence -because Σ is acyclic). We also notice that, since acyclicity of Σ yields local finiteness, we immediately get as a Corollary the decidability of safety problems for transitions systems based on DB schemas satisfying the hypotheses of the above theorem.

Covers via Constrained Superposition
Of course, a model completion may not exist at all. Proposition 4.5 shows that it exists in case T is a DB theory axiomatized by universal one-variable formulae and Σ is acyclic. The second hypothesis is unnecessarily restrictive and the algorithm for quantifier elimination suggested by the proof of Proposition 4.5 is highly impractical: for this reason we are trying a different approach. In this section, we drop the acyclicity hypothesis and examine the case where the theory T is empty and the signature Σ may contain function symbols of any arity. Covers in this context were shown to exist already in [37], using an algorithm that, very roughly speaking, determines all the conditional equations that can be derived concerning the nodes of the congruence closure graph. An algorithm for the generation of interpolants, still relying on congruence closure [40], is sketched in [41].
We follow a different plan and we want to produce covers (and show that they exist) using saturation-based theorem proving. The natural idea to proceed in this sense is to take the matrix φ(e, y) of the primitive formula ∃e φ(e, y) we want to compute the cover of: this is a conjunction of literals, so we consider each variable as a free constant, we saturate the corresponding set of ground literals and finally we output the literals involving only the y. For saturation, one can use any version of the superposition calculus [54]. However, this procedure for our problem is not sufficient. As a trivial counterexample consider the primitive formula ∃e (R(e, y 1 ) ∧ ¬R(e, y 2 )): the set of literals {R(e, y 1 ), ¬R(e, y 2 )} is saturated (recall that we view e, y 1 , y 2 as constants), however the formula has a non-trivial cover y 1 = y 2 which is not produced by saturation. If we move to signatures with function symbols, the situation is even worse: the set of literals { f (e, y 1 ) = y 1 , f (e, y 2 ) = y 2 } is saturated but the formula ∃e ( f (e, y 1 ) = y 1 ∧ f (e, y 2 ) = y 2 ) has the conditional equality y 1 = y 2 → y 1 = y 2 as cover.
Disjunctions of disequations might also arise: the cover of ∃e h(e, y 1 , y 2 ) = h(e, y 1 , y 2 ) (as well as the cover of ∃e f ( f (e, y 1 ), y 2 ) = f ( f (e, y 1 ), y 2 ), see Example 5.5 below) is y 1 = y 1 ∨ y 2 = y 2 . 5 Notice that our problem is different from the problem of producing ordinary quantifier-free interpolants via saturation-based theorem proving [42]: for ordinary Craig interpolants, we have as input two quantifier-free formulae φ(e, y), φ (y, z) such that φ(e, y) → φ (y, z) is valid; here we have a single formula φ(e, y) as input and we are asked to find an interpolant which is good for all possible φ (y, z) such that φ(e, y) → φ (y, z) is valid. Ordinary interpolants can be extracted from a refutation of φ(e, y) ∧ ¬φ (y, z), whereas here we are not given any refutation at all (and we are not even supposed to find one).
What we are going to show is that, nevertheless, saturation via superposition can be used to produce covers, if suitably adjusted. In this section we consider signatures with n-ary function symbols (for all n ≥ 1). For simplicity, we omit n-ary relation symbols (they can be easily handled by rewriting R(t 1 , . . . , t n ) as R(t 1 , . . . , t n ) = true, as customary in the paramodulation literature [54]).
We are going to compute the cover of a primitive formula ∃e φ(e, y) to be fixed for the remainder of this section. We call variables e existential and variables y parameters. By applying abstraction steps, we can assume that φ is primitive flat, i.e. that it is a conjunction of e-flat literals, defined below. [By an abstraction step we mean replacing ∃e φ with ∃e ∃e (e = u ∧ φ ), where e is a fresh variable and φ is obtained from φ by replacing some occurrences of a term u(e, y) by e ].
A term or a formula are said to be e-free iff the existential variables do not occur in it. An e-flat term is an e-free term t(y) or a variable from e or again it is of the kind f (u 1 , . . . , u n ), where f is a function symbol and u 1 , . . . , u n are e-free terms or variables from e. An e-flat literal is a literal of the form where t is an e-flat term and a, b are either e-free terms or variables from e.
We assume the reader is familiar with standard conventions used in rewriting and paramodulation literature: in particular s | p denotes the subterm of s in position p and s[u] p denotes the term obtained from s by replacing s | p with u. We use ≡ to indicate coincidence of syntactic expressions (as strings) to avoid confusion with equality symbol; when we write equalities like s = t below, we may mean both s = t or t = s (an equality is seen as a multiset of two terms). For information on reduction orderings, see for instance [2].
We first replace variables e = e 1 , . . . , e n and y = y 1 , . . . , y m by free constants -we keep the names e 1 , . . . , e n , y 1 , . . . , y m for these constants. Let > be a reduction ordering that is total for ground terms such that e-flat literals t = a are always oriented from left to right in the following two cases: (i) t is not e-free and a is e-free; (ii) t is not e-free, it is not equal to any of the e and a is a variable from e. To obtain such properties, one may for instance choose a suitable Knuth-Bendix ordering taking weights in some transfinite ordinal (see, e.g., [46]).
Given two e-flat terms t, u, we indicate with E(t, u) the following procedure, which intuitively is a unification algorithm for the terms t and u where the e variables are treated as constants; as shown by Lemma 5.1 below, E(t, u) collects 'the equalities that are needed in order to force t = u', whenever the e are assumed to be free (i.e. not to satisfy any specific equational constraint): • E(t, u) fails if t is e-free and u is not e-free (or vice versa); Notice that, whenever E(t, u) succeeds, the formula E(t, u) → t = u is universally valid. The definition of E(t, u) is motivated by the next lemma.

Lemma 5.1 Let R be a convergent (i.e. terminating and confluent) ground rewriting system, whose rules consist of e-free terms. Suppose that t and u are e-flat terms with the same Rnormal form. Then E(t, u) does not fail and all pairs from E(t, u) have the same R-normal form as well.
Proof This is due to the fact that if t is not e-free, no R-rewriting is possible at root position because rules from R are e-free.
In the following, we handle constrained ground flat literals of the form L C where L is a ground flat literal and C is a conjunction of ground equalities among e-free terms. The logical meaning of L C is the Horn clause C → L.
In the literature, various calculi with constrained clauses were considered, starting, e.g., from the non-ground constrained versions of the Superposition Calculus of [4,53]. The calculus we propose here is inspired by such versions and it has close similarities with a subcase of hierarchic superposition calculus [5], or rather to its "weak abstraction" variant from [6] (we thank an anonymous referee of our CADE 2019 submission for pointing out this connection).
The rules of our Constrained Superposition Calculus follow; each rule applies provided the E subprocedure called by it does not fail. The symbol ⊥ indicates the empty clause. Further explanations and restrictions to the calculus are given in the Remarks below.

Superposition Right (Constrained)
and C ⊇ D Remark 5. 1 The first three rules are inference rules: they are non-deterministically selected for application, until no rule applies anymore. The selection strategy for the rule to be applied is not relevant for the correctness and completeness of the algorithm (some variant of a 'given clause algorithm' can be applied). An inference rule is not applied in case one premise is e-free (we have no reason to apply inferences to e-free premises, since we are not looking for a refutation).

Remark 5.2
The Demodulation rule is a simplification rule: its application not only adds the conclusion to the current set of constrained literals, but it also removes the first premise. It is easy to see (e.g., representing literals as multisets of terms and extending the total reduction ordering to multisets), that one cannot have an infinite sequence of consecutive applications of Demodulation rules.

Remark 5.3
The calculus takes {L ∅ | L is a flat literal from the matrix of φ} as the initial set of constrained literals. It terminates when a saturated set of constrained literals is reached. We say that S is saturated iff every constrained literal that can be produced by an inference rule, after being exhaustively simplified via Demodulation, is already in S (there are more sophisticated notions of 'saturation up to redundancy' in the literature, but we do not need them). When it reaches a saturated set S, the algorithm outputs the conjunction of the clauses C → L, varying L C among the e-free constrained literals from S.
We need some rule application policy to ensure termination: without any such policy, a set like may produce by Right Superposition the infinitely many literals (all oriented from right to The next remark explains the policy we follow.

Remark 5.4 [Policy Remark] We apply Demodulation only in case the second premise is of the kind e j = t(y) D, where t is e-free.
Demodulation rule is applied with higher priority with respect to the inference rules. 6 Inside all possible applications of Demodulation rule, we give priority to the applications where both premises have the form e j = t(y) D (for the same e j but with possibly different D's -the D from the second premise being included in the D of the first). In case we have two constrained literals of the kind e j = t 1 (y) D, e j = t 2 (y) D inside our current set of constrained literals (notice that the e j 's and the D's here are the same), among the two possible applications of the Demodulation rule, we apply the rule that keeps the smallest t i . Notice that in this way two different constrained literals cannot simplify each other.
We say that a constrained literal L C belonging to a set of constrained literals S is simplifiable in S iff it is possible to apply (according to the above policy) a Demodulation rule removing it. A first effect of our policy is:

Lemma 5.2 If a constrained literal L C is simplifiable in S, then after applying to S any sequence of rules, it remains simplifiable until it gets removed. After being removed, if it is regenerated, it is still simplifiable and so it is eventually removed again.
Proof Suppose that L C can be simplified by e = t D and suppose that a rule is applied to the current set of constrained literals. Since there are simplifiable constrained literals, that rule cannot be an inference rule by the priority stated in Remark 5.4. For simplification rules, keep in mind again Remark 5.4. If L C is simplified, it is removed; if none of L C and e = t D get simplified, the situation does not change; if e = t D gets simplified, this can be done by some e = t D , but then L C is still simplifiable -although in a different way -using e = t D (we have that D is included in D, which is in turn included in C). Similar observations apply if L C is removed and re-generated.
Due to Lemma 5.2, if we show that a derivation (i.e., a sequence of applications of rules) can produce terms only from a finite set, it is clear that when no new constrained literal is produced, saturation is reached. First notice that:

Lemma 5.3 Every constrained literal L C produced during the run of the algorithm is e-flat.
Proof The constrained literals from initialization are e-flat. The Demodulation rule, applied according to Remark 5.4, produces an e-flat literal out of an e-flat literal. The same happens for the Superposition rules: in fact, since both the terms s and l from these rules are e-flat, a Superposition may take place at root position or may rewrite some l ≡ e j with r ≡ e i or with r ≡ t(y). 7 There are in principle infinitely many e-flat terms that can be generated out of the e-flat terms occurring in φ (see the above counterexample (4)). We show however that only finitely many e-flat terms can in fact occur during saturation and that one can determine in advance the finite set they are taken from.
To formalize this idea, let us introduce a hierarchy of e-flat terms (this hierarchy concerns terms, not clauses or constraints -although it will be used to delimit the kind of clauses or constraints that might occur in a saturation process). Let D 0 be the e-flat terms occurring in φ and let D k+1 be the set of e-flat terms obtained by simultaneous rewriting of an e-flat term from i≤k D i via rewriting rules of the kind e j → t j (y) where the t j are e-free terms from i≤k D i . The degree of an e-flat term is the minimum k such that it belongs to set D k (it is necessary to take the minimum because the same term can be obtained at different stages and via different rewritings).

Lemma 5.4
Let the e-flat term t be obtained by a rewriting e j → u(y) from the e-flat term t; then, if t has degree k > 1 and u has degree at most k − 1, we have that t has degree at most k.
Proof This is clear, because at the k-stage one can directly produce t instead of just t: in fact, all rewriting producing directly t replace an occurrence of some e i by an e-free term, so they are all done in parallel positions.
[We illustrate the phenomenon via an example: suppose that t is f (e 1 , g(g(c))) and that t is obtained from t by rewriting e 1 to g(c). Now it might well be that t has degree 2, being obtained from f (e 1 , e 2 ) via e 2 → g(g(c))) (the latter having been previously obtained from g(e 3 ) via e 3 → g(c)). Now t still has degree 2 because it can be directly obtained from f (e 1 , e 2 ) via the parallel rewritings e 1 → g(c), e 2 → g(g(c))).] 7 Notice that Superposition Left is considerably restricted in our calculus: recall in fact that e-flat negative literals must be of the kind s = t where s, t are either variables from e or e-free terms. Since rules do not apply to e-free literals, the only possibility is that the term s from the literal s = t of the right premise of Superposition Left is a variable from e and that the term l from the left premise coincides with it. Thus Superposition Left looks like a Demodulation, however it is not a Demodulation because the constraint of its left premise may not be included into the constraint of its right premise. It would be harmless to allow a more liberal version of Superposition Left, but we do not need it.

Proposition 5.5 The saturation of the initial set of e-flat constrained literals always terminates after finitely many steps.
Proof We show that all e-flat terms that may occur during saturation have at most degree n (where n is the cardinality of e). This shows that the saturation must terminate, because only finitely many terms may occur in a derivation (see the above observations).
Let the algorithm during saturation reach the state S; we say that a constraint C allows the explicit definition of e j in S iff S contains a constrained literal of the kind e j = t(y) D with D ⊆ C. Now we show by mutual induction two facts concerning a constrained literal L C ∈ S: (1) if an e-flat term u of degree k occurs in L, then C allows the explicit definition of k different e j in S; (2) if L is of the kind e i = t(y), for an e-free term t of degree k, then either e i = t C can be simplified in S or C allows the explicit definition of k + 1 different e j in S (e i itself is of course included among these e j ).
Notice that (1) is sufficient to exclude that any e-flat term of degree bigger than n can occur in a constrained literal arising during the saturation process. We prove (1) and (2) by induction on the length of the derivation leading to L C ∈ S. Notice that it is sufficient to check that (1) and (2) hold for the first time where L C ∈ S because if C allows the explicit definition of a certain variable in S, it will continue to do so in any S obtained from S by continuing the derivation (the definition may be changed by the Demodulation rule, but the fact that e i is explicitly defined is forever). Also, by Lemma 5.2, a literal cannot become non simplifiable if it is simplifiable.
(1) and (2) are evident if S is the initial status. To show (1), suppose that u occurs for the first time in L C as the effect of the application of a certain rule: we can freely assume that u does not occur in the literals from the premisses of the rule (otherwise induction trivially applies) and that u of degree k is obtained by rewriting in a non-root position some u occurring in a constrained literal L D via some e j → t D. This might be the effect of a Demodulation or Superposition in a non-root position (Superpositions in root position do not produce new terms).
If u has degree k, then by induction D contains the required k explicit definitions, and we are done because D is included in C. If u has lower degree, then t must have degree at least k − 1 (otherwise u does not reach degree k by Lemma 5.4). Then by induction on (2), the constraint D (also included in C) has (k − 1) + 1 = k explicit definitions (when a constraint e j → t D is selected for Superposition or for making Demodulations in a non-root position, it is itself not simplifiable according to the procedure explained in Remark 5.4).
To show (2), we analyze the reasons why the non simplifiable constrained literal e i = t(y) C is produced (let k be the degree of t).
Suppose it is produced from e i = u C via Demodulation with e j = u(y) D (with D ⊆ C) in a non-root position; if u has degree at least k, we apply induction for (1) to e i = u C: by such induction hypotheses, we get k explicit definitions in C and we can add to them the further explicit definition e i = t(y) (the explicit definitions from C cannot concern e i because e i = t(y) C is not simplifiable). Otherwise, u has degree less than k and u has degree at least k − 1 by Lemma 5.4 (recall that t has degree k): by induction, e j = u D is not simplifiable (it is used as the active part of a Demodulation in a non-root position, see Remark 5.4) and supplies k explicit definitions, inherited by C ⊇ D. Note that e i cannot have a definition in D, otherwise e i = t(y) C would be simplifiable, so with e i = t(y) C we get the required k + 1 definitions.
The remaining case is when e i = t(y) C is produced via Superposition Right. Such a Superposition might be at root or at a non-root position. We first analyse the case of a root position. This might be via e j = e i C 1 and e j = t(y) C 2 (with e j > e i and C = C 1 ∪ C 2 because E(e j , e j ) = ∅), but in such a case one can easily apply induction. Otherwise, we have a different kind of Superposition at root position: e i = t(y) C is obtained from s = e i C 1 and s = t(y) C 2 , with C = C 1 ∪ C 2 ∪ E(s, s ). In this case, by induction for (1), C 2 supplies k explicit definitions, to be inherited by C. Among such definitions, there cannot be an explicit definition of e i otherwise e i = t(y) C would be simplifiable, so again we get the required k + 1 definitions.
In case of a Superposition at a non root-position, we have that e i = t(y) C is obtained from u = e i C 1 and e j = u(y) C 2 , with C = C 1 ∪ C 2 ; here t is obtained from u by rewriting e j to u. This case is handled similarly to the case where e i = t(y) C is obtained via Demodulation rule.
Having established termination, we now prove that our calculus computes covers. To this aim, we rely on refutational completeness of unconstrained Superposition Calculus: thus, our technique resembles the technique used [5,6] in order to prove refutational completeness of hierarchic superposition, although it is not clear whether Theorem 5.6 below can be derived from the results concerning hierarchic superposition 8 .
We state the following theorem: Theorem 5.6 Let T be the theory EUF. Suppose that the above algorithm, taking as input the primitive e-flat formula ∃e φ(e, y), gives as output the quantifier-free formula ψ(y). Then the latter is a T -cover of ∃e φ(e, y).
Proof Let S be the saturated set of constrained literals produced upon termination of the algorithm; let S = S 1 ∪ S 2 , where S 1 contains the constrained literals in which the e do not occur and S 2 is its complement. Clearly ∃e φ(e, y) turns out to be logically equivalent to Superposition Right produces the constrained literal e 1 = e 2 {y 1 = y 1 }; supposing that we have e 1 > e 2 , Superposition Right gives first f (e 2 , y 2 ) = e 1 {y 1 = y 1 } and then also e 1 = e 2 {y 1 = y 1 , y 2 = y 2 }. Superposition Left and Reflection now produce ⊥ {y 1 = y 1 , y 2 = y 2 }. Thus the clause y 1 = y 1 ∧ y 2 = y 2 → ⊥ will be part of the output (actually, this will be the only clause in the output).
We apply our algorithm to an additional example, taken from [37]. Example 5. 6 We compute the cover of the primitive formula ∃e (s 1 (y 1 , e), f (y 2 , e))), where s 1 , s 2 , t are terms in y. Flattening gives the set of literals Suppose that we have e > e 1 > e 2 > t > s 1 > s 2 > y 1 > y 2 > y 3 > y 4 . Superposition Right between the 3rd and the 4th clauses produces the constrained 6th clause e 1 = e 2 {y 1 = y 2 }. From now on, we denote the application of a Superposition Right to the ith and jth clauses with R(i, j). We list a derivation performed by our calculus: The set of clauses above is saturated. The 7th, 17th, 18th, 19th and 20th clauses are exactly the output clauses of [37]. The non-simplified clauses that do not appear as output in [37] are redundant and they could be simplified by introducing a Subsumption rule as an additional simplification rule of our calculus.

Complexity Analysis of the Fragment for Database Driven Applications
The saturation procedure of Theorem 5.6 can in principle produce double exponentially many clauses, because there are exponentially many terms of degree n (if n is the cardinality of the variables to be eliminated); it is not clear whether we can improve this bound to a simple exponential one, by limiting the kind of terms that can be produced. An estimation of the complexity costs of computing uniform interpolants in EUF is better performed within approaches making use of compressed DAG-representations of terms [26]. In this paper, however, we are especially interested (for our applications to verification of data-aware processes) to the special case where the signature Σ contains only unary function symbols and relations of arbitrary arity (cf. Sect. 4.1). In this special case, important remarks apply. In fact, we shall see below that if the signature Σ contains only unary function symbols, only empty constraints can be generated; in case Σ contains also relation symbols of arity n > 1, the only constrained clauses that can be generated have the form ⊥ {t 1 = t 1 , . . . , t n−1 = t n−1 }. Also, it is not difficult to see that in a derivation at most one explicit definition e i = t(y)||∅ can occur for every e i : as soon as this definition is produced, all occurrences of e i are rewritten to t. This implies that Constrained Superposition computes covers in polynomial time for the empty theory, whenever the signature Σ matches the restrictions of Definition 4.3 for DB schemas. We give here a finer complexity analysis, in order to obtain a quadratic bound.
In this section, we assume that our signature Σ contains only unary function and m-ary relation symbols. In order to attain the optimized quadratic complexity bound, we need to follow a different strategy in applying the rules of our constrained superposition calculus (this different strategy would not be correct for the general case). Thanks to this different strategy, we can make our procedure close to the algorithm of [37]: in fact, such algorithm is correct for the case of unary functions and requires only a minor adjustment for the case of unary functions and m-ary relations. Since relations play a special role in the present restricted context, we prefer to treat them as such, i.e. not to rewrite R(t 1 , . . . , t n ) as R(t 1 , . . . , t n ) = true; the consequence is that we need an additional Constrained Resolution Rule 9 . We preliminarily notice that when function symbols are all unary, the constraints remain all empty during the run of the saturation procedure, except for the case of the newly introduced Resolution Rule below. This fact follows from the observation that given two terms u 1 and u 2 , procedure E(u 1 , u 2 ) does not fail iff: (1) either u 1 and u 2 are both terms containing only variables from y, or (2) u 1 and u 2 are terms that syntactically coincide.
In case (1), E(u 1 , u 2 ) is {u 1 = u 2 } and in case (2), E(u 1 , u 2 ) is ∅. In case (1), Superposition Rules are not applicable. To show this, suppose that u 1 ≡ s | p and u 2 ≡ l; then, terms l and r use only variables from y, and consequently cannot be fed into Superposition Rules, since Superposition Rules are only applied when variables from e occur in both premises. Reflection Rule does not apply too in case (1), because this rule (like any other rule) cannot be applied to an e-free literal.
Thus, in the particular case of m-ary relations and unary functions, the rules of the calculus are the following: We still restrict the use of our rules to the case where all premises are not e-free literals; again Demodulation is applied only in the case where l = r is of the kind e i = t(y). For the order of applications of the Rules, Lemma 6.1 below show that we can apply (restricted) Superpositions, Demodulations, Reflections and Resolutions in this order and then stop.
An important preliminary observation to obtain such a result is that we do not need to apply Superposition Rules whose left premise l = r is of the kind e i = t(y): this is because constraints are always empty (unless the constrained clause is the empty clause), so that a Superposition Rule with the left premise e i = t(y) can be replaced by a Demodulation Rule. 10 If the left premise of Superposition is not of the kind e i = t(y), then since our literals are e-flat, it can be either of the kind e i = e j (with e i > e j ) or of the kind f (e i ) = t. In the latter case t is either e k ∈ e or it is an e-free term; for Superposition Left (i.e. for Superposition applied to a negative literal), the left premise can only be e i = e j , because our literals are e-flat and so negative literals L cannot have a position p such that L | p ≡ f (e i ).
Let S be a set of e-flat literals with empty constraints; we say that S is RS-closed iff it is closed under Restricted Superposition Rules, i.e under Superposition Rules whose left premise is not of the kind e i = t(y). In equivalent terms, as a consequence of the above discussion, S is RS-closed iff it satisfies the following two conditions: Since Restricted Superpositions do not introduce essentially new terms (newly introduced terms are just rewritings of variables with variables), it is clear that we can make a finite set S of e-free literals RS-closed in finitely many steps. This can be naively done in time quadratic in the size of the formula. As an alternative, we can apply a congruence closure algorithm to S and produce a set of e-free constraints S which is RS-closed and logically equivalent to S: the latter can be done in O(n · log(n))-time, as it is well-known from the literature [40,48,52].

Lemma 6.1 Let S be a RS-closed set of empty-constrained e-flat literals. Then, to saturate S it is sufficient to first exhaustively apply the Demodulation Rule, and then Reflection and Resolution Rules.
Proof LetS be the set obtained from S after having exhaustively applied Demodulation. Notice that the final effect of the reiterated application of Demodulation can be synthetically described by saying that literals in S are rewritten by using some explicit definitions These definitions are either in S, or are generated through the Demodulations themselves (we can freely assume that Demodulations are done in appropriate order: first all occurrences of e i 1 are rewritten to t 1 , then all occurrences of e i 2 are rewritten to t 2 , etc.). 11 Suppose now that a pair L, l = r ∈S can generate a new literal L[r ] p by Superposition. We know from above that we can limit ourselves to Restricted Superposition, so l is either of the form e j or of the form f (e j ), where moreover e j is not among the set {e i 1 , . . . , e i k } from (6). The literals L and l = r ∈S happen to have been obtained from literals L and l = r belonging to S by applying the rewriting rules (6) (notice that l cannot have been rewritten). Since such rewritings must have occurred in positions parallel to p and since S was closed under Restricted Superposition, we must have that S contained the literal L [r ] p that rewrites to L[r ] p by the rewriting rules (6). This shows that L[r ] p is already inS (thus, in particular, Demodulation does not destroy RS-closedness) and proves the lemma, because Reflection and Resolution can only produce the empty clause and no rule applies to the empty clause.
Thus the strategy of applying (in this order) Restricted Superposition+Demodulation+Reflection+Resolution always saturates.
To produce an output in optimized format, it is convenient to get it in a DAG-like form. This can be simulated via explicit acyclic definitions as follows. When we write Def (e, y) (where e, y are tuples of distinct variables), we mean any flat formula of the kind (let e := e 1 . . . , e n ) n i=1 e i = t i , where in the term t i only the variables e 1 , . . . , e i−1 , y can occur. We shall supply the output in the form ∃e (Def (e , y) ∧ ψ(e , y)) (7) where the e is a subset of the e and ψ is quantifier-free. The DAG-format (7) is not quantifierfree but can be converted to a quantifier-free formula by unravelling the acyclic definitions of the e . Thus our procedure for computing a cover in DAG-format of a primitive formula ∃e φ(e, y) (in case the function symbols of the signature Σ are all unary) runs by performing the following steps, one after the other. Let OU T be a quantifier-free formula (initially OU T is ).
(1) We preprocess φ in order to produce a RS-closed set S of empty-constrained e-flat literals.
(2) We mark the variables e in the following way (initially, all variables are unmarked): we scan S and, as soon as we find an equality of the kind e i = t where all variables from e occurring in t are marked, we mark e i . This loop is repeated until no more variable gets marked. Proof The preprocessing step (1) requires an abstraction phase for producing e-flat literals and a second phase in order to get a RS-closed set: the first phase requires linear time, whereas the second one requires O(n · log(n)) time (via congruence closure). All the remaining steps require linear time, except steps (2) and (5) that requires quadratic time. This is the dominating cost, thus the entire procedure requires O(n 2 ) time.
Although we do not deeply investigate the problem here, we conjecture that it might be possible to further lower down the above complexity to O(n · log(n)).

An Extension of the Constrained Superposition Calculus
We consider an extension of our Constrained Superposition Calculus which is useful for our applications to verification of data-aware processes. Let us assume that we have a theory whose axioms are (3), namely, for every function symbol f : One direction of the above equivalence is equivalent to the ground literal f (undef) = undef and as such it does not interfere with the completion process (we just add it to our constraints from the very beginning).
To handle the other direction, we need to modify our Calculus. First, we add to the Constrained Superposition Calculus of Sect. 5 the following extra Rule The Rule is sound because u(y) = undef ∧ f (e j ) = u(y) → e j = undef follows from the axioms (3). For cover computation with our new axioms, we need a restricted version of Paramodulation Rule: Notice that we can have e j > r only in case r is either some existential variable e i or it is an e-free term u(y). Paramodulation Rule (if it is not a Superposition) can only apply to a right member of an equality and such a right member must be e j itself (because our literals are flat). Thus the rule cannot introduce new terms and consequently it does not compromize the termination argument of Proposition 5.5.
Suppose that the algorithm from Sect. 5, taking as input the primitive e-flat formula ∃e φ(e, y), gives as output the quantifier-free formula ψ(y). Then the latter is a T -cover of ∃e φ(e, y).
Proof The proof of Theorem 5.6 can be easily adjusted as follows. We proceed as in the proof of Theorem 5.6, so as to obtain the set Δ(M) ∪ R ∪S which is saturated in the standard (unconstrained) Superposition Calculus. Below, we refer to the general refutational completeness proof of the Superposition Calculus given in [54]. Since we only have unit literals here, in order to produce a model of Δ(M)∪ R∪S, we can just consider the convergent ground rewriting system → consisting of the oriented equalities in Δ + (M) ∪ R ∪S: the support of such model is formed by the →-normal forms of our ground terms with the obvious interpretation for the function and constant symbols. For simplicity, we assume that undef is in normal form. 12 We need to check that whenever we have 13 f (t) → * undef then we have also t → * undef: we prove this by induction on the reduction ordering for our ground terms. Let t be a term such that f (t) → * undef: if t is e-free then the claim is trivial (because the axioms (3) are supposed to hold in M). Suppose also that induction hypothesis applies to all terms smaller than t. If t is not in normal form, then lett be its normal form; then we have f (t) → + f (t) → * undef, by the fact that → is convergent. By induction hypothesis,t → undef, hence t → +t → * undef, as desired.
Finally, let us consider the case in which t is in normal form; since f (t) is reducible in root position by some rule l → r , our rules l → r are e-flat and t is not e-free, we have that t ≡ e j for some existential variable e j . Then, we must have that S contains an equality of the kind f (e j ) = u(y) D or of the kind f (e j ) = e i D (the constraint D being true in M under the given assignment to the y). The latter case is reduced to the former, since e i → * undef (by the convergence of → * ) and since S is closed under Paramodulation. In the former case, by the rule E xt(undef), we must have that S contains e j = undef D ∪ {u(y) = undef}. Now, since f (e j ) = u(y) D belongs to S and D is true in M, we have that the normal forms of f (e j ) and of u(y) are the same; since the normal form of f (e j ) is undef, the normal form of u(y) is undef too, which means that u(y) = undef is true in M. But e j = undef D ∪ {u(y) = undef} belongs to S, hence e j = undef belongs toS, which implies e j → * undef, as desired.

Remarks on MCMT Implementation
As evident from Sect. 4.1, our main motivation for investigating covers originated from the verification of data-aware processes. Such applications require database (DB) signatures to contain only unary function symbols (besides relations of every arity). We observed that computing covers of primitive formulae in such signatures requires only polynomial time. In addition, if relation symbols are at most binary, the cover of a primitive formula is a conjunction of literals (this is due to the fact that the constrained literals produced during saturation either have empty constraints or are of the kind ⊥ t 1 = t 2 ): this is crucial in applications, because model checkers like mcmt [32] and cubicle [19] represent sets of reachable states as primitive formulae. This makes cover computations a quite attractive technique in verification of data-aware processes.
Our cover algorithm for DB signatures has been implemented in the model checker mcmt. The implementation is however still partial, nevertheless the tool is able to compute covers for the EUF-fragment with unary function symbols, unary relations and binary relations. The optimized procedure of Sect. 6 has not yet been implemented, instead mcmt uses a customary Knuth-Bendix completion (in fact, for the above mentioned fragments the constraints are always trivial and our constrained Superposition Calculus essentially boils down to Knuth-Bendix completion for ground literals in EUF).
Axioms (3) are also covered in the following way. We assume that constraints of which we want to compute the cover always contain either the literal e j = undef or the literal e j = undef for every existential variable e j . Whenever a constraint contains the literal e j = undef, the completion procedure adds the literal u(y i ) = undef whenever it had produced a literal of the kind f (e j ) = u(y i ). 14 We wonder whether we are justified in assuming that all constraints of which we want to compute the cover always contain either the literal e j = undef or the literal e j = undef for every existential variable e j . The answer is affirmative: according to the backward search algorithm implemented in array-based systems tools, the variable e j to be eliminated always comes from the guard of a transition and we can assume that such a guard contains the literal e j = undef (if we need a transition with e j = undef -for an existentially quantified variable e j -it is possible to write trivially this condition without using a quantified variable). The mcmt User Manual (available from the distribution) contains precise instructions on how to write specifications following the above prescriptions.
A first experimental evaluation (based on the existing benchmark provided in [44], which samples 32 real-world BPMN workflows taken from the BPMN official website http://www. bpmn.org/) is described in [11,17]. The benchmark set is available as part of the last distribution 3.0 of mcmt http://users.mat.unimi.it/users/ghilardi/mcmt/ (see the subdirectory /examples/dbdriven of the distribution). The User Manual, also included in the distribution, contains a dedicated section giving essential information on how to encode relational artifact systems (comprising both first-order and second-order variables) in mcmt specifications and how to produce user-defined examples in the database driven framework. The first experiments were very encouraging: the tool was able to solve in few seconds all the proposed benchmarks and the cover computations generated automatically during the modelchecking search were discharged instantaneously: see [11,17] for more information about our experiments.

Conclusions and Future Work
The above experimental setup motivates new research to extend Proposition 4.5 to further theories axiomatizing integrity constraints used in DB applications.
Practical algorithms for the computation of covers in the theories falling under the hypotheses of Proposition 4.5 need to be designed: as a little first example, in Sect. 7 above we showed how to handle Axiom (3) by light modifications to our techniques. Symbol elimination of function and predicate variables should also be combined with cover computations. Combined cover algorithms (along the perspectives in [37]) could be crucial also in this setting: a first attempt to attack this problem, regarding the disjoint signatures combination, can be found in [16].
We consider the present work, together with [12,13,17,28], as the starting point for a full line of research dedicated to SMT-based techniques for the effective verification of data-aware processes [15], addressing richer forms of verification beyond safety (such as liveness, fairness, or full LTL-FO) and richer classes of artifact systems, (e.g., with concrete data types and arithmetics), while identifying novel decidable classes (e.g., by restricting the structure of the DB and of transition and state formulae) beyond the ones presented in [13,17]. Concerning implementation, we plan to further develop our tool to incorporate in it the plethora of optimizations and sophisticated search strategies available in infinite-state SMT-based model checking. Finally, in [12] we tackle more conventional process modeling notations, concerning data-aware extensions of the de-facto standard BPMN 15 : we plan to provide a full-automated translator from the data-aware BPMN model presented in [12] to the artifact systems setting of [13,17].
Funding Open access funding provided by Libera Università di Bolzano within the CRUI-CARE Agreement.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.