1 Introduction

Conflict-driven clause learning (CDCL) [27] is the standard paradigm for solving the satisfiability problem (SAT) in propositional logic. CDCL solvers learn clauses implied through resolution inferences. Additionally, all competitive CDCL solvers use pre- and inprocessing techniques captured by the resolution asymmetric tautology (RAT) proof system [22]. As examples, the well-studied pigeonhole and mutilated chessboard problems are challenging benchmarks with exponentially-sized resolution proofs [1, 13]. It is possible to construct small hand-crafted proofs for the pigeonhole problem using extended resolution (ER) [9], a proof system that allows the introduction of new variables [33]. ER can be expressed in RAT but has proved difficult to automate due to the large search space for introducing new variables. Even with modern inprocessing techniques, many CDCL solvers struggle on these seemingly simple problems. The propagation redundant (PR) proof system allows short proofs for these problems [16, 18], and unlike in ER, no new variables are required. This makes PR an attractive candidate for automation.

At a high level, CDCL solvers make decisions that typically yield an unsatisfiable branch of a problem. The clause that prunes the unsatisfiable branch from the search space is learned, and the solver continues by searching another branch. PR extends this paradigm by allowing more aggressive pruning. In the PR proof system a branch can be pruned as long as there exists another branch that is at least as satisfiable. This can be viewed as a kind of “without loss of generality” reasoning where the branch that was pruned could be handled similarly (w.r.t. a proof of unsatisfiability) to the branch that is at least as satisfiable.

Fig. 1
figure 1

Motivating example of a bipartite graph perfect matching problem. Green edges are assigned true (in the perfect matching), and red edges are assigned false (not in the perfect matching). (Color figure online)

As an example, consider the perfect matching problem for a bipartite graph in Fig. 1. This problem involves finding a set of edges such that every vertex is incident to exactly one edge. It can be encoded naturally as a SAT problem, with at-least-one constraints for vertices on one side of the graph and at-most-one constraints for vertices on the other. Assume we are placing the at-most-one constraints on vertices from the bottom side of the graph, and edges are labelled by variables \(x_{i,j}\) with i as the index of the top vertex. For any perfect matching solution that uses the two green edges in the (a), assigning those two edges to false (red) and instead using the edges in (b) will give another valid solution. It is easy to see that both choices for edges will be incident to vertices 1 and 2 on the top and bottom, so switching between then will not affect the matching on the remaining vertices. This means the partial assignment in (b) is at least as satisfiable as the partial assignment in (a). Therefore, one could carry out the proof after excluding the edge orientation in (a) without loss of generality. This is a powerful form of reasoning that can efficiently remove many symmetries.

The satisfaction-driven clause learning (SDCL) solver SaDiCaL [17] incorporates PR clause learning into the CDCL loop. SaDiCaL implements hand-crafted decision heuristics that exploit the canonical structure of the pigeonhole and mutilated chessboard problems to find short proofs. However, SaDiCaL’s performance deteriorates under slight variations to the problems including different constraint encodings [8]. The heuristics were developed from a few well-understood problems and do not generalize to other problem classes. Further, the heuristics for PR clause learning are likely ill-suited for CDCL, making the solver less robust.

In this paper, we present PReLearn, a preprocessing technique for learning PR clauses. PReLearn alternates between finding and learning PR clauses. We develop multiple heuristics for finding PR clauses and multiple configurations for learning some subset of the found PR clauses. As PR clauses are learned we use failed literal probing [12] to find unit clauses implied by the formula. The preprocessing is made efficient by taking advantage of the inner/outer solver framework in SaDiCaL. The learned PR clauses are added to the original formula, aggressively pruning the search space in an effort to guide CDCL solvers to short proofs. With this method PR clauses can be learned without altering the complex heuristics that make CDCL solvers robust. PReLearn focuses on finding short PR clauses and failed literals to effectively reduce the search space. This is done with general heuristics that work across a wide range of problems.

For some highly structured problems, the addition of short PR clauses can be viewed as a form of symmetry breaking, as shown with the bipartite matching example above. There exist tools for detecting symmetries and generating symmetry-breaking constraints, such as BreakID [10]. They work by converting the SAT problem into a colored graph, then using an automorphism extractor such as SAUCY [23] to detect symmetries. Recent work has shown that some preprocessing techniques are harmful to graph-based symmetry breaking methods [2]. State-of-the-art SAT solvers incorporate many preprocessing techniques throughout solving [22], and the interaction between preprocessing techniques is not well understood. Therefore, it is important that new preprocessing techniques are robust if they are to be incorporated in a complex solver. PReLearn performs symmetry-breaking in a much different way than the graph-based tools, finding PR clauses by solving small SAT problems that do not consider the formula’s global structure. In our evaluation we show that randomly permuting variable names and applying preprocessors will not significantly alter the performance of PReLearn.

Most SAT solvers support logging proofs of unsatisfiability for independent checking [15, 21, 34]. This has proved valuable for verifying solutions independent of a (potentially buggy) solver. Modern SAT solvers log proofs in the DRAT proof system (RAT [22] with deletions). DRAT captures all widely used pre- and inprocessing techniques including bounded variable elimination [11], bounded variable addition [26], and extended learning [5, 33]. DRAT can express the common symmetry-breaking techniques, but it is complicated [14]. PR can compactly express some symmetry-breaking techniques [16, 18], yielding short proofs that can be checked by the proof checker DPR-trim [17]. PR gives a framework for strong symmetry-breaking inferences and also maintains the highly desirable ability to independently verify proofs.

This journal article is an extension of a conference paper under the same name that appeared in IJCAR’22 [30]. The contributions of the original paper included: (1) giving a high-level algorithm for extracting PR clauses, (2) implementing several heuristics for finding and learning PR clauses, (3) evaluating the effectiveness of different heuristic configurations, and (4) assessing the impact of PReLearn on solver performance. PReLearn improved the performance of the CDCL solver Kissat on \(22\%\) of the satisfiable and unsatisfiable competition benchmarks we considered. The improvement was significant for a number of instances that can only be solved by Kissat after preprocessing. Most of them come from hard combinatorial problems with small formulas. In addition, PReLearn directly produced refutation proofs for the mutilated chessboard problem containing only unit and binary PR clauses. We extend the results in this article by exploring the impact or permuting and preprocessing formulas before running PReLearn. In an experimental evaluation we found that the effectiveness of PReLearn was not significantly altered. We also present several examples and pseudocode for our main algorithm not appearing in the conference version.

2 Preliminaries

We consider propositional formulas in conjunctive normal form (CNF). A CNF formula F is a conjunction of clauses where each clause is a disjunction of literals. A literal \(\ell \) is either a variable x (positive literal) or a negated variable \(\overline{x}\) (negative literal). The polarity of a literal is positive if it is a positive literal, and negative if it is a negative literal. Clauses are represented as a set of literals, but we often write them out directly, e.g., the clause \(\{x_{1},\overline{x}_{2}\}\) is written \((x_{1} \vee \overline{x}_{2})\). For a set of literals L the formula F(L) is the clauses \(\{C \in F \; \mid \; C \cap L \ne \emptyset \}\).

