feat(fc): define store pruning and prove the finalized-slot memory bound - #73
Merged
Conversation
Deliver the memory-bound half of #71: a concrete Store.prune dropping every block/state outside the finalized subtree, with - mem_prune_blocks_iff: a block survives iff the finalized checkpoint is its ancestor, - prune_block_slot_ge / prune_blocks_length_le: every retained block sits at or above the finalized slot, bounding the live store by the finalized-slot horizon (the statable memory bound for upstream), - prune_blocks_sublist: pruning only drops entries. The observational-equivalence half needs a new prune-congruence lemma family (existing congruence lemmas require blocks equality, which pruning breaks) and is split into follow-up work.
Deliver the invariant half of #71 on top of the memory bound: - getBlock?_prune_iff / getState?_prune_iff: lookups on the pruned store return the original entry exactly when pruning keeps it (via an association-list find?/filter characterization under key uniqueness). - ancestorWalk_sound: walk success exhibits the relational ancestry plus the ancestor block at the checkpoint slot (converse of ancestorWalk_complete). - keepBlock_of_ancestorOrEqual: every finalized-subtree block survives pruning. - properAncestor_prune: finalized-rooted ancestry derivations transfer to the pruned store (each visited node is kept). - prune_wellFormed: pruning preserves WellFormed. The justified anchor survives with its finalized ancestry: the justified root lies on the finalized subtree (M-1), the transferred relation is re-run by walk completeness inside the pruned store via an auxiliary store whose justified checkpoint is the finalized one (breaking the WellFormed circularity), and congruence maps the result back.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Delivers the memory-bound and invariant halves of #71 (verified safety of store pruning below the finalized root).
New file
LeanSpec/Forks/Lstar/Store/Prune.lean:Memory bound
Store.prune— concrete pruning: drop every block/state whose root is not in the finalized subtree, decided by the samecheckpointIsAncestorwalk fork choice already uses. Control fields (checkpoints, head, vote pools) untouched.mem_prune_blocks_iff— a block survives iff the finalized checkpoint is its ancestor.prune_block_slot_ge/prune_blocks_length_le— the memory bound: the live store after pruning is bounded by the blocks at or above the finalized slot. This is the statable upper bound Verified safety of store pruning below the finalized root (via ST-6 / FC-2) #71 feeds upstream (today the reference store grows without bound).prune_blocks_sublist— pruning only drops entries.Invariant preservation (second commit)
getBlock?_prune_iff/getState?_prune_iff— pruned-store lookups return the original entry exactly when pruning keeps it (assoc-listfind?/filtercharacterization under key uniqueness).ancestorWalk_sound— walk success exhibits the relational ancestry plus the ancestor block at the checkpoint slot (converse ofancestorWalk_complete).keepBlock_of_ancestorOrEqual— every finalized-subtree block survives pruning.properAncestor_prune— finalized-rooted ancestry derivations transfer to the pruned store.prune_wellFormed— pruning preservesWellFormed. The justified anchor survives with its finalized ancestry: the justified root lies on the finalized subtree (M-1 clause), the transferred relation is re-run by walk completeness inside the pruned store (via an auxiliary store whose justified checkpoint is the finalized one, breaking theWellFormedcircularity), and congruence maps the result back.All theorems sorry-free;
lake buildpasses.Not in this PR (follow-up per #71)
The observational-equivalence half (
update_head/on_block/checkpoint evolution agree betweenstandprune st). It builds directly on the subtree-transfer lemmas proved here.Refs #71