Internal Bounded-Depth BufTrie Character Walk (bufWalkLoopGenProg) #
Internal traversal loop shared privately by EverPresent, Lookup, and Delete.
Main definitions #
Main results #
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.realizes_bufWalkLoopGen :
WordRAM.Realization.Realizes WordRAM.Basis.exact bufWalkLoopGenProg WordRAM.Realization.WordEncoding.encode
WordRAM.Realization.WordEncoding.encode
(fun (w : ℕ) (x : (BufRt × ℕ × ℕ × ℕ) × ℕ) (s : Memory.State) =>
match x with
| ((rt, x), rem) => WordRAM.Realization.iterationSafe bufWalkStepProg BufWalkStepPre w rt rem x s)
fun (x : (BufRt × ℕ × ℕ × ℕ) × ℕ) (x_1 : Memory.State) => 0
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.bufWalkLoop_spec {c U V w n_max base ep : ℕ} {tr : SuccinctWhp.BufTrie} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hep : ep = 0 ∨ ep = 1) (hrep : BufTrieMemRep base c U V w n_max ep tr s.mem) (halloc : 1 ≤ tr.nodeAlloc) (hchild : ∀ (v ch : ℕ), tr.trieChild v ch ≠ 0 → tr.trieChild v ch < tr.nodeAlloc) :
have rt := mkBufRt c U V w n_max base ep;
∀ (rem alive cur r_cur : ℕ),
cur < tr.nodeAlloc →
have prog := bufWalkLoopGenProg ((rt, alive, cur, r_cur), rem);
WordRAM.Realization.iterationSafe bufWalkStepProg BufWalkStepPre w rt rem (alive, cur, r_cur) s ∧ (Memory.spec 0).clientState s prog = s ∧ WordRAM.Realization.memoryCost prog s = 2 * rem ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ (alive = 0 → ((Memory.spec 0).clientResult s prog).1 = 0) ∧ (alive = 1 →
match SuccinctWhp.bufWalk (SuccinctWhp.bCharWhp n_max) tr.trieChild r_cur rem 0 cur with
| none => ((Memory.spec 0).clientResult s prog).1 = 0
| some leaf =>
∃ (r_leaf : ℕ), (Memory.spec 0).clientResult s prog = (1, leaf, r_leaf) ∧ leaf < tr.nodeAlloc)