An assignment \(\alpha \) is a mapping from variables to truth values 1 (true) and 0 (false). An assignment is total if it assigns every variable appearing in a finite formula to a value, and is partial if it assigns a subset of variables to values. For a literal \(\ell \), \(\textsf{var}(\ell )\) is the variable corresponding to \(\ell \), e.g., \(\textsf{var}(x_1) = \textsf{var}(\overline{x}_1) = x_1\). The set of variables occurring in a formula, assignment, or clause is given by \(\textsf{var}(F)\), \(\textsf{var}(\alpha )\), or \(\textsf{var}(C)\). Assignment \(\alpha \) satisfies a positive (negative) literal \(\ell \) if \(\alpha \) maps \(\textsf{var}(\ell )\) to true (\(\alpha \) maps \(\textsf{var}(\ell )\) to false, respectively), and falsifies it if \(\alpha \) maps \(\textsf{var}(\ell )\) to false (\(\alpha \) maps \(\textsf{var}(\ell )\) to true, respectively). We write a partial assignment as the set of literals it satisfies, e.g., \(x\,\overline{y}\) mapping \(\alpha (x) = 1\) and \(\alpha (y) = 0\). An assignment satisfies a clause if the clause contains a literal satisfied by the assignment. An assignment satisfies a formula if every clause in the formula is satisfied by the assignment. A formula is satisfiable if there exists a satisfying assignment, and unsatisfiable otherwise. Two formulas are logically equivalent if they share the same set of satisfying assignments. Two formulas are satisfiability equivalent if they are either both satisfiable or both unsatisfiable.

