Bucket-Level Dictionary Deletion (deletePrepProg, deleteFinishProg) in Memory.Prog #
This module realizes the two-phase bucket-level deletion of the fixed-capacity succinct dictionary
in Memory.Prog via realize:
deletePrepProgandrealizes_deletePrepGen: Phase 1 ofdelete(search bucketbforq_targetand, if found, read the quotientq_lastof the last slot in the bucket so that the Word-RAM wrapper can computem_last);deleteSwapProg,deleteFoundProg,deleteFinishProg, andrealizes_deleteFinishGen: Phase 2 ofdelete(unlink the deleted slot, swap the last slot into the deleted slot and relink intom_lastwhenj_del < j_last, and pop the last slot from the bucket).
Main definitions #
Cslib.DataStructure.Dictionary.WordRAM.Succinct.deletePrepProg: Phase 1 ofdeleteinMemory.Prog(searches bucketband readsq_lastwhen found).Cslib.DataStructure.Dictionary.WordRAM.Succinct.deleteSwapProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.deleteFoundProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.deleteFinishProg: Phase 2 ofdeleteinMemory.Prog(unlinksj_del, relocatesj_lastintoj_delwhenj_del < j_last, and callspopBackSlotProg).
Main results #
Cslib.DataStructure.Dictionary.WordRAM.Succinct.realizes_deletePrepGen,Cslib.DataStructure.Dictionary.WordRAM.Succinct.deletePrepProg_bucket_spec:Realizescertificate and bucket-level specification fordeletePrepProg.Cslib.DataStructure.Dictionary.WordRAM.Succinct.realizes_deleteFinishGen,Cslib.DataStructure.Dictionary.WordRAM.Succinct.deleteFinishProg_bucket_spec:Realizescertificate,BucketStateInvpreservation, and amortizedmemoryCostbound fordeleteFinishProg.
Section 1: deletePrepProg via realize #
Parameter-free Phase 1 of delete (d = (dp, (((base, b), q_target), m))):
searches bucket b for q_target; if found (searchResFound res = 1), resolves the last slot
phys_last of bucket b, reads its quotient q_last, and returns (res, q_last); otherwise
returns (((0, 0), 0), 0).
Phase 1 of delete (d = (((base, b), q_target), m)):
searches bucket b for q_target; if found (res.1.1 = 1), resolves the last slot phys_last of
bucket b, reads its quotient q_last, and returns (res, q_last); otherwise returns
(((0, 0), 0), 0).
Specification of deletePrepProg under BucketStateInv when m = mOf q_target.
Section 2: deleteSwapProg, deleteFoundProg, and deleteFinishProg via realize #
Swap helper for delete when j_del < j_last
(d = ((((base, b), j_del), phys_del), (m_last, j_last))):
unlinks j_last from (b, m_last) (if indexed), copies (q_last, v_last) into phys_del, and
prepends j_del to (b, m_last) (if indexed).
Parameter-free precondition for deleteSwapGenProg in Realizes.
Found-branch helper for delete (d = ((((base, b), j_del), phys_del), (m, m_last))):
unlinks j_del from (b, m), reads c_b, runs deleteSwapProg if j_del < c_b - 1, and
calls popBackSlotProg.
Parameter-free precondition for deleteFoundGenProg in Realizes.
Pure state effect, BucketStateInv preservation, and amortized memoryCost bound of
deleteFinishProg following deletePrepProg under BucketStateInv.