Minimizing learned clauses #
MiniSat's minimization of learned clauses. In its recursive mode (ccmin_mode = 2, Sörensson and
Biere), a literal y of a learned clause, false below the backjump point, is redundant when the
literal ¬y of the trail is implied and every other literal of its reason is either in the learned
clause or, recursively, redundant (Cslib.Algorithms.Lean.CDCL.derived). In its basic mode
(ccmin_mode = 1, MiniSat 1.13), the recursion goes only into the literals implied without any
decision, which MiniSat's test of level 0 admits. Removing every redundant literal
gives a clause that follows from the rest by unit propagation: assuming its negation, the reasons
of the derived literals, oldest first, propagate the negations of the removed literals, and then
the learned clause is false.
So the minimized clause is learned with the hints of the learned clause after those reasons
(Cslib.Algorithms.Lean.CDCL.Learned.minimize), still one RUP step, and the hints are proved to
refute it (Cslib.Algorithms.Lean.CDCL.Learned.propagateHints_redundant), with no check at run
time. The proof rests on the soundness of the memo of the search: a variable recorded as derived
has a reason on the trail whose other literals are on variables of the learned clause or recorded
as derived. The search records a variable as not derived while it searches its reason, so a
recorded result is never changed. Reasons point down the trail, so propagating the derived
literals oldest first reaches each reason with its other literals false. The minimized clause is a
subset of the learned one containing its asserting literal once, at its head, so it is again a
learned clause.
On the solver's array trail (Cslib.Algorithms.Lean.CDCL.ATrail), reasons are looked up in
constant time through self-certifying position hints (Cslib.Algorithms.Lean.CDCL.ATrail.reasonAt),
and the clause-variable and memo arrays are cleared along the variables touched and reused in place
across conflicts when unshared and within bounds.
Main definitions #
Cslib.Algorithms.Lean.CDCL.MinStep,Cslib.Algorithms.Lean.CDCL.derived,Cslib.Algorithms.Lean.CDCL.redundant: memoized search for derived literals.Cslib.Algorithms.Lean.CDCL.Learned.minimize: the minimized learned clause, reusing scratch arrays.
Main results #
Cslib.Algorithms.Lean.CDCL.Learned.propagateHints_redundant: the minimized clause, with the reasons of the derived literals, oldest first, before the hints of the learned clause, is a RUP clause.
References #
State of the memoized search for derived literals: ok holds the answer of the current step (or
whether any literal was removed in redundant), memo caches answers (some true for derived,
some false for not derived or active), and visited lists every variable written in memo so
the caller can clear memo in time proportional to the search.
Whether the literal of the trail on v is derived from the literals of the learned clause,
whose variables satisfy inC: its reason, looked up in log through reasonCode (0 for none or
a decision, r + 1 for reason r), has every other literal either on a variable of the learned
clause or, on a variable where deep allows the recursion, derived. The results are memoized in
memo, where v counts as not derived while its reason is searched; visited records every
variable written in memo; fuel bounds the depth of the search, and running out of it counts as
not derived.
Whether any literal of the clause C other than lit has its negation derived, together with
the memoized search and the list of variables written in memo.
The minimized clause is a RUP clause #
Removing derived literals yields a RUP clause, for any sound reason lookup reasonCode,
clause-variable predicate inC, depth filter deep, fuel, and empty initial memo₀.
derivedHints of the entries below position p, read in one pass from the arrays of the
trail.
Minimizing a learned clause, whose false literals are on the entries of the trail T below
position p, recursively if recursive (MiniSat's ccmin_mode = 2) and otherwise in the basic
way (ccmin_mode = 1): the learned clause without its redundant literals, together with the
restored scratch memo array. Reasons are looked up in constant time through ATrail.reasonAt vpos p, L.seenMarks is detached first so the clause variables are marked and cleared in place when
unshared and within bounds, and the memo is cleared along res.visited.