If assignment \(\alpha \) satisfies a clause C we define , otherwise represents the clause C with the literals falsified by \(\alpha \) removed. The empty clause is denoted by \(\bot \). The formula F reduced by an assignment \(\alpha \) is given by . Given an assignment \(\alpha = \ell _{1}\dots \ell _{n}\), \(C = ( \overline{\ell }_{1} \vee \dots \vee \overline{\ell }_{n})\) is the clause that blocks \(\alpha \). The assignment blocked by a clause is the negation of the literals in the clause. A unit is a clause containing a single literal. The unit clause rule takes the assignment \(\alpha \) of all units in a formula F and generates . Iteratively applying the unit clause rule until fixpoint is referred to as unit propagation. In cases where unit propagation yields \(\bot \) we say it derived a conflict. A formula F implies a formula \(F'\), denoted \(F \models F'\), if every assignment satisfying F satisfies \(F'\). By \(F \vdash _{1} F'\) we denote that for every clause \(C \in F'\), applying unit propagation to the assignment blocked by C in F derives a conflict. If unit propagation derives a conflict on the formula \(F \cup \{\{\ell \}\}\), we say \(\ell \) is a failed literal and the unit \(\overline{\ell }\) is logically implied by the formula. Failed literal probing [12] is the process of successively assigning literals to check if units are implied by the formula. In its simplest form, probing involves assigning a literal \(\ell \) and learning the unit \(\overline{\ell }\) if unit propagation derives a conflict, otherwise \(\ell \) is unassigned and the next literal is checked.

To evaluate the satisfiability of a formula, a CDCL solver [27] iteratively performs the following operations: First, the solver performs unit propagation, and tests for a conflict. Unit propagation is made efficient with two-literal watch pointers [28]. If there is no conflict and all variables are assigned, the formula is satisfiable. Otherwise, the solver chooses an unassigned variable through a variable decision heuristic [7, 25], assigns a truth value to it, and performs unit propagation. The selected variables are decision variables, and the assignment including decision variables and propagated variables is called the trail. If, however, there is a conflict, the solver performs conflict analysis potentially learning a short clause. In case this clause is the empty clause, the formula is unsatisfiable.

3 The PR Proof System

A clause C is redundant w.r.t. a formula F if F and \(F \cup \{C\}\) are satisfiability equivalent. The clause sequence \(F, C_{1}, C_{2}, \ldots , C_{n}\) is a clausal proof of \(C_{n}\) from F if each clause \(C_{i} \; (1 \le i \le n)\) is redundant w.r.t. \(F \cup \{ C_{1}, C_{2}, \ldots , C_{i-1}\}\). The proof is a refutation of F if \(C_{n}\) is \(\bot \). Clausal proof systems may also allow deletion. In a refutation proof, clauses can be deleted freely because the deletion cannot make a formula less satisfiable.

Clausal proof systems are distinguished by the kinds of redundant clauses they allow to be added. The standard SAT solving paradigm CDCL learns clauses implied through resolution. These clauses are logically implied by the formula, and fall under the reverse unit propagation (RUP) proof system. A clause has RUP if unit propagation on the falsified literals of the clause results in a conflict. The Resolution Asymmetric Tautology (RAT) proof system generalizes RUP. All commonly used inprocessing techniques emit DRAT proofs. The propagation redundant (PR) proof system generalizes RAT, but requires witnesses for proof steps to be efficiently checkable.

Let C be a clause in the formula F and \(\alpha \) the assignment blocked by C. Then C is PR w.r.t. F if and only if there exists an assignment \(\omega \) such that and \(\omega \) satisfies C. Intuitively, this allows inferences that block a partial assignment \(\alpha \) as long as another assignment \(\omega \) is as satisfiable. This means every assignment containing \(\alpha \) that satisfies F can be transformed into an assignment containing \(\omega \) that satisfies F.

Running Example As the running example, we consider the bipartite graph from Fig. 1. There may be more nodes in the graph but as long as there are no additional edges incident to the vertices \(1-3\) on the top and bottom the additional edges will not affect the calculation of the positive reduct or any following examples. Variable \(x_{i,j}\) denotes the edge from vertex i on the top to vertex j on the bottom set of nodes. The at-most-one constraints for the bottom vertices shown are: \((\overline{x}_{1,1} \vee \overline{x}_{2,1} ) \wedge (\overline{x}_{1,2} \vee \overline{x}_{2,2} ) \wedge (\overline{x}_{2,3} \vee \overline{x}_{3,3} ) \wedge (\overline{x}_{2,3} \vee \overline{x}_{4,3} ) \wedge (\overline{x}_{3,3} \vee \overline{x}_{4,3}) \). The at-least-one constraints for the top vertices are: \( (x_{1,1} \vee x_{1,2}) \wedge (x_{2,1} \vee x_{2,2} \vee x_{2,3}) \wedge (x_{3,3} \vee \cdots ) \wedge (x_{4,2} \vee x_{4,3} \vee \cdots ) \). In the examples below, F denotes the entire formula.

Example 1

From Fig. 1, the clause \(( \overline{x}_{1,1} \vee \overline{x}_{2,2} ) \) corresponds to the binary PR clause blocking the assignment of red edges in (a). One possible witness for this PR clause could be \(\omega = x_{1,2}\,x_{2,1} \,\overline{x}_{1,1}\). The witness is saying that if \( x_{1,1} \, x_{2,2} \) (red edges) were in a satisfying assignment to the problem, we could negate them then set \(x_{1,2}\,x_{2,1}\) (green edges) to true in the assignment while keeping the rest of the assignment untouched, and it would still satisfy the formula.

Clausal proofs systems must be checkable in polynomial time to be useful in practice. RUP and RAT are efficiently checkable due to unit propagation. In general, determining if a clause is PR is NP-complete [19]. However, a PR proof is checkable in polynomial time if the witness assignments \(\omega \) are included. A clausal proof with witnesses has the form \(F, (C_{1},\omega _{1}), (C_{2},\omega _{2}), \ldots , (C_{n},\omega _{n})\). The proof checker DPR-trim can efficiently check PR proofs that include witnesses. Further, DPR-trimFootnote 1 can emit proofs in the LPR format. They can be validated by the formally-verified checker Cake-LPR [32], which was used to validate results in recent SAT competitions.

4 Pruning Predicates and SaDiCaL

Determining if a clause is PR is NP-complete and can naturally be formulated in SAT. Given a clause C and formula F, a pruning predicate is a formula such that if it is satisfiable, the clause C is redundant w.r.t. F. SaDiCaL uses two pruning predicates to determine if a clause is PR: positive reduct and filtered positive reduct. If either predicate is satisfiable, the satisfying assignment serves as the witness showing the clause is PR.

Definition 1

(Definition 3 of [19]) Let F be a formula, \(\alpha \) an assignment, and C the clause that blocks \(\alpha \). The positive reduct \(p(F, \alpha )\) of F with respect to \(\alpha \) is the formula \(G \wedge C\), where G is obtained from F by first removing all clauses that are not satisfied by \(\alpha \) and then removing from the remaining clauses all literals that are not assigned by \(\alpha \).

Definition 2

(Definition 6 of [18]) Let F be a formula, \(\alpha \) an assignment, and C the clause that blocks \(\alpha \). The filtered positive reduct \(f(F, \alpha )\) of F with respect to \(\alpha \) is the formula \(G \wedge C\), where G is obtained from F by first removing all clauses that are not satisfied by \(\alpha \). Next, clauses are removed (filtered) if unit propagation on the formula conjuncted with negated literals from the clause that are not assigned by \(\alpha \) derives a conflict. Finally, all literals that are not assigned by \(\alpha \) are removed from the remaining clauses.

The filtered positive reduct is a subset of the positive reduct. The filtered positive reduct is more expensive to compute due to the filtering operation that applies unit propagation. In Example 2 the PR clause found by solving the positive reduct is larger than it needs to be. In fact, one can assign variables, perform unit propagation to get a new assignment \(\alpha \), solve the reduct based on \(\alpha \), then remove all propagated literals from the resulting clause. This is shown in Example 3, where the the positive reduct is SAT, and we can remove the propagated literals appearing in the PR clause from Example 2. For more information on the positive reduct and filtered positive reduct, we refer readers to [18].

Example 2

Given the assignment \(\alpha = x_{1,1}\,x_{2,2}\,\overline{x}_{1,2}\,\overline{x}_{2,1}\), the positive reduct is the clause that blocks \(\alpha \), \(( \overline{x}_{1,1} \vee \overline{x}_{2,2} \vee x_{1,2} \vee x_{2,1})\), conjuncted with the satisfied clauses with literals from \(\alpha \), \((\overline{x}_{1,1} \vee \overline{x}_{2,1} ) \wedge (\overline{x}_{1,2} \vee \overline{x}_{2,2} ) \wedge (x_{1,1} \vee x_{1,2}) \wedge (x_{2,1} \vee x_{2,2} ) \). The assignment \(\omega = \overline{x}_{1,1}\,\overline{x}_{2,2}\,x_{1,2}\,x_{2,1}\) satisfies the positive reduct, so we can learn the clause \(( \overline{x}_{1,1} \vee \overline{x}_{2,2} \vee x_{1,2} \vee x_{2,1})\) with witness \(\omega \) added to the proof.

Fig. 2
figure 2

Assignments and propagation used in Example 3

Example 3

In this example, (a) and (b) refer to Fig. 2. This example considers the positive reduct generated from an assignment after unit propagation and shows how propagated literals can be removed from the learned PR clause. After assigning \(\alpha = x_{1,1}\,x_{2,2}\), shown in (a), then performing unit propagation, the new assignment is \(\alpha = x_{1,1}\,x_{2,2}\,\overline{x}_{1,2}\,\overline{x}_{2,1}\), shown in (b). The resulting positive reduct is satisfiable, with witness \(\omega = \overline{x}_{1,1}\,\overline{x}_{2,2}\,x_{1,2}\,x_{2,1}\). Instead of learning \(( \overline{x}_{1,1} \vee \overline{x}_{2,2} \vee x_{1,2} \vee x_{2,1})\), we can remove propagated literals and learn the clause \(( \overline{x}_{1,1} \vee \overline{x}_{2,2} )\) that blocks the assignment in (a), and this binary clause is far more effective at pruning the search space.

SaDiCaL [17] uses satisfaction-driven clause learning (SDCL) that extends CDCL by learning PR clauses [19] based on (filtered) positive reducts. SaDiCaL uses an inner/outer solver framework. The outer solver attempts to solve the SAT problem with SDCL. SDCL diverges from the basic CDCL loop when unit propagation after a decision does not derive a conflict. In this case a reduct is generated using the current assignment, and the inner solver attempts to solve the reduct using CDCL. If the reduct is satisfiable, the PR clause blocking the current assignment is learned, and the SDCL loop continues. The PR clause can be simplified by removing all non-decision variables from the assignment. SaDiCaL emits PR proofs by logging the satisfying assignment of the reduct as the witness, and these proofs are verified with DPR-trim. The key to SaDiCaL finding good PR clauses leading to short proofs is the decision heuristic, because variable selection builds the candidate PR clauses. Hand-crafted decision heuristics enable SaDiCaL to find short proofs on pigeonhole and mutilated chessboard problems. However, these heuristics differ significantly from the score-based heuristics in most CDCL solvers. Our experiences with SaCiDaL suggest that improving the heuristics for SDCL reduces the performance of CDCL and vice versa. This may explain why SaDiCaL performs worse than standard CDCL solvers on the majority of the SAT competition benchmarks. While SaDiCaL integrates finding PR clauses of arbitrary size in the main search loop, our tool focuses on learning short PR clauses as a preprocessing step. This allows us to develop good heuristics for PR learning without compromising the main search loop.

5 Extracting PR Clauses

PReLearn is a preprocessor that adds short PR clauses to a formula. The new formula which now contains the additional PR clauses can be solved by an off-the-shelf SAT solver. In this section, we first discuss an overview of how PReLearn fits in the general SAT solving tool-chain. Next, we describe the process for finding candidate short PR clauses. Then, we provide a method for determining if a candidate PR clause can be learned by solving the positive reduct. We present several additional configurations for finding and learning PR clauses that do not appear in the experimental evaluation. Finally, we detail the implementation of PReLearn through pseudocode.

5.1 Overview of PReLearn

Fig. 3
figure 3

Solving a formula with PReLearn and a CDCL solver

The goal of PReLearn is to find useful PR clauses that improve the performance of CDCL solvers on both satisfiable and unsatisfiable instances. Figure 3 shows how a SAT problem is solved using PReLearn. For some preset time limit, PR clauses are found and then added to the original formula. When the preprocessing stage ends, the new formula that includes learned PR clauses is solved by a CDCL solver. If the formula is satisfiable, the solver will produce a satisfying assignment. If the formula is unsatisfiable, a refutation proof of the original formula can be computed by combining the satisfaction preserving proof from PReLearn and the refutation proof emitted by the CDCL solver. The complete proof can be verified with DPR-trim.

PReLearn alternates between finding PR clauses and learning PR clauses. Candidate PR clauses are found by iterating over each variable in the formula, and for each variable constructing clauses that include that variable. To determine if a clause is PR, the positive reduct generated by that clause is solved. We use unit propagation on the original formula to construct the positive reduct. When unit propagation after assigning a single literal derives the empty clause, the negation of the failed literal is RUP and is learned as a unit. This is in contrast to a PR unit found by solving the positive reduct, which requires storing a witness in the proof. It can be costly to generate and solve many positive reducts, so heuristics are used to find candidate clauses that are more likely to be PR. It is possible to find multiple PR clauses that conflict with each other. PR clauses are conflicting if adding one of the PR clauses to the formula makes the other no longer PR. Learning PR clauses involves selecting PR clauses that are nonconflicting. The selection may maximize the number of PR clauses learned or optimize for some other metric. Adding PR clauses and failed literals may cause new clauses to become PR, so the entire process is iterated multiple times.

5.2 Finding PR Clauses

PR clauses are found by constructing a set of candidate clauses and solving the positive reduct generated by each clause. In SaDiCaL the candidates are the clauses blocking the partial assignment of the solver after each decision in the SDCL loop that does not derive a conflict. In effect, candidates are constructed using the solver’s variable decision heuristic. We take a more general approach, constructing sets of candidates for each variable based on unit propagation and the partial assignment’s \(\textsf{neighbors}\).

For a formula F and variable x, \(\textsf{neighbors}(F, x)\) denotes the set of variables occurring in clauses containing literal x or \(\overline{x}\), excluding variable x. For a partial assignment \(\alpha \), \( \textsf{neighbors}(F, \alpha )\) denotes \(\bigcup _{x \in \textsf{var}(\alpha )} \textsf{neighbors}(F, x) {\setminus } \textsf{var}(\alpha )\). Candidate clauses for a literal \(\ell \) are generated in the following way:

  • Let \(\alpha \) be the partial assignment found by unit propagation starting with the assignment that makes \(\ell \) true.

  • Generate the candidate PR clauses \(\{ (\overline{\ell }\vee y), (\overline{\ell }\vee \overline{y}) \; \mid \; y \in \textsf{neighbors}(F, \alpha ) \}\).

Example 4 shows how candidate binary PR clauses are constructed using a single polarity of an initial variable x. This can also be done by assigning x to false and proceeding with candidate generation in a similar way. If x was assigned false, candidate PR clauses would be of the form \((x \vee y), (x \vee \overline{y})\) for some variable y. The example also describes how larger sets of candidate clauses can be created with recursive applications of \(\textsf{neighbors}\). The is important for solving the mutilated chess problem from Sect. 5.5.

Fig. 4
figure 4

Neighbors visualizations used in Example 4

Example 4

In this example, (a) and (b) refer to Fig. 4. To find the neighbors for a candidate variable \(x_{1,1}\) we first assign \(x_{1,1}\) to true (green), then perform unit propagation assigning \(x_{2,1}\) to false (red). With \(\alpha = x_{1,1}\,\overline{x}_{2,1}\), \( \textsf{neighbors}(F, \alpha ) = \{ x_{1,2}, x_{2,2}, x_{2,3}\}\) (blue), shown in (a). Using these variables, we can construct the following candidate PR clauses, \( (\overline{x}_{1,1} \vee x_{1,2}), (\overline{x}_{1,1} \vee \overline{x}_{1,2}), \ldots , (\overline{x}_{1,1} \vee x_{2,3}), (\overline{x}_{1,1} \vee \overline{x}_{2,3})\).

We can extend the candidates by taking \(\textsf{neighbors}( F, \textsf{neighbors}(F, \alpha )) = \{ x_{3,3}, x_{4,3}\}\), shown as yellow in (b). This will increase the number of candidate PR clauses to test. In general, we can continue to iteratively extend the the candidates by calculating the \(\textsf{neighbors}\) of the previous iteration.

We consider both polarities when constructing candidates for a variable. After all candidates for a variable are constructed, the positive reduct for each candidate is generated and solved in order. Note that propagated literals appearing in the partial assignment do not appear in the PR clause. The satisfying assignment is stored as the witness and the PR clause may be learned immediately depending on the learning configuration.

This process is naturally extended to ternary clauses. The binary candidates are generated, and for each candidate \((x \vee y )\), x and y are assigned to false in the first step. The variables \(z \in \textsf{neighbors}(F,\alpha )\) yield clauses \(( x \vee y \vee z)\) and \(( x \vee y \vee \overline{z})\). This approach can generate many candidate ternary clauses depending on the connectivity of the formula since each candidate binary clause is expanded. A filtering operation would be useful to avoid the blow-up in number of candidates. There are likely diminishing returns when searching for larger PR clauses because (1) there are more possible candidates, (2) the positive reducts are likely larger, and (3) each clause blocks less of the search space. We consider only unit and binary candidate clauses in our main evaluation.

Ideally, we should construct candidate clauses that are likely PR to reduce the number of failed reducts generated. Note, the (filtered) positive reduct can only be satisfiable if given the partial assignment there exists a reduced, satisfied clause. By focusing on neighbors, we guarantee that such a clause exists. The reduced heuristic in SaDiCaL finds variables in all reduced but unsatisfied clauses. Given a formula F and assignment \(\alpha \), . The idea behind this heuristic is to direct the assignment towards conditional autarkies that imply a satisfiable positive reduct [19]. The \(\textsf{neighbors}\) approach generalizes this to variables in all reduced clauses whether or not they are unsatisfied. A comparison can be found in Sect. 5.4.

5.3 Learning PR Clauses

Given multiple clauses that are PR w.r.t. the same formula, it is possible that some of the clauses conflict with each other and cannot be learned simultaneously. Example 5 below shows how learning one PR clause may invalidate the witness of another PR clause. It may be that a different witness exists, but finding it requires regenerating the positive reduct to include the learned PR clause and solving it. The simplest way to avoid conflicting PR clause is to learn PR clauses as they are found. When a reduct is satisfiable, the PR clause is added to the formula and logged with its witness in the proof. Then subsequent reducts will be generated from the formula including all added PR clauses. Therefore, a satisfiable reduct ensures a PR clause can be learned.

Alternatively, clauses can be found in batches, then a subset of nonconflicting clauses can be learned. The set of conflicts between PR clauses can be computed in polynomial time. For each pair of PR clauses C and D, if the partial assignment that generated the pruning predicate for D satisfies C and C is not satisfied by the witness of D, then C conflicts with D. Intuitively, if the partial assignment \(\alpha \) that generated the pruning predicate for D satisfies C then C will appear in the positive reduct generated for D after removing literals from C not assigned by \(\alpha \). If this clause is not satisfied by the previous witness for D, then the previous witness for D no longer satisfies the positive reduct, making the witness invalid. In some cases reordering the two PR clauses may avoid a conflict. In Example 5 learning the second clause would not affect the validity of the first clauses’ witness. Once the conflicts are known, clauses can be learned based on some heuristic ordering. Batch learning configurations are discussed more in the following section.

Example 5

Assume the following clause witness pairs are valid in a formula F: \(\{( x_{1} \vee x_{2} \vee x_{3} ), x_{1}\,\overline{x}_{2}\)\(\overline{x}_{3} \}\), and \(\{( x_{1} \vee \overline{x}_{2} \vee x_{4} ), \overline{x}_{1}\)\(\overline{x}_2\)\(x_{4}\}\). The first clause conflicts with the second. If the first clause is added to F, the clause \( ( x_{1} \vee x_{2} ) \) would be in the positive reduct for the second clause, but it is not satisfied by the witness of the second clause.

5.4 Additional Configurations

The sections above describe the PReLearn configuration used in the main evaluation, i.e., finding candidate PR clauses with the \(\textsf{neighbors}\) heuristic and learning clauses instantly as the positive reducts are solved. In this section we present several additional configurations.

In batch learning a set of PR clauses are found in batches then learned. Learning as many nonconflicting clauses as possible coincides with the maximum independent set problem. This problem is NP-Hard. We approximate the solution by adding the clause causing the fewest conflicts with unblocked clauses. When a clause is added, the clauses it blocks are removed from the batch and conflict counts are recalculated Alternatively, clauses can be added in a random order. Random ordering requires less computation at the cost of potentially fewer learned PR clauses.

The \(\textsf{neighbors}\) heuristic for constructing candidate clauses can be modified to include a depth parameter. \(\textsf{neighbors}_i\) indicates the number of iterations expanding the variables. For example, \(\textsf{neighbors}_2\) expands on the variables in \(\textsf{neighbors}_1\), seen in Example 4. We also implement the \(\textsf{reduced}\) heuristic, shown in Example 6. Detailed evaluations and comparisons can be found in our repository. In general, we found that the additional configurations did not improve on our main configuration. Also, increasing the timeout for PReLearn by \(5\times \)’s would increase the number of PR clauses learned when using larger values of i in \(\textsf{neighbors}_i\), but these additional PR clauses did not improve solver performance. More work needs to be done to determine when and how to apply these additional configurations.

Example 6

Given the assignment \(\alpha = x_{1,1}\,\overline{x}_{2,1}\) from Example 4, the only clause reduced but not satisfied is \((x_{2,1} \vee x_{2,2} \vee x_{2,3})\), yielding the candidate variables \(\{ x_{2,2}, x_{2,3}\}\). This is a smaller set than \( \textsf{neighbors}(F, \alpha ) = \{ x_{1,2}, x_{2,2}, x_{2,3}\}\), because \(\textsf{neighbors}\) does not consider if the clause is satisfied, and will include \(x_{1,2}\) from the satisfied clause \((x_{1,1} \vee x_{1,2})\).

5.5 Implementation

Algorithm 1
figure a

PReLearn (F : CNF)

PReLearn was implemented using the inner/outer-solver framework in SaDiCaL, and the general algorithm for the outer solver is presented in Algorithm 1. The outer solver takes a formula F as input, and learns clauses by adding them to the formula while writing clauses and witnesses to a proof. Instead of performing a complete search procedure like CDCL, the outer solver searches for short clauses to learn. The outer loop ranges over both polarities of each variable in the formula, selecting candidate literals \(\ell \). Given a set of variables V, the function \( Both \) returns set of literals \(\bigcup _{x \in V} \{x, \overline{x} \}\). In line 2, it propagates all unit clauses and simplifies the formula (i.e., removes falsified literals from clauses and removes satisfied clauses from the formula). This ensures that as PReLearn learns unit clauses they are removed from the formula and do not affect candidate generation (which depends on unit propagation). If the candidate literal \(\ell \) is assigned, the candidate is skipped and the next candidate literal is considered. The assignment of \(\ell \) in \(\alpha \) on line 6 is achieved by deciding on \(\ell \) within the outer solver at the top decision level. The unit propagation algorithm propagates an input assignment \(\alpha \) on an input formula, adding propagated literals to \(\alpha \) during the procedure, and returns UNSAT if a conflict is found. \(\alpha \) is represented internally as the trail of the outer solver. The function call in line 7 checks if \(\ell \) is a failed literal, and if so learns \(\overline{\ell }\). The \( Learn \) function adds a clause to the input formula and writes a clause and witness to the proof (the witness is empty for a failed literal since it is RUP). In line 11, the positive reduct is generated for the assignment \(\alpha \) after propagating \(\ell \). If the inner solver returns SAT, then the satisfying assignment to the positive reduct (\(\omega \)) is used as the witness for the unit PR clause \(\overline{\ell }\). In the case of a failed literal or unit PR clause, the procedure continues with the next candidate literal.

Candidate binary PR clauses are tested in lines 15–24. Line 15 ranges over both polarities of all of the \(\textsf{neighbors}{}\) of \(\alpha \), and this can be substituted with any procedure that finds candidate variables (e.g., the reduced heuristic). The assignment of k in \(\alpha '\) is achieved by deciding on k within the outer solver at the first decision level. Again, unit propagation is necessary to obtain the new assignment \(\alpha \) in order to generate the positive reduct. If the reduct is SAT, then the satisfying assignment (\(\omega \)) to the positive reduct is used as the witness for the binary PR clause \((\overline{\ell } \vee \overline{k})\). Upon each subsequent iteration of this inner loop, the assignment in line 16 is achieved by backtracking one decision level, (unassigning the previous k), then deciding on the new literal k.

In this pseudocode, clauses are learned immediately and added to the formula, so in subsequent calls to unit propagation, all learned units will be propagated and learned binary PR clauses will be included in the formula. For this reason, after learning a binary PR clause we move on to the next candidate variable in the outer for loop, instead of finding more PR clauses with the same candidate. Alternatively, the \( Learn \) function could store found binary PR clauses, and every so often select some of the non-conflicting binary PR clauses to learn and add to the formula in a batch.

6 Mutilated Chessboard

The mutilated chessboard is an \(N \times N\) grid of alternating black and white squares with two opposite corners removed. The problem is whether or not the the board can be covered with \(2 \times 1\) dominoes. This can be encoded in CNF by using variables to represent domino placements on the board. At-most-one constraints say only one domino can cover each square, and at-least-one constraints say some domino must cover each square.

In recent SAT competitions, no proof-generating SAT solver could deal with instances larger than \(N = 18\). In ongoing work, we found refutation proofs that contain only units and binary PR clauses for some boards of size \(N \le 30\). PReLearn can be modified to automatically find proofs of this type. Running iterations of PReLearn until saturation, meaning no new binary PR clauses or units can be found, yields some set of units and binary PR clauses. Removing the binary PR clauses from the formula and rerunning PReLearn will yield additional units and a new set of binary PR clauses. Repeating the process of removing binary PR clauses and keeping units will eventually derive the empty clause for this problem. Figure 6 gives detailed values for \(N=20\). Within each execution (red dotted lines) there are at most 10 iterations (red tick markers), and each iteration learns some set of binary PR clauses (red). Some executions saturate binary PR clauses before the tenth iteration and exit early. At the end of each execution the binary PR clauses are deleted, but the units (blue) are kept for the following execution. A complete DPR proof (PR with deletion) can be constructed by adding deletion information for the binary PR clauses removed between each execution when concatenating the PReLearn proofs. The approach works for mutilated chess because in each execution there are many binary PR clauses that can be learned and will lead to units, but they are mutually exclusive and cannot be learned simultaneously. Further, adding units allows new binary PR clauses to be learned in following executions.

Fig. 5
figure 5

Occurrences of two horizontal dominoes may be replaced by two vertical dominos in a solution. Similarly, occurrences of a horizontal domino atop two vertical dominos can be replaced by shifting the horizontal domino down

Fig. 6
figure 6

Unit and binary PR clauses learned each execution (red-dotted line) until the empty clause was learned. Markers on binary PR lines represent an iteration within an execution. (Color figure online)

Table 1 Statistics running multiple executions of PReLearn on the mutilated chessboard problem with the configurations described below

Table 1 shows the statistics for PReLearn. Achieving these results required some modifications to the configuration of PReLearn. First, notice in Fig. 5 the PR clauses that can be learned involve blocking one domino orientation that can be replaced by a symmetric orientation. To optimize for these types of PR clauses, we only constructed candidates where the first literal was negative. The \(\textsf{neighbors}\) heuristic had to be increased to a depth of 6, meaning more candidates were generated for each variable. Intuitively, the proof is constructed by adding binary PR clauses in order to find negative units (dominos that cannot be placed) around the borders of the board. Following iterations build more units inwards, until a point is reached where units cover almost the entire board. This forces an impossible domino placement leading to a contradiction. Complete proofs using only units and binary PR clauses were found for boards up to size \(N=24\) within 5000 seconds. We verified all proofs using DPR-trim. The mutilated chessboard has a high degree of symmetry and structure, making it suitable for this approach. For most problems it is not expected that multiple executions while keeping learned units will find new PR clauses.

Experiments were done with several configurations (see Sect. 5.4) to find the best results (presented above). The \(\textsf{reduced}\) heuristic (a subset of \(\textsf{neighbors}\)) did not yield complete proofs. The same was true for \(\textsf{neighbors}\) when the depth parameter was not large enough. The configurations that worked best were those that tested many candidate PR clauses, allowing units to be found in each successive iteration and eventually completing the proof. In fact, we found that increasing the depth of \(\textsf{neighbors}\) was necessary for larger boards including \(N = 24\).

We know of PR proofs using only unit and binary PR clauses that are shorter than the proofs PReLearn produced. One way to achieve a more optimal proof size is through batch learning – systematically adding only the PR clauses that are most effective in the proof – instead of adding PR clauses immediately after they are found. The current heuristics for batch learning, random and sorted, are not clever enough to achieve this result.

7 SAT Competition Benchmarks

We evaluated PReLearn on previous SAT competition formulas. Formulas from the ’13, ’15, ’16, ’19, ’20, and ’21 SAT competitions’ main tracks were grouped by size. 0–10k contains the 323 formulas with less than 10, 000 clauses and 10–50k contains the 348 formulas with between 10, 000 and 50, 000 clauses. In general, short PR proofs have been found for hard combinatorial problems typically having few clauses (0–10k). These include the pigeonhole and mutilated chessboard problems, some of which appear in 0–10k benchmarks. The PR clauses that can be derived for these formulas are intuitive and almost always beneficial to solvers. Less is known about the impact of PR clauses on larger formulas, motivating our separation of test sets by size. The repository containing the preprocessing tool, experiment configurations, and experiment data can be found at https://zenodo.org/record/7882172.

We ran our experiments on StarExec [31]. The specs for the compute nodes can be found online.Footnote 2 The compute nodes that ran our experiments were Intel Xeon E5 cores with 2.4 GHz, and all experiments ran with 64 GB of memory and a 5000 seconds timeout. We run PReLearn for 50 iterations over 100 seconds, exiting early if no new PR clauses were found in an iteration.

PReLearn was executed as a stand-alone program, producing a derivation proof and a modified CNF. For experiments, the CDCL solver Kissat [6] was called once on the original formula and once on the modified CNF. Kissat was selected because of its high-rankings in previous SAT competitions, but we expect the results to generalize to other CDCL SAT solvers.

In the satisfiable case, the derivation for the learned PR clauses was verified using a forward check in DPR-trim, and the satisfying assignment found by Kissat was verified by the StarExec post-processing tool. In the unsatisfiable case, we verified complete proofs with a formally-verified proof checker. To do this, the derivation for the learned PR clauses was concatenated to the proof traced by Kissat. The proof was then passed through DPR-trim to produce a proof with hints, which was then checked by Cake-LPR. Only two proofs were not verified on the cluster because of resource limitations (timeouts), so we verified them locally.

Table 2 Fraction of benchmarks where PR clauses were learned, average runtime of PReLearn, generated positive reducts and satisfiable positive reducts (PR clauses learned), and number of failed literals found
Table 3 Number of total solved instances and exclusive solved instances running Kissat with and without PReLearn

Table 2 shows the cumulative statistics for running PReLearn on the benchmark sets. PR clauses are found in about one third of the formulas (174 of the 323 small formulas and 115 of the 348 larger formulas), showing our approach generalizes beyond the canonical problems for which we knew PR clauses existed. Expanding the exploration and increasing the time limit did not help to find PR clauses in the remaining one third. The number of satisfiable reducts is the number of learned PR clauses, because PR clauses are learned immediately after the reduct is solved. These include both unit and binary PR clauses. A very small percentage of generated reducts is satisfiable, and subsequently learned. This is less important for small formulas when reducts can be computed quickly and there are fewer candidates to consider. However, for the 10–50k formulas the average runtime more than triples, but the number of generated reducts less than doubles.

Table 3 gives a high-level picture of PReLearn’s impact on Kissat. PReLearn significantly improves performance on 0–10k SAT and UNSAT benchmarks. These contain the hard combinatorial problems including pigeonhole that PR clauses are well-suited for. There were 5 additional SAT formulas solved with PReLearn that Kissat alone could not solve. This shows that PReLearn impacts not only hard unsatisfiable problems but satisfiable problems as well. On the other hand, the addition of PR clauses makes some problems more difficult. This is clear with the 10–50k results, where 2 benchmarks are solved exclusively with PReLearn and 5 are solved exclusively without. Additionally, PReLearn improved Kissat’s performance on 98 of 671 or approximately \(15\%\) of benchmarks. This is a large portion of benchmarks, both SAT and UNSAT, for which PReLearn is helpful.

Fig. 7
figure 7

Execution times w/ and w/o PReLearn on 0–10k (top) and 10–50k (bottom) benchmarks. The left-hand point of each segment shows the time for the SAT solver alone; the right-hand point indicates the combined time for preprocessing and solving

Figure 7 gives a more detailed picture on the impact of PReLearn per benchmark. In the scatter plot the left-hand end of each line indicates the Kissat execution time, while the length of the line indicates the PReLearn execution time, and so the right-hand end gives the total time for PReLearn plus Kissat. Lines that cross the diagonal indicate that the preprocessing improved Kissat’s performance but ran for longer than the improvement. PReLearn improved performance for points above the diagonal. Points on the dotted-lines (timeout) are solved by one configuration and not the other.

The top plot gives the results for the 0–10k formulas, with many points on the top timeout line as expected. These are the hard combinatorial problems that can only be solved with PReLearn. In general, the unsatisfiable formulas benefit more than the satisfiable formulas. PR clauses can reduce the number of solutions in a formula and this may explain the negative impact on many satisfiable formulas. However, there are still some satisfiable formulas that are only solved with PReLearn.

In the bottom plot, formulas that take a long time to solve (above the diagonal in the upper right-hand corner) are helped more by PReLearn. Many of these formulas are satisfiable, unlike for the smaller benchmarks. Most of the formulas solved within 100 seconds barely cross the diagonal, indicating that the addition of PR clauses provided a negligible benefit.

The results in Fig. 7 are encouraging, with many formulas significantly benefitting from PReLearn. PReLearn improves the performance on both SAT and UNSAT formulas of varying size and difficulty. In addition, lines that cross the diagonal imply that improving the runtime efficiency of PReLearn alone would produce more improved instances. For future work, it would be beneficial to classify formulas before running PReLearn. There may exist general properties of a formula that signal when PReLearn will be useful and when PReLearn will be harmful to a CDCL solver. For instance, a formula’s community structure [3] may help focus the search to parts of the formula where PR clauses are beneficial.

7.1 Benchmark Families

In this section we analyze benchmark families that PReLearn had the greatest positive (negative) effect on, found in Table 4. Studying the formulas PReLearn works well on may reveal better heuristics for finding good PR clauses.

Table 4 Some formulas solved by Kissat exclusively with PReLearn (top) and some formulas solved exclusively without PReLearn (bottom)

It has been shown that PR works well for hard combinatorial problems based on perfect matchings [16, 18]. The perfect matching benchmarks (randomG) [8] are a generalization of the pigeonhole (PHP) and mutilated chessboard problems with varying at-most-one encodings and edge densities. The binary PR clauses can be intuitively understood as blocking two edges from the perfect matching if there exist two other edges that match the same nodes. These benchmarks are relatively small but extremely hard for CDCL solvers. Symmetry-breaking with PR clauses greatly reduces the search space and leads Kissat to a short proof of unsatisfiability. PReLearn also benefits other hard combinatorial problems that use pseudo-Boolean constraints. The pseudo-Boolean (Pb-chnl) [24] benchmarks are based on at-most-one constraints (using the pairwise encoding) and at-least-one constraints. These formulas have a similar graphical structure to the perfect matching benchmarks. Binary PR clauses block two edges when another set of edges exists that are incident to the same nodes.

For the other benchmark family that benefited from PReLearn, the intuition behind PR learning is less clear. The fixed-shape random formulas (FSF) [29] are parameterized non-clausal random formulas built from hyper-clauses. The SAT encoding makes use of the Plaisted-Greenbaum transformation, introducing circuit-like structure to the problem. It cannot be determined without a deeper knowledge of the benchmark how PR clauses are improving the solving time.

The relativized pigeonhole problem (RPHP) [4] involves placing k pigeons in \(k-1\) holes with n nesting places. This problem has polynomial hardness for resolution, unlike the exponential hardness of the classical pigeonhole problem. The symmetry-breaking preprocessor BreakID [10] generates symmetry-breaking formulas for RPHP that are easy for a CDCL solver. PReLearn can learn many PR clauses but the formula does not become easier. Note PReLearn can solve the php with \(n=12\) in a second.

One problem is clause and variable permuting (a.k.a. shuffling), where variable names are permuted within a formula, or clause ordering is shuffled (neither operation changes the meaning of the formula but may affect solver heuristics). The mutilated chessboard problem can still be solved by PReLearn after permuting variables and clauses. The pigeonhole problem can be solved after permuting clauses but not after permuting variable names. In PReLearn, PR candidates are sorted by variable name independent of clause ordering, but when the variable names change the order of learned clauses changes. In the mutilated chessboard problem there is local structure, so similar PR clauses are learned under variable renaming. In the pigeonhole problem there is global structure, so a variable renaming can significantly change the binary PR clauses learned and cause earlier saturation with far fewer units. These benchmarks motivated a further exploration of the robustness of PReLearn in Sect. 8.

Another problem is that the addition of PR clauses can change the existing structure of a formula and negatively affect CDCL heuristics. The Pythagorean Triples Problem (PTN) [20] asks whether monochromatic solutions of the equation \(a^{2} + b^{2} = c^{2}\) can be avoided. The formulas encode numbers \(\{1, \ldots , 7824\}\), for which a valid 2-coloring is possible. In the namings, the N in bN denotes the number of backbone literals added to the formula. A backbone literal is a literal assigned true in every solution. Adding more than 20 backbone literals makes the problem easy. For each formula Kissat can find a satisfying assignment, but timeouts with the addition of PR clauses. For one instance, adding only 39 PR clauses will lead to a timeout. In some hard SAT and UNSAT problems, solvers require some amount of luck and adding a few clauses or shuffling a formula can cause a CDCL solver’s performance to sharply decrease. For example, we found that adding the found PR clauses to the beginning of the formula instead of the end, or removing blocked clauses from the set of found PR clauses, improved the solving time of Kissat. The Pythagorean Triples Problem was originally solved with a local search solver, and local search still performs well after adding PR clauses.

In a straight-forward way, one can avoid the negative effects of adding harmful PR clauses by running two solvers in parallel: one with PReLearn and one without. This fits with the portfolio approach for solving SAT problems.

8 Robustness of PReLearn

Preprocessing is necessary for state-of-the-art SAT solvers to achieve good performance on a diverse benchmark set. In general, preprocessing can significantly change the structure of a formula by removing literals from clauses, removing clauses, and propagating literals. There are a multitude of preprocessing techniques, many of which are run repeatedly during a solver’s execution. Therefore, new preprocessing techniques must be robust against changes to the formula in order to be effective in relation to other important forms of preprocessing. Recent work has shown that some preprocessing techniques are harmful to graph-based symmetry breaking methods [2]. The work presented a restricted set of preprocessing techniques that still allowed for, and aided, syntactic-based symmetry breaking. In addition to preprocessing, it is important that solving techniques are robust under clause order permutations (shuffling) and variable name permutations (renaming), as there is no guarantee of how a user will translate some problem into a formula. Graph-based symmetry breaking is resilient to such renamings and shuffling, as they will not affect the graphical structure of the formula.

PR clauses are found by solving the positive reduct. Preprocessing can significantly affect the structure of a positive reduct on certain literals, potentially turning a satisfiable reduct unsatisfiable. Furthermore, preprocessing can remove variables themselves either through propagation or elimination, nullifying any PR clause that may have contained those variables. It is unclear whether the combination of preprocessing techniques will prevent many PR clauses from being found, or whether new PR clauses will appear. With respect to clause shuffling and variable renamings, if PReLearn were to loop over every variable in the formula it should find all of the same PR clauses. However, learning PR clauses in a different order might block other PR clauses from being found and learned, and this could occur under a variable renaming.

8.1 Evaluation with Preprocessing

For this evaluation we perform preprocessing using the SAT solver CaDiCaL with flags -o inproc.cnf -c 10000. With this configuration, the solver returns the irredundant formula clauses after 10, 000 conflicts have been found. Before 10, 000 conflicts, CaDiCaL will have applied all of the standard preprocessing techniques to the formula. This approach mimics the preprocessing that would occur to a real problem before it was passed to another tool like PReLearn. There are four configurations we consider: preprocessing, PReLearn then preprocessing, preprocessing then PReLearn, and PReLearn then preprocessing then PReLearn. In each case PReLearn was run with the same configuration as the main evaluation. Experiments were run on the 0-10k benchmark set for 5000 seconds as in the main evaluation.

Figure 8 shows the cumulative instances solved for the four configurations including preprocessing and the fifth configuration with only PReLearn. The runtimes consist of the entire toolchain for each configuration, including preprocessing with CaDiCaL, preprocessing with PReLearn, and solving with Kissat. Only using preprocessing solves the fewest instances. Note that many of the inprocessing techniques from CaDiCaL are included in Kissat. This result shows that applying preprocessing before PReLearn will not be worse than only applying PReLearn. In other words, the PR clauses learned by PReLearn will still benefit solving even after preprocessing. However, preprocessing before PReLearn does affect the number of solved instances, producing slightly worse performance than applying PReLearn before preprocessing. The three configurations with PReLearn applied first show similar performance, suggesting that PReLearn is most effective when applied to the original formula before preprocessing, and nearly as effective after preprocessing.

The scatter plots in Fig. 9 show the number of PR clauses learned (top) and the execution times (bottom) for each formula. From the top plot it is clear that fewer PR clauses are learned after applying preprocessing, and in many formulas no PR clauses are learned after preprocessing. The bottom plot shows that execution times are varied, and fewer PR clauses does not necessarily mean worse performance. In fact, there are several problems solved exclusively when preprocessing is applied before PReLearn, and vice versa. However, this does not lead to a large difference in overall performance, as seen by the cumulative solved instances in Fig. 8.

Fig. 8
figure 8

Cumulative number of solved instances with different preprocessing configurations. In the legend, pr is a call to PReLearn, and preproc is a call to the preprocessor. After running some combination of the two, Kissat is called on the resulting formula

Fig. 9
figure 9

Number of unit and binary PR clauses learned (top) and execution times (bottom) with PReLearn after preprocessing vs. without preprocessing

Fig. 10
figure 10

Unit and binary PR clauses learned (top) execution times (bottom) with PReLearn on the original formulas vs. formulas after permuting variables

8.2 Evaluation with Variable Permutating

For this evaluation, we randomly permuted the variable names in the formula then ran the default PReLearn configuration on the modified formulas. The learned PR clauses were then permuted back to the original variable naming and appended to the original formula. With this method we could pinpoint the effect of variable permuting on PReLearn without including noise from variable permuting on solving with Kissat. We did not consider clause permuting because PReLearn sorts candidates based on variable naming so that it works independently of clause ordering; while the renaming of variables can impact the order variables are expanded and the choice of candidates. The runtimes consist of the preprocessing with PReLearn and solving with Kissat, but do not include the script for permuting variables before and after executing PReLearn.

The top plot of Fig. 10 shows the number of unit and binary PR clauses learned on the original formula versus the formula with permuted variables when applying PReLearn. For most instances, permuting variables within the formula had little impact on the number of PR clauses learned. There is an outlier, the SAT point below the diagonal with  100 learned PR clauses on the original formulas and  1000 learned PR clauses on the permuted formulas. There was one instance, battleship-13-25-sat, where in the original formula, the variable with name 1 is the first variable expanded by PReLearn. After propagating this variable, most other variables in the formula are \(\textsf{neighbors}{}\) of the assignment, so the candidate list is large, and the pruning predicates require nearly all clauses in the formula. Thus, PReLearn spends the entire 100 seconds looking for candidates that include the variable 1, finding only 100 PR clauses. After permuting variable names, a different variable is selected first. This new variable will not generate as many candidates, and so PReLearn can explore many more variables and find more PR clauses. This type of problem can arise in any formula where propagating a few variables touches all or most other variables in the formula. To avoid this, a limit can be set on the number of candidates each variable can generate, or on the size of the pruning predicate produced. This would allow PReLearn to search across the entire formula without getting stuck on candidates involving a small set of variables.

The bottom plot of Fig. 10 shows the execution time on the original formula versus the formula with permuted variables when applying PReLearn. There are a few UNSAT formulas that are solved without permutation, due to a difference of a few thousand PR clauses not learned after variable permuting. In one of these cases, PReLearn timed out with and without variable permuting, so an increase in the timeout may have brought the execution times closer together. In general, a small variation in the number of PR clauses added to a formula will negatively impact some formulas and positively impact others, but in most cases will not make a large difference.

9 Conclusion and Future Work

In this paper we presented PReLearn, a tool built from the SaDiCaL framework that learns PR clauses in a preprocessing stage. We developed several heuristics for finding PR clauses and multiple configurations for clause learning. In the evaluation we found that PReLearn improved the performance of the CDCL solver Kissat on many benchmarks from past SAT competitions. In addition, we showed that the performance of PReLearn does not decline after preprocessing a formula or permuting variables names.

For future work, quantifying the usefulness of each PR clause in relation to guiding the CDCL solver may lead to better learning heuristics. This is a difficult task that likely requires problem specific information. However, we found that for some problems where PR clauses made the solving time worse, many of the PR clauses were blocked and could be removed by an additional preprocessing tool. Finding a way to filter certain PR clauses as to not harm CDCL heuristics may be a general way to improve the effectiveness of PReLearn. Separately, failed clause caching can improve performance by remembering and avoiding candidate clauses that fail with unsatisfiable reducts in multiple iterations. This would be most beneficial for problems like the mutilated chessboard that have many conflicting PR clauses. Lastly, incorporating PReLearn during inprocessing may allow for more PR clauses to be learned. This could be implemented with the inner/outer solver framework but would require a significantly narrowed search. CDCL learns many clauses during execution and it would be infeasible to examine binary PR clauses across the entire formula.