Internal Deamortized Trie Clear Loop (bufClearLoopGenProg) #
Internal ClearableBufTrie iterative edge-popping and node-clearing loop consumed privately by
Clear.
Main definitions #
Main results #
def Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.BufClearOnePre (w : ℕ) (p : BufRt × Unit) (s : Memory.State) :
Precondition for bufClearOneRtProg.
One elementary cleanup step bufClearOne.
Parameter-free wrapper for iterate bufClearOneRtProg.
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.realizes_bufClearLoopGen :
WordRAM.Realization.Realizes WordRAM.Basis.exact bufClearLoopGenProg WordRAM.Realization.WordEncoding.encode
WordRAM.Realization.WordEncoding.encode
(fun (w : ℕ) (x : (BufRt × Unit) × ℕ) (s : Memory.State) =>
match x with
| ((rt, x), k) => WordRAM.Realization.iterationSafe bufClearOneRtProg BufClearOnePre w rt k x s)
fun (x : (BufRt × Unit) × ℕ) (x_1 : Memory.State) => 0
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.bufClearLoop_spec {c U V w n_max base ep : ℕ} (henv : WhpLargeEnv c U V w n_max w base) (hep : ep = 0 ∨ ep = 1) :
have rt := mkBufRt c U V w n_max base ep;
∀ (k : ℕ) (tr : SuccinctWhp.BufTrie) (s : Memory.State),
BufTrieMemRep base c U V w n_max ep tr s.mem →
SuccinctWhp.ClearableBufTrie tr →
have prog := bufClearLoopGenProg ((rt, ()), k);
have s' := (Memory.spec 0).clientState s prog;
have tr' := SuccinctWhp.bufClearSteps k tr;
WordRAM.Realization.iterationSafe bufClearOneRtProg BufClearOnePre w rt k () s ∧ s'.frontier = s.frontier ∧ WordRAM.Realization.memoryCost prog s ≤ 15 * k ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ BufTrieMemRep base c U V w n_max ep tr' s'.mem ∧ BufEpFrame base c U V w n_max ep s.mem s'.mem