Documentation

CslibFrontier.Algorithms.WordRAM.TwoSAT.ImplCSR

Implication-graph CSR assembly (buildImplCSRCode, buildImplCSRCode_spec) #

Combines degree counting, prefix sums, and edge backfilling to establish CSRAt G.adjFin.

Build the CSR representation of G.adjFin at (offB, edgeB) in O(n + |φ|) steps.

theorem Cslib.Algorithms.WordRAM.TwoSAT.buildImplCSRCode_spec (G : Instance) {w : ℕ} (hfit : WordRAM.Fits w G.wordBound) (hcs : ∀ c ∈ G.φ, 1 ≤ List.length c ∧ List.length c ≤ 2) {x : WordRAM.Data 28} (hcm : ClauseMemAt x.mem 3 G.φ) (hc0 : x.regs DFS.Reg.cZero = 0) (hc1 : x.regs DFS.Reg.cOne = 1) (hc3 : x.regs DFS.Reg.cThree = 3) (hm : x.regs Reg.mClauses = List.length G.φ) (hNv : x.regs DFS.Reg.nVerts = 2 * G.n) (hoffB : x.regs DFS.Reg.offB = DFS.kOffAddr G.workBase) (hedgeB : x.regs DFS.Reg.edgeB = DFS.kEdgeAddr G.workBase (2 * G.n)) (hcurB : x.regs DFS.Reg.curB = DFS.kCurAddr G.workBase (2 * G.n) (2 * List.length G.φ)) :
∃ (y : WordRAM.Data 28), WordRAM.ExecWithin w buildImplCSRCode x y (26 * G.n + 49 * List.length G.φ + 18) ∧ DFS.CSRAt G.adjFin (DFS.kOffAddr G.workBase) (DFS.kEdgeAddr G.workBase (2 * G.n)) y.mem ∧ (∀ a < G.workBase, y.mem a = x.mem a) ∧ ∀ (r : Fin 28), ↑r < 18 → y.regs r = x.regs r