Clauses as words #
The word-RAM SAT programs store a literal (v, b) as the word 2 f(v) + b, where f numbers the
variables (Cslib.Algorithms.WordRAM.ClauseCode.litCodeBy), and a clause as its length followed by
the codes of its literals (Cslib.Algorithms.WordRAM.ClauseCode.encodeClauseBy). The variable's
number of a code is its shift right by one bit and the sign its low bit, so for injective f the
codes determine the literals (Cslib.Algorithms.WordRAM.ClauseCode.litCodeBy_injective), and
flipping the low bit negates the literal (Cslib.Algorithms.WordRAM.ClauseCode.litCodeBy_xor_one).
Programs over the variables ℕ, such as the LRAT checker, number them by id
(Cslib.Algorithms.WordRAM.ClauseCode.litCode, Cslib.Algorithms.WordRAM.ClauseCode.encodeClause);
programs over Fin n, such as Schöning's and PPSZ's, by Fin.val.
Main definitions #
Cslib.Algorithms.WordRAM.ClauseCode.litCodeBy,Cslib.Algorithms.WordRAM.ClauseCode.encodeClauseBy: the codes of literals and clauses.
Main results #
Cslib.Algorithms.WordRAM.ClauseCode.litCodeBy_shiftRight,Cslib.Algorithms.WordRAM.ClauseCode.litCodeBy_and_one: decoding the variable and the sign.Cslib.Algorithms.WordRAM.ClauseCode.litCodeBy_injective: the codes determine the literals.Cslib.Algorithms.WordRAM.ClauseCode.litCodeBy_xor_one: the low bit negates.
The word code 2 f(v) + b of the literal (v, b). Inlined, so that compiled code computes
the code without a call through f.
A clause is stored as its length followed by the codes of its literals.
The code of a literal over the variables ℕ.
The words of a clause over the variables ℕ.
Shifting a literal code right recovers the number of its variable.
The low bit of a literal code is its sign.
A literal code is at most twice the number of its variable plus one.
The codes determine the literals when f is injective.
The codes of literals over ℕ determine the literals.
Flipping the low bit negates: the code of the negation of a literal.
Negating a literal raises its code by at most one.