feat(fc): prove FC-5 block-production iteration terminates - #47
Merged
Conversation
Store/BlockProduction.lean mirrors build_block's fixed-point selection (block_production.py, post leanEthereum/leanSpec#1181): candidates ordered once by (target.slot, hash_tree_root), the per-candidate filter chain, the MAX_ATTESTATIONS_DATA budget, the trial state transition, and re-anchoring on a moved justified/finalized checkpoint. selectionLoop is defined by well-founded recursion on the unprocessed candidate count with no fuel: selectionPass_rest_lt shows a pass that accepted something strictly shrinks the remainder, which is exactly upstream's termination argument (the chosen set only grows, and is bounded). Lean accepts the definition only because the iteration provably terminates - that is FC-5. The explicit bound is build_block_selection_terminates: at most payloads.length + 1 passes. The coverage picker (select_proofs_for_coverage) is a parameter: its choices never steer the loop's control flow and its tie-break needs encode_bytes of XMSS aggregates (Arklib side), so FC-5 holds for every picker. The post-loop collapse is packaging outside the fixed point and is not modeled.
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
Final FC proposition — the fork-choice domain is now fully proved (5/5). The catalog marked FC-5 "expressed via WellFoundedRecursion. High difficulty."
Approach
Store/BlockProduction.leanmirrorsbuild_block's fixed-point selection (block_production.py, post leanEthereum/leanSpec#1181 — candidate order and every tie-break content-derived):candidatePrecedence— candidates ordered once by(target.slot, hash_tree_root)candidateEligible— the per-candidate filter chain (head known, source at the justified anchor, lies on chain, source justified, target not already justified with the genesis self-vote exemption)selectionPass— one pass with theMAX_ATTESTATIONS_DATAproposer budgetselectionLoop— thewhile Truefixed point, defined by well-founded recursion on the unprocessed candidate count with no fuel. The decreasing measure (selectionPass_rest_lt: a pass that accepted something strictly shrinks the remainder) is exactly upstream's own termination argument — "the chosen set only grows, and is bounded". Lean accepts the definition only because the iteration provably terminates: that is FC-5.buildBlockAttestations—build_block's setup (slot advancement, genesis anchoring, justified-window extension, chain-view assembly, candidate sort) feeding the loopThe explicit finite-rounds statement
build_block_selection_terminates: the loop reaches its fixed point withinpayloads.length + 1passes, for any coverage picker.Modeling choices (documented in the module docstring)
select_proofs_for_coverage) is a parameter: its choices never steer the loop's control flow (a pass continues on which data were accepted, not which proofs), and its tie-break needsencode_bytesof XMSS aggregates (Arklib side) — so FC-5 holds for every pickerCatalog: FC-5 checked — FC 5 proved / 0 open, progress table 21/9/1.
lake buildpasses with nosorry, no warnings.