There has been extensive research on sound and complete calculi for first-order logic with equality. The current prime calculus is superposition , where ordering restrictions guide paramodulation inferences and an abstract redundancy notion enables a number of clause simplification and deletion mechanisms, such as rewriting or subsumption. Still this “syntactic” form of superposition infers many redundant clauses. The completeness proof of superposition provides a “semantic” way of generating only non-redundant clauses, however, the underlying ground model assumption cannot be effectively computed in general . It requires an ordered enumeration of infinitely many ground instances of the given clause set, in general. Our calculus overcomes this issue by providing an effective way of generating ground model assumptions that then guarantee non-redundant inferences on the original clauses with variables.
The underlying ordering is based on the order of ground literals in the model assumption, hence changes during a run of the calculus. It incorporates a standard rewrite ordering. For practical redundancy criteria this means that both rewriting and redundancy notions that are based on literal subset relations are permitted to dynamically simplify or eliminate clauses. Newly generated clauses are non-redundant, so redundancy tests are only needed backwards. Furthermore, the ordering is automatically generated by the structure of the clause set. Instead of a fixed ordering as done in the superposition case, the calculus finds and changes an ordering according to the currently easiest way to make progress, analogous to CDCL (Conflict Driven Clause Learning) [28, 21, 24, 11, 33].
Typical for CDCL and SCL (Clause Learning from Simple Models) [1, 18, 14] approaches to reasoning, the development of a model assumption is done by decisions and propagations. A decision guesses a ground literal to be true whereas a propagation concludes the truth of a ground literal through an otherwise false clause. While propagations in CDCL and propositional logic are restricted to the finite number of propositional variables, in first-order logic there can already be infinite propagation sequences . In order to overcome this issue, model assumptions in SCL(EQ) are at any point in time restricted to a finite number of ground literals, hence to a finite number of ground instances of the clause set at hand. Therefore, without increasing the number of considered ground literals, the calculus either finds a refutation or runs into a stuck state where the current model assumption satisfies the finite number of ground instances. In this case one can check whether the model assumption can be generalized to a model assumption of the overall clause set or the information of the stuck state can be used to appropriately increase the number of considered ground literals and continue search for a refutation. SCL(EQ) does not require exhaustive propagation, in general, it just forbids the decision of the complement of a literal that could otherwise be propagated.
For an example of SCL(EQ) inferring clauses, consider the three first-order clauses
with a Knuth-Bendix Ordering (KBO), unique weight , and precedence . A Superposition Left  inference between and results in
For SCL(EQ) we start by building a partial model assumption, called a trail, with two decisions
where . Decisions and propagations are always ground instances of literals from the first-order clauses, and are annotated with a level and a justification clause, in case of a decision a tautology. Now with respect to clause is false with grounding , and rule Conflict is applicable; see Section 3.1 for details on the inference rules. In general, clauses and justifications are considered variable disjoint, but for simplicity of the presentation of this example, we repeat variable names here as long as the same ground substitution is shared. The maximal literal in is and a rewrite refutation using the ground equations from the trail results in the justification clause
where for the refutation justification clauses and all otherwise inferred clauses we use the grounding for guidance, but operate on the clauses with variables. The respective ground clause is smaller than , false with respect to and becomes our new conflict clause by an application of our inference rule Explore-Refutation. It is simplified by our inference rules Equality-Resolution and Factorize, resulting in the finally learned clause
which is then used to apply rule Backtrack to the trail. Further details on this example are available from the Appendix, Example 4. Observe that is strictly stronger than the clause inferred by superposition and that cannot be inferred by superposition. Thus SCL(EQ) can infer stronger clauses than superposition for this example.
SCL(EQ) is based on ideas of SCL [1, 18, 14] but for the first time includes a native treatment of first-order equality reasoning. Similar to  propagations need not to be exhaustively applied, the trail is built out of decisions and propagations of ground literals annotated by first-order clauses, SCL(EQ) only learns non-redundant clauses, but for the first time conflicts resulting out of a decision have to be considered, due to the nature of the equality relation.
There have been suggested several approaches to lift the idea of an inference guiding model assumption from propositional to full first-order logic [18, 6, 13, 12]. They do not provide a native treatment of equality, e.g., via paramodulation or rewriting.
Baumgartner et al. describe multiple calculi that handle equality by using unit superposition style inference rules and are based on either hyper tableaux  or DPLL [15, 16]. Hyper tableaux fix a major problem of the well-known free variable tableaux, namely the fact that free variables within the tableau are rigid, i.e., substitutions have to be applied to all occurrences of a free variable within the entire tableau. Hyper tableaux with equality  in turn integrates unit superposition style inference rules into the hyper tableau calculus.
Another approach that is related to ours is the model evolution calculus with equality () by Baumgartner et al. [9, 8] which lifts the DPLL calculus to first-order logic with equality. Similar to our approach, creates a candidate model until a clause instance contradicts this model or all instances are satisfied by the model. The candidate model results from a so-called context, which consists of a finite set of non-ground rewrite literals. Roughly speaking, a context literal specifies the truth value of all its ground instances unless a more specific literal specifies the complement. Initially the model satisfies the identity relation over the set of all ground terms. Literals within a context may be universal or parametric, where universal literals guarantee all its ground instances to be true. If a clause contradicts the current model, it is repaired by a non-deterministic split which adds a parametric literal to the current model. If the added literal does not share any variables in the contradictory clause it is added as a universal literal.
Another approach by Baumgartner and Waldmann  combined the superposition calculus with the Model Evolution calculus with equality. In this calculus the atoms of the clauses are labeled as ”split atoms” or ”superposition atoms”. The superposition part of the calculus then generates a model for the superposition atoms while the model evolution part generates a model for the split atoms. Conversely, this means that if all atoms are labeled as ”split atom”, the calculus behaves similar to the model evolution calculus. If all atoms are labeled as ”superposition atom”, it behaves like the superposition calculus.
Both the hyper tableaux calculus with equality and the model evolution calculus with equality allow only unit superposition applications, while SCL(EQ) inferences are guided paramodulation inferences on clauses of arbitrary length. The model evolution calculus with equality was revised and implemented in 2011  and compares its performance with that of hyper tableaux. Model evolution performed significantly better, with more problems solved in all relevant TPTP  categories, than the implementation of the hyper tableaux calculus.
Plaisted et al.  present the Ordered Semantic Hyper-Linking (OSHL) calculus. OSHL is an instantiation based approach that repeatedly chooses ground instances of a non-ground input clause set such that the current model does not satisfy the current ground clause set. A further step repairs the current model such that it satisfies the ground clause set again. The algorithm terminates if the set of ground clauses contains the empty clause. OSHL supports rewriting and narrowing, but only with unit clauses. In order to handle non-unit clauses it makes use of other mechanisms such as Brand’s Transformation .
Inst-Gen  is an instantiation based calculus, that creates ground instances of the input first-order formulas which are forwarded to a SAT solver. If a ground instance is unsatisfiable, then the first-order set is as well. If not then the calculus creates more instances. The Inst-Gen-EQ calculus  creates instances by extracting instantiations of unit superposition refutations of selected literals of the first-order clause set. The ground abstraction is then extended by the extracted clauses and an SMT solver then checks the satisfiability of the resulting set of equational and non-equational ground literals.
In favor of a better structure we have moved all proofs to an Appendix. The rest of the paper is organized as follows. Section 2 provides basic formalisms underlying SCL(EQ). The rules of the calculus are presented in Section 3. Soundness and completeness results are provided in Section 4. We end with a discussion of obtained results and future work, Section 5. The main contribution of this paper is the SCL(EQ) calculus that only learns non-redundant clauses, permits subset based redundancy elimination and rewriting, and its soundness and completeness.
We assume a standard first-order language with equality and signature where the only predicate symbol is equality . denotes a set of clauses, denote clauses, denote equational literals, denote equational atoms, terms from for an infinite set of variables , function symbols from , constants from and variables from . The function denotes the complement of a literal. We write as a shortcut for . The literal may denote both and . The semantics of first-order logic and semantic entailment is defined as usual.
By we denote substitutions, which are total mappings from variables to terms. Let be a substitution, then its finite domain is defined as and its codomain is defined as . We extend their application to literals, clauses and sets of such objects in the usual way. A term, literal, clause or sets of these objects is ground if it does not contain any variable. A substitution is if is ground. A substitution is for a term , literal , clause if , , is ground, respectively. By , we denote a closure consisting of a clause , literal and a grounding substitution , respectively. The function computes the set of all ground instances of a literal, clause, or clause set. The function denotes the most general unifier of terms, atoms, literals, respectively. We assume that mgus do not introduce fresh variables and that they are idempotent.
The set of positions of a literal (term ) is inductively defined as usual. The notion denotes the subterm of a literal ( for term ) at position (). The replacement of a subterm of a literal (term ) at position () by a term is denoted by (). For example, the term has the positions , and denotes the term .
Let be a set of rewrite rules , called a term rewrite system (TRS). The rewrite relation is defined as usual by if there exists , , and a matcher , such that and We write if s is the normal form of in the rewrite relation . We write if is the normal form of and is the normal form of . A rewrite relation is terminating if there is no infinite descending chain and confluent if implies . A rewrite relation is convergent if it is terminating and confluent. A rewrite order is a irreflexive and transitive rewrite relation. A TRS is terminating, confluent, convergent, if the rewrite relation is terminating, confluent, convergent, respectively. A term is called irreducible by a TRS if no rule from rewrites . Otherwise it is called reducible. A literal, clause is irreducible if all of its terms are irreducible, and reducible otherwise. A substitution is called irreducible if any is irreducible, and reducible otherwise.
Let denote a well-founded rewrite ordering on terms which is total on ground terms and for all ground terms there exist only finitely many ground terms . We call a desired term ordering. We extend to equations by assigning the multiset to positive equations and to inequations . Furthermore, we identify with its multiset extension comparing multisets of literals. For a (multi)set of terms and a term , we define if . For a (multi)set of Literals and a term , we define if . Given a ground term then computes the set of all ground instances of a literal, clause, or clause set where the groundings are smaller than according to the ordering . Given a set (sequence) of ground literals let be a convergent rewrite system out of the positive equations in using .
Let be a well-founded, total, strict ordering on ground literals, which is lifted to clauses and clause sets by its respective multiset extension. We overload for literals, clauses, clause sets if the meaning is clear from the context. The ordering is lifted to the non-ground case via instantiation: we define if for all grounding substitutions it holds . Then we define as the reflexive closure of and and use the standard superposition style notion of redundancy .
Definition 1 (Clause Redundancy).
A ground clause is redundant with respect to a set of ground clauses and an ordering if . A clause is redundant with respect to a clause set and an ordering if for all , is redundant with respect to .
3 The SCL(EQ) Calculus
We start the introduction of the calculus by defining the ingredients of an SCL(EQ) state.
Definition 2 (Trail).
A trail is a consistent sequence of ground equations and inequations where is annotated by a level with , and a closure . We omit the annotations if they are not needed in a certain context. A ground literal is true in if . A ground literal is false in if . A ground literal is undefined in if and . Otherwise it is defined. For each literal in it holds that is undefined in and irreducible by .
The above definition of truth and undefinedness is extended to clauses in the obvious way. The notions of true, false, undefined can be parameterized by a ground term by saying that is -undefined in a trail if or is undefined. The notions of a -true, -false term are restrictions of the above notions to literals smaller , respectively. All SCL(EQ) reasoning is layered with respect to a ground term .
Let be a trail and a ground literal such that is defined in . By we denote a minimal subsequence such that is defined in . By we denote the set of all cores.
Note that is not necessarily unique. There can be multiple cores for a given trail and ground literal .
Definition 4 (Trail Ordering).
Let be a trail. The (partial) trail ordering is the sequence ordering given by , i.e., if for all .
Definition 5 (Defining Core and Defining Literal).
For a trail and a sequence of literals we write for the largest literal in according to the trail ordering . Let be a trail and a ground literal such that is defined in . Let be a sequence of literals where for all , then is called the defining literal and is called a defining core for in . If contains only the empty core, then has no defining literal and no defining core.
Note that there can be multiple defining cores but only one defining literal for any defined literal . For example, consider a trail with an ordering that orders the terms of the equations from left to right, and a literal . Then the defining cores are and . The defining literal, however, is in both cases . Defined literals that have no defining core and therefore no defining literal are literals that are trivially false or true. Consider, for example, . This literal is trivially true in . Thus an empty subset of is sufficient to show that is defined in .
Definition 6 (Literal Level).
Let be a trail. A ground literal is of level if is annotated with in . A defined ground literal is of level if the defining literal of is of level . If has no defining literal, then is of level . A ground clause is of level if is the maximum level of a literal in .
The restriction to minimal subsequences for the defining literal and definition of a level eventually guarantee that learned clauses are smaller in the trail ordering. This enables completeness in combination with learning non-redundant clauses as shown later.
Let be a trail and a defined literal that is of level in . Then is of level in a trail .
Let be a trail and a literal. is called a decision literal if . Otherwise is called a propagated literal.
In our above example is of level since the defining literal is annotated with . on the other hand is of level .
We define a well-founded total strict ordering which is induced by the trail and with which non-redundancy is proven in Section 4. Unlike SCL [18, 14] we use this ordering for the inference rules as well. In previous SCL calculi, conflict resolution automatically chooses the greatest literal and resolves with this literal. In SCL(EQ) this is generalized. Coming back to our running example above, suppose we have a conflict clause . The defining literal for both inequations is . So we could do paramodulation inferences with both literals. The following ordering makes this non-deterministic choice deterministic.
Definition 8 (Trail Induced Ordering).
Let be a trail, a ground term such that and all -defined ground literals not contained in : for a defining literal and for two literals , we have if . The trail induces a total well-founded strict order on ground literals , , of level greater than zero, where
if or ( and )
and for all literals of level zero:
if is of level greater than zero and is
and can eventually be extended to ground literals by
The literal ordering is extended to ground clauses by multiset extension and identified with as well.
Lemma 2 (Properties of ).
is a total strict order, i.e. is irreflexive, transitive and total.
is a well-founded ordering.
Assume a trail , select KBO as the term ordering where all symbols have weight one and and a ground term . According to the trail induced ordering we have that by 8.2. Furthermore we have that
by 8.3 and 8.4. Now for any literal that is in and the defining literal is it holds that by 8.6 and 8.7. This holds analogously for all literals that are in and the defining literal is or . Thus we get:
where are the literals and are the trivially defined literals.
Definition 9 (Rewrite Step).
A rewrite step is a five-tuple and inductively defined as follows. The tuple is a rewrite step. Given rewrite steps and a position then is a rewrite step. The literal is called the rewrite literal. In case are not , the rewrite literal of is an equation.
Rewriting is one of the core features of our calculus. The following definition describes a rewrite inference between two clauses. Note that unlike the superposition calculus we allow rewriting below variable level.
Definition 10 (Rewrite Inference).
Let and be two variable disjoint rewrite steps where , for some position . We distinguish two cases:
if and then
is the result of a rewrite inference.
if then let be the most general instance of such that , introduces only fresh variables and for some minimal . Let . Then
is the result of a rewrite inference.
Let and be two variable disjoint rewrite steps where , for some position . Let be the result of a rewrite inference. Then:
If for some set of clauses , then
Now that we have defined rewrite inferences we can use them to define a reduction chain application and a refutation, which are sequences of rewrite steps. Intuitively speaking, a reduction chain application reduces a literal in a clause with literals in until it is irreducible. A refutation for a literal that is in for a given , is a sequence of rewrite steps with literals in such that is inferred. Refutations for the literals of the conflict clause will be examined during conflict resolution by the rule Explore-Refutation.
Definition 11 (Reduction Chain).
Let be a trail. A reduction chain from is a sequence of rewrite steps such that for each either
is contained in and or
is the result of a rewriting inference from rewrite steps out of where .
Let be an annotated ground literal. A reduction chain application from to is a reduction chain from such that and . We assume reduction chain applications to be minimal, i.e., if any rewrite step is removed from the sequence it is no longer a reduction chain application.
Definition 12 (Refutation).
Let be a trail and an annotated ground literal that is in for a given . A refutation from and is a reduction chain from such that for some . We assume refutations to be minimal, i.e., if any rewrite step , is removed from the refutation, it is no longer a refutation.
3.1 The SCL(EQ) Inference Rules
We can now define the rules of our calculus based on the previous definitions. A state is a six-tuple similar to the SCL calculus, where a sequence of annotated ground literals, and the sets of initial and learned clauses, is a ground term such that for all it holds , is the decision level, and a status that is , or a closure . Before we propagate or decide any literal, we make sure that it is irreducible in the current trail. Together with the design of this eventually enables rewriting as a simplification rule.
provided there is a , grounding for , , , , , is in , , is irreducible by , is a reduction chain application from to where .
Note that the definition of Propagate also includes the case where is irreducible by . In this case and . The rule Decide below, is similar to Propagate, except for the subclause which must be or in , i.e., Propagate cannot be applied and the decision literal is annotated by a tautology.
provided there is a , grounding for , , is or in , is in , , is irreducible by , is a reduction chain application from to where .
provided there is a , grounding for , is in , is irreducible by , if is of level and otherwise.
For the non-equational case, when a conflict clause is found by an SCL calculus [18, 14], the complements of its first-order ground literals are contained in the trail. For equational literals this is not the case, in general. The proof showing to be with respect to is a rewrite proof with respect to . This proof needs to be analyzed to eventually perform paramodulation steps on or to replace by a smaller clause showing up in the proof.
if is in .
The Explore-Refutation rule is the FOL with Equality counterpart to the resolve rule in CDCL or SCL. While in CDCL or SCL complementary literals of the conflict clause are present on the trail and can directly be used for resolution steps, this needs a generalization for FOL with Equality. Here, in general, we need to look at (rewriting) refutations of the conflict clause and pick an appropriate clause from the refutation as the next conflict clause.
if is strictly maximal in , is the defining literal of , is a refutation from and , , , , is in .
provided , and .
provided , .
provided is of level where , is of level and the minimal trail subsequence such that there is a grounding substitution with -false in but not in ; if is a decision literal and otherwise.
In addition to soundness and completeness of the SCL(EQ) rules their tractability in practice is an important property for a successful implementation. In particular, finding propagating literals or detecting a false clause under some grounding. It turns out that these operations are NP-complete, similar to first-order subsumption which has been shown to be tractable in practice.
Assume that all ground terms with for any are polynomial in the size of . Then testing Propagate (Conflict) is NP-Complete, i.e., the problem of checking for a given clause whether there exists a grounding substitution such that propagates (is false) is NP-Complete.
Example 2 (SCL(EQ) vs. Superposition: Saturation).
Consider the following clauses:
where again we assume a KBO with all symbols having weight one, precedence and . Suppose that we first decide and then propagate : . Now we have a conflict with . Explore-Refutation applied to the conflict clause results in a paramodulation inference between and . Another application of Equality-Resolution gives us the new conflict clause . Now we can Skip the last literal on the trail, which gives us . Another application of the Explore-Refutation rule to using the decision justification clause followed by Equality-Resolution and Factorize gives us . Thus with SCL(EQ) the following clauses remain:
where we derived out of by subsumption resolution  using . Actually, subsumption resolution is compatible with the general redundancy notion of SCL(EQ), see Lemma 6. Now we consider the same example with superposition and the very same ordering ( is the clause set of the previous step and the initial clause set ).
Thus superposition ends up with the following clauses: