A Two-Watched Literal Scheme for First-Order Logic Martin Bromberger1 , Tobias Gehl1 , Lorenz Leutgeb1,2 and Christoph Weidenbach1 1 Max Planck Institute for Informatics, Saarland Informatics Campus, Saarbrücken, Germany 2 Graduate School of Computer Science, Saarland Informatics Campus, Saarbrücken, Germany Abstract The two-watched literal scheme for propositional logic is a core component of any efficient CDCL (Conflict Driven Clause Learning) implementation. The family of SCL (Clause Learning from Simple Models) calculi also learns clauses with respect to a partial model assumption built by decisions and propagations similar to CDCL. We show that the well-known two-watched literal scheme can be lifted to SCL for first-order logic. Keywords CDCL, SCL, two-watched literal scheme, first-order logic 1. Introduction The two-watched literal scheme is an indispensable part of any CDCL SAT solver implementation [1, 2]. CDCL SAT solvers build an explicit partial model assumption, called a trail, and check whether clauses with respect to this model assumption propagate or whether they are falsified. Propagation here means the clause is false except for one undefined literal. This literal needs then to be propagated in order to satisfy the clause. For example, with respect to the partial model assumption [Q] the clause P ∨ ¬Q ∨ R is neither false nor does it propagate. With respect to propagation and falsification, there is no need to do any update on the status of a clause, as long as it has two undefined literals or it is true in the current model assumption. This leads to the two-watched literal scheme. In any clause two literals are watched, e.g., we can watch P and R in the above clause represented by the triple (P ∨ ¬Q ∨ R; P ; R). Then only the watched literals are indexed with respect to the trail, i.e., for a trail [Q] the above clause is not visited because ¬Q is not watched in the clause. The first benefit of the two-watched literal scheme is that the clause only needs to be considered on trail extensions if a watched literal is concerned. For a trail [¬P ] the above clause is visited, P is false with respect to the trail [¬P ] and the watched literals are updated resulting in (P ∨ ¬Q ∨ R; ¬Q; R). Now PAAR’22: 8th Workshop on Practical Aspects of Automated Reasoning, August 11–12, 2022, Haifa, Israel email: mbromber@mpi-inf.mpg.de (M. Bromberger); tgehl@mpi-inf.mpg.de (T. Gehl); lorenz@mpi-inf.mpg.de (L. Leutgeb); weidenb@mpi-inf.mpg.de (C. Weidenbach) orcid: 0000-0001-7256-2190 (M. Bromberger); 0000-0003-0391-3430 (L. Leutgeb); 0000-0001-6002-0458 (C. Weidenbach) © 2022 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings http://ceur-ws.org ISSN 1613-0073 CEUR Workshop Proceedings (CEUR-WS.org) if the trail is extended to [¬P Q] the clause will be visited again and it will be detected that it propagates R. The general invariant kept by the watched literal scheme for a clause with respect to a trail is: either one of the watched literals is true or if there is a watched false literal then there are no literals in the clause that are true or undefined and not watched. The second benefit is that the two-watched literal scheme invariant is invariant with respect to a shrinking trail, because this just turns true/false literals into undefined literals. In this paper we lift the propositional two-watched literal scheme to first-order logic without equality. Our trail consists of ground first-order literals and clauses are full first- order clauses containing implicitly universally quantified variables. Again we want to detect propagating and false clauses by the two-watched literal scheme by only considering the watched literals for trail extensions. For first-order logic the two-watched literals scheme gets more sophisticated because of variable instantiation. The first extension concerns universally quantified variables. Variable instantiation may result in merging literals and different clauses may produce identical instances by variable instantiation. For example, the first-order clause R(x, y) ∨ R(a, z) ∨ R(u, b) where a, b are constants and x, y, z, u are variables represents already the propagating ground instance R(a, b). Therefore, our two-watched literal scheme contains the rule FactorizeWatched for considering common instances of watched literals and assumes that all starting units, including units built by instantiation are performed right from the start. Furthermore, updates on the trail induce further instances of clauses, in general, represented by the rule CreateInstance. The second extension addresses potentially infinite trails. Consider the trail [P (a)] and the clause ¬P (x) ∨ P (g(x)). Already this clause produces an infinite trail if propagation is done exhaustively [P (a), P (g(a)), P (g(g(a))), . . . ]. Even in a first-order setting without non-constant function symbols, the trail may grow exponentially with respect to the maximal arity of a predicate symbol. Thus exhaustive propagation cannot be afforded in first-order logic, in general. On the other hand any CDCL style calculus typically breaks if a decided (guessed) literal immediately results in a false clause, a conflict. Our solution to this is a one step propagation look-ahead, represented by the rule DetectPropLiteral and by separating the trail from a set of potentially propagating literals. This way our two-watched literal scheme serves the SCL family of calculi considering a first-order language [3, 4]. The paper is organized as follows: after a section on preliminaries, Section 2, we present the TWFO calculus and prove that it detects all conflicts and propagations, Section 3. Then we present some intuitive example runs of TWFO, Section 4. Next we show in Section 5 that TWFO finds all conflicts and propagations with a minimal amount of overhead: it only needs to check a clause instance for propagations and conflicts if the clause instance was recently derived or if an instance of one of its watched literals was assigned to false. Following this, we show how the interaction between the TWFO calculus and the SCL calculus works in detail. The paper ends with a discussion of the obtained results and directions for future work, Section 7. 2. Preliminaries We assume a first-order language without equality where N denotes a clause set; C, D denote clauses; L, K, H denote literals; A, B denote atoms; P, Q, R denote predicates; t, s terms; f, g, h function symbols; a, b, c constants; and x, y, z variables. Atoms, literals, clauses and clause sets are considered as usual, where in particular clauses are identified both with their disjunction and multiset of literals. The complement of a literal is denoted by the function comp. Semantic entailment |= is defined as usual where variables in clauses are assumed to be universally quantified. Substitutions σ, τ are total mappings from variables to terms, where dom(σ) := {x | xσ 6= x} is finite and codom(σ) := {t | xσ = t, x ∈ dom(σ)}. Their application is extended to literals, clauses, and sets of such objects in the usual way. A term, atom, clause, or a set of these objects is ground if it does not contain any variable. A substitution σ is ground if codom(σ) is ground. A substitution σ is grounding for a term t, literal L, clause C if tσ, Lσ, Cσ is ground, respectively. A substitution σ is the minimally grounding substitution for a term/atom/literal/clause Z if Zσ is ground and there exist no substitutions τ and ρ such that τ ρ = σ and Zτ is ground. The function mgu denotes the most general unifier of two terms, atoms, literals. We assume that any mgu of two terms or literals does not introduce any fresh variables and is idempotent. The function vars(Z) returns the set of variables in a term/atom/literal/clause/clause set Z. Let ≺B denote a well-founded, total, strict ordering on ground literals such that for any ground literal L there are only finitely many ground literals K with K ≺B L. For example, a Knuth-Bendix ordering has this property [5]. Let L be a ground literal L and let K be a non-ground literal. Then we write K ≺B L in order to denote that there exists a grounding τ for K such that Kτ ≺B L and C ≺B L in order to denote that there exists a grounding τ for C such that Kστ ≺B L for all K ∈ C. 3. The Two-Watched Literal Calculus for First-Order Clauses The Two-Watched Literal Calculus for First-Order Clauses (TWFO) calculus is a lazy two- watched literals scheme for first-order logic without equality. Its purpose is to efficiently detect propagations and all immediate conflicts with respect to a ground partial model M and a set of first-order clauses without equality N . The calculus works on a tuple (M ; β; O; F ; D) called a state where M is a sequence of ground literals called a trail, β is the limit of the state, i.e., a ground literal limiting the considered ground literals and clause instances, O is a set of triples (C; L1 ; L2 ) where C is a first-order clause and L1 and L2 are the two literals that are watched in C, F is a set of annotated literals LC;K that can be propagated with the clause instance C, and D is the conflict clause or >. Annotations for literals in F mark the leftmost literal in the trail such that the respective clause propagates and > if the literal is propagated by a (implicit after factoring) unit clause. Annotations are only explicitly written where they are needed or changed. The literals on the trail M are annotated either with a positive natural number or with a clause instance. These annotations are just the standard annotations used in CDCL [1, 2, 6] and SCL [3, 4]. So a literal annotated with a positive natural number k means that this literal is a decision literal of level k and a literal annotated with a clause instance Cσ means that this literal is a propagated literal and that the clause instance Cσ propagates that literal. A literal L is called assigned with respect to a sequence M of ground literals, if either L ∈ M or comp(L) ∈ M , i.e., it is either true or false, otherwise it is called unassigned. A ground clause {L1 , . . . , Ln } is called assigned with respect to a sequence M of ground literals, if either {L1 , . . . , Ln } ∩ M 6= ∅ or {comp(L1 ), . . . , comp(Ln )} ⊆ M , i.e., it is either true or false, otherwise it is called unassigned. A clause C can propagate the literal L with respect to a trail M if C = C 0 ∨ L ∨ . . . ∨ L and L is unassigned with respect to M and M |= ¬C 0 . In the following the watched literals L1 and L2 are considered interchangeably. A literal Lj σ is fresh out of (C; L1 ; L2 ) if Lj σ ∈ Cσ, Lj σ 6= L1 σ, Lj σ 6= L2 σ. TWFO is called lazy because: (i) TWFO does not check literals for all its instances, i.e., a literal with variables may be watched although all its instances are false. (ii) TWFO does not propagate all propagatable literals it detects but only stores them in the set of detected propagations F ; this is useful for first-order logic because there are infinitely many ground instances per predicate. For a finite set of clauses N , also called the initial clauses, the start state for TWFO is (; β; O; F ; >) where (i) we choose the starting limit β such that C ≺B β for all clauses C ∈ N , (ii) the starting set O consists of exactly one instance (C; L1 ; L2 ) for all starting clauses C ∈ N such that L1 ∈ C and L2 ∈ C and L1 6= L2 if possible, and (iii) the starting set F consists of all literals LC,> we can propagate from starting units C in N , including units Cσ = L ∨ · · · ∨ L (where Cσ ≺B β) that we can build by factoring a clause C ∈ N , e.g., if N contains the clause P (x) ∨ P (a), then P (x) ∨ P (a) can be factored to P (a) ∨ P (a) so the starting F must contain the literal P (a) . Note that we only allow non-empty clauses in N . The rules of the calculus are as follows: CreateInstance (M ; β; O ] {(C; L1 ; L2 )}; F ; >) ⇒TWFO (M ; β; O ∪ {(C; L1 ; L2 ), (Cσ; Lj σ; Lk σ)}; F ; >) provided comp(L1 σ) ∈ M for some minimal grounding substitution σ, Cσ ≺B β, Lj σ ∈ Cσ, if possible Lj σ ∈ M otherwise if possible Lj σ unassigned otherwise M = M10 comp(Lj σ)M100 and for all literals Lσ ∈ Cσ holds comp(Lσ) 6∈ M100 , if comp(L2 σ) 6∈ M then Lk = L2 else Lk σ ∈ Cσ and if possible Lk σ 6= Lj σ and if possible Lk σ ∈ M otherwise if possible Lk σ unassigned otherwise M = M20 comp(Lk σ)M200 and for all literals Lσ ∈ Cσ \ {Lj σ} holds comp(Lσ) 6∈ M200 , there exists no K1 σ, K2 σ ∈ Cσ such that (Cσ; K1 σ; K2 σ) ∈ O. CreateInstance creates an instance as long as a watched literal gets false by instantiation and the created instance is new. UpdateWatched (M ; β; O ] {(C; L1 ; L2 )}; F ; >) ⇒TWFO (M ; β; O ∪ {(C; Lj ; L2 )}; F ; >) provided comp(L1 ) ∈ M , L2 6∈ M , fresh Lj ∈ C where Lj ∈ M or if no such Lj exists Lj is unassigned. UpdateWatched exchanges a false watched literal as long as the other watched is not true. It is replaced by a true or if such a literal does not exist, an unassigned literal. FactorizeWatched (M ; β; O ] {(C; L1 ; L2 )}; F ; >) ⇒TWFO (M ; β; O0 ∪ {(C; L1 ; L2 ), (Cσ; Lj σ; Lk σ)}; F ; >) provided L1 σ = L2 σ for mgu σ, Cσ ≺B β, fresh Lj σ ∈ Cσ, if possible Lj σ ∈ M otherwise if possible Lj σ unassigned otherwise M = M10 comp(Lj σ)M100 and for all literals Lσ ∈ Cσ holds comp(Lσ) 6∈ M100 , if comp(L2 σ) 6∈ M then Lk = L2 else Lk σ ∈ Cσ and if possible Lk σ 6= Lj σ and if possible Lk σ ∈ M otherwise if possible Lk σ unassigned otherwise M = M20 comp(Lk σ)M200 and for all literals Lσ ∈ Cσ \ {Lj σ} holds comp(Lσ) 6∈ M200 , there exists no K1 σ, K2 σ ∈ Cσ such that (Cσ; K1 σ; K2 σ) ∈ O. DetectPropLiteral (M ; β; O]{(C; L1 ; L2 )}; F ; >) ⇒TWFO (M ; β; O∪{(C; L1 ; L2 )}; F ∪ {L2C;K }; >) provided comp(L1 ) ∈ M , C = C0 ∨ L2 ∨ . . . ∨ L2 , L2 unassigned, M |= ¬C0 , M = M 0 KM 00 and comp(K) ∈ C, and for all L ∈ C holds comp(L) 6∈ M 00 , 0 there is no H D;K ∈ F such that Hτ = L2 for some τ with Dτ ≺B β and K 0 ∈ M 0 K. So DetectPropLiteral factorizes implicitely on the unassigned literal and propagates as long as the literal is not known to be propagating. Note that we annotate the literal that we propagate with the last literal on the trail that falsifies a literal in the clause. As we will see below in a reasonable strategy this will be the last literal on the trail, that equals comp(L1 ), except directly after backtracking. Also only in a reasonable strategy the condition that L2 is assigned can only occur directly after backtracking, because DetectPropLiteral is complete for a reasonable strategy, as we will see. Conflict (M ; β; O ] {(C; L1 ; L2 )}; F ; >) ⇒TWFO (M ; β; O ∪ {(C; L1 ; L2 )}; F ; C) provided comp(L1 ) ∈ M and comp(L2 ) ∈ M , M |= ¬C. C C ConflictF (M ; β; O; F ] {L1 1 , L2 2 }; >) ⇒TWFO (M L1 σ C1 σ ; β; O; C1 C2 F ∪ {L1 , L2 }; C2 σ) there is a grounding unifier σ such that L1 σ = comp(L2 σ), L1 σ 6∈ M , L2 σ 6∈ M , C1 σ ≺B β and C2 σ ≺B β Note that in the ConflictF rule we do not need the prerequisites that comp(L1 σ) 6∈ M and comp(L2 σ) 6∈ M hold because comp(L1 σ) = L2 σ 6∈ M and comp(L2 σ) = L1 σ 6∈ M hold. DecLiteral(Lk ) (M ; β; O; F ; >) ⇒TWFO (M Lk ; β; O; F ; >) provided L ground and not defined in M , there is no L0 ∈ F and grounding substitution σ such that comp(L) = L0 σ and Lσ ≺B β PropLiteral(Lσ Cσ ) (M ; β; O; F ; >) ⇒TWFO (M Lσ Cσ ; β; O; F ; >) provided Lσ ground and not defined in M , there is a literal LC ∈ F , Cσ ≺B β RemoveLiteral (M L; β; O; F ; D) ⇒TWFO (M ; β; O; F 0 ; D) provided F 0 ⊆ F , for all L0C;K ∈ F 0 holds that L 6= K, for all L0C;K ∈ F \ F 0 holds that L = K, D 6= > The clause D is the original conflict clause and the clause C in the rule Backtrack(C) below is the clause that we get from resolution in the SCL(T) calculus and learn as a new clause. The learned clause C in Backtrack(C) is a new clause and not an instance of an already existing clause, as we know from the SCL(T) calculus, and is therefore not already in O. Backtrack(C) (M ; β; O; F ; D) ⇒TWFO (M ; β; O0 ∪ {(C; L1 ; L2 )}; F 0 ; >) provided D 6= >, there is a grounding σ such that Cσ can propagate L1 σ, Cσ ≺B β there is no τ and M = M 0 M 00 where M 00 is non-empty such that Cτ can propagate with respect to M 0 , Cτ ≺B β L1 , L2 ∈ C, L1 6= L2 if C contains different literals, L1 unassigned, if possible L2 unassigned otherwise M = M 0 comp(L2 )M 00 and for all literals L ∈ C holds comp(L) 6∈ M 00 , if there is a minimal substitution τ with Cτ ≺B β such that Cτ = Lτ ∨ . . . ∨ Lτ then F 0 = F ∪ {Lτ Cτ ;> } else F 0 = F The learned clause C in the Backtrack rule is a clause with a ground instance that propagates directly. So there are no true literals in C and at least one unassigned literal, the one that propagates. All other literals can be unassigned if not ground or false if ground. So we can watch one unassigned literal and the other watched literal can be unassigned or false. Forget(V ) (M ; β; O; F ; >) ⇒TWFO (; β; O0 ; F 0 ; >) provided O0 = {(C; K1 ; K2 ) ∈ O | C 6∈ V } and F 0 = {LCσ;> ∈ F } Note that the Forget rule only keeps clause instances annotated with >. Also we only forget clauses when we restart and therefore the rule Forget(V ) not only removes the given clauses V but also restarts with an empty trail and removes all clause instances that are not original instances. It also removes all literals in F that can not be directly propagated from the kept clauses, i.e. literals that can be propagated from factorized unit instances. Grow(β 0 ) (; β; O; F ; >) ⇒TWFO (; β 0 ; O; F ; >) provided β ≺B β 0 . The TWFO-calculus is part of a larger calculus to efficiently detect propagations and conflicts. So the rules DecLiteral(Lk ), PropLiteral(Lσ Cσ ), RemoveLiteral, Backtrack(C), Forget(V ) and Grow(B 0 ) are rules that are used to update the TWFO-calculus such that it has the same trail, uninstantiated clauses and the same state of the conflict clause, if it is > or not, as the larger calculus. Therefore the rules DecLiteral(Lk ), PropLiteral(Lσ Cσ ), Backtrack(C), Forget(V ) and Grow(B 0 ) have arguments. CDCL-like calculi typically only forget clauses after a restart. Hence, Forget(V ) not only removes the clauses V but also restarts with an empty trail and removes all clause instances that are not original instances. It also removes all literals in F that can not be directly propagated from the kept clauses, i.e. literals that can be propagated from factorized unit instances. The TWFO-calculus is supposed to efficiently detect propagations and conflicts for a larger calculus. The intended larger calculus is the SCL calculus presented in [3], but there are also other calculi to which it could be adapted, e.g., the SCL(T) calculus [4]. The rules DecLiteral(Lk ), PropLiteral(Lσ Cσ ), RemoveLiteral, Backtrack(C), Forget(V ), and Grow(β 0 ) are rules that are used to update the TWFO calculus such that it has the same trail, uninstantiated clauses and the same state of the conflict clause, if it is > or not, as the larger calculus. Therefore the rules DecLiteral(Lk ), PropLiteral(Lσ Cσ ), Backtrack(C), Forget(V ), and Grow(β 0 ) have arguments. In order to keep TWFO in sync with the SCL calculus, it has to detect all propagations and conflicts before SCL can change the trail with the rules DecLiteral(Lk ) and PropLiteral(Lσ Cσ ). We ensure this with the help of a strategy: Definition 1 (Reasonable Strategy). A strategy is called reasonable if the rules CreateIn- stance, UpdateWatched, FactorizeWatched, DetectPropLiteral, and Conflict are preferred over the rules DecLiteral(Lk ) and PropLiteral(Lσ Cσ ). To newly created instances by Cre- ateInstance, UpdateWatched, FactorizeWatched, Backtrack(C) these rules are exhaustively applied before any other rule is applied. The rules ConflictF, RemoveLiteral, Backtrack(C) may be applied without further restrictions. Given this strategy TWFO actually finds all propagations and conflicts before SCL can change the trail. But in order to prove this, we first must ensure some invariants that each state reachable by TWFO from a starting state must fulfill: Definition 2 (Consistent State). A state (M ; β; O; F ; D) is called consistent if all of the following properties hold: 1. Every instance (D; L1 ; L2 ) ∈ O is an instance of an initial clause or of a learned clause. 2. For every clause C there is at most one instance (C; L1 ; L2 ) ∈ O. 3. For every instance (C; L1 ; L2 ) ∈ O it holds that L1 ∈ C and L2 ∈ C. 4. For a clause instance (C; L1 ; L2 ) ∈ O it holds that either all literals in C are equal or L1 6= L2 . 5. The trail M only contains ground literals and does define a literal at most once. 6. For all literals LC,K ∈ F with K 6= > it holds that M = M 0 KM 00 , C = C0 ∨ L ∨ · · · ∨ L, M 0 K |= ¬C0 , and L is undefined in M 0 K. 7. For all literals LC,> ∈ F it holds that C = L ∨ · · · ∨ L. 8. For all literals LC,K ∈ F there exists an instance (D; L1 ; L2 ) ∈ O, a literal L0 ∈ D, and a substitution σ such that C = Dσ and L = L0 σ. D,K 9. For all literals LC1 ∈ M it holds that there exists a literal L2 ∈ F and a substitution σ such that L1 = L2 σ, C = Dσ, D = D0 ∨ L2 ∨ · · · ∨ L2 , and if K is a literal, then M = M1 KM2 L1 M3 . 10. For every instance (C; L1 ; L2 ) ∈ O for which there exists a substitution σ such that Cσ = L ∨ · · · ∨ L and Cσ ≺B β, there also must exist a K D,> ∈ F and a substitution τ such that L = Kτ and Dτ = L ∨ · · · ∨ L. 11. For every instance (D; L1 ; L2 ) ∈ O, D ≺B β. 12. For all literals LC 1 ∈ M it holds that there exists a clause instance (C; K1 ; K2 ) ∈ O, a literal L ∈ C, and a substitution σ such that L1 = L0 σ and L1 ≺B β. 0 13. For every literal LD,K2 ∈ F , L2 ≺B β. Lemma 1 (Consistency of Starting States). A starting state (; β; O; F ; >) for clause set N is consistent. Lemma 2 (Preservation). Let (M ; β; O; F ; D) be a consistent state. Then any state reachable from (M ; β; O; F ; D) by a sequence of TWFO reasonable rule applications is consistent. Theorem 1 (Correctness). The following properties hold for a consistent state (M ; β; O; F ; D) and every clause instance (C, L1 , L2 ) ∈ O: 1. If D = > and there is a ground instance Cσ ≺B β such that M |= ¬Cσ, then Conflict or ConflictF is applicable to Cσ after a series of rule applications that consist only of the rules CreateInstance, UpdateWatched, and FactorizeWatched. 2. If D = > and there is a ground instance Cσ ≺B β such that M |= ¬Cσ, then any sequence of rule applications that follows a reasonable strategy will apply one of the rules Conflict, ConflictF, or Forget(V ), before the rules DecLiteral(Lk ) and PropLiteral(Lσ Cσ ) are applicable. This means if there is a clause in conflict with the trail, then the calculus will detect a conflict clause or forget/reset the trail, before it can propagate or decide new literals onto the trail. 3. If D = > and there is an instance Cσ = C 0 σ ∨ Lσ ∨ · · · ∨ Lσ where Cσ ≺B β, C 0 σ is ground, M |= ¬C 0 σ and Lσ is unassigned with respect to M , and there exists no H ∈ F and substitution τ such that Hτ = Lσ, then DetectPropLiteral is applicable to Lσ or a literal H that can be instantiated to Lσ after a series of rule applications that consist only of the rules CreateInstance, UpdateWatched, and FactorizeWatched. 4. If D = > and there is an instance Cσ = C 0 σ ∨ Lσ ∨ · · · ∨ Lσ where Cσ ≺B β, C 0 σ is ground, M |= ¬C 0 σ and Lσ is unassigned with respect to M , and there exists no H ∈ F and substitution τ such that Hτ = Lσ, then any sequence of rule applications that follows a reasonable strategy will apply one of the rules DetectPropLiteral, Conflict, ConflictF, or Forget(V ), before the rules DecLiteral(Lk ) and PropLiteral(Lσ Cσ ) are applicable. This means if there exists a propagatable literal that has not been detected yet, then the calculus will detect a new propagatable literal or a conflict or forget/reset the trail, before it can propagate or decide new literals onto the trail. 5. If D = >, then exhaustively applying CreateInstance, UpdateWatched, Factor- izeWatched, and DetectPropLiteral will terminate after a finite number of rule applications. 6. If there is a transition (M ; β; O; F ; >) ⇒Conflict TWFO (M ; β; O; F ; Dσ) then there is a conflict M |= ¬Dσ and Dσ ≺B β is a ground instance of an initial clause or of a learned clause. 7. If there is a transition (M ; β; O; F ; >) ⇒ConflictF TWFO (M L; β; O; F ; Dσ) then there is a conflict M L |= ¬Dσ and Dσ ≺B β is a ground instance of an initial clause or of a learned clause. 8. If there is a transition (M ; β; O; F ; >) ⇒DetectPropLiteral TWFO (M ; β; O; F ∪ {LD }; >) then there is a propagation where D = D ∨ L ∨ · · · ∨ L, D ≺B β, and M |= ¬D0 , D is 0 an instance of an initial clause or of a learned clause, and D0 is ground. Let (M ; β; O; F ; >) be a consistent state. Together the above properties show that our calculus is correct. That means in any reasonable run starting from (M ; β; O; F ; >), TWFO tries to exhaustively apply the rules CreateInstance, UpdateWatched, Factor- izeWatched, and DetectPropLiteral. This can end in one of three ways (Theorem 1.1 and 1.3): (i) TWFO finds a conflict and interrupts the exhaustive exploration with Conflict or ConflictF, (ii) TWFO finds all literals that can be potentially propagated, and (iii) TWFO interrupts the exhaustive exploration by resetting the trail with rule Forget(V ). Either way, the exhaustive exploration for trail M will terminate (Theorem 1.5). With regard to DecLiteral(Lk ) and PropLiteral this means that TWFO will detect any conflicts and any literals that can be potentially propagated before the trail can be extended by DecLiteral(Lk ) and PropLiteral (Theorem 1.2 and 1.3). Moreover, all detected conflicts and propagatable literals are sound (Theorem 1.6–8). 4. Examples We now present some examples that intuitively show how each rule of the TWFO calculus is used. Note that the trails in the examples are not annotated with the clauses that propagated the literals to shorten the notation. Also instead of writing down the tuple (C; L1 ; L2 ) for elements in the set O we will annotate watched literals with ∗ . Example 1 (Example run 1). Let N = {(1) P (x)∨¬Q(x)∨R(x, y), (2) P (x)∨Q(a), (3) P (a)∨ ¬R(x, b)} be the set of starting clauses and let ≺B be an ordering and β be a ground literal such that L ≺B β iff the predicate of L is P , Q, or R and const(L) ⊆ {a, b}. Let O0 , O1 , and O2 be sets of clause instances such that O0 = {(1)P (x)∗ ∨ ¬Q(x)∗ ∨ R(x, y), (2)P (x)∗ ∨ Q(a)∗ , (3)P (a)∗ ∨ ¬R(x, b)∗ }, O1 = O0 ∪ {(1.1)P (a) ∨ ¬Q(a)∗ ∨ R(a, y)∗ }, O2 = O1 ∪ {(4)P (a)∗ ∨ P (x)∗ } O0 is our starting set of clause instances and the others will be reached during the run. Then the following is a run of the TWFO calculus: (; β; O0 ; ∅; >) DecLiteral(¬P (a)1 ) ⇒TWFO (¬P (a)1 ; β; O0 ; ∅; >) CreateInstance(1) ⇒TWFO (¬P (a)1 ; β; O1 ; ∅; >) DetectPropLit(2) ⇒TWFO (¬P (a)1 ; β; O1 ; {Q(a)P (a)∨Q(a);¬P (a) }; >) DetectPropLit(3) ⇒TWFO (¬P (a)1 ; β; O1 ; {Q(a)P (a)∨Q(a);¬P (a) , ¬R(x, b)P (a)∨¬R(x,b);¬P (a) }; >) PropLiteral(Q(a)) ⇒TWFO (¬P (a)1 Q(a); β; O1 ; {Q(a)P (a)∨Q(a);¬P (a) , ¬R(x, b)P (a)∨¬R(x,b);¬P (a) }; >) DetectPropLit(1.1) ⇒TWFO (¬P (a)1 Q(a); β; O1 ; {Q(a)P (a)∨Q(a);¬P (a) , ¬R(x, b)P (a)∨¬R(x,b);¬P (a) , R(a, y)P (a)∨¬Q(a)∨R(a,y);Q(a) }; >) PropLiteral(R(a,b)) ⇒TWFO (¬P (a)1 Q(a)R(a, b); β; O1 ; {Q(a)P (a)∨Q(a);¬P (a) , ¬R(x, b)P (a)∨¬R(x,b);¬P (a) , R(a, y)P (a)∨¬Q(a)∨R(a,y);Q(a) }; >) Conflict(3) ⇒TWFO (¬P (a)1 Q(a)R(a, b); β; O1 ; {Q(a)P (a)∨Q(a);¬P (a) , ¬R(x, b)P (a)∨¬R(x,b);¬P (a) , R(a, y)P (a)∨¬Q(a)∨R(a,y);Q(a) }; P (a) ∨ ¬R(a, b)) ⇒RemoveLiteral TWFO (¬P (a)1 Q(a); β; O1 ; {Q(a)P (a)∨Q(a);¬P (a) , ¬R(x, b)P (a)∨¬R(x,b);¬P (a) , R(a, y)P (a)∨¬Q(a)∨R(a,y);Q(a) }; P (a) ∨ ¬R(a, b)) ⇒RemoveLiteral TWFO (¬P (a)1 ; β; O1 ; {Q(a)P (a)∨Q(a);¬P (a) , ¬R(x, b)P (a)∨¬R(x,b);¬P (a) }; P (a) ∨ ¬R(a, b)) ⇒RemoveLiteral TWFO (; β; O1 ; ∅; P (a) ∨ ¬R(a, b)) Backtrack(4) ⇒TWFO (; β; O2 ; {P (a)P (a)∨P (x);> }; >) In the last step the notation for the rule Backtrack(P (a) ∨ P (x)) was shortened to Backtrack(4). Note that in the last step where we use the rule Backtrack(P (a) ∨ P (x)) we got the clause P (a) ∨ P (x) just from resolving the conflict clause with the propagating clauses and fully factorizing the resulting clause. We use the original uninstantiated clauses to resolve. Example 2 (Example run 2). Let the clause set N = {P (x)∨Q(a)∨Q(x), P (x)∨¬Q(x)∨ Q(b), ¬Q(a) ∨ ¬Q(b)} be the set of starting clauses and and let ≺B be an ordering and β be a ground literal such that L ≺B β iff the predicate of L is P or Q and const(L) ⊆ {a, b}. Let O0 , O1 , O2 , and O3 be sets of clause instances such that O0 = {(1)P (x) ∨ Q(a)∗ ∨ Q(x)∗ , (2)P (x)∗ ∨ ¬Q(x) ∨ Q(b)∗ , (3)¬Q(a)∗ ∨ ¬Q(b)∗ }, O1 = O0 ∪ {(1.1)P (a)∗ ∨ Q(a)∗ ∨ Q(a)}, O2 = O1 ∪ {(2.1)P (a) ∨ ¬Q(a)∗ ∨ Q(b)∗ }, O3 = O2 ∪ {(4)P (a)∗ } O0 is our starting set of clause instances and the others will be reached during the run. Then the following is a run of the TWFO calculus: (; β; O0 ; ∅; >) FactorizeWatched(1) ⇒TWFO (; β; O1 ; ∅; >) DecLiteral(¬P (a)1 ) ⇒TWFO (¬P (a)1 ; β; O1 ; ∅; >) CreateInstance(2) ⇒TWFO (¬P (a)1 ; β; O2 ; ∅; >) DetectPropLit(1.1) ⇒TWFO (¬P (a)1 ; β; O2 ; {Q(a)P (a)∨Q(a)∨Q(a);¬P (a) }; >) PropLiteral(Q(a)) ⇒TWFO (¬P (a)1 Q(a); β; O2 ; {Q(a)P (a)∨Q(a)∨Q(a);¬P (a) }; >) DetectPropLit(2.1) ⇒TWFO (¬P (a)1 Q(a); β; O2 ; {Q(a)P (a)∨Q(a)∨Q(a);¬P (a) , Q(b)P (a)∨¬Q(a)∨Q(b);Q(a) }; >) DetectPropLit(3) ⇒TWFO (¬P (a)1 Q(a); β; O2 ; {Q(a)P (a)∨Q(a)∨Q(a);¬P (a) , Q(b)P (a)∨¬Q(a)∨Q(b);Q(a) , ¬Q(b)¬Q(a)∨¬Q(b);Q(a) }; >) ⇒ConflictF TWFO (¬P (a)1 Q(a)Q(b); β; O2 ; {Q(a)P (a)∨Q(a)∨Q(a);¬P (a) , Q(b)P (a)∨¬Q(a)∨Q(b);Q(a) , ¬Q(b)¬Q(a)∨¬Q(b);Q(a) }; ¬Q(a) ∨ ¬Q(b)) ⇒RemoveLiteral TWFO (¬P (a)1 Q(a); β; O2 ; {Q(a)P (a)∨Q(a)∨Q(a);¬P (a) , Q(b)P (a)∨¬Q(a)∨Q(b);Q(a) , ¬Q(b)¬Q(a)∨¬Q(b);Q(a) }; ¬Q(a) ∨ ¬Q(b)) ⇒RemoveLiteral TWFO (¬P (a)1 ; β; O2 ; {Q(a)P (a)∨Q(a)∨Q(a);¬P (a) }; ¬Q(a) ∨ ¬Q(b)) ⇒RemoveLiteral TWFO (; β; O2 ; ∅; ¬Q(a) ∨ ¬Q(b)) Backtrack(4) ⇒TWFO (; β; O3 ; {P (a)P (a),> }; >) Here the notation for the rule Backtrack(P (x) ∨ Q(a) ∨ P (y) ∨ Q(y)) was shortened to Backtrack(4). To get the clause for backtracking we resolve ¬Q(a) ∨ ¬Q(b) · ∅ with P (x) ∨ ¬Q(x) ∨ Q(b) · {x 7→ a} resulting in P (x) ∨ ¬Q(x) ∨ ¬Q(a) · {x 7→ a} and then we factorize this to P (a) ∨ ¬Q(a) · ∅. Finally we resolve with P (x) ∨ Q(a) ∨ Q(x) · {x 7→ a} and factorize again. Example 3 (Example run 3). Let the clause set N = {P (a) ∨ P (b) ∨ Q(a) ∨ R(x), P (a) ∨ ¬P (x), P (a) ∨ ¬Q(a)} be the set of starting clauses and and let ≺B be an ordering and β be a ground literal such that L ≺B β iff the predicate of L is P , Q, or R and const(L) ⊆ {a, b}. Let O0 , O1 , and O2 be sets of clause instances such that O0 = {(1)P (a)∗ ∨ P (b)∗ ∨ Q(a) ∨ R(x), (2)P (a)∗ ∨ ¬P (x)∗ , (3)P (a)∗ ∨ ¬Q(a)∗ }, O1 = {(1)P (a) ∨ P (b)∗ ∨ Q(a)∗ ∨ R(x), (2)P (a)∗ ∨ ¬P (x)∗ , (3)P (a)∗ ∨ ¬Q(a)∗ }, O2 = {(1)P (a) ∨ P (b) ∨ Q(a)∗ ∨ R(x)∗ , (2)P (a)∗ ∨ ¬P (x)∗ , (3)P (a)∗ ∨ ¬Q(a)∗ } O0 is our starting set of clause instances and the others will be reached during the run. The only difference between the three sets are the selected watched literals. Then the following is a run of the TWFO calculus: (; β; O0 ; ∅; >) DecLiteral(¬P (a)1 ) ⇒TWFO (¬P (a)1 ; β; O0 ; ∅; >) UpdateWatched(1) ⇒TWFO (¬P (a)1 ; β; O1 ; ∅; >) DetectPropLit(2) ⇒TWFO (¬P (a)1 ; β; O1 ; {¬P (x)P (a)∨¬P (x);¬P (a) }; >) DetectPropLit(3) ⇒TWFO (¬P (a)1 ; β; O1 ; {¬P (x)P (a)∨¬P (x);¬P (a) , ¬Q(a)P (a)∨¬Q(a);¬P (x) }; >) PropLiteral(¬P (b)) ⇒TWFO (¬P (a)1 ¬P (b); β; O1 ; {¬P (x)P (a)∨¬P (x);¬P (a) , ¬Q(a)P (a)∨¬Q(a);¬P (x) }; >) UpdateWatched(1) ⇒TWFO (¬P (a)1 ¬P (b); β; O2 ; {¬P (x)P (a)∨¬P (x);¬P (a) , ¬Q(a)P (a)∨¬Q(a);¬P (x) }; >) PropLiteral(¬Q(a)) ⇒TWFO (¬P (a)1 ¬P (b)¬Q(a); β; O2 ; {¬P (x)P (a)∨¬P (x);¬P (a) , ¬Q(a)P (a)∨¬Q(a);¬P (x) }; >) DetectPropLit(1) ⇒TWFO (¬P (a)1 ¬P (b)¬Q(a); β; O2 ; {¬P (x)P (a)∨¬P (x);¬P (a) , ¬Q(a)P (a)∨¬Q(a);¬P (x) , R(x)P (a)∨P (b)∨Q(a)∨R(x);¬Q(a) }; >) Note that the trail at the end can be extended to a satisfiable valuation as DetectPro- pLiteral rule was applied to every clause instance and there are no contradicting literals in F . 5. Efficient Detection of Propagations and Conflicts There are multiple reasons why the original two-watched literals scheme for SAT solving is so efficient. The most important reason is that it only has to check a clause for propagations and conflicts if one of its watched literals was assigned false. This means whenever a new literal L has been added to the trail, it only has to check clauses where comp(L) is a watched literal. For our two-watched literals scheme for first-order logic, we can prove similar properties that we assume will lead to an efficient implementation as in the SAT case. Lemma 3 (Single Check). Let (M ; β; O0 ; F0 ; >) ⇒TWFO (M ; β; O1 ; F1 ; >) ⇒TWFO . . . ⇒TWFO (M ; β; On ; Fn ; >) be a reasonable run starting from a consistent state, where n may be 0 and Forget(V ) was not applied. 1. Then if none of the rules CreateInstance, UpdateWatched, FactorizeWatched, De- tectPropLiteral, and Conflict are applicable to clause instance (C, L1 , L2 ) ∈ Oi ∩ Oj in state (M ; β; Oi ; Fi ; >) then they are also not applicable to (C, L1 , L2 ) in state (M ; β; Oj ; Fj ; >) with 0 ≤ i < j ≤ n. (Hence, TWFO does not have to check a clause instance again after it was fully processed and before the trail has changed.) 2. CreateInstance is applied at most twice to a clause instance C with (C, L1 , L2 ) ∈ Oi . 3. UpdateWatched is applied at most twice to a clause instance C with (C, L1 , L2 ) ∈ Oi independently of which literals are watched. 4. FactorizedWatched and DetectPropLiteral are applied at most once to a clause instance (C, L1 , L2 ) ∈ Oi . The above lemma guarantees that TWFO only has to check each clause instance once before it changes the trail again. Moreover, for a fixed trail M the maximum number of rule applications per clause instance is at most 6. Note that this does not include the rule applications to clause instances that were derived from this one. Lemma 4 (Empty Trail Exploration). Let (; β; O0 ; F ; >) be a consistent state. Then Cre- ateInstance, UpdateWatched, DetectPropLiteral and Conflict are not applicable. (However, all clauses have to be checked for potential applications of FactorizeWatched.) The above lemma guarantees that only FactorizeWatched can be applied on the empty trail. Lemma 5 (New Literal Exploration). Let (M ; β; O0 ; F0 ; >) be a consistent state such that CreateInstance, UpdateWatched, FactorizeWatched, DetectPropLiteral, and Conflict are not applicable in state (M ; β; O0 ; F ; >). Let (M ; β; O0 ; F0 ; >) ⇒TWFO (M L; β; O0 ; F0 ; >) ⇒TWFO (M L; β; O1 ; F1 ; >) ⇒TWFO . . . ⇒TWFO (M L; β; On ; Fn ; >) be a reasonable run (where n may be 0): 1. Then in state (M L; β; On ; Fn ; >) UpdateWatched is only applicable to clause in- stances (C, L1 , L2 ) ∈ On where comp(L) = L1 . 2. Then in state (M L; β; On ; Fn ; >) CreateInstance, DetectPropLiteral, and Conflict are only applicable to clause instances (C, L1 , L2 ) ∈ On if there exists a substitution σ such that comp(L) = L1 σ or if (C, L1 , L2 ) 6∈ O0 , i.e., the instance was added or its watched literals were modified after the trail was extended. 3. Then in state (M L; β; On ; Fn ; >) FactorizeWatched is only applicable to clause instances (C, L1 , L2 ) ∈ On \ O0 , i.e., only to those clause instances that where modified or added after the trail was extended. The above lemma guarantees that after TWFO adds a new literal L to the trail, we only have to check those clause instances (C, L1 , L2 ) for rule applications, where comp(L) is a ground instance of one of its watched literals (i.e., there exists σ and i ∈ 1, 2 so Li σ = L) and those clause instances that were added or modified after L was added to the trail. Lemma 6 (Backtrack Exploration). Let (M M 0 L; β; O0 ; F00 ; >) be a consistent state. Conflict/ConflictF Let (M M 0 L; β; O0 ; F00 ; >) ⇒TWFO (M M 0 L; β; O0 ; F00 ; D) ⇒RemoveLiteral∗ TWFO Backtrack(D’) (M ; β; On ; Fn0 ; D) ⇒TWFO (M ; β; O1 ; F1 ; >) be a reasonable run from one application of Conflict/ConflictF to the first subsequent application of Backtrack(D0 ). Let (M ; β; O1 ; F0 ; >) ⇒TWFO (M ; β; O2 ; F2 ; >) ⇒TWFO . . . ⇒TWFO (M ; β; On ; Fn ; >) be a reasonable run (where n may be 1) and Forget was never applied. Then in state (M L; β; On ; Fn ; >) UpdateWatched, FactorizeWatched, CreateInstance, DetectPropLiteral, and Conflict are only applicable to clause instances (C, L1 , L2 ) ∈ On where (C, L1 , L2 ) 6∈ O0 . The above lemma guarantees that after TWFO applies Backtrack(D0 ), we only have to check those clause instances (C, L1 , L2 ) for applications of the rules that were (i) either added by the last Backtrack (i.e., C = D0 ) or (ii) derived after Backtrack by an application of the rules UpdateWatched, FactorizeWatched, and CreateInstance. 6. Interaction between TWFO and SCL The TWFO calculus is a calculus to help detect propagations and conflicts efficiently for the SCL calculus. So we have to keep certain aspects of the state of both calculi equal, these are the trail, the clauses and the state of the conflict clause, that is if it is > or not. So for all rule applications of SCL we have to show that we can simulate them with rule applications of TWFO. We do this only for a regular run of SCL and a reasonable run of TWFO. A SCL-state has the form (M ; N ; U ; β; k; D) and a TWFO-state has the form (M 0 ; β; O; F ; D0 ). We have to show that we can keep M and M 0 equal as well as that D = > iff D0 = > and that for every C ∈ N ∪ U there are L1 and L2 such that (C; L1 ; L2 ) ∈ O. The start state of SCL is (; N ; ∅; β; 0; >) and then the start state of TWFO is (; β; O; F ; >) such that for every C ∈ N ∪U there are L1 and L2 such that (C; L1 ; L2 ) ∈ O holds. So now we show for every rule application in SCL how we can simulate them with TWFO. First we look at the rule propagate: (M ; N ; U ; β; k; >) ⇒Propagate SCL (M Lσ Cδ·σ ; N ; U ; β; k; >) We know that Lσ is undefined in M . Because we can propagte Lσ in TWFO, either DetectPropLiteral was already applied or can be applied after applications of CreateIn- stance, UpdateWatched and FactorizeWatched. This holds because DetectPropLiteral is complete, Theorem 1.3, and F always contains all literals that we can propagate from (factorized) unit clauses, Def 2.10. So we can do the following rule applications in TWFO: (M ; β; O; F ; >) (⇒CreateInstance, TWFO UpdateWatched, FactorizeWatched,∗ (M ; β; O0 ; F ; >) ⇒DetectPropLiteral TWFO (M ; β; O0 ; F ∪ {Lσ Cσ;K }; >)) PropLiteral(Lσ) ⇒TWFO (M Lσ Cσ ; β; O0 ; F 0 ; >) Note that the rules CreateInstance, UpdateWatched and FactorizeWatched do not add a clause instance (C; L1 ; L2 ). So the rule Propagate can be simulated. Moreover, TWFO never adds a literal to F that cannot be propagated by Propagate, Theorem 1.8. The next rule we look at is the Decide rule: (M ; N ; U ; β; k; >) ⇒Decide SCL (M Lσ k+1 ; N ; U ; β; k + 1; >) We know that Lσ is undefined in M . For DecLiteral to be applicable we need that there is no contradicting literal L0 ∈ F such that there is a τ where comp(Lσ) = L0 τ . To show this we need that the SCL run is regular. We assume that there is such an L0C ∈ F . From Definition 2.6 we know that C = C0 ∨ L0 ∨ · · · ∨ L0 and M |= ¬C0 . Because the SCL run is regular we know that there is no conflict before the application of Decide because Conflict is preferred over every other rule. In a regular run an application of Decide does not create a conflict so there is also no conflict after the application of Decide. So especially M 6|= ¬Cτ and M Lσ 6|= ¬Cτ for all grounding substitutions τ . But because M |= ¬C0 we can follow that M Lσ 6|= ¬L0 τ for all grounding substitutions τ . Therefore there is no τ such that comp(Lσ) = L0 τ contradicting our assumption. So we can do the following rule application in TWFO: DecLiteral(Lσ k+1 ) (M ; β; O; F ; >) ⇒TWFO (M Lσ k+1 ; β; O; F ; >) So the rule Decide can be simulated. Now we look at the rule Conflict: (M ; N ; U ; β; k; >) ⇒Conflict SCL (M ; N ; U ; β; k; D · σ) We know that M |= ¬Dσ holds. For TWFO we know from the completeness of the Conflict rule, Theorem 1.1, that Conflict either is applicable or will be applicable after applications of CreateInstance, UpdateWatched and FactorizeWatched. So we can do the following rule applications in TWFO: (M ; β; O; F ; >) ⇒CreateInstance, TWFO UpdateWatched, FactorizeWatched,∗ (M ; β; O0 ; F ; >) ⇒Conflict TWFO (M ; β; O0 ; F ; Dσ) So the rule Conflict can be simulated. The next rules are Resolve and Factorize. Both these rules only change the conflict clause but before the rule application it holds that the conflict clause is not > and this does not change after the rule application. So we do not have to change anything in the state of TWFO. Then we look at the rule Skip: (M L; N ; U ; β; k; D · σ) ⇒Skip SCL (M ; N ; U ; β; l; D · σ) We can just remove a literal with the rule RemoveLiteral in TWFO: (M L; β; O; F ; D0 ) ⇒RemoveLiteral TWFO (M ; β; O0 ; F 0 ; D0 ) So we can simulate the rule Skip. Now we look at the rule Backtrack: (M K i+1 M 0 ; N ; U ; β; k; (D ∨ L) · σ) ⇒Backtrack SCL (M Lσ C·σ ; N ; U ∪ {D ∨ L}; β; i; >) In TWFO we first have to remove the literals with RemoveLiteral until the trail is M and then use Backtrack(D ∨ L) to add the new clause to O. Finally we have to apply CreateInstance, UpdateWatched and FactorizeWatched to apply DetectPropLiteral and then we can apply PropLiteral(Lσ Cσ ). (M K i+1 M 0 ; β; O; F ; D0 ) RemoveLiteral,|M 0 |+1 ⇒TWFO (M ; β; O1 ; F 1 ; D0 ) Backtrack(D∨L) ⇒TWFO (M ; β; O2 ; F 2 ; >) ⇒CreateInstance, TWFO UpdateWatched, FactorizeWatched,∗ (M ; β; O3 ; F 2 ; >) ⇒DetectPropLiteral TWFO (M ; β; O3 ; F 3 ; >) PropLiteral(Lσ (D∨L)σ ) ⇒TWFO (M Lσ (D∨L)σ ; β; O3 ; F 3 ; >) Note that after the application of Backtrack(D ∨ L) it holds again that for every C ∈ N ∪ U there are L1 and L2 such that (C; L1 ; L2 ) ∈ O. Note also that Backtrack checks whether the new clause can be factorized to a unit and adds the resulting literal to F . So Backtrack can also be simulated. The last rule that we have to look at is the Grow rule: (M ; N ; U ; β; k; >) ⇒Backtrack SCL (; N ; U ; β 0 ; 0; >) To simulate this rule we have to use the rule Forget(∅) to restart and then use Grow(β 0 ). (M ; β; O; F ; >) Forget(∅) ⇒TWFO (∅; β; O0 ; F 0 ; >) Grow(β 0 ) ⇒TWFO (∅; β 0 ; O0 ; F 0 ; >) So Grow can also be simulated. So all rule applications in the SCL calculus can be simulated with rule applications in the TWFO calculus and therefore the states can stay similar. We also want to show how we can simulate an application of the rule ConflictF with rules in SCL. (M ; β; O; F ] {LC 1 C2 ConflictF 1 , L2 }; >) ⇒TWFO (M L1 σ C1 σ ; β; O; F ∪ {LC C2 1 , L2 }; C2 σ) 1 We know that L1 σ = comp(L2 σ) and L1 σ, L2 σ 6∈ M hold. From Definition 2.6 we know that C1 = C10 ∨ L1 ∨ · · · ∨ L1 and M |= ¬C10 as well as C2 = C20 ∨ L2 ∨ · · · ∨ L2 and M |= ¬C20 hold. So L1 σ C1 σ can be propagated on the trail and because L1 σ = comp(L2 σ) holds that M L1 σ C1 σ |= ¬C2 σ and therefore Conflict in the SCL calculus is applicable. (M ; N ; U ; β; k; >) ⇒Propagate SCL (M L1 σ C1 σ ; N ; U ; β; k; >) ⇒Conflict SCL (M L1 σ C1 σ ; N ; U ; β; k; C2 σ) So the ConflictF rule can be simulated with rules in SCL. Note that the only other rule in TWFO that is no rule to synchronize TWFO with SCL and that does affect elements that we have to keep consistent between the two calculi is the Conflict rule. But this can just easily be simulated with an application of the Conflict rule in SCL is a direct implication of the Soundness of the Conflict rule, Theorem 1.6. We also must guarantee that for a reasonable strategy an application of the rule DecLiteral(Lk ) does not create a conflict. Lemma 7 (DecLiteral does not enable Conflict). In a reasonable run starting from a consistent start state (∅; β; O; F ; >) an application of the rule DecLiteral(Lk ) does not enable an application of the rule Conflict. 7. Conclusion We have generalized the two-watched literal principle from propositional logic to a finite domain first-order logic (fixed β). The lifting is involved and we managed to keep the main properties of the principle: first, only watched literals need to be considered for trail changes, and, second, after backtracking no updates are needed except for the newly learned clause. We are confident that these properties will guarantee that an implementation of TWFO for first-order logic will be efficient in practice. There is still some future work left before we can implement an efficient version of TWFO. First and foremost, we need to develop efficient indexing structures for TWFO. For instance, in the propositional case, we put all clauses with watched literal L into a vector watched[L]. This allows us to efficiently iterate through all clauses that need to be checked when the negation of watched literal comp(L) is added to the trail. However, when comp(L) is added to the trail in the first-order case, it is not enough to just check all clause instances C where L is watched. Instead, we have to check all clause instances C with a watched literal L0 that can be instantiated to L (i.e., there exists τ with L0 τ = L). So we need an efficient data structure that finds all watched literals that can be instantiated to L. Work on indexing in first-order logic can here be a good starting point [7]. Although model building through trails has been considered in first-order logic, e.g. [8, 9, 10], we are not aware of any work adapting the propositional two-watched literal principle to this setting. This might also be due to the fact that exhaustive propagation, as done in propositional logic, cannot be afforded in more expressive logics [3] and therefore the two-watched literal scheme needs an additional laziness component, as suggested in this work. References [1] J. P. M. Silva, K. A. Sakallah, Grasp - a new search algorithm for satisfiability, in: International Conference on Computer Aided Design, ICCAD, IEEE Computer Society Press, 1996, pp. 220–227. [2] M. W. Moskewicz, C. F. Madigan, Y. Zhao, L. Zhang, S. Malik, Chaff: Engineering an efficient sat solver, in: Design Automation Conference, 2001. Proceedings, ACM, 2001, pp. 530–535. [3] A. Fiori, C. Weidenbach, Scl clause learning from simple models, in: P. Fontaine (Ed.), 27th International Conference on Automated Deduction, CADE-27, volume 11716 of LNAI, Springer, 2019, pp. 233–249. [4] M. Bromberger, A. Fiori, C. Weidenbach, Deciding the bernays-schoenfinkel fragment over bounded difference constraints by simple clause learning over theories, in: F. Henglein, S. Shoham, Y. Vizel (Eds.), Verification, Model Checking, and Abstract Interpretation - 22nd International Conference, VMCAI 2021, Copenhagen, Denmark, January 17-19, 2021, Proceedings, volume 12597 of Lecture Notes in Computer Science, Springer, 2021, pp. 511–533. [5] D. E. Knuth, P. B. Bendix, Simple word problems in universal algebras, in: I. Leech (Ed.), Computational Problems in Abstract Algebra, Pergamon Press, 1970, pp. 263–297. [6] A. Biere, M. Heule, H. van Maaren, T. Walsh (Eds.), Handbook of Satisfiability - Second Edition, volume 336 of Frontiers in Artificial Intelligence and Applications, IOS Press, 2021. [7] R. Nieuwenhuis, T. Hillenbrand, A. Riazanov, A. Voronkov, On the evaluation of indexing techniques for theorem proving, in: R. Goré, A. Leitsch, T. Nipkow (Eds.), Automated Reasoning, First International Joint Conference, IJCAR 2001, Siena, Italy, June 18-23, 2001, Proceedings, volume 2083 of LNCS, Springer, 2001, pp. 257–271. [8] P. Baumgartner, A. Fuchs, C. Tinelli, Lemma learning in the model evolution calculus, in: LPAR, volume 4246 of Lecture Notes in Computer Science, Springer, 2006, pp. 572–586. [9] K. Korovin, Inst-gen - A modular approach to instantiation-based automated reasoning, in: A. Voronkov, C. Weidenbach (Eds.), Programming Logics - Essays in Memory of Harald Ganzinger, volume 7797 of Lecture Notes in Computer Science, Springer, 2013, pp. 239–270. [10] M. P. Bonacina, U. Furbach, V. Sofronie-Stokkermans, On first-order model-based reasoning, in: N. Martí-Oliet, P. C. Ölveczky, C. L. Talcott (Eds.), Logic, Rewriting, and Concurrency - Essays dedicated to José Meseguer on the Occasion of His 65th Birthday, volume 9200 of Lecture Notes in Computer Science, Springer, 2015, pp. 181–204.