RAT and PR steps in LRAT and LPR certificates #
Cslib.Logic.PL.CNF.checkLRUP checks the RUP-only (LRUP) fragment of LRAT: it rejects RAT
additions. The full LRAT format of
Cruz-Filipe et al. also adds clauses with the RAT
property. A clause C whose first literal is p has it with respect to a
formula F when, for every clause D of F containing ¬p, the resolvent C ∨ (D \ {¬p})
follows from F by unit propagation, or is a tautology. Adding such a clause does not preserve
the models of F, only its satisfiability: a model of F falsifying C becomes a model of
F ∧ C once p is made true. Solvers emit RAT steps for bounded variable addition, as CaDiCaL's
--factor does, and extended resolution.
Cslib.Logic.PL.CNF.checkLRATRat checks full LRAT certificates with RAT steps. A RAT step
.addRat id c _ rup rat carries RUP hints rup and RAT hints rat, pairs (i, hs) of a clause
number and a hint list. It is accepted (Cslib.Logic.PL.CNF.ratWith) when the RUP hints refute
the negation of c, or else when every clause d numbered i that contains ¬p has a
tautological resolvent with c or a resolvent refuted by unit propagation along rup followed
by the hints that rat gives to i. This is Algorithm check_RAT of the paper (Section 4),
with the following differences, each of which only accepts more certificates:
- the pivot is the first literal of the clause, as the paper's format requires (Section 3); the
step's
pivotfield, which Lean core's parser sets to that literal, is not read; - the RAT hints may come in any order, and hints naming clauses without
¬pare ignored; the paper's format lists the negative hints in increasing order (Section 3); - the RUP hints are propagated again in each resolvent check, rather than once before them, so a clause of the RUP part that is not yet unit does not reject the step.
As in the paper's algorithm, a candidate with a tautological resolvent needs no RAT hint, and a
RAT step with no candidate needs no hints at all: Lean core's parser reads a clause with no hints
as such a step, which is how CaDiCaL writes the definition clauses of --factor. Drat-trim's
lrat-check rejects those steps, since it does not check that no candidate exists.
The checker numbers clauses as checkLRUP does, and reads a clause number as its first entry in
the database, the clause a later one with the same number shadows being gone. Accepted
certificates refute their formula (Cslib.Logic.PL.CNF.not_satisfiable_of_checkLRATRat), and it
accepts every certificate checkLRUP accepts (Cslib.Logic.PL.CNF.checkLRATRat_of_checkLRUP), so
it is also complete (Cslib.Algorithms.Lean.DPLL.exists_checkLRATRat_iff). The RAT check is
written for any clause lookup and any test over the stored clauses, so that the kernel checker
Cslib.Logic.PL.CNF.checkLRATKernel and the array checker Cslib.Logic.PL.CNF.checkLRATFast
run the same check on their own databases.
PR steps and the LPR format #
A clause C is propagation redundant (PR) with respect to F when some assignment ω
satisfies C and F restricted by the negation α of C implies F restricted by ω by
unit propagation Tan, Heule and Myreen (Definition 2, which attributes the
notion to Heule, Kiesl and Biere). It suffices to check, for each clause D of F that ω
reduces (falsifies a literal of without satisfying it), that unit propagation refutes α and the
negation of D restricted by ω. A model of F falsifying C becomes a model of F ∧ C once
the literals of ω are made true. RAT is the case ω = {p}.
The LPR format of the same paper (Section 3, Fig. 1) writes the witness on the clause line of
LRAT: "the (potentially empty) witness starts from the second occurrence of the first literal of
the clause until the first 0 that separates the unit clause hints"; the unit hints for a reduced
clause follow as the RAT hints of LRAT. So Lean core's LRAT parser reads an LPR line as an LRAT
step whose clause is the clause followed by the witness, and Cslib.Logic.PL.Clause.splitWitness
splits it again. This is also how cake_lpr reads it: parse_clause_witness and
parse_until_k in examples/lpr_checker/lpr_parsingScript.sml of CakeML (commit 080a3bd)
return the literals before the repeat as the clause and the literals from it on as the witness.
Cslib.Logic.PL.CNF.prWith is the PR check of a step, the algorithm of Fig. 3 of the paper and
check_PR and is_PR of examples/lpr_checker/lprScript.sml in CakeML, with the differences
listed for ratWith above and these, each of which only accepts more certificates:
- a reduced clause that the witness also satisfies is skipped, as in the paper's Step 5.1;
cake_lprchecks its hints if it has any; - a reduced clause without a hint is checked by the RUP hints alone, and one whose restriction by
ω, added to the clause, is a tautology needs no hint; the paper's Step 5.3 skips such a clause only once its hint is found.
It also checks what Fig. 3 leaves to the format: that ω satisfies the clause, and that it is
consistent, as is_PR does.
Cslib.Logic.PL.CNF.checkLPR checks LPR certificates: an addition whose clause repeats its first
literal is a PR step with the witness read by splitWitness, and other additions are checked as
by checkLRATRat. Accepted certificates refute their formula
(Cslib.Logic.PL.CNF.not_satisfiable_of_checkLPR). The two checkers read the same certificate
differently when a clause repeats its first literal, which LRAT allows; on certificates where none
does (Cslib.Logic.PL.CNF.noWitness) they agree (Cslib.Logic.PL.CNF.checkLPR_eq_checkLRATRat).
Main definitions #
Cslib.Logic.PL.CNF.ratWith: the RAT check of a step.Cslib.Logic.PL.CNF.checkLRATRat: the full LRAT checker with RAT steps.Cslib.Logic.PL.Clause.splitWitness: the clause and the witness of an LPR addition.Cslib.Logic.PL.CNF.prWith: the PR check of a step.Cslib.Logic.PL.CNF.checkLPR: the LPR checker.
Main results #
Cslib.Logic.PL.CNF.exists_eval_of_ratWith: a RAT step keeps a database satisfiable.Cslib.Logic.PL.CNF.not_satisfiable_of_checkLRATRat: a formula with an accepted certificate is unsatisfiable.Cslib.Logic.PL.CNF.checkLRATRat_of_checkLRUP: the full LRAT checker accepts whatcheckLRUPaccepts.Cslib.Logic.PL.CNF.exists_eval_of_prWith: a PR step keeps a database satisfiable.Cslib.Logic.PL.CNF.not_satisfiable_of_checkLPR: a formula with an accepted LPR certificate is unsatisfiable.Cslib.Logic.PL.CNF.checkLPR_eq_checkLRATRat: on certificates whose clauses do not repeat their first literal, the LPR checker agrees with the LRAT checker.
References #
The clause and the witness of an LPR addition Tan et al. (Section 3):
if the first literal p of c occurs again, the clause is the literals of c before that
second occurrence and the witness the literals from it on, so that the witness starts with p;
if it does not, none.
The RAT check of the clause c, whose pivot is its first literal p, with the RUP hints
rup and the RAT hints rat, reading clauses with lookup; all f tells whether f n d holds
for every clause d that lookup gives the number n. Either unit propagation along rup
refutes the negation of c, or every clause d containing ¬p has a resolvent
c ∨ (d \ {¬p}) that is a tautology or whose negation unit propagation refutes along rup
followed by the hints rat gives to the number of d.
Two clause enumerations of one database are equal if each tells whether f n d holds for
every clause d that lookup gives the number n. The RAT and PR checks (ratWith, prWith)
read the stored clauses only through such an enumeration, so a checker may substitute its own.
The RAT check reads the stored clauses only through what all tells about them.
A RAT step keeps a database satisfiable: if the RAT check of c succeeds and σ
satisfies every clause that lookup returns, some assignment satisfies them and c. It is σ
if σ satisfies c, and otherwise σ with the pivot made true.
PR steps #
The PR check of the clause c with the witness w, the RUP hints rup and the RAT hints
rat, reading clauses with lookup; all f tells whether f n d holds for every clause d
that lookup gives the number n (Tan et al., Fig. 3). Either unit propagation along rup
refutes the negation of c, or w satisfies c, contains no literal together with its
negation, and every clause d that w reduces is satisfied by w, or has a restriction d'
by w such that c ∨ d' is a tautology or its negation is refuted by unit propagation along
rup followed by the hints rat gives to the number of d.
A PR step keeps a database satisfiable: if the PR check of c with the witness w
succeeds and σ satisfies every clause that lookup returns, some assignment satisfies them and
c. It is σ if σ satisfies c, and otherwise σ with the literals of w made true.
The checker #
The LRAT checker with RAT steps: the clauses of φ are numbered from 1, and the
certificate must reach an empty-clause step through RUP steps, RAT steps (CNF.ratWith) and
deletions.
The LPR checker Tan et al.: as CNF.checkLRATRat, except that an
addition whose clause repeats its first literal is a PR step (CNF.prWith) adding the clause
before the repeat, with the witness from the repeat on (Clause.splitWitness).
Whether no addition of the certificate repeats the first literal of its clause, so that the LPR format reads no witness in it.
Soundness and completeness #
If the checker accepts on a database, no assignment satisfies the clauses it looks up.
A formula with a certificate accepted by the checker with RAT steps is unsatisfiable.
A formula with an LPR certificate accepted by CNF.checkLPR is unsatisfiable.
The checker with RAT steps accepts on a database whatever checkLRUPAux accepts.
The full LRAT checker with RAT steps accepts every certificate checkLRUP accepts.
On certificates whose additions do not repeat their first literal, the LPR checker agrees with the LRAT checker with RAT steps.