Forced values of PPZ on the word RAM #
A partial assignment τ : Fin n → Option Bool is stored as n words, 0 or 1 for a set
variable and 2 for an unset one (Cslib.Algorithms.WordRAM.PPZ.PartialAt). The formula is
stored as in Cslib.Algorithms.WordRAM.Schoening.encodeClauses: each clause is its length followed
by the codes 2 v + b of its literals.
Cslib.Algorithms.WordRAM.PPZ.unitScan scans the clauses once and reports whether one of them is a
unit clause on the variable x with polarity b under τ (Cslib.Complexity.PPZ.IsUnitOn): a
clause that contains (x, b), whose literals on x all have polarity b, and whose other literals
τ falsifies. Cslib.Algorithms.WordRAM.PPZ.forcedCode runs it for the polarity true and then,
if needed, for false, and stores the word of Cslib.Complexity.PPZ.forced φ τ x
(Cslib.Algorithms.WordRAM.PPZ.forcedCode_spec). Both leave memory unchanged and take
O(E) instructions, where E is the length of the encoding of the clauses.
Main definitions #
Cslib.Algorithms.WordRAM.PPZ.optCode,Cslib.Algorithms.WordRAM.PPZ.PartialAt: storing a partial assignment.Cslib.Algorithms.WordRAM.PPZ.litHas,Cslib.Algorithms.WordRAM.PPZ.litOk: the two literal tests of a unit clause.Cslib.Algorithms.WordRAM.PPZ.unitScan,Cslib.Algorithms.WordRAM.PPZ.forcedCode: the scans.
Main results #
Cslib.Algorithms.WordRAM.PPZ.isUnitOn_iff: a unit clause through its literal tests.Cslib.Algorithms.WordRAM.PPZ.unitScan_spec: the scan finds a unit clause exactly when there is one.Cslib.Algorithms.WordRAM.PPZ.forcedCode_spec: the forced value, within28 E + 15instructions.
References #
Partial assignments #
The word of a value of a partial assignment: 0 or 1 when set, 2 when unset.
Unit clauses through literal tests #
Whether the literal l is (x, b).
The value forced by unit clauses, through the literal tests.
Registers #
Address of the first clause.
End address of the clauses.
Address of the stored partial assignment.
The number n of variables.
Address of the current clause.
Length of the current clause.
Address of the current literal.
End address of the current clause.
The current literal code.
The sign of the current literal.
Whether the current clause contains (x, b).
Whether every literal of the current clause passes litOk.
Whether a unit clause was found.
The word of the forced value.
The scan #
Test the literals in [lptr, lend).
Read the length of the clause at ptr and set up its literal loop.
After a clause: record whether it is a unit clause and move on.
One clause.
Test the clauses in [ptr, cEnd).
The registers the scan relies on. The scan writes none of them and leaves memory unchanged, so
a call of one of its parts proves the frame from the caller's (scanFrame_iff).
One literal.
The literal loop. From hasLit = h and ok = o, the loop over the literals ls ends with
hasLit = h || ls.any (litHas x b) and ok = o && ls.all (litOk τ x b), and unchanged memory.
The clause loop. From ptr at the encoding of the clauses ψ, which end at cEnd, and
fnd = f, the loop ends with fnd = f || ψ.any (unitTest τ x b) and unchanged memory.
The unit-clause scan. From the clauses of φ stored in [cBeg, cEnd), the scan reports
whether φ has a unit clause on x with polarity b under τ, within 14 E + 4 instructions,
where E is the length of the encoding, and leaves memory unchanged.
The forced value. From the clauses of φ stored in [cBeg, cEnd) and the partial
assignment τ stored at tBase, forcedCode stores optCode (forced φ τ x) in res within
28 E + 15 instructions, where E is the length of the encoding, and leaves memory unchanged.