Preprocessing of Propagation Redundant Clauses

The propagation redundant (PR) proof system generalizes the resolution and resolution asymmetric tautology proof systems used by conflict-driven clause learning (CDCL) solvers. PR allows short proofs of unsatisfiability for some problems that are difficult for CDCL solvers. Previous attempts to automate PR clause learning used hand-crafted heuristics that work well on some highly-structured problems. For example, the solver SaDiCaL incorporates PR clause learning into the CDCL loop, but it cannot compete with modern CDCL solvers due to its fragile heuristics. We present PReLearn, a preprocessing technique that learns short PR clauses. Adding these clauses to a formula reduces the search space that the solver must explore. By performing PR clause learning as a preprocessing stage, PR clauses can be found efficiently without sacrificing the robustness of modern CDCL solvers. On a large portion of SAT competition benchmarks we found that preprocessing with PReLearn improves solver performance. In addition, there were several satisfiable and unsatisfiable formulas that could only be solved after preprocessing with PReLearn. PReLearn supports proof logging, giving a high level of confidence in the results. Lastly, we tested the robustness of PReLearn by applying other forms of preprocessing as well as by randomly permuting variable names in the formula before running PReLearn, and we found PReLearn performed similarly with and without the changes to the formula.


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.
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.Fig. 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) 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 symmetrybreaking 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.

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 is either a variable x (positive literal) or a negated variable 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 , x 2 } is written An assignment α 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 , var( ) is the variable corresponding to , e.g., var(x 1 ) = var(x 1 ) = x 1 .The set of variables occurring in a formula, assignment, or clause is given by var(F), var(α), or var(C).Assignment α satisfies a positive (negative) literal if α maps var( ) to true (α maps var( ) to false, respectively), and falsifies it if α maps var( ) to false (α maps var( ) to true, respectively).We write a partial assignment as the set of literals it satisfies, e.g., x y mapping α(x) = 1 and α(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 α satisfies a clause C we define C | α = , otherwise C | α represents the clause C with the literals falsified by α removed.The empty clause is denoted by ⊥.The formula F reduced by an assignment α is given by is the clause that blocks α.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 α of all units in a formula F and generates F | α .Iteratively applying the unit clause rule until fixpoint is referred to as unit propagation.In cases where unit propagation yields ⊥ we say it derived a conflict.A formula F implies a formula F , denoted F | F , if every assignment satisfying F satisfies F .By F 1 F we denote that for every clause C ∈ 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 ∪ {{ }}, we say is a failed literal and the unit 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 and learning the unit if unit propagation derives a conflict, otherwise 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.

The PR Proof System
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 α the assignment blocked by C. Then C is PR w.r.t.F if and only if there exists an assignment ω such that F | α 1 F | ω and ω satisfies C. Intuitively, this allows inferences that block a partial assignment α as long as another assignment ω is as satisfiable.This means every assignment containing α that satisfies F can be transformed into an assignment containing ω 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: ).The at-least-one constraints for the top vertices are: In the examples below, F denotes the entire formula.
Example 1 From Fig. 1, the clause (x 1,1 ∨ 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 ω = x 1,2 x 2,1 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 ω are included.A clausal proof with witnesses has the form F, (C 1 , ω 1 ), (C 2 , ω 2 ), . . ., (C n , ω n ).The proof checker DPR-trim can efficiently check PR proofs that include witnesses.Further, DPR-trim1 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.

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, α an assignment, and C the clause that blocks α.The positive reduct p(F, α) of F with respect to α is the formula G ∧ C, where G is obtained from F by first removing all clauses that are not satisfied by α and then removing from the remaining clauses all literals that are not assigned by α.
Definition 2 (Definition 6 of [18]) Let F be a formula, α an assignment, and C the clause that blocks α.The filtered positive reduct f (F, α) of F with respect to α is the formula G ∧ C, where G is obtained from F by first removing all clauses that are not satisfied by α.Next, clauses are removed (filtered) if unit propagation on the formula F | α conjuncted with negated literals from the clause that are not assigned by α derives a conflict.Finally, all literals that are not assigned by α 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 α, solve the reduct based on α, 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].
satisfies the positive reduct, so we can learn the clause ) with witness ω added to the proof.

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 α = x 1,1 x 2,2 , shown in (a), then performing unit propagation, the new assignment is α ), we can remove propagated literals and learn the clause (x 1,1 ∨ 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.

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 toolchain.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.

Overview of PRELEARN
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.

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 neighbors.
For a formula F and variable x, neighbors(F, x) denotes the set of variables occurring in clauses containing literal x or x, excluding variable x.For a partial assignment α, neighbors(F, α) denotes x∈var(α) neighbors(F, x)\var(α).Candidate clauses for a literal are generated in the following way: • Let α be the partial assignment found by unit propagation starting with the assignment that makes true.
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 ∨ y), (x ∨ y) for some variable y.The example also describes how larger sets of candidate clauses can be created with recursive applications of neighbors.The is important for solving the mutilated chess problem from Sect.5.5.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 . Using these variables, we can construct the following candidate PR clauses, We can extend the candidates by taking neighbors(F, neighbors(F, α)) = {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 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 ∨ y), x and y are assigned to false in the first step.The variables z ∈ neighbors(F, α) yield clauses (x ∨ y ∨ z) and (x ∨ y ∨ 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 blowup 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 α, reduced(F, α) = var(F | α \ F).The idea behind this heuristic is to direct the assignment towards conditional autarkies that imply a satisfiable positive reduct [19].The 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.

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 α 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 α.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: The first clause conflicts with the second.If the first clause is added to F, the clause (x 1 ∨ x 2 ) would be in the positive reduct for the second clause, but it is not satisfied by the witness of the second clause.

Additional Configurations
The sections above describe the PReLearn configuration used in the main evaluation, i.e., finding candidate PR clauses with the 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 neighbors heuristic for constructing candidate clauses can be modified to include a depth parameter.neighbors i indicates the number of iterations expanding the variables.For example, neighbors 2 expands on the variables in neighbors 1 , seen in Example 4. We also implement the 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×'s would increase the number of PR clauses learned when using larger values of i in 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.

Implementation
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 .Given a set of variables V , the function Both returns set of literals x∈V {x, 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 is assigned, the candidate is skipped and the next candidate literal is considered.The assignment of in α on line 6 is achieved by deciding on within the outer solver at the top decision level.The unit propagation algorithm propagates an input assignment α on an input formula, adding propagated literals to α during the procedure, and returns UNSAT if a conflict is found.α is represented internally as the trail of the outer solver.The function call in line 7 checks if is a failed literal, and if so learns .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 α after propagating .If the inner solver returns SAT, then the satisfying assignment to the positive reduct (ω) is used as the witness for the unit PR clause .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 neighbors of α, and this can be substituted with any procedure that finds candidate variables (e.g., the reduced heuristic).The assignment of k in α 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 α in order to generate the positive reduct.If the reduct is SAT, then the satisfying assignment (ω) to the positive reduct is used as the witness for the binary PR clause ( ∨ 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.

Mutilated Chessboard
The mutilated chessboard is an N × 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 × 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 ≤ 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.
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  Total units includes failed literals and learned PR units.The average units and average binary PR clauses learned during each execution (Exe.) are shown as well orientation.To optimize for these types of PR clauses, we only constructed candidates where the first literal was negative.The 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 reduced heuristic (a subset of neighbors) did not yield complete proofs.The same was true for 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 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 proofinstead 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.

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. 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.Number of improved instances running Kissat with PReLearn.PReLearn execution times were included in total execution times.An instance was improved if it was solved at least a second faster and the difference in solving time was at least one percent 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 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 PRe-Learn and 5 are solved exclusively without.Additionally, PReLearn improved Kissat's 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.
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.

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.
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.Symmetrybreaking 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 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, . . ., 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.

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.

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 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 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.

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 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.

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.

Fig. 2
Fig. 2 Assignments and propagation used in Example 3

Fig. 3
Fig. 3 Solving a formula with PReLearn and a CDCL solver

Fig. 5 Fig. 6
Fig.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. 7
Fig. 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

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

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

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 4
Some formulas solved by Kissat exclusively with PReLearn (top) and some formulas solved exclusively without PReLearn (bottom) Clauses include PR clauses and failed literals learned 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.