An LRUP (RUP-only LRAT) checker on the word RAM: encoding and program #
This file states the input encoding and the program of a word-RAM LRUP (RUP-only LRAT) checker
that agrees with Cslib.Logic.PL.CNF.checkLRUP (accepting RUP additions, empty-clause steps and
deletions, and rejecting RAT steps; full LRAT with RAT steps CNF.checkLRATRat is not checked
here).
Encoding #
A literal (v, b) is the word 2 v + b (Cslib.Algorithms.WordRAM.ClauseCode.litCode), and a
clause is its length followed by the codes of its literals
(Cslib.Algorithms.WordRAM.ClauseCode.encodeClause), the encoding the word-RAM Schöning scan
uses. The input is the number of clauses of the
formula, the clauses, then the steps of the certificate
(Cslib.Algorithms.WordRAM.LRAT.encode). A step is a tag followed by its fields:
0, k, h₁, …, hₖ: the empty clause with hintsh₁, …, hₖ;1, i, c, k, h₁, …, hₖ: the clausec(encoded as above) with numberiand hints;2: a RAT step;3, k, i₁, …, iₖ: deletion of the clauses numberedi₁, …, iₖ.
The encoding keeps exactly what checkLRUP reads: it drops the number of an empty-clause step and
the contents of a RAT step, which the checker rejects, and it encodes a clause of DIMACS integers by
the literals Cslib.Logic.PL.Clause.ofDIMACS names, dropping 0s.
Memory #
With the input of length L at addresses 1, …, L, let T = L + 1. The clause numbered i is
found through the table cell T + 2 i, which holds the address of its encoding (0 when there is
none); formula clauses and added clauses are both read in place in the input. The literal with
code c is true in the current step when the cell T + 2 c + 1 holds the current step's stamp.
The assignment is indexed by literal rather than by variable because the trail of
checkLRUP may hold a literal and its negation at once, when an added clause is a tautology.
The stamp starts at 1 and increases after every accepted step, so the assignment never needs to
be cleared, and since word-RAM memory starts at zero (Cslib.WordRAM.Data.init), neither the
table nor the assignment needs to be initialised.
Main definitions #
Cslib.Algorithms.WordRAM.LRAT.encode: the input word list of a formula and a certificate.Cslib.Algorithms.WordRAM.LRAT.checker,Cslib.Algorithms.WordRAM.LRAT.program: the checker, as a structured program and as a flat program halting with its answer.
Its correctness and instruction bound are Cslib.Algorithms.WordRAM.LRAT.program_spec.
Encoding #
The words of a certificate step; see the module docstring.
The input of the checker: the number of clauses of φ, its clauses, and the steps of
cert.
Registers #
Constant 2, the tag of a RAT step.
Constant 3, the tag of a deletion.
One past the last input address.
The base T of the table and the assignment.
The number of formula clauses.
A length read from the input.
The stamp of the current step.
The tag of the current step.
End of the hints of the current step.
Address of the hinted clause.
Address of the current literal.
End address of the current clause.
The current literal code.
Whether a non-false literal was found in the hinted clause.
The non-false literal found.
Whether two different non-false literals were found.
The result of unit propagation.
Address of the encoding of the clause added by the current step.
The complementary literal code.
Unit propagation along hints #
One literal of a hinted clause: skip it when false, and otherwise record it as the unit, or note a second, different non-false literal.
The literals in [lptr, lend).
After scanning a hinted clause: a conflict ends propagation with success, a unit is assigned, and anything else ends propagation with failure.
One hint: look up its clause; a missing clause ends propagation with failure.
The hints in [ptr, hend).
Steps #
Assume the negation of a literal of the added clause.
Assume the negations of the literals in [lptr, lend).
Stop the run with output 0.
An empty-clause step: its result is the answer.
A RUP step: assume the negated clause, propagate, and on success record the clause's address in the table and advance the stamp.
One deleted clause number: clear its table cell.
A deletion step.
One step of the certificate, dispatched on its tag.
The steps in [ptr, endp); running out of steps leaves the output 0.
The checker #
One formula clause: record its address under the next clause number.
Number the nCl formula clauses from 1.
Set up the registers: constants, the end of the input, the table base, and the cursor at the first clause.
The LRAT checker as a flat program halting with out.