## 1 Introduction

There has been extensive research on sound and complete calculi for first-order logic with equality. The current prime calculus is superposition [2], 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 [35]. 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) [11, 12, 28, 33, 39].

Typical for CDCL and SCL (Clause Learning from Simple Models) [1, 15, 21] 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 [21], as there might exist an infinite set of ground instances. 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

\begin{aligned} \begin{array}{l} C_1 {:}{=}\, h(x) \approx g(x)\vee c\approx d \qquad C_2 {:}{=} \,f(x) \approx g(x) \vee a \approx b\\ C_3 {:}{=}\, f(x) \not \approx h(x) \vee f(x) \not \approx g(x)\\ \end{array} \end{aligned}

with a Knuth–Bendix Ordering (KBO), unique weight 1, and precedence $$d\prec c\prec b\prec a \prec g \prec h \prec f$$. A Superposition Left [2] inference between $$C_2$$ and $$C_3$$ results in

\begin{aligned} C'_4 {:}{=} \, h(x) \not \approx g(x) \vee f(x) \not \approx g(x) \vee a \approx b. \end{aligned}

For SCL(EQ) we start by building a partial model assumption, called a trail, with two decisions

\begin{aligned} \Gamma {:}{=}\, \bigg [h(a)\approx g(a)^{1:(h(x) \approx g(x)\vee h(x) \not \approx g(x))\cdot \sigma },f(a)\approx g(a)^{2:(f(x) \approx g(x)\vee f(x) \not \approx g(x))\cdot \sigma }\bigg ], \end{aligned}

where $$\sigma {:}{=} \{x\mapsto a\}$$. 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 $$\Gamma$$ clause $$C_3$$ is false with grounding $$\sigma$$, and rule Conflict is applicable; see Sect. 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 $$C_3\sigma$$ is $$(f(x) \not \approx h(x))\sigma$$ and a rewrite refutation using the ground equations from the trail results in the justification clause

\begin{aligned} (g(x) \not \approx g(x)\vee f(x) \not \approx g(x)\vee f(x) \not \approx g(x) \vee h(x) \not \approx g(x))\cdot \sigma , \end{aligned}

where for the refutation justification clauses and all otherwise inferred clauses we use the grounding $$\sigma$$ for guidance, but operate on the clauses with variables. The respective ground clause is smaller than $$(f(x) \not \approx h(x))\sigma$$, false with respect to $$\Gamma$$ 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

\begin{aligned} C_4 {:}{=}\, h(x) \not \approx g(x) \vee f(x) \not \approx g(x), \end{aligned}

which is then used to apply rule Backtrack to the trail. Further details on this example are available from the Appendix, Example 6. Observe that $$C_4$$ is strictly stronger than $$C'_4$$ the clause inferred by superposition and that $$C_4$$ cannot be inferred by superposition. Thus SCL(EQ) can infer stronger clauses than superposition for this example.

### 1.1 Related Work

SCL(EQ) is based on ideas of SCL [1, 15, 17, 21] but for the first time includes a native treatment of first-order equality reasoning. Similar to [15] 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 [8, 13, 14, 21]. 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 [5] or DPLL [18, 19]. 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 [9] 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 ($$\mathcal {ME_E}$$) by Baumgartner et al. [6, 10] which lifts the DPLL calculus to first-order logic with equality. Similar to our approach, $$\mathcal {ME_E}$$ 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 [7] 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 [10] and compares its performance with that of hyper tableaux. Model evolution performed significantly better, with more problems solved in all relevant TPTP [34] categories, than the implementation of the hyper tableaux calculus.

Plaisted et al. [31] 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 [4].

Inst-Gen [25] 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 [26] 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.

On ground equational clauses, the behavior of SCL(EQ) is similar to SMT (Satisfiability Modulo Theories) [30]. SCL(EQ) rigorously searches for implied equalities and does not explicitely consider the propositional abstraction that drives SMT. Therefore, SCL(EQ)  only learns non-redundant clauses that is not guaranteed by standard SMT reasoning. On the other hand the level of laziness in reasoning that is offered by SMT is currently not supported by SCL(EQ). On equational clauses with variables, SCL(EQ) learns only non-redundant clauses with variables whereas SMT solely operates on ground instances.

This article is an extended version of our proceedings paper [27]. It includes more examples and an extended background and discussion section. 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 Sect. 3. Soundness and completeness results are provided in Sect. 4. We end with a discussion of obtained results and future work, Sect. 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.

## 2 Preliminaries

We assume a standard first-order language with equality and signature $$\Sigma = (\Omega , \emptyset )$$ where the only predicate symbol is equality $$\approx$$. N denotes a set of clauses, CD denote clauses, LKH denote equational literals, AB denote equational atoms, ts terms from $$T(\Omega ,\mathcal {X})$$ for an infinite set of variables $$\mathcal {X}$$, fgh function symbols from $$\Omega$$, abc constants from $$\Omega$$ and xyz variables from $$\mathcal {X}$$. The function comp denotes the complement of a literal. We write $$s\not \approx t$$ as a shortcut for $$\lnot (s \approx t)$$. The literal $$s\,\#\, t$$ may denote both $$s\approx t$$ and $$s\not \approx t$$. The semantics of first-order logic and semantic entailment $$\models$$ is defined as usual.

By $$\sigma ,\tau ,\delta$$ we denote substitutions, which are total mappings from variables to terms. Let $$\sigma$$ be a substitution, then its finite domain is defined as $$dom(\sigma ) {:}{=} \{x \mid x\sigma \not = x\}$$ and its codomain is defined as $$codom(\sigma ) = \{t \mid x\sigma = t, x \in dom (\sigma )\}$$. 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 $$\sigma$$ is ground if $$codom(\sigma )$$ is ground. A substitution $$\sigma$$ is grounding for a term t, literal L, clause C if $$t\sigma$$, $$L\sigma$$, $$C\sigma$$ is ground, respectively. By $$C\cdot \sigma$$, $$L\cdot \sigma$$ we denote a closure consisting of a clause C, literal L and a grounding substitution $$\sigma$$, respectively. The function gnd computes the set of all ground instances of a literal, clause, or clause set. The function $${\text {mgu}}$$ 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 $${{\text {pos}}}(L)$$ of a literal (term $${{\text {pos}}}(t)$$) is inductively defined as usual. The notion $$L\vert _p$$ denotes the subterm of a literal L ($$t\vert _p$$ for term t) at position $$p\in {{\text {pos}}}(L)$$ ($$p\in {{\text {pos}}}(t)$$). The replacement of a subterm of a literal L (term t) at position $$p\in {{\text {pos}}}(L)$$ ($$p\in {{\text {pos}}}(t)$$) by a term s is denoted by $$L[s]_p$$ ($$t[s]_p$$). For example, the term f(ag(x)) has the positions $$\{\epsilon , 1, 2, 21\}$$, $$f(a,g(x))\vert _{21} = x$$ and $$f(a,g(x))[b]_2$$ denotes the term f(ab).

Let R be a set of rewrite rules $$l \rightarrow r$$, called a term rewrite system (TRS). The rewrite relation $$\rightarrow _R \subseteq T(\Omega , \mathcal {X})\times T(\Omega , \mathcal {X})$$ is defined as usual by $$s\rightarrow _R t$$ if there exists $$(l\rightarrow r)\in R$$, $$p\in {{\text {pos}}}(s)$$, and a matcher $$\sigma$$, such that $$s\vert _p=l\sigma$$ and $$t = s[r\sigma ]_p.$$ We write $$s=t{\downarrow _R}$$ if s is the normal form of t in the rewrite relation $$\rightarrow _R$$. We write $$s\,\#\, t =(s'\,\#\, t'){\downarrow _R}$$ if s is the normal form of $$s'$$ and t is the normal form of $$t'$$. A rewrite relation is terminating if there is no infinite descending chain $$t_0\rightarrow t_1\rightarrow ...$$ and confluent if $$t ^{*}\hspace{-1.5ex}\leftarrow s \rightarrow ^* t'$$ implies $$t \leftrightarrow ^* t'$$. A rewrite relation is convergent if it is terminating and confluent. A rewrite order is a irreflexive and transitive rewrite relation. A TRS R is terminating, confluent, convergent, if the rewrite relation $$\rightarrow _R$$ is terminating, confluent, convergent, respectively. A term t is called irreducible by a TRS R if no rule from R rewrites t. Otherwise it is called reducible. A literal, clause is irreducible if all of its terms are irreducible, and reducible otherwise. A substitution $$\sigma$$ is called irreducible if any $$t\in codom(\sigma )$$ is irreducible, and reducible otherwise.

Let $$\prec _T$$ denote a well-founded rewrite ordering on terms which is total on ground terms and for all ground terms t there exist only finitely many ground terms $$s \prec _T t$$. We call $$\prec _T$$ a desired term ordering. We extend $$\prec _T$$ to equations by assigning the multiset $$\{s,t\}$$ to positive equations $$s\approx t$$ and $$\{s,s,t,t\}$$ to inequations $$s\not \approx t$$. Furthermore, we identify $$\prec _T$$ with its multiset extension comparing multisets of literals. For a (multi)set of terms $$\{t_1,\ldots ,t_n\}$$ and a term t, we define $$\{t_1,\ldots ,t_n\} \prec _T t$$ if $$\{t_1,\ldots ,t_n\} \prec _T \{t\}$$. For a (multi)set of Literals $$\{L_1,\ldots ,L_n\}$$ and a term t, we define $$\{L_1,\ldots ,L_n\} \prec _T t$$ if $$\{L_1,\ldots ,L_n\} \prec _T \{\{t\}\}$$. Given a ground term $$\beta$$ then $${\text {gnd}}_{\prec _T\beta }$$ computes the set of all ground instances of a literal, clause, or clause set where the groundings are smaller than $$\beta$$ according to the ordering $$\prec _T$$. Given a set (sequence) of ground literals $$\Gamma$$ let $${\text {conv}}(\Gamma )$$ be a convergent rewrite system from the positive equations in $$\Gamma$$ using $$\prec _T$$.

Let $$\prec$$ 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 $$\prec$$ 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 $$C \prec D$$ if for all grounding substitutions $$\sigma$$ it holds $$C\sigma \prec D\sigma$$. Then we define $$\preceq$$ as the reflexive closure of $$\prec$$ and $$N^{\preceq C} {:}{=} \{D \mid D\in N \;\text {and}\; D\preceq C\}$$ and use the standard superposition style notion of redundancy [2].

### Definition 1

(Clause Redundancy) A ground clause C is redundant with respect to a set N of ground clauses and an ordering $$\prec$$ if $$N^{\preceq C} \models C$$. A clause C is redundant with respect to a clause set N and an ordering $$\prec$$ if for all $$C'\in gnd(C)$$, $$C'$$ is redundant with respect to gnd(N).

The Superposition calculus [2] is defined by the following rules. Given a reduction order $$\succ$$ on terms which is extended to an ordering on literals and clauses in the usual way, the basic Superposition rule is as follows:

Inferences are only allowed if the left premise is not greater than or equal to the right one, the last literal of each premise is greater than the remaining literals of the respective clause and the lefthand side of these literals is not smaller or equal to the righthand side. Two more rules are needed for completeness:

## 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 $$\Gamma {:}{=}[L_1^{i_1:C_1\cdot \sigma _1},...,L_n^{i_n:C_n\cdot \sigma _n}]$$ is a consistent sequence of ground equations and inequations where $$L_j$$ is annotated by a level $$i_j$$ with $$i_{j-1}\le i_j$$, and a closure $$C_j\cdot \sigma _j$$. We omit the annotations if they are not needed in a certain context. A ground literal L is true in $$\Gamma$$ if $$\Gamma \models L$$. A ground literal L is false in $$\Gamma$$ if $$\Gamma \models comp(L)$$. A ground literal L is undefined in $$\Gamma$$ if $$\Gamma \not \models L$$ and $$\Gamma \not \models comp(L)$$. Otherwise it is defined. For each literal $$L_j$$ in $$\Gamma$$ it holds that $$L_j$$ is undefined in $$[L_1,...,L_{j-1}]$$ and irreducible by $${\text {conv}}(\{L_1,...,L_{j-1}\})$$.

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 $$\beta$$ by saying that L is $$\beta$$-undefined in a trail $$\Gamma$$ if $$\beta \prec _T L$$ or L is undefined. The notions of a $$\beta$$-true, $$\beta$$-false term are restrictions of the above notions to literals smaller $$\beta$$, respectively. All SCL(EQ) reasoning is layered with respect to a ground term $$\beta$$.

### Definition 3

Let $$\Gamma$$ be a trail and L a ground literal such that L is defined in $$\Gamma$$. By $${\text {core}}(\Gamma ;L)$$ we denote a minimal subsequence $$\Gamma ' \subseteq \Gamma$$ such that L is defined in $$\Gamma '$$. By $${\text {cores}}(\Gamma ;L)$$ we denote the set of all cores.

Note that $$core(\Gamma ;L)$$ is not necessarily unique. There can be multiple cores for a given trail $$\Gamma$$ and ground literal L.

### Definition 4

(Trail Ordering) Let $$\Gamma {:}{=}[L_1,...,L_n]$$ be a trail. The (partial) trail ordering $$\prec _\Gamma$$ is the sequence ordering given by $$\Gamma$$, i.e., ($$L_i\prec _\Gamma L_j$$ if $$i < j$$) for all $$1\le i,j\le n$$.

### Definition 5

(Defining Core and Defining Literal) For a trail $$\Gamma$$ and a sequence of literals $$\Delta \subseteq \Gamma$$ we write $$max_{\prec _\Gamma }(\Delta )$$ for the largest literal in $$\Delta$$ according to the trail ordering $$\prec _\Gamma$$. Let $$\Gamma$$ be a trail and L a ground literal such that L is defined in $$\Gamma$$. Let $$\Delta \in cores(\Gamma ;L)$$ be a sequence of literals where $$max_{\prec _\Gamma }(\Delta ) \preceq _\Gamma max_{\prec _\Gamma }(\Lambda )$$ for all $$\Lambda \in cores(\Gamma ;L)$$, then $$\max _\Gamma (L) {:}{=} \max _{\prec _\Gamma }(\Delta )$$ is called the defining literal and $$\Delta$$ is called a defining core for L in $$\Gamma$$. If $$cores(\Gamma ;L)$$ contains only the empty core, then L has no defining literal and no defining core.

