Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.SuccinctWhpTickHealProg.SelfHeal

In-Place csrToFastGenProg and trySelfHealGenProg Subroutines for SuccinctWhp #

This internal module composes the parallel array/slice phase loops into:

Main definitions #

Main results #

Section 1: csrToFastGenProg (CsrMemRep → FastMemRep) #

@[irreducible]

Convert CsrMemRep in place to FastMemRep for csrToFast c U n_max θ csr salts when GoodSeedOnState holds and salts b is stored at offBktMeta[16 * b + 1] (d = (wp, base)).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.csrToFastGenProg_spec {c U V w n_max base : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {csr : SuccinctWhp.CsrState} {dict : State U} {salts : ℕ → ℕ} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : CsrMemRep base c U V w n_max csr s.mem) (hcsr : SuccinctWhp.ValidCsrState U V n_max (SuccinctWhp.bktHash c U n_max θ.1) csr dict) (hqv : ∀ (p : ℕ), csr.qArr p < 2 ^ SuccinctWhp.quotBitsWhp U n_max ∧ csr.vArr p < max V 1) (hgood : SuccinctWhp.GoodSeedOnState c U n_max θ dict) (hsalts_mem : ∀ b < SuccinctWhp.numBucketsWhp n_max, BitPackedArray.readPacked (base + offBktMeta c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w s.mem (16 * b + 1) = salts b) :
have prog := csrToFastGenProg (mkWhpParams c U V w n_max, base); have s' := (Memory.spec 0).clientState s prog; SeedWhpMemRep base c U w n_max θ s'.mem ∧ FastMemRep base c U V w n_max (SuccinctWhp.csrToFast c U n_max θ csr salts) s'.mem ∧ s'.frontier = s.frontier ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ ∀ (a : ℕ), a < base ∨ base + SuccinctWhp.largeSpaceWhp c U V w n_max ≤ a → s'.mem a = s.mem a

Exact specification of csrToFastGenProg: refines csrToFast c U n_max θ csr salts into FastMemRep while preserving SeedWhpMemRep, frontier, and caller memory outside [base, base + largeSpaceWhp c U V w n_max).

Section 2: trySelfHealGenProg (CsrMemRep → WhpMemRep) #

@[irreducible]

Check GoodSeedOnState on CsrMemRep and immediately convert in place to FastMemRep if ok = 1 (d = (wp, base)).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.trySelfHealGenProg_spec {c U V w n_max base : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {csr : SuccinctWhp.CsrState} {dict : State U} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : CsrMemRep base c U V w n_max csr s.mem) (hcsr : SuccinctWhp.ValidCsrState U V n_max (SuccinctWhp.bktHash c U n_max θ.1) csr dict) (hqv : ∀ (p : ℕ), csr.qArr p < 2 ^ SuccinctWhp.quotBitsWhp U n_max ∧ csr.vArr p < max V 1) :
have prog := trySelfHealGenProg (mkWhpParams c U V w n_max, base); have s' := (Memory.spec 0).clientState s prog; WhpMemRep base c U V w n_max θ (SuccinctWhp.trySelfHeal c U n_max θ csr) s'.mem ∧ s'.frontier = s.frontier ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ ∀ (a : ℕ), a < base ∨ base + SuccinctWhp.largeSpaceWhp c U V w n_max ≤ a → s'.mem a = s.mem a

Exact specification of trySelfHealGenProg: refines trySelfHeal c U n_max θ csr into WhpMemRep while preserving frontier and memory outside [base, base + largeSpaceWhp).