Phase saving for the CDCL solver #
MiniSat's choice of polarity for a decision (with phase_saving = 2). Every variable has a saved
phase, initially false, so a fresh variable is decided negative, as MiniSat's default polarity
does. When a backjump unassigns variables, each one's phase becomes the value it had on the trail
(Phases.save), and a later decision on it takes that value again (Phases.get). The solver thus
returns to the part of the search space it left, keeping the assignments of the subproblems it
had solved.
The polarity of a decision does not affect correctness.
Main definitions #
Cslib.Algorithms.Lean.CDCL.Phases: the saved phases.Cslib.Algorithms.Lean.CDCL.Phases.save: saving the phases of the literals undone by a backjump.
Main results #
Cslib.Algorithms.Lean.CDCL.Phases.get_save_of_mem,Cslib.Algorithms.Lean.CDCL.Phases.get_save_of_not_mem: on a trail assigning each variable once, each undone variable reads back the value it had, and every other variable keeps its phase.
Storage. The phases are an array indexed by variable; setting a variable past its end grows it.
WExec.init gives it varSlots φ slots, one more than the largest variable of the formula and
none for a formula without variables, so solveCompact, which renames the variables to
0, …, k - 1 first, keeps it at k slots.
Saved phases: a polarity for each variable, by index; variables past the end have the
phase false.
The saved polarity of each variable.
The initial phases of the variables below n: all false.
The phase of the variable v: the polarity of its next decision.
Saving the phases of the literals of M, which a backjump undoes: each variable takes the
value it had.
Saved phases are the undone values: on a trail assigning each variable once, saving its literals gives each of their variables the value it had.