As an example, consider the trail $$\Gamma {:}{=}[L_1,L_2,L_3]$$ and literal L, such that $$[L_1,L_2]\models L$$ and $$[L_2,L_3]\models L$$. Then both $$[L_1,L_2]$$ and $$[L_2,L_3]$$ are cores, but only $$[L_1,L_2]$$ is a defining core and only $$L_2$$ is the defining literal. Note that there can be multiple defining cores but only one defining literal for any defined literal L. For example, consider a trail $$\Gamma {:}{=}[f(a)\approx f(b)^{1:C_1\cdot \sigma _1},a\approx b^{2:C_2\cdot \sigma _2},b\approx c^{3:C_3\cdot \sigma _3}]$$ with an ordering $$\prec _T$$ that orders the terms of the equations from left to right, and a literal $$g(f(a))\approx g(f(c))$$. Then the defining cores are $$\Delta _1 {:}{=}[a\approx b,b\approx c]$$ and $$\Delta _2 {:}{=}[f(a)\approx f(b),b\approx c]$$. The defining literal, however, is in both cases $$b\approx c$$. Defined literals that have no defining core and therefore no defining literal are literals that are trivially false or true. Consider, for example, $$g(f(a))\approx g(f(a))$$. This literal is trivially true in $$\Gamma$$. Thus an empty subset of $$\Gamma$$ is sufficient to show that $$g(f(a))\approx g(f(a))$$ is defined in $$\Gamma$$.

### Definition 6

(Literal Level) Let $$\Gamma$$ be a trail. A ground literal $$L \in \Gamma$$ is of level i if L is annotated with i in $$\Gamma$$. A defined ground literal $$L\not \in \Gamma$$ is of level i if the defining literal of L is of level i. If L has no defining literal, then L is of level 0. A ground clause D is of level i if i is the maximum level of a literal in D.

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.

### Lemma 1

Let $$\Gamma _1$$ be a trail and K a defined literal that is of level i in $$\Gamma _1$$. Then K is of level i in a trail $$\Gamma {:}{=}\Gamma _1,\Gamma _2$$.

### Definition 7

Let $$\Gamma$$ be a trail and $$L\in \Gamma$$ a literal. L is called a decision literal if $$\Gamma = \Gamma _0,K^{i:C\cdot \tau }, L^{i+1:C'\cdot \tau '}, \Gamma _1$$. Otherwise L is called a propagated literal.

In other words: L is a decision literal if the level of L is one greater than the level of the preceeding literal K. In our above example $$g(f(a))\approx g(f(c))$$ is of level 3 since the defining literal $$b\approx c$$ is annotated with 3. $$a\not \approx b$$ on the other hand is of level 2.

We define a well-founded total strict ordering which is induced by the trail and with which non-redundancy is proven in Sect. 4. Unlike SCL [15, 21] 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 $$f(b)\not \approx f(c)\vee b\not \approx c$$. The defining literal for both inequations is $$b\approx c$$. So we could do paramodulation inferences with both literals. The following ordering makes this non-deterministic choice deterministic.

### Definition 8

(Trail Induced Ordering) Let $$\Gamma {:}{=}[L_1^{i_1:C_1\cdot \sigma _1},...,L_n^{i_n:C_n\cdot \sigma _n}]$$ be a trail, $$\beta$$ a ground term such that $$\{L_1,...,L_n\}\prec _T \beta$$ and $$M_{i,j}$$ all $$\beta$$-defined ground literals not contained in $$\Gamma \,\cup \, comp(\Gamma )$$: for a defining literal $$max_\Gamma (M_{i,j}) = L_i$$ and for two literals $$M_{i,j}$$, $$M_{i,k}$$ we have $$j<k$$ if $$M_{i,j} \prec _T M_{i,k}$$.

The trail induces a total well-founded strict order $$\prec _{\Gamma ^*}$$ on $$\beta \text {-} defined$$ ground literals $$M_{k,l}, M_{m,n}$$, $$L_i$$, $$L_j$$ of level greater than zero, where

1. 1.

$$M_{i,j}\prec _{\Gamma ^*} M_{k,l}$$ if $$i<k$$ or ($$i=k$$ and $$j<l$$);

2. 2.

$$L_i\prec _{\Gamma ^*} L_j$$ if $$L_i\prec _\Gamma L_j$$;

3. 3.

$$comp(L_i)\prec _{\Gamma ^*} L_j$$ if $$L_i\prec _\Gamma L_j$$;

4. 4.

$$L_i\prec _{\Gamma ^*} comp(L_j)$$ if $$L_i\prec _\Gamma L_j$$ or $$i = j$$;

5. 5.

$$comp(L_i)\prec _{\Gamma ^*} comp(L_j)$$ if $$L_i\prec _\Gamma L_j$$;

6. 6.

$$L_i\prec _{\Gamma ^*} M_{k,l}$$, $${\text {comp}}(L_i)\prec _{\Gamma ^*} M_{k,l}$$ if $$i\le k$$;

7. 7.

$$M_{k,l}\prec _{\Gamma ^*} L_i$$, $$M_{k,l}\prec _{\Gamma ^*} {\text {comp}}(L_i)$$ if $$k<i$$;

and for all $$\beta \text {-} defined$$ literals L of level zero:

1. 8.

$$\prec _{\Gamma ^*} {:}{=} \prec _T$$;

2. 9.

$$L\prec _{\Gamma ^*} K$$ if K is of level greater than zero and K is $$\beta {\text {-}} defined$$;

and can eventually be extended to $$\beta {\text {-}} undefined$$ ground literals KH by

1. 10.

$$K \prec _{\Gamma ^*} H$$ if $$K\prec _T H$$;

2. 11.

$$L \prec _{\Gamma ^*} H$$ if L is $$\beta {\text {-}} defined$$.

The literal ordering $$\prec _{\Gamma ^*}$$ is extended to ground clauses by multiset extension and identified with $$\prec _{\Gamma ^*}$$ as well.

Note, that in the above definition for a given i we can always put the $$M_{i,j}$$ in an order corresponding to the integers. This is due to the fact, that the total number of ground literals is countable and since there are only finitely many $$\beta$$-defined literals.

### Lemma 2

(Properties of $$\prec _{\Gamma ^*}$$)

1. 1

$$\prec _{\Gamma ^*}$$ is well-defined.

2. 2

$$\prec _{\Gamma ^*}$$ is a total strict order, i.e. $$\prec _{\Gamma ^*}$$ is irreflexive, transitive and total.

3. 3

$$\prec _{\Gamma ^*}$$ is a well-founded ordering.

### Example 1

Assume a trail $$\Gamma {:}{=} [a\approx b^{1:C_0\cdot \sigma _0}, c\approx d^{1:C_1\cdot \sigma _1}, f(a')\not \approx f(b')^{1:C_2\cdot \sigma _2}]$$, select KBO as the term ordering $$\prec _T$$ where all symbols have weight one and $$a\prec a'\prec b\prec b'\prec c\prec d\prec f$$ and a ground term $$\beta {:}{=} f(f(a))$$. According to the trail induced ordering we have that $$a\approx b\prec _{\Gamma ^*} c\approx d\prec _{\Gamma ^*} f(a')\not \approx f(b')$$ by 8.2. Furthermore we have that

