Repository navigation
proof(consensus): share the source of a link below its target - #2518
Merged
Merged
Conversation
link_source_lt states that the justified checkpoint that a link names as its source is older than its target, from JustifiedSettled and JustifiedSeparated. It moves from a private lemma of direct safety next to JustifiedSeparated in TargetSlots, with its statement unchanged. The finality and slack proofs of the FFG justification now read it for both of their epochs, in place of the same arithmetic written inline. Follows the ethereum#2187 status after ethereum#2482. Amp-Thread-ID: https://ampcode.com/threads/T-01a1d43a-249d-7630-89b4-475f6dd73b3b Co-authored-by: Amp <amp@ampcode.com>
…ed invariant Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tcoratger
approved these changes
Nov 14, 2026
tcoratger
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed: the move removes the private copy and adds one shared theorem, stated on epochs so callers need no placeholder checkpoint. The two direct-safety callers prove the same facts as before; no statement weakens. Touched modules and importers build with --wfail and replay with leanchecker.
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.
The bound that a link's source epoch is below its target epoch moves from a private lemma of direct safety to
Transition/TargetSlots.lean, next toJustifiedSeparated. The finality and slack proofs of FFG justification read it instead of repeating its arithmetic. Part of #2187: this is thelink_source_ltitem of the #2187 status after #2482.The problem
A link of FFG justification takes the current or the previous justified checkpoint as its source, and the current or the previous epoch as its target. Once justification runs, from the third epoch on, its source is older than its target. A private lemma,
link_source_ltinDirectSafety/Fields.lean, stated that. It reads two facts about the state:JustifiedSettled: the current justified epoch is at most the previous epoch;JustifiedSeparated: from the third epoch on, the previous justified epoch is below the previous epoch.processJustificationAndFinalization_slackBits(FfgFinality.lean) andprocessJustificationAndFinalization_slackJustifiedCheckpoints(FfgSlack.lean) derived the same inequalities inline.The idea
The fact is about the justified checkpoints, not about direct safety, so it belongs with
JustifiedSeparated. As a public theorem it is stated on epochs, so callers need no placeholder checkpoint:The two statements are equivalent: the two direct-safety callers rewrite with their target-epoch equation first.
Example
At current epoch 10, the previous epoch is 9.
current = true: the source is the current justified checkpoint, at most 9 byJustifiedSettled, and the target is epoch 10.current = false: the source is the previous justified checkpoint, below 9 byJustifiedSeparated, and the target is epoch 9.For reviewers
DirectSafety/Fields.lean, and the two FFG proofs above.FfgFinalityreads it for the current epoch only; for the previous epoch it keepsseparated late, which is that case exactly.TargetSlots.leangains one line for the new result.Checks
At head
db6a4d0e7, merged with master094a4a19b:lake build --wfailon the four touched modules, their direct importers andEthLib.Consensus.Proofs: passed.leancheckeronTargetSlots,FfgFinality,FfgSlackandDirectSafety.Fields: passed.scripts/check_writing.py --base upstream/master: no suggestions.scripts/check_lean_layout.py --base upstream/master: no findings.git grep link_source_lton master: only the removed private lemma and its two callers.Earlier checks by the author, at head
f8e78d39d4with master57c573efa1: fulllake build --wfail,check-decls,check-accessors,soundness_facts.py --check,check_layers.py,ty check,tests/downstream, and#print axiomson the changed theorems (onlypropext,Classical.choice,Quot.sound).🤖 Generated with Claude Code