feat(val): prove VAL-1 proposers are selected round-robin - #39
Merged
Conversation
Extract ValidatorIndex.proposerForSlot mirroring proposer_for_slot in upstream containers/identifiers.py and refactor processBlockHeader's proposer check to consume it (semantics unchanged: the UInt64 construction never wraps since slot % n <= slot < 2^64, recorded as proposerForSlot_toNat). Prove proposer_index_round_robin, the catalog form of the round-robin selection. Axiom-free, no Mathlib.
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
Discharges VAL-1 from
docs/lean4-proof-propositions.md: proposers are selected round-robin (slot % n).LeanSpec/Forks/Lstar/Containers/Identifiers.lean(mirrors upstreamcontainers/identifiers.py):ValidatorIndex.proposerForSlot— round-robin selection,UInt64.ofNat (slot.toNat % n).proposer_index_round_robin(VAL-1, catalog form —ValidatorIndex.mkrealized asUInt64.ofNat).proposerForSlot_toNat— the substantive half: theUInt64construction never wraps (slot % n ≤ slot < 2^64), so the selected index is exactlyslot.toNat % nat theNatlevel.StateTransition.lean—processBlockHeader's proposer check refactored to consumeproposerForSlot(upstream comparesblock.proposer_index != proposer_for_slot(...)directly), so the theorem speaks about the deployed selection rather than an orphan definition. Equivalent to the previousNat-level check for all inputs byproposerForSlot_toNat; all ST proofs pass unchanged.Note: no GitHub issue exists for VAL-1 (issue creation is blocked in-session); the catalog entry is the tracking artifact.
Verification
lake buildgreen with zero warnings; nosorry, no new axioms.Part of the Validator domain (VAL-3 follows in a stacked PR).