\begin{aligned} a\approx b\prec _{\Gamma ^*} a\not \approx b\prec _{\Gamma ^*} c\approx d\prec _{\Gamma ^*} c\not \approx d\prec _{\Gamma ^*} f(a')\not \approx f(b')\prec _{\Gamma ^*} f(a')\approx f(b'), \end{aligned}

by 8.3 and 8.4. Now for any literal L that is $$\beta {\text {-}} defined$$ in $$\Gamma$$ and the defining literal is $$a\approx b$$ it holds that $$a\not \approx b\prec _{\Gamma ^*} L\prec _{\Gamma ^*} c\approx d$$ by 8.6 and 8.7. This holds analogously for all literals that are $$\beta \text {-} defined$$ in $$\Gamma$$ and the defining literal is $$c\approx d$$ or $$f(a')\not \approx f(b')$$. Thus we get:

\begin{aligned} \begin{array}{c} L_1 \prec _{\Gamma ^*}... \prec _{\Gamma ^*} a\approx b\prec _{\Gamma ^*} a\not \approx b\prec _{\Gamma ^*} f(a)\approx f(b)\prec _{\Gamma ^*} f(a)\not \approx f(b)\prec _{\Gamma ^*} \\ c\approx d\prec _{\Gamma ^*} c\not \approx d\prec _{\Gamma ^*} f(c)\approx f(d)\prec _{\Gamma ^*} f(c)\not \approx f(d)\prec _{\Gamma ^*}\\ f(a')\not \approx f(b')\prec _{\Gamma ^*} f(a')\approx f(b')\prec _{\Gamma ^*} a'\approx b'\prec _{\Gamma ^*} a'\not \approx b'\prec _{\Gamma ^*} K_1\prec _{\Gamma ^*} \ldots \end{array} \end{aligned}

where $$K_i$$ are the $$\beta {\text {-}} undefined$$ literals and $$L_j$$ are the trivially defined literals.

Table 1 summarizes the various orders presented so far.

### Definition 9

(Rewrite Step) A rewrite step is a five-tuple $$(s\# t\cdot \sigma , s\# t\vee C\cdot \sigma , R, S, p)$$ and inductively defined as follows. The tuple $$(s\# t\cdot \sigma , s\# t\vee C\cdot \sigma , \epsilon , \epsilon , \epsilon )$$ is a rewrite step. Given rewrite steps RS and a position p then $$(s\# t\cdot \sigma , s\# t\vee C\cdot \sigma , R, S, p)$$ is a rewrite step. The literal $$s\# t$$ is called the rewrite literal. In case RS are not $$\epsilon$$, the rewrite literal of R is an equation.

Note that R and S in the above definition describe the “history” of a rewrite step, i.e. they contain all preceeding rewrite steps.

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 $$I_1 {:}{=} (l_1\approx r_1\cdot \sigma _1,l_1\approx r_1\vee C_1\cdot \sigma _1, R_1,L_1, p_1)$$ and $$I_2 {:}{=} (l_2\# r_2\cdot \sigma _2,l_2\# r_2\vee C_2\cdot \sigma _2, R_2, L_2, p_2)$$ be two variable disjoint rewrite steps where $$r_1\sigma _1\prec _T l_1\sigma _1$$, $$(l_2\# r_2)\sigma _2\vert _p = l_1\sigma _1$$ for some position p. We distinguish two cases:

1. 1.

if $$p\in {{\text {pos}}}(l_2\# r_2)$$ and $$\mu {:}{=} {\text {mgu}}((l_2\# r_2)\vert _p,l_1)$$ then $$(((l_2\# r_2)[r_1]_{p})\mu \cdot \sigma _1\sigma _2,$$

$$((l_2\# r_2)[r_1]_{p})\mu \vee C_1\mu \vee C_2\mu \cdot \sigma _1\sigma _2,I_1,I_2,p)$$ is the result of a rewrite inference.

2. 2.

if $$p\not \in {{\text {pos}}}(l_2\# r_2)$$ then let $$(l_2\# r_2)\delta$$ be the most general instance of $$l_2\# r_2$$ such that $$p\in {{\text {pos}}}((l_2\# r_2)\delta )$$, $$\delta$$ introduces only fresh variables and $$(l_2\# r_2)\delta \sigma _2\rho = (l_2\# r_2)\sigma _2$$ for some minimal $$\rho$$. Let $$\mu {:}{=} {\text {mgu}}((l_2\# r_2)\delta \vert _p,l_1)$$. Then

$$((l_2\# r_2)\delta [r_1]_{p}\mu \cdot \sigma _1\sigma _2\rho , (l_2\# r_2)\delta [r_1]_{p}\mu \vee C_1\mu \vee C_2\delta \mu \cdot \sigma _1\sigma _2\rho , I_1, I_2,p)$$ is the result of a rewrite inference.

Note that case 1 describes rewriting above or at a variable and case 2 describes rewriting inside a variable.

### Lemma 3

Let $$I_1 {:}{=} (l_1\approx r_1\cdot \sigma _1,l_1\approx r_1\vee C_1\cdot \sigma _1, R_1, L_1, p_1)$$ and $$I_2 {:}{=} (l_2\# r_2\cdot \sigma _2,l_2\# r_2\vee C_2\cdot \sigma _2, R_2, L_2, p_2)$$ be two variable disjoint rewrite steps where $$r_1\sigma _1\prec _T l_1\sigma _1$$, $$(l_2\# r_2)\sigma _2\vert _p = l_1\sigma _1$$ for some position p. Let $$I_3 {:}{=} (l_3\# r_3\cdot \sigma _3,l_3\# r_3\vee C_3\cdot \sigma _3, I_1, I_2, p)$$ be the result of a rewrite inference. Then:

1. 1.

$$C_3\sigma _3 = (C_1\vee C_2)\sigma _1\sigma _2$$ and $$l_3\# r_3\sigma _3 = (l_2\# r_2)\sigma _2[r_1\sigma _1]_p$$.

2. 2.

$$(l_3\# r_3)\sigma _3\prec _T (l_2\# r_2)\sigma _2$$

3. 3.

If $$N\models ( l_1\approx r_1\vee C_1) \wedge (l_2\# r_2\vee C_2)$$ for some set of clauses N, then $$N\models l_3\# r_3\vee C_3$$

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 $$conv(\Gamma )$$ until it is irreducible. A refutation for a literal L that is $$\beta \text {-} false$$ in $$\Gamma$$ for a given $$\beta$$, is a sequence of rewrite steps with literals in $$\Gamma ,L$$ such that $$\bot$$ 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 $$\Gamma$$ be a trail. A reduction chain $$\mathcal {P}$$ from $$\Gamma$$ is a sequence of rewrite steps $$[I_1,...,I_m]$$ such that for each $$I_i = (s_i\# t_i\cdot \sigma _i, s_i\# t_i\vee C_i\cdot \sigma _i, I_j, I_k, p_i)$$ either

1. 1.

$$s_i\# t_i^{n_i:s_i\# t_i\vee C_i\cdot \sigma }$$ is contained in $$\Gamma$$ and $$I_j = I_k = p_i = \epsilon$$ or

2. 2.

$$I_i$$ is the result of a rewriting inference from rewrite steps $$I_j, I_k$$ out of $$[I_1,...,I_m]$$ where $$j, k < i$$.

Let $$(l\,\#\, r)\delta ^{o:l\,\#\, r \vee C \cdot \delta }$$ be an annotated ground literal. A reduction chain application from $$\Gamma$$ to $$l\,\#\, r$$ is a reduction chain $$[I_1,...,I_m]$$ from $$\Gamma ,(l\,\#\, r)\delta ^{o:l\,\#\, r \vee C \cdot \delta }$$ such that $$l\delta {\downarrow _{{\text {conv}}(\Gamma )}} = s_m\sigma _m$$ and $$r\delta {\downarrow _{{\text {conv}}(\Gamma )}} = t_m\sigma _m$$. 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 $$\Gamma$$ be a trail and $$(l\,\#\, r)\delta ^{o:l\,\#\, r \vee C \cdot \delta }$$ an annotated ground literal that is $$\beta \text {-} false$$ in $$\Gamma$$ for a given $$\beta$$. A refutation $$\mathcal {P}$$ from $$\Gamma$$ and $$l\,\#\, r$$ is a reduction chain $$[I_1,...,I_m]$$ from $$\Gamma ,(l\,\#\, r)\delta ^{o:l\,\#\, r \vee C \cdot \delta }$$ such that $$(s_m\# t_m)\sigma _m = s \not \approx s$$ for some s. We assume refutations to be minimal, i.e., if any rewrite step $$I_k$$, $$k<m$$ 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 $$(\Gamma ; N; U; \beta ; k; D)$$ similar to the SCL calculus, where $$\Gamma$$ a sequence of annotated ground literals, N and U the sets of initial and learned clauses, $$\beta$$ is a ground term such that for all $$L\in \Gamma$$ it holds $$L\prec _T \beta$$, k is the decision level, and D a status that is $$\top$$, $$\bot$$ or a closure $$C\,\cdot \sigma$$. Before we propagate or decide any literal, we make sure that it is irreducible in the current trail. Together with the design of $$\prec _{\Gamma ^*}$$ this eventually enables rewriting as a simplification rule.

The rule Propagate finds a ground instance of a clause which is propagable, i.e. it contains (possibly multiple occurences of) a literal that is $$undefined$$ and all other literals are $$false$$ in the trail. The multiple occurences of the undefined literal are factored. Then it adds the normal form of this literal to the trail. The propagating clause is reduced by the corresponding paramodulation steps. Note that the definition of Propagate also includes the case where $$L\sigma$$ is irreducible by $$\Gamma$$. In this case $$L = s_m\# t_m$$ and $$m=1$$. The rule Decide below, is similar to Propagate, except for the subclause $$C_0$$ which must be $$\beta \text {-} undefined$$ or $$\beta \text {-} true$$ in $$\Gamma$$, i.e., Propagate cannot be applied and the decision literal is annotated by a tautology.

For the non-equational case, when a conflict clause is found by an SCL calculus [15, 21], 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 D to be $$\beta \text {-} false$$ with respect to $$\Gamma$$ is a rewrite proof with respect to $${\text {conv}}(\Gamma )$$. This proof needs to be analyzed to eventually perform paramodulation steps on D or to replace D by a $$\prec _{\Gamma ^*}$$ smaller $$\beta \text {-} false$$ clause showing up in the proof.

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.

For backtracking we have to make sure, that the learned clause is not $$false$$ in the resulting trail. It is not sufficient to backtrack to the point where the clause with the current substitution is no longer false, but where it is no longer false with all possible substitutions.

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.

### Lemma 4

Assume that all ground terms t with $$t\prec _T \beta$$ for any $$\beta$$ are polynomial in the size of $$\beta$$. Then testing Propagate (Conflict) is NP-Complete, i.e., the problem of checking for a given clause C whether there exists a grounding substitution $$\sigma$$ such that $$C\sigma$$ propagates (is false) is NP-Complete.

### Example 2

(SCL(EQ) vs. Superposition: Saturation) Consider the following clauses:

\begin{aligned} N {:}{=} \{C_1 {:}{=} c\approx d\vee D, C_2 {:}{=} a\approx b\vee c\not \approx d, C_3 {:}{=} f(a)\not \approx f(b)\vee g(c)\not \approx g(d)\}, \end{aligned}

where again we assume a KBO with all symbols having weight one, precedence $$d\prec c\prec b\prec a\prec g\prec f$$ and $$\beta {:}{=} f(f(g(a)))$$. Suppose that we first decide $$c\approx d$$ and then propagate $$a\approx b$$: $$\Gamma = [c\approx d^{1:c\approx d\vee c\not \approx d}, a\approx b^{1:C_2}]$$. Now we have a conflict with $$C_3$$. Explore-Refutation applied to the conflict clause $$C_3$$ results in a paramodulation inference between $$C_3$$ and $$C_2$$. Another application of Equality-Resolution gives us the new conflict clause $$C_4 {:}{=} c\not \approx d\vee g(c)\not \approx g(d)$$. Now we can Skip the last literal on the trail, which gives us $$\Gamma = [c\approx d^{1:c\approx d\vee c\not \approx d}]$$. Another application of the Explore-Refutation rule to $$C_4$$ using the decision justification clause followed by Equality-Resolution and Factorize gives us $$C_5 {:}{=} c\not \approx d$$. Thus with SCL(EQ) the following clauses remain:

\begin{aligned} \begin{array}{c} C'_1 = D \qquad C_5 = c\not \approx d\\ C_3 = f(a)\not \approx f(b)\vee g(c)\not \approx g(d)\\ \end{array} \end{aligned}

where we derived $$C'_1$$ out of $$C_1$$ by subsumption resolution [37] using $$C_5$$. 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 ($$N_i$$ is the clause set of the previous step and $$N_0$$ the initial clause set N).

\begin{aligned} \begin{array}{ll} N_0 &{}\Rightarrow _{Sup(C_2,C_3)}N_1\cup \{C_4 {:}{=} c\not \approx d\vee g(c)\not \approx g(d)\}\\ &{}\Rightarrow _{Sup(C_1,C_4)}N_2\cup \{C_5 {:}{=} c\not \approx d\vee D\} \Rightarrow _{Sup(C_1,C_5)}N_3\cup \{C_6 {:}{=} D\}\\ \end{array} \end{aligned}

Thus superposition ends up with the following clauses:

\begin{aligned} \begin{array}{ll} C_2 = a\approx b\vee c\not \approx d &{}\quad C_3 = f(a)\not \approx f(b)\vee g(c)\not \approx g(d)\\ C_4 = c\not \approx d\vee g(c)\not \approx g(d) &{}\quad C_6 = D\\ \end{array} \end{aligned}

The superposition calculus generates more and larger clauses.

### Example 3

(SCL(EQ) vs. Superposition: Refutation) Suppose the following set of clauses: $$N {:}{=} \{C_1 {:}{=} f(x)\not \approx a\vee f(x)\approx b, C_2 {:}{=} f(f(y))\approx y, C_3 {:}{=} a\not \approx b\}$$ where again we assume a KBO with all symbols having weight one, precedence $$b\prec a\prec f$$ and $$\beta {:}{=} f(f(f(a)))$$. A long refutation by the superposition calculus results in the following ($$N_i$$ is the clause set of the previous step and $$N_0$$ the initial clause set N):

\begin{aligned} \begin{array}{lll} N_0 &{} \Rightarrow _{Sup(C_1,C_2)} &{} N_1\cup \{C_4 {:}{=} y\not \approx a\vee f(f(y))\approx b\}\\ &{} \Rightarrow _{Sup(C_1,C_4)} &{} N_2\cup \{C_5 {:}{=} a\not \approx b\vee f(f(y))\approx b\vee y\not \approx a\}\\ &{} \Rightarrow _{Sup(C_2,C_5)} &{} N_3\cup \{C_6 {:}{=} a\not \approx b\vee b\approx y\vee y\not \approx a\}\\ &{} \Rightarrow _{Sup(C_2,C_4)} &{} N_4\cup \{C_7 {:}{=} y\approx b\vee y\not \approx a\}\\ &{} \Rightarrow _{EqRes(C_7)} &{} N_5\cup \{C_8 {:}{=} a\approx b\}\Rightarrow _{Sup(C_3,C_8)}N_6\cup \{\bot \}\\ \end{array} \end{aligned}

The shortest refutation by the superposition calculus is as follows:

\begin{aligned} \begin{array}{lll} N_0 &{} \Rightarrow _{Sup(C_1,C_2)} &{} N_1\cup \{C_4 {:}{=} y\not \approx a\vee f(f(y))\approx b\}\\ &{} \Rightarrow _{Sup(C_2,C_4)} &{} N_2\cup \{C_5 {:}{=} y\approx b\vee y\not \approx a\}\\ &{} \Rightarrow _{EqRes(C_5)} &{} N_3\cup \{C_6 {:}{=} a\approx b\} \Rightarrow _{Sup(C_3,C_6)}N_4\cup \{\bot \}\\ \end{array} \end{aligned}

In SCL(EQ) on the other hand we would always first propagate $$a\not \approx b,f(f(a))\approx a$$ and $$f(f(b))\approx b$$. As soon as $$a\not \approx b$$ and $$f(f(a))\approx a$$ are propagated we have a conflict with $$C_1\{x\rightarrow f(a)\}$$. So suppose in the worst case we propagate:

\begin{aligned} \Gamma {:}{=} [a\not \approx b^{0:a\not \approx b} f(f(b))\approx b^{0:(f(f(y))\approx y)\{y\rightarrow b\}} f(f(a))\approx a^{0:(f(f(y))\approx y)\{y\rightarrow a\}}] \end{aligned}

Now we have a conflict with $$C_1\{x\rightarrow f(a)\}$$. Since there is no decision literal on the trail, $$Conflict$$ rule immediately returns $$\bot$$ and we are done.

## 4 Soundness and Completeness

In this section we show soundness and refutational completeness of SCL(EQ) under the assumption of a regular run. We provide the definition of a regular run and show that for a regular run all learned clauses are non-redundant according to our trail induced ordering. We start with the definition of a sound state.

### Definition 13

A state $$(\Gamma ; N; U; \beta ; k; D)$$ is sound if the following conditions hold:

1. 1

$$\Gamma$$ is a consistent sequence of annotated literals,

2. 2

for each decomposition $$\Gamma = \Gamma _1, L\sigma ^{i:(C \vee L)\cdot \sigma }, \Gamma _2$$ where $$L\sigma$$ is a propagated literal, we have that $$C\sigma$$ is $$\beta \text {-} false$$ in $$\Gamma _1$$, $$L\sigma$$ is $$\beta \text {-} undefined$$ in $$\Gamma _1$$ and irreducible by $$conv(\Gamma _1)$$, $$N\cup U \models (C \vee L)$$ and $$(C \vee L) \sigma \prec _T \beta$$,

3. 3

for each decomposition $$\Gamma = \Gamma _1, L\sigma ^{i:(L\vee comp(L))\cdot \sigma }, \Gamma _2$$ where $$L\sigma$$ is a decision literal, we have that $$L\sigma$$ is $$\beta \text {-} undefined$$ in $$\Gamma _1$$ and irreducible by $$conv(\Gamma _1)$$, $$N\cup U \models (L\vee comp(L))$$ and $$(L \vee comp(L))\sigma \prec _T \beta$$,

4. 4

$$N \models U$$,

5. 5

if $$D = C\cdot \sigma$$, then $$C\sigma$$ is $$\beta \text {-} false$$ in $$\Gamma$$, $$N \cup U\models C$$

### Lemma 5

The initial state $$(\epsilon ; N; \emptyset ; \beta ; 0; \top )$$ is sound.

### Definition 14

A run is a sequence of applications of SCL(EQ) rules starting from the initial state.

### Theorem 1

Assume a state $$(\Gamma ;N;U;\beta ;k;D)$$ resulting from a run. Then $$(\Gamma ;N;U;\beta ;k;D)$$ is sound.

Next, we give the definition of a regular run. Intuitively speaking, in a regular run we are always allowed to do decisions except if

1. 1.

a literal can be propagated before the first decision and

2. 2.

the negation of a literal can be propagated.

To ensure non-redundant learning we enforce at least one application of Skip during conflict resolution except for the special case of a conflict after a decision.

### Definition 15

(Regular Run) A run is called regular if

1. 1.

the rules $$Conflict$$ and $$Factorize$$ have precedence over all other rules,

2. 2.

If $$k=0$$ in a state $$(\Gamma ; N;U;\beta ;k;D)$$, then $$Propagate$$ has precedence over $$Decide$$,

3. 3.

If an annotated literal $$L^{k:C\cdot \sigma }$$ could be added by an application of Propagate on $$\Gamma$$ in a state $$(\Gamma ; N;U;\beta ;k;D)$$ and $$C\in N\cup U$$, then the annotated literal $$comp(L)^{k+1:C'\cdot \sigma '}$$ is not added by Decide on $$\Gamma$$,

4. 4.

during conflict resolution $$Skip$$ is applied at least once, except if $$Conflict$$ is applied immediately after an application of $$Decide$$.

5. 5.

if $$Conflict$$ is applied immediately after an application of $$Decide$$, then Backtrack is only applied in a state $$(\Gamma ,L'; N;U;\beta ;k;D\cdot \sigma )$$ if $$L\sigma = comp(L')$$ for some $$L\in D$$.

Now we show that any learned clause in a regular run is non-redundant according to our trail induced ordering.

### Lemma 6

(Non-Redundant Clause Learning) Let N be a clause set. The clauses learned during a regular run in SCL(EQ) are not redundant with respect to $$\prec _{\Gamma ^*}$$ and $$N \cup U$$. For the trail only non-redundant clauses need to be considered.

The proof of Lemma 6 is based on the fact that conflict resolution eventually produces a clause smaller then the original conflict clause with respect to $$\prec _{\Gamma ^*}$$. All simplifications, e.g., contextual rewriting, as defined in [2, 24, 37, 38, 40, 41], are therefore compatible with Lemma 6 and may be applied to the newly learned clause as long as they respect the induced trail ordering. In detail, let $$\Gamma$$ be the trail before the application of rule Backtrack. The newly learned clause can be simplified according to the induced trail ordering $$\prec _{\Gamma ^*}$$ as long as the simplified clause is smaller with respect to $$\prec _{\Gamma ^*}$$.

Another important consequence of Lemma 6 is that newly learned clauses need not to be considered for redundancy. Furthermore, the SCL(EQ) calculus always terminates, Lemma 11, because there only finitely many non-redundant clauses with respect to a fixed $$\beta$$.

For dynamic redundancy, we have to consider the fact that the induced trail ordering changes. At this level, only redundancy criteria and simplifications that are compatible with all induced trail orderings may be applied. Due to the construction of the induced trail ordering, it is compatible with $$\prec _T$$ for unit clauses.

### Lemma 7

(Unit Rewriting) Assume a state $$(\Gamma ;N;U;\beta ;k;D)$$ resulting from a regular run where the current level $$k>0$$ and a unit clause $$l\approx r\in N$$. Now assume a clause $$C\vee L[l']_p \in N$$ such that $$l' = l\mu$$ for some matcher $$\mu$$. Now assume some arbitrary grounding substitutions $$\sigma '$$ for $$C\vee L[l']_p$$, $$\sigma$$ for $$l\approx r$$ such that $$l\sigma =l'\sigma '$$ and $$r\sigma \prec _T l\sigma$$. Then $$(C\vee L[r\mu \sigma \sigma ']_p)\sigma '\prec _{\Gamma ^*} (C\vee L[l']_p)\sigma '$$.

In addition, any notion that is based on a literal subset relationship is also compatible with ordering changes. The standard example is subsumption.

### Lemma 8

Let CD be two clauses. If there exists a substitution $$\sigma$$ such that $$C\sigma \subset D$$, then D is redundant with respect to C and any $$\prec _{\Gamma ^*}$$.

The notion of redundancy, Definition 1, only supports a strict subset relation for Lemma 8, similar to the superposition calculus. However, the newly generated clauses of SCL(EQ) are the result of paramodulation inferences [32]. In a recent contribution to dynamic, abstract redundancy [36] it is shown that also the non-strict subset relation in Lemma 8, i.e., $$C\sigma \subseteq D$$, preserves completeness.

If all stuck states, see below Definition 16, with respect to a fixed $$\beta$$ are visited before increasing $$\beta$$ then this provides a simple dynamic fairness strategy.

When unit reduction or any other form of supported rewriting is applied to clauses smaller than the current $$\beta$$, it can be applied independently from the current trail. If, however, unit reduction is applied to clauses larger than the current $$\beta$$ then the calculus must do a restart to its initial state, in particular the trail must be emptied, as for otherwise rewriting may result generating a conflict that did not exist with respect to the current trail before the rewriting. This is analogous to a restart in CDCL once a propositional unit clause is derived and used for simplification. More formally, we add the following new Restart rule to the calculus to reset the trail to its initial state after a unit reduction.

Next we show refutation completeness of SCL(EQ). To achieve this we first give a definition of a stuck state. Then we show that stuck states only occur if all ground literals $$L\prec _T\beta$$ are $$\beta \text {-} defined$$ in $$\Gamma$$ and not during conflict resolution. Finally we show that conflict resolution will always result in an application of Backtrack. This allows us to show termination (without application of Grow) and refutational completeness.

### Definition 16

(Stuck State) A state $$(\Gamma ;N;U;\beta ;k;D)$$ is called stuck if $$D\ne \bot$$ and none of the rules of the calculus, except for Grow, is applicable.

### Lemma 9

(Form of Stuck States) If a regular run (without rule Grow) ends in a stuck state $$(\Gamma ;N;U;\beta ;k;D)$$, then $$D=\top$$ and all ground literals $$L\sigma \prec _T \beta$$, where $$L\vee C\in (N\cup U)$$ are $$\beta \text {-} defined$$ in $$\Gamma$$.

### Lemma 10

Suppose there is a sound state $$(\Gamma ; N;U;\beta ;k; D)$$ resulting from a regular run where $$D\not \in \{\top ,\bot \}$$. If Backtrack is not applicable then any set of applications of $$Explore\text {-}Refutation$$, Skip, $$Factorize$$, $$Equality\text {-}Resolution$$ will finally result in a sound state $$(\Gamma '; N;U;\beta ;k;D')$$, where $$D' \prec _{\Gamma ^*} D$$. Then Backtrack will be finally applicable.

### Corollary 1

(Satisfiable Clause Sets) Let N be a satisfiable clause set. Then any regular run without rule Grow will end in a stuck state, for any $$\beta$$.

Thus a stuck state can be seen as an indication for a satisfiable clause set. Of course, it remains to be investigated whether the clause set is actually satisfiable. Superposition is one of the strongest approaches to detect satisfiability and constitutes a decision procedure for many decidable first-order fragments [3, 23]. Now given a stuck state and some specific ordering such as KBO, LPO, or some polynomial ordering [20], it is decidable whether the ordering can be instantiated from a stuck state such that $$\Gamma$$ coincides with the superposition model operator on the ground terms smaller than $$\beta$$. In this case it can be effectively checked whether the clauses derived so far are actually saturated by the superposition calculus with respect to this specific ordering. In this sense, SCL(EQ) has the same power to decide satisfiability of first-order clause sets as superposition.

### Definition 17

A regular run terminates in a state $$(\Gamma ; N;U;\beta ;k; D)$$ if $$D=\top$$ and no rule is applicable, or $$D = \bot$$.

### Lemma 11

Let N be a set of clauses and $$\beta$$ be a ground term. Then any regular run that never uses Grow terminates.

### Lemma 12

If a regular run reaches the state $$(\Gamma ;N;U;\beta ;k;\bot )$$ then N is unsatisfiable.

### Theorem 2

(Refutational Completeness) Let N be an unsatisfiable clause set, and $$\prec _T$$ a desired term ordering. For any ground term $$\beta$$ where $$gnd_{\prec _T\beta }(N)$$ is unsatisfiable, any regular $${\text {SCL(EQ)}}$$ run without rule Grow will terminate by deriving $$\bot$$.

## 5 Discussion

We presented SCL(EQ), a new sound and complete calculus for reasoning in first-order logic with equality. We will now discuss some of its aspects and present ideas for future work beyond the scope of this paper.

The SCL(EQ) calculus can be viewed as a generalization of the first-order without equality SCL calculus [17], where syntactic equality with respect to trail literals is replaced with equality modulo the presented equational theory. If standard first-order literals like R(xy) are represented by equations like $$f_R(x,y)\approx \texttt {true}$$ then performing SCL(EQ) on the latter simplifies to classical SCL reasoning on the first-order literals with a slightly different strategy.

The trail induced ordering, Definition 8, is the result of letting the calculus follow the logical structure of the clause set on the literal level and at the same time supporting rewriting at the term level. It can already be seen by examples on ground clauses over (in)equations over constants that this combination requires a layered approach as suggested by Definition 8, see Example 4.

### Example 4

(Propagate Smaller Equation) Assume a term ordering $$\prec _{kbo}$$, unique weight 1 and with precedence $$d\prec c\prec b\prec a$$. Further assume $$\beta$$ to be large enough. Assume the ground clause set N solely built out of constants

\begin{aligned} \begin{array}{c} C_1 {:}{=} c\approx d \qquad C_2 {:}{=} c\not \approx d \vee a\approx b\\ C_3 {:}{=} a\not \approx b \vee a \approx c\\ \end{array} \end{aligned}

and the trail $$\Gamma {:}{=} [c\approx d^{0:C_1}, a\approx b^{0:C_2}, b\approx d^{0:C_3}]$$. Now, although the first two steps propagated equations that are strictly maximal in the ordering in their respective clauses, the finally propagated equation $$b\approx d$$ is smaller in the term ordering $$\prec _{kbo}$$ than $$a\approx b$$. Thus the structure of the clause set forces propagation of a smaller equation in the term ordering. So the more complicated trail ordering is a result of following the structure of the clause set rather than employing an a priori fixed ordering.

In case the calculus runs into a stuck state, i.e., the current trail is a model for the set of considered ground instances, then the trail information can be effectively used for a guided continuation. For example, in order to use the trail to certify a model, the trail literals can be used to guide the design of a lifted ordering for the clauses with variables such that propagated trail literals are maximal in respective clauses. Then it could be checked by superposition, if the current clause is saturated by such an ordering. If this is not the case, then there must be a superposition inference larger than the current $$\beta$$, thus giving a hint on how to extend $$\beta$$. Another possibility is to try to extend the finite set of ground terms considered in a stuck state to the infinite set of all ground terms by building extended equivalence classes following patterns that ensure decidability of clause testing, similar to the ideas in [15]. If this fails, then again this information can be used to find an appropriate extension term $$\beta$$ for rule Grow.

In contrast to superposition, SCL(EQ) does also inferences below variable level. In general, single superposition inferences below variables are redundant [2]. Inferences in SCL(EQ) are guided by a false clause with respect to a partial model assumption represented by the trail. They are typically not single superposition steps, but a sequence of superposition inferences eventually resulting in a non-redundant clause changing the partial model assumption. Therefore, compared to the syntactic style of superposition-based theorem proving, in SCL(EQ) reasoning below variables does not result in an explosion in the number of possibly inferred clauses but also rather in the derivation of more general clauses, see Example 5.

### Example 5

(Rewriting below variable level) Assume a term ordering $$\prec _{kbo}$$, unique weight 1 and with precedence $$d\prec c\prec b\prec a \prec g \prec h \prec f$$. Further assume $$\beta$$ to be large enough. Assume the clause set N:

\begin{aligned} \begin{array}{c} C_1 {:}{=} f(x)\approx h(b)\vee x\not \approx g(a) \qquad C_2 {:}{=} c\approx d \vee f(g(b))\not \approx h(b)\\ C_3 {:}{=} a\approx b \vee f(g(b)) \approx h(b)\\ \end{array} \end{aligned}

Let $$\sigma =\{x\rightarrow g(a)\}$$ be a substitution. $$C_1\sigma$$ must be propagated: $$\Gamma = [f(g(a))\approx h(b)^{0:C_1\sigma }]$$. Now suppose that we decide $$f(g(b))\not \approx h(b)$$. Then $$\Gamma = [f(g(a))\approx h(b)^{0:C_1\sigma },f(g(b))\not \approx h(b)^{1:f(g(b))\not \approx h(b)\vee f(g(b))\approx h(b)}]$$ and $$C_3$$ is a conflict clause. Explore-Refutation now creates the following refutation for $$a\approx b$$:

\begin{aligned} \begin{array}{ll} I_1 {:}{=} &{} (f(x)\approx h(b)\cdot \sigma , C_1\cdot \sigma ,\epsilon ,\epsilon ,\epsilon )\\ I_2 {:}{=} &{} (f(g(b))\not \approx h(b), C_2,\epsilon ,\epsilon ,\epsilon )\\ I_3 {:}{=} &{} (a\approx b, C_3,\epsilon ,\epsilon ,\epsilon )\\ I_4 {:}{=} &{} (f(g(b))\approx h(b),f(g(b))\approx h(b)\vee g(a)\not \approx g(a) \vee f(g(b)) \approx h(b),I_3,I_1,\epsilon )\\ I_5 {:}{=} &{} (h(b)\not \approx h(b),h(b)\not \approx h(b)\vee g(a)\not \approx g(a) \vee f(g(b)) \approx h(b)\\ &{} \vee f(g(b)) \approx h(b), I_4,I_2,\epsilon ) \end{array} \end{aligned}

Multiple applications of Equality-Resolution and Factorize result in the final conflict clause $$C_4 {:}{=} f(g(b)) \approx h(b)$$ with which we can backtrack. The clause set resulting from this new clause is:

\begin{aligned} \begin{array}{l} C_1 = f(x)\approx h(b)\vee x\not \approx g(a) \qquad C'_2 = c\approx d\\ C_4 = f(g(b))\approx h(b)\\ \end{array} \end{aligned}

where $$C'_2$$ is the result of a unit reduction between $$C_4$$ and $$C_2$$. Note that the refutation required rewriting below variable level in step $$I_4$$. Superposition would create the following clauses (Equality-Resolution and Factorization steps are implicitly done):

\begin{aligned} \begin{array}{ll} N &{} \Rightarrow _{Sup(C_2,C_3)} N_1\cup \{C_4 {:}{=} c\approx d \vee a\approx b\}\\ &{} \Rightarrow _{Sup(C_1,C_2)} N_2\cup \{C_5 {:}{=} c\approx d\vee g(a)\not \approx g(b)\}\\ &{} \Rightarrow _{Sup(C_4,C_5)} N_3\cup \{C_6 {:}{=} c\approx d\}\\ \end{array} \end{aligned}

For superposition the resulting clause set is thus:

\begin{aligned} \begin{array}{l} C_1 = f(x)\approx h(b)\vee x\not \approx g(a) \qquad C_2 = a\approx b\vee f(g(b))\approx h(b)\\ C_6 = c\approx d\\ \end{array} \end{aligned}

Currently, the reasoning with solely positive equations is done on and with respect to the trail. It is well-known that also inferences from this type of reasoning can be used to speed up the overall reasoning process. The SCL(EQ) calculus already provides all information for such a type of reasoning, because it computes the justification clauses for trail reasoning via rewriting inferences. By an assessment of the quality of these clauses, e.g., their reduction potential with respect to trail literals, they could also be added, independently from resolving a conflict.

The trail reasoning is currently defined with respect to rewriting. It could also be performed by congruence closure [29]. However, we still need a ground term rewrite system to propagate literals. A possible solution to this is an algorithm by Gallier et al. [22] which creates a ground rewrite system out of the congruence classes in polynomial time.

Bromberger et al. [16] showed how to lift the two-watched literal scheme to SCL. We could make use of this in an implementation as well. In general, an implementation of SCL(EQ) requires both the infrastructure of a superpositon-based prover and an CDCL/SMT solver. The aspect of how to find interesting ground decision or propagation literals for the trail including the respective grounding substituion $$\sigma$$ can be treated similar to CDCL [11, 12, 28, 33]. A simple heuristic may be used from the start, like counting the number of instance relationships of some ground literal with respect to the clause set, but later on a bonus system can focus the search towards the structure of the clause sets. Ground literals involved in a conflict or the process of learning a new clause get a bonus or preference. However, since the number of ground literals is not fixed from the beginning with growing $$\beta$$, all these operations need to be done via hashing or indexing operations modulo matching/unification in contrast to simple look-ups in the CDCL case. The regular strategy requires the propagation of all ground unit clauses smaller than $$\beta$$. For an implementation a propagation of the (explicit and implicit) unit clauses with variables to the trail will be a better choice. This complicates the implementation of refutation proofs and rewriting (congruence closure), but because every reasoning is layered by a ground term $$\beta$$ this can still be efficiently done.