Documentation

CslibFrontier.Algorithms.WordRAM.LRAT.Checker

An LRUP (RUP-only LRAT) checker on the word RAM: correctness and running time #

This file proves the main theorem about the word-RAM LRUP (RUP-only LRAT) checker (Cslib.Algorithms.WordRAM.LRAT.program): on the input encode φ cert it halts with output 1 exactly when Cslib.Logic.PL.CNF.checkLRUP φ cert = true, and otherwise with 0, within 60 L + 20 W + 21 instructions, where L is the length of the input and W is the total length of the clauses that the hints of the certificate name (Cslib.Algorithms.WordRAM.LRAT.certWork). It checks the RUP-only fragment of LRAT and rejects RAT steps (full LRAT with RAT steps CNF.checkLRATRat is not checked here). Since each hint names a clause of the database, W is at most the number of hints times the length of the longest clause of the database, so the run also takes at most 80 (F + C · max 1 w) + 81 instructions, where F and C are the numbers of words encoding the formula and the certificate, and w is that width. The certificate is measured in encoded words: a RAT step, which the checker rejects, is encoded by its tag alone, however large its contents.

Main definitions #

Main results #

The database of the formula #

The numbered clauses of ψ, numbered from j.

The database checkLRUP starts from.

theorem Cslib.Algorithms.WordRAM.LRAT.TableAt.snoc {mem : ℕ → ℕ} {T : ℕ} {db : List (ℕ × Logic.PL.Clause ℕ)} (h : TableAt mem T db) (i : ℕ) (c : Logic.PL.Clause ℕ) (hi : List.find? (fun (x : ℕ × Logic.PL.Clause ℕ) => x.1 == i) db = none) (a : ℕ) (ha : 0 < a) (haT : a + List.length c + 1 ≤ T) (hc : WordRAM.Block.HoldsList a (ClauseCode.encodeClause c) mem) :
TableAt (Function.update mem (tcell T i) a) T (db ++ [(i, c)])

Recording the address a of the encoding of c under a new number i appends (i, c) to the database.

Loading the formula #

theorem Cslib.Algorithms.WordRAM.LRAT.loadLoop_spec {w : ℕ} (done ψ : Logic.PL.CNF ℕ) (x : WordRAM.Data 28) (M T : ℕ) (hone : x.regs Reg.one = 1) (hT : x.regs Reg.tbase = T) (hn : x.regs Reg.nCl = List.length done + List.length ψ) (hcnt : x.regs Reg.cnt = List.length done) (hid : x.regs Reg.id = List.length done + 1) (hl : WordRAM.Block.HoldsList (x.regs Reg.ptr) (List.flatMap ClauseCode.encodeClause ψ) x.mem) (hpT : x.regs Reg.ptr + (List.flatMap ClauseCode.encodeClause ψ).length ≤ T) (hp1 : 1 ≤ x.regs Reg.ptr) (htab : TableAt x.mem T (numbered done 1)) (hfr : Fresh x.mem T 1) (hnM : List.length done + List.length ψ + 1 ≤ M) (hw : WordRAM.Fits w (T + 2 * M + 2)) :
∃ (y : WordRAM.Data 28), WordRAM.ExecWithin w loadLoop x y (10 * List.length ψ + 2) ∧ y.regs Reg.ptr = x.regs Reg.ptr + (List.flatMap ClauseCode.encodeClause ψ).length ∧ TableAt y.mem T (numbered (done ++ ψ) 1) ∧ Fresh y.mem T 1 ∧ ∀ a < T, y.mem a = x.mem a

The loading loop records the clauses ψ at ptr under the numbers that follow the clauses done already recorded.

The checker #

The total length of the clauses that the hints of cert name, in the database of each step.

The word size the checker needs on the input encode φ cert: the input's addresses, and twice its largest word, fit.

The LRUP (RUP-only LRAT) checker leaves checkLRUP φ cert in out, within 60 L + 20 W + 20 instructions on an input of length L whose hinted clauses have total length W.

The LRUP (RUP-only LRAT) checker on the word RAM. At any word size w that fits wordBound φ cert, the program run on the input encode φ cert of length L halts with output 1 when checkLRUP φ cert = true and 0 otherwise, after at most 60 L + 20 W + 21 instructions, where W = certWork φ cert is the total length of the clauses that the hints of cert name. RAT steps are rejected.

The bound in terms of the certificate size and the clause width #

The length of the longest clause of φ or of a RUP step of cert: every clause of every database that checkLRUP φ cert reads has at most this length.

The hinted clauses are bounded by the hints and the width: they have total length at most the number of RUP/empty hints (Cslib.Logic.PL.CNF.lrupHintCount) times dbWidth φ cert.

The hints are part of the certificate: there are at most as many as the words encoding cert.

The LRUP (RUP-only LRAT) checker on the word RAM, in terms of the formula, the certificate and the clause width. At any word size w that fits wordBound φ cert, the program run on the input encode φ cert halts with output 1 when checkLRUP φ cert = true and 0 otherwise, after at most 80 (F + C · max 1 W) + 81 instructions, where F and C are the numbers of words encoding φ and cert, and W = dbWidth φ cert bounds the length of every clause in the database. The max 1 keeps the certificate term when W = 0: every step is read even when no clause is. RAT steps are rejected.