Documentation

CslibFrontier.Algorithms.WordRAM.LRAT.Steps

An LRUP (RUP-only LRAT) checker on the word RAM: the steps of a certificate #

This file proves that the step loop of the word-RAM LRUP (RUP-only LRAT) checker (Cslib.Algorithms.WordRAM.LRAT.stepLoop) computes Cslib.Logic.PL.CNF.checkLRUPAux (rejecting RAT steps).

Main definitions #

Main results #

The database under additions and deletions #

theorem Cslib.Algorithms.WordRAM.LRAT.find?_filter_of_imp {α : Type u_1} {p q : α → Bool} (l : List α) (h : ∀ (a : α), p a = true → q a = true) :
theorem Cslib.Algorithms.WordRAM.LRAT.TableAt.cons {mem : ℕ → ℕ} {T : ℕ} {db : List (ℕ × Logic.PL.Clause ℕ)} (h : TableAt mem T db) (i : ℕ) (c : Logic.PL.Clause ℕ) (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 ((i, c) :: db)

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

theorem Cslib.Algorithms.WordRAM.LRAT.TableAt.erase {mem : ℕ → ℕ} {T : ℕ} {db : List (ℕ × Logic.PL.Clause ℕ)} (h : TableAt mem T db) (i : ℕ) :
TableAt (Function.update mem (tcell T i) 0) T (List.filter (fun (e : ℕ × Logic.PL.Clause ℕ) => !e.1 == i) db)

Clearing the cell of number i deletes the clauses numbered i.

The trail #

Every assignment cell holds less than the stamp s: the trail of a new step is empty.

theorem Cslib.Algorithms.WordRAM.LRAT.Fresh.trailAt {mem : ℕ → ℕ} {T s : ℕ} (h : Fresh mem T s) :
TrailAt mem T s []
theorem Cslib.Algorithms.WordRAM.LRAT.TrailAt.fresh_succ {mem : ℕ → ℕ} {T s : ℕ} {trail : List (Logic.PL.Literal ℕ)} (h : TrailAt mem T s trail) :
Fresh mem T (s + 1)
theorem Cslib.Algorithms.WordRAM.LRAT.TrailAt.congr {mem : ℕ → ℕ} {T s : ℕ} {t₁ t₂ : List (Logic.PL.Literal ℕ)} (h : TrailAt mem T s t₁) (ht : ∀ (l : Logic.PL.Literal ℕ), l ∈ t₁ ↔ l ∈ t₂) :
TrailAt mem T s t₂
theorem Cslib.Algorithms.WordRAM.LRAT.Fresh.of_tcell {mem : ℕ → ℕ} {T s : ℕ} (h : Fresh mem T s) (i v : ℕ) :
Fresh (Function.update mem (tcell T i) v) T s
theorem Cslib.Algorithms.WordRAM.LRAT.TrailAt.of_tcell {mem : ℕ → ℕ} {T s : ℕ} {t : List (Logic.PL.Literal ℕ)} (h : TrailAt mem T s t) (i v : ℕ) :
TrailAt (Function.update mem (tcell T i) v) T s t

Work #

The total length of the clauses the hints of the steps name, in the database of each step, following checkLRUPAux as if every step were accepted.

Assuming the negated clause #

theorem Cslib.Algorithms.WordRAM.LRAT.assumeLoop_spec {w : ℕ} (ls trail : List (Logic.PL.Literal ℕ)) (x : WordRAM.Data 28) (M T s : ℕ) (hone : x.regs Reg.one = 1) (hT : x.regs Reg.tbase = T) (hst : x.regs Reg.stamp = s) (hl : WordRAM.Block.HoldsList (x.regs Reg.lptr) (List.map ClauseCode.litCode ls) x.mem) (hle : x.regs Reg.lend = x.regs Reg.lptr + ls.length) (hlT : x.regs Reg.lend ≤ T) (htr : TrailAt x.mem T s trail) (hM : ∀ l ∈ ls, ClauseCode.litCode l + 1 ≤ M) (hw : WordRAM.Fits w (T + 2 * M + 2)) :

Assuming the negated clause: the loop over the literals ls at lptr puts their negations on the trail, changing only assignment cells.

theorem Cslib.Algorithms.WordRAM.LRAT.rupStep_spec {w : ℕ} (db : List (ℕ × Logic.PL.Clause ℕ)) (i : ℕ) (c : Logic.PL.Clause ℕ) (hints : List ℕ) (x : WordRAM.Data 28) (M T s : ℕ) (hzero : x.regs Reg.zero = 0) (hone : x.regs Reg.one = 1) (hE : x.regs Reg.endp = T) (hT : x.regs Reg.tbase = T) (hst : x.regs Reg.stamp = s) (hl : WordRAM.Block.HoldsList (x.regs Reg.ptr) (i :: ClauseCode.encodeClause c ++ encodeNums hints) x.mem) (hpT : x.regs Reg.ptr + (i :: ClauseCode.encodeClause c ++ encodeNums hints).length ≤ T) (htab : TableAt x.mem T db) (hfr : Fresh x.mem T s) (hiM : i ≤ M) (hcM : ∀ l ∈ c, ClauseCode.litCode l + 1 ≤ M) (hhM : ∀ h ∈ hints, h ≤ M) (hdbM : ∀ e ∈ db, ∀ l ∈ e.2, ClauseCode.litCode l + 1 ≤ M) (hw : WordRAM.Fits w (T + 2 * M + 2)) (hsT : s + 1 ≤ T) :

A RUP step on the words i :: encodeClause c ++ encodeNums hints at ptr: when propagation from the negated clause along the hints succeeds, it adds (i, c) to the database, advances the stamp, and leaves ptr past the step; otherwise it rejects.

theorem Cslib.Algorithms.WordRAM.LRAT.delLoop_spec {w : ℕ} (db : List (ℕ × Logic.PL.Clause ℕ)) (ids : List ℕ) (x : WordRAM.Data 28) (M T s : ℕ) (hzero : x.regs Reg.zero = 0) (hone : x.regs Reg.one = 1) (hT : x.regs Reg.tbase = T) (hl : WordRAM.Block.HoldsList (x.regs Reg.ptr) ids x.mem) (hhe : x.regs Reg.hend = x.regs Reg.ptr + ids.length) (hhT : x.regs Reg.hend ≤ T) (htab : TableAt x.mem T db) (hfr : Fresh x.mem T s) (hM : ∀ i ∈ ids, i ≤ M) (hw : WordRAM.Fits w (T + 2 * M + 2)) :

The deletion loop clears the table cells of the numbers in [ptr, hend).

theorem Cslib.Algorithms.WordRAM.LRAT.delStep_spec {w : ℕ} (db : List (ℕ × Logic.PL.Clause ℕ)) (ids : List ℕ) (x : WordRAM.Data 28) (M T s : ℕ) (hzero : x.regs Reg.zero = 0) (hone : x.regs Reg.one = 1) (hT : x.regs Reg.tbase = T) (hl : WordRAM.Block.HoldsList (x.regs Reg.ptr) (encodeNums ids) x.mem) (hpT : x.regs Reg.ptr + 1 + ids.length ≤ T) (htab : TableAt x.mem T db) (hfr : Fresh x.mem T s) (hM : ∀ i ∈ ids, i ≤ M) (hw : WordRAM.Fits w (T + 2 * M + 2)) :
∃ (y : WordRAM.Data 28), WordRAM.ExecWithin w delStep x y (8 * ids.length + 6) ∧ y.regs Reg.ptr = x.regs Reg.ptr + 1 + ids.length ∧ TableAt y.mem T (List.filter (fun (e : ℕ × Logic.PL.Clause ℕ) => !ids.contains e.1) db) ∧ Fresh y.mem T s ∧ y.regs Reg.zero = 0 ∧ y.regs Reg.one = 1 ∧ y.regs Reg.tbase = T ∧ ∀ a < T, y.mem a = x.mem a

A deletion step on the words encodeNums ids at ptr.

The registers and memory of the step loop before a step, with the database db and the stamp s.

@[reducible, inline]

The words of a list of steps.

theorem Cslib.Algorithms.WordRAM.LRAT.stepLoop_spec {w : ℕ} (rest : List Std.Tactic.BVDecide.LRAT.IntAction) (db : List (ℕ × Logic.PL.Clause ℕ)) (x : WordRAM.Data 28) (M T s : ℕ) (hinv : StepInv w M T s db x) (hl : WordRAM.Block.HoldsList (x.regs Reg.ptr) (stepWords rest) x.mem) (hpT : x.regs Reg.ptr + (stepWords rest).length = T) (hM : ∀ v ∈ stepWords rest, v + 1 ≤ M) :

The step loop computes checkLRUPAux db rest for the steps rest at ptr, which run to the end of the input.