Checking an LRAT file against a DIMACS file #
Cslib.Logic.PL.CNF.checkDIMACSLRAT cnf proof reads a formula from the text cnf of a DIMACS
file (Cslib.Logic.PL.CNF.ofDIMACS), reads a certificate from the bytes proof of an LRAT file,
text or binary, with Lean core's parser (Std.Tactic.BVDecide.LRAT.parseLRATProof), and checks it
with the array checker Cslib.Logic.PL.CNF.checkLRATFast, RAT steps included
Cruz-Filipe et al.. With lpr := true it reads
the file in the LPR format of Tan et al. and checks it with
Cslib.Logic.PL.CNF.checkLPRFast, PR steps included: Lean core's parser reads an LPR line as an
LRAT line whose clause is followed by the witness, which the checker splits off. It returns
.ok () when the certificate is accepted, and otherwise an error saying which of the three stages
failed. The executable lake exe lrat_check [--lpr] FORMULA.cnf PROOF.lrat, LratCheck.lean in
the scripts directory, runs it.
An accepted certificate shows that the formula read is unsatisfiable
(Cslib.Logic.PL.CNF.not_satisfiable_of_checkDIMACSLRAT). The statement concerns the formula that
ofDIMACS reads, so the DIMACS parser is trusted to read the file as intended; it reads back
exactly what Cslib.Logic.PL.CNF.toDIMACS writes (Cslib.Logic.PL.CNF.ofDIMACS_toDIMACS). The
LRAT parser is not trusted: whatever certificate it produces, the checker's verdict is sound.
The clauses of the formula are numbered from 1 in file order, as LRAT files expect.
Main definitions #
Cslib.Logic.PL.CNF.checkDIMACSLRAT: the file checker.
Main results #
Cslib.Logic.PL.CNF.not_satisfiable_of_checkDIMACSLRAT: a formula whose certificate is accepted is unsatisfiable.
References #
The LRAT file checker: read a formula from the DIMACS text cnf and an LRAT certificate,
text or binary, from proof, and check it with CNF.checkLRATFast, or, if lpr, read it as an
LPR certificate and check it with CNF.checkLPRFast. It returns .ok () when the certificate is
accepted, and otherwise the reason it is not.
An accepted LRAT or LPR file refutes the DIMACS file: if checkDIMACSLRAT cnf proof lpr
accepts, the formula read from cnf is unsatisfiable.