The CDCL solver on DIMACS text #
What the executable lake exe cdcl prints, apart from the statistics and times:
Cslib.Algorithms.Lean.CDCL.answerDIMACS reads a DIMACS CNF formula, solves it on renamed
variables (Cslib.Algorithms.Lean.CDCL.solveCompactWith), and gives the answer in the format of
the SAT competitions with MiniSat's exit code: s SATISFIABLE and the model on v lines, exit
code 10, or s UNSATISFIABLE and the certificate, exit code 20.
The model lists one literal for each variable occurring in the formula, in increasing order, and
ends with 0: a formula without variables gets v 0, and a formula over the single DIMACS
variable 10⁶ gets one literal, not one for each smaller name.
Main definitions #
Cslib.Algorithms.Lean.CDCL.occurringVars: the distinct variables of a formula.Cslib.Algorithms.Lean.CDCL.modelLines: thevlines of a model.Cslib.Algorithms.Lean.CDCL.answerFor,Cslib.Algorithms.Lean.CDCL.answerDIMACS: the answer for a formula, and for DIMACS text.
Main statements #
Cslib.Algorithms.Lean.CDCL.mem_occurringVars,Cslib.Algorithms.Lean.CDCL.nodup_occurringVars,Cslib.Algorithms.Lean.CDCL.pairwise_occurringVars: the variable list passed tomodelLinesholds exactly the variables of the formula, each once, in increasing order. Thevlines rendered from it are covered only by the checked examples.Cslib.Algorithms.Lean.CDCL.satisfiable_of_answerFor_code: exit code10only for a satisfiable formula.Cslib.Algorithms.Lean.CDCL.checkLRUP_of_answerFor_cert: the certificate given is accepted by the LRUP (RUP-only LRAT) checker (Cslib.Logic.PL.CNF.checkLRUP).Cslib.Algorithms.Lean.CDCL.answerDIMACS_toDIMACS: on the textφ.toDIMACSthatCslib.Logic.PL.CNF.toDIMACSprints, the answer is that forφ, soCslib.Algorithms.Lean.CDCL.satisfiable_of_answerDIMACS_toDIMACSandCslib.Algorithms.Lean.CDCL.checkLRUP_of_answerDIMACS_toDIMACSconclude aboutφitself. For a formula built in Lean and printed, the DIMACS parser is then outside the trusted base; for a file from elsewhere, the parser is still trusted to read it as intended.
The text itself (modelLines and the s lines) is output formatting, with no theorem about it.
The variables occurring in φ, each once, in increasing order.
The variables passed to modelLines are those of the formula.
The variables passed to modelLines increase, so each appears once.
The variables passed to modelLines have no repeats.
The answer of the solver for a DIMACS formula.
- formula : Logic.PL.CNF ℕ
The formula read.
- output : String
The
sline, and for a satisfiable formula thevlines. - code : UInt32
MiniSat's exit code:
10for satisfiable,20for unsatisfiable. - stats : Stats
The statistics of the solver.
The certificate, for an unsatisfiable formula.
The answer for a formula, solved with the options o on renamed variables.
Exit code 10 only for a satisfiable formula.
The certificate given is accepted by the LRUP (RUP-only LRAT) checker.
The answer for a DIMACS formula, read by Cslib.Logic.PL.CNF.ofDIMACS; an error if the
text is not a DIMACS formula.
The answer for a printed formula is the answer for the formula: reading
Cslib.Logic.PL.CNF.toDIMACS gives the formula back (Cslib.Logic.PL.CNF.ofDIMACS_toDIMACS).
Exit code 10 on the printed formula only for a satisfiable formula, end to end: the
hypothesis is about the text φ.toDIMACS, the conclusion about φ.
A certificate given for the printed formula is accepted for the formula, end to end, so
the formula is unsatisfiable (Cslib.Logic.PL.CNF.not_satisfiable_of_checkLRUP).