Skip to content

feat(fc): prove FC-5 block-production iteration terminates - #47

Merged
adust09 merged 1 commit into
mainfrom
feat/fc-5-block-production-terminates
Jul 5, 2026
Merged

feat(fc): prove FC-5 block-production iteration terminates#47
adust09 merged 1 commit into
mainfrom
feat/fc-5-block-production-terminates

Conversation

@adust09

@adust09 adust09 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

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.lean mirrors build_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 the MAX_ATTESTATIONS_DATA proposer budget
  • selectionLoop — the while True fixed 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.
  • buildBlockAttestationsbuild_block's setup (slot advancement, genesis anchoring, justified-window extension, chain-view assembly, candidate sort) feeding the loop

The explicit finite-rounds statement

build_block_selection_terminates: the loop reaches its fixed point within payloads.length + 1 passes, for any coverage picker.

Modeling choices (documented in the module docstring)

  • The coverage picker (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 needs encode_bytes of XMSS aggregates (Arklib side) — so FC-5 holds for every picker
  • Python re-scans the full sorted list skipping the processed set; the model consumes accepted candidates and re-enters on the remainder — equivalent for distinct dict keys with a fixed order
  • The post-loop per-data collapse is packaging outside the fixed point and is not modeled

Catalog: FC-5 checked — FC 5 proved / 0 open, progress table 21/9/1. lake build passes with no sorry, no warnings.

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.
@adust09
adust09 merged commit c56b62d into main Jul 5, 2026
1 check passed
@adust09
adust09 deleted the feat/fc-5-block-production-terminates branch July 5, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant