Repository navigation
Ed448/X448: remove dead declarations and modules - #4342
Merged
reaperhulk merged 1 commit intoNov 6, 2026
Merged
Conversation
Remove the Ed448, X448 and Curve448 proof and implementation declarations that nothing reachable from the registrations, the trusted base or the tests uses, and the modules left empty. No Spec/, TCB/ or generated code changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWvczSrPuzG4qdbYu6t
reaperhulk
deleted the
claude/unify-random-bytes-crypto-xqmg0z-deadcode-ed448
branch
November 6, 2026 18:27
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.
Like #4305 (DSA) and #4314 (ECDSA), this removes the Ed448, X448 and Curve448 proof and implementation declarations that nothing reachable uses: 1,076 declarations, including 73 whole modules, plus 3 local notations nothing uses any more.
Spec/,TCB/,src/or the generated crates changes.Emit.lean --checkpasses, so the emitted code is identical.Spec/definitions in scope: Ed448 0 of 37, X448 0 of 21 (Curve448 has no spec).277 files, +280 / −13,191.
How "dead" was decided
The method of
tools/deadcode/README.md(on the tooling branch):.ileanfiles of a full build.Artifacts/,Generic/,Variants/,TCB/andVerifiedGarbageTest/;*.leanfiles import..ileanfiles don't record:Two refinements for this scope, both on the safe side:
local notationdoesn't protect its module. It can't be used outside its file, so it doesn't count as syntax for keeping a module. Its auxiliarymacroRulesdeclaration, which no.ileanreference ever reaches, is kept wherever the module stays. I removed a notation only where its token no longer appears in the file.lit_decidefinds everyN.lit_eq/N.litpair in the environment by name (Proof/Framework/Lit.lean), not only thosematerialize_*makes. SoProof/Ed448/X86_64/VariantForLit, which the x86-64 registrations import, stays whole, with what it uses.The plan was iterated to a fixed point. Three passes on the rebuilt tree then found a cascade the README's loop doesn't see: it leaves out deleted modules between rounds, but not trimmed declarations. Those passes deleted
Comb56Contract, thenPoint56Contract, thenField56Contract, whose last users had gone. A final analysis finds nothing dead in scope but what is kept on purpose (below).Removed
Proof/Ed448/and 42 underProof/X448/. They include:Proof/Ed448/{Contract,Point56Contract,Point64Contract,Comb56Contract}andProof/X448/{Field56Contract,Field56MulContract,Field64Contract}, plusArm/FnContract;Fastone replaced (Proof/X448/AArch64/{Ladder,Ops,Row,MulLoop,Pointwise*,…},Weak/{Ladder,Finish});Proof/X448/Wide/{Mul,Columns,Tail*,…};Window/{KInit,KLoop,SBase,Window,Digit},VerifyMain,VerifyCT/*);Window/{First,Joint,Loop,Round,Sign,SignedSelect,Digit},BaseLoop,PowVariant);BaseCT/ScalarCT.*_okand*_ctlemmas, and implementation definitions that no registration emits:Impl.X448.RISCV64.x448with its field operations (the registered code isR64);Impl.X448.AArch64.x448andWeak.x448;VerifyWindowcode (window,wcross,kInit,table,verifyEquation, …);publicKey,signCached,verifyandscalarBasesteps, where the registrations use the…For vforms.Verifiedproofs of routines that no registration exports. No file inArtifacts/,Generic/orVariants/names any of them. Each proves that an internal routine meets a contract on its own; those routines are reached only inlined or through the variants' proofs, which stay. The emitted functions are unchanged.scalarBase_verified,scalarMulAdd_verified,scalarReduce_verified:verifyEquation_verifiedon all but RISC-V;Sparse.verifyEquation_verified(AArch64), andscalarBaseFor_verifiedandverifyEquationFor_verified(x86-64).CombBase.combBaseFn_verifiedandPoint56.{add,double,mul,pow}Fn_verified.FieldVariant.{add,double,pow}_verified.gf448_{add,sub,mul,mulA24}_verified.{add,sub,mul,mulA24}Fn_verified.pow223_verifiedandpow223With_verified.Outside the Ed448/X448/Curve448 directories:
3 of Ed448's own registration files (
Generic/Curve448Field/X86_64/Ed448{SignCached,Verify},Generic/Keccak/AArch64/Ed448Verify) only drop imports of deleted modules.check_registrationspasses.ci/lean_speed_allowed.pydrops 4DECIDE_SIMP_ALLOWEDentries:X448/AArch64/Inv);X448/AArch64/{Carry,Main,Weak/Main}).check_lean_speedrequires these counts to be exact.Other edits that come with the removal:
meta).include … in/variablelines were removed: a removed theorem's range starts attheorem, so its modifier would otherwise apply to the next declaration. Emptynamespace/sectionblocks and section headers with nothing under them are removed too.Field16Contract, the AArch64Window/*helpers,Impl/X448/RISCV64).Kept on purpose
Proof/Ed448/X86_64/VariantForLit(8 declarations):lit_decidefinds itsN.lit_eqliterals by name. The x86-64 registrations import it.local notations (EV,FV,BFrame, …) in modules that stay, which their files still use. TheirmacroRulesauxiliaries show as unreferenced in the.ileanfiles.Checks
Lean, on the pre-rebase base:
lake build --log-level=warningpasses;Emit.lean --checkpasses, with the standard axiom audit and no generated crate changed;check_lean_public_imports.py --base origin/mainpasses on the 204 modified modules (48 analysed).Static checks: every step of the
Static checksjob passes, withcheck_lean_single_importer.py --base origin/main.Rust:
cargo fmt --checkandcargo clippy --all-targets -- -D warningspass. No Rust changed.No escape hatches: nothing adds
sorry,native_decide,bv_decideormaxHeartbeats.Rebuilt analysis: nothing dead is left in scope beyond what is kept above.
After rebasing onto current
main(437 Lean files changed upstream; the only one in scope isSpec/X448/Contract.lean, which addsvg_x448_exchange's spec):The CI Lean build on the merge commit is the final check.
No benchmark: the emitted code is unchanged.
Generated by Claude Code