Repository navigation
Bignum/Mont: remove dead declarations and modules - #4367
Merged
alex merged 7 commits intoNov 6, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWvsvcgXj2u5S6o9SeM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWvsvcgXj2u5S6o9SeM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWvsvcgXj2u5S6o9SeM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWvsvcgXj2u5S6o9SeM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWvsvcgXj2u5S6o9SeM
No file imports Init.Data.Bool any more; TCB/AuditBase.lean is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWvsvcgXj2u5S6o9SeM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWvsvcgXj2u5S6o9SeM
alex
enabled auto-merge
November 6, 2026 20:46
alex
deleted the
claude/unify-random-bytes-crypto-xqmg0z-deadcode-bignum
branch
November 6, 2026 21:59
This was referenced Nov 7, 2026
alex
pushed a commit
that referenced
this pull request
Nov 7, 2026
…SA modules it uses (work in progress) Main's dead-code removals (#4305, #4336, #4344, #4367) deleted RISC-V modules and declarations that only this search uses. Restore them as they were before each removal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHGhkN8REQLPW8yxN5A
alex
pushed a commit
that referenced
this pull request
Nov 7, 2026
Main removed declarations only this branch still used (#4336, #4367, #4514): `fin64_exec_li_lit`, the RISC-V Miller–Rabin search pieces the sieved parameter candidate calls, and three of `ModExpWin`'s WP lemmas. They return, unchanged, as FFDH-only modules (`Proof/Ffdh/RISCV64/Li.lean`, `Impl/Ffdh/RISCV64/Search.lean`, `Proof/Ffdh/RISCV64/Search.lean`) and local lemmas in `Cached/Rows.lean`. The registrations drop `consts :=` (#4380). The generated code takes #4514's Montgomery schedule and #4468's dispatcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHHEKNw8eCDhgbwoFBL
alex
pushed a commit
that referenced
this pull request
Nov 15, 2026
Main removed declarations only this branch still used (#4336, #4367, #4514): `fin64_exec_li_lit`, the RISC-V Miller–Rabin search pieces the sieved parameter candidate calls, and three of `ModExpWin`'s WP lemmas. They return, unchanged, as FFDH-only modules (`Proof/Ffdh/RISCV64/Li.lean`, `Impl/Ffdh/RISCV64/Search.lean`, `Proof/Ffdh/RISCV64/Search.lean`) and local lemmas in `Cached/Rows.lean`. The registrations drop `consts :=` (#4380). The generated code takes #4514's Montgomery schedule and #4468's dispatcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHHEKNw8eCDhgbwoFBL
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 Bignum, Mont and Divstep proof and implementation declarations that nothing reachable uses. That is 1,384 declarations, including 181 whole modules.
WordsandWords64had nothing dead.Spec/,TCB/,src/orcrates/changes.Emit.lean --checkpasses, so the emitted code is identical.Spec/module belongs to this scope, so there are no deadSpec/definitions to report.459 files, +262 / −21,133.
How "dead" was decided
The method of
tools/deadcode/README.md(on the tooling branch), as for #4305 and #4314..ileanfiles of a full build ofmain.Artifacts/,Generic/,Variants/,TCB/andVerifiedGarbageTest/;*.leanfiles import..ileanfiles don't record, kept by the README's rules:brunand its siblings name theexec_*,rd_mem,wr_memandsp_memlemmas ofProof/Bignum/{AArch64,PPC64LE,RISCV64}/Run.lean. This keeps 39 declarations.`(…)quotation or a`nameliteral in meta code names it. A full name counts wherever the declaration is defined, since it resolves where the syntax is used. This keeps 6 declarations. Example: RSA's and FFDH'srsa_stack_shapetactic appliesVG.Proof.Mont.X86.StaticSquare.seq_noSp/ite_noSp.live4, leaving out deleted modules, to a fixed point.local notation(below).Removed
181 modules (171 under
Proof/, 10 underImpl/): 120 Mont, 61 Bignum. 687 of the declarations were in them.697 declarations from 252 modules that remain:
*_ct,*_okand*_wplemmas;mul,addandsubinImpl/Mont/Arm.lean, where the register-basedmulR,addRandsubRand the shared parts stay;mulandaddinImpl/Mont/X86.lean, wheresub,row,csubandchainstay;Proof/Divstep/modules.27 top-level
Verifiedproofs of routines that no registration exports. Each proves that an internal routine meets a contract as if it were exported. No registration file exports any of them on any target: the live roots never reach them, and they are reached only as internal callees, whose correctness and constant-time proofs stay. The emitted functions are unchanged.MontFn.fn_verified,MontFn.mul_verified,MontFn.Product.mul_verified;WindowHelper.verified,WindowShared.verified.mont_verified,montCallUmaal_verified,montCallSquareU_verified,umaalRows_verified.mul_verified,scratch_verified.MontFn.{fn,fnLazy,fnAdx,fnAdxLazy}_verified;FoldedPublic.{base,adx,checked}_verified;Ifma.verified,crt_verified,precompute_verified.Compact.verified,Square.verified,StaticSquare.verified;Rt.rt_verified,Rt.rt_scalar_verified;Sse2.at_verified.Outside the scope's directories, imports only:
DsaArithmetic,MillerRabinandRsaPrivateCrtvariant proofs.lean/VerifiedGarbageAuditBase.leanis regenerated withci/audit_base.py generate. It dropsimport Init.Data.Bool, which only the deletedProof/Mont/X86/StaticSquare/CarryMath.leanimported.TCB/AuditBase.leanis byte-identical.Follow-on edits within the scope:
check_lean_public_importspasses on them.opens of namespaces that no longer exist, emptysections and namespace blocks are removed.Impl/Mont/{X86,Arm}.lean,Proof/Mont/{X86,Arm}/Ops.lean,Proof/Mont/X86/OutsZ.lean,Proof/Bignum/PPC64LE/Mont{Fn,Save,Verified}.lean).Kept on purpose
Proof/Bignum/{X86/PublicRt/Verified, Arm/PublicVerified, Arm/PublicEntry, Arm/PublicEntryReady, AArch64/SquareHelper, PPC64LE/CrtVerified, RISCV64/CrtVerified}, whichArtifacts/Rsa/*andGeneric/RsaPrivateCrt/Arm/*import;Proof/Mont/X86/{Exponentiate, ExponentLoop, ExponentStep, DynamicSelect}, whichGeneric/RsaPrivateCrt/X86/*imports;Proof/Mont/X86/{SparseShift, SparseStep, P256Red}, whichGeneric/BrainpoolP{256,384}r1/X86/*imports.Bignum.Arm.TwoExp);Bignum.AArch64.pubContract,Bignum.X86.storeBE_truncated_ok);local notation "CLay"inProof/Bignum/X86_64/Ifma/CTMain.lean. Its generatedmacro_rulesdeclaration has no references, so the analysis lists it, but live proofs use the notation.PPC64LE/MontVerified,Mont/X86/OutsZ), because other algorithms import them. Renaming them is not this PR's change.Checks
Lean:
lake build --log-level=warningpasses on this branch rebased ontoc47391f70(28,454 jobs, on the restored CI cache);Emit.lean --checkpasses, with the standard axiom audit and no change to any crate;check_lean_public_imports --base origin/mainpasses on the modified modules.Static checks: every step of the job passes, including
check_lean_single_importer --base origin/main,audit_base checkandrun_unit_tests.Rust:
cargo fmt --checkandcargo clippy --all-targets -- -D warningspass. No Rust changed.No escape hatches: nothing adds
sorry,admit,native_decide,bv_decideormaxHeartbeats.No trust changes: no
Spec/orTCB/file changes.After rebasing onto
de183ea71(19 more commits, including the FFDH/Miller-Rabin, RSA and other dead-code removals):check_registrationsandaudit_base checkpass.The CI Lean build on the merge commit is the final check.
No benchmark: the emitted code is unchanged.
Generated by Claude Code