Tail Pool Allocation and Compaction Operations #
This module defines the pure GlobalMeta updates (gmAppendTail, gmRemoveTail) and the
corresponding branch-free Memory.Prog operations (appendTailItemProg, removeLastTailItemProg,
realized to Word-RAM code via realize) that allocate and compact tail items while preserving
TailBijection and SlabBijection.
Main definitions #
Cslib.DataStructure.Dictionary.WordRAM.Succinct.gmAppendTail: pureGlobalMetaupdate appending one tail item to bucketb.Cslib.DataStructure.Dictionary.WordRAM.Succinct.gmRemoveTail: pureGlobalMetaupdate removing the last tail item of bucketband compacting the tail pool.Cslib.DataStructure.Dictionary.WordRAM.Succinct.appendTailItemProg:Memory.Progsubroutine realizinggmAppendTail.Cslib.DataStructure.Dictionary.WordRAM.Succinct.removeLastTailItemProg:Memory.Progsubroutine realizinggmRemoveTailand relocating the compacted payload.
Main results #
Cslib.DataStructure.Dictionary.WordRAM.Succinct.tailBijection_gmAppendTail,Cslib.DataStructure.Dictionary.WordRAM.Succinct.slabBijection_gmAppendTail:gmAppendTailpreservesTailBijectionandSlabBijection.Cslib.DataStructure.Dictionary.WordRAM.Succinct.tailBijection_gmRemoveTail,Cslib.DataStructure.Dictionary.WordRAM.Succinct.slabBijection_gmRemoveTail:gmRemoveTailpreservesTailBijectionandSlabBijection.Cslib.DataStructure.Dictionary.WordRAM.Succinct.appendTailItemProg_effect,Cslib.DataStructure.Dictionary.WordRAM.Succinct.realizes_appendTailItemGen: effect andRealizescertificate forappendTailItemProg.Cslib.DataStructure.Dictionary.WordRAM.Succinct.removeLastTailItemProg_effect,Cslib.DataStructure.Dictionary.WordRAM.Succinct.realizes_removeLastTailItemGen: effect andRealizescertificate forremoveLastTailItemProg.
Section 1: Pure gmAppendTail and gmRemoveTail updates #
Pure GlobalMeta update appending one tail item to bucket b: assigns physical tail offset
t_new = gm 1 to descriptor d_new = b * tailCapPerBucket n_max + gm (gmRIdx b) and increments
gm (gmRIdx b) and gm 1.
Pure GlobalMeta update removing the last tail item r_del = gm (gmRIdx b) - 1 of bucket b
by relocating the last physical tail t_last = gm 1 - 1 into
t_del = gm (gmTailPtrIdx n_max b r_del) and decrementing gm (gmRIdx b) and gm 1. When
t_del = t_last, the pointer updates are idempotent.
Section 2: Memory.Prog tail allocation and compaction operations (realize) #
Base address d.2.1 in a parameter-free (DictParams, (base, b)) bucket call.
Bucket index d.2.2 in a parameter-free (DictParams, (base, b)) bucket call.
Parameter-free Memory.Prog operation appending one tail item to bucket b = tailCallBucket d
at base = tailCallBase d.
Memory.Prog operation appending one tail item to bucket b = d.2 at base = d.1
(0 < bucketBits n_max) and returning the newly allocated physical tail offset t_new = gm 1.
Pure state effect and return value of appendTailItemProg.
Precondition for appendTailItemProg.
Parameter-free precondition for appendTailItemGenProg.
Parameter-free Memory.Prog operation removing the last tail item of bucket
b = tailCallBucket d at base = tailCallBase d.
Memory.Prog operation removing the last tail item of bucket b = d.2 at base = d.1
(0 < bucketBits n_max, 1 ≤ gm (gmRIdx b)), compacting the tail pool by moving the payload at
physical slot (n_max - 1) - (gm 1 - 1) into (n_max - 1) - t_del and updating GlobalMeta via
gmRemoveTail.
Pure state effect of removeLastTailItemProg.
Precondition for removeLastTailItemProg.
Parameter-free precondition for removeLastTailItemGenProg.