Repository navigation
DSA: remove dead declarations and modules - #4305
Merged
reaperhulk merged 1 commit intoNov 6, 2026
Merged
Conversation
Remove every declaration under Proof/Dsa/ and Impl/Dsa/ that nothing
reachable from the registrations (Artifacts/, Generic/, Variants/), TCB/,
the Lean tests or the lakefile's libraries refers to, directly or
transitively, found with a declaration-level graph built from the build's
.ilean files. A declaration with an attribute (an instance, a simp lemma)
in a module the roots import counts as used, since such uses leave no
reference; a module-level command's references count once its module is
used.
* 41 modules deleted (136 declarations), among them AArch64's
Generation/{Tape*, WrappedSeed, RoundTail, ForceWitnessCT, WorkspaceCT},
the unregistered `vg_dsa_sign` proofs on PPC64LE and RISC-V, RISC-V's
unregistered parameter-check `Verified`, Arm's PublicValidation*
proofs, x86's Comb.{ABI, Registration, Satisfiable, PrivateVerified,
KeyCorrect} and Generation/Sizes.
* 458 declarations removed from 224 modules: unused lemmas in the Refill*
modules, CodeDepth, CodeSafety, RoundCode, ValidateDepth,
SubgroupState, Generation/{PDomain, Layout}, and the per-architecture
proofs and code helpers nothing uses.
`Proof/Dsa/X86/LoadSlot.lean` stays: its one theorem is unused, but RSA's
x86 Generic and Variants files import the module. Docs that named removed
declarations are updated, and the speed allowlist drops the count of
`Arm/Prime/Inv.lean`, which no longer has its uses.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ajQWxFgLnhRDJS1FKU7Ub
reaperhulk
deleted the
claude/unify-random-bytes-crypto-xqmg0z-dsa-dead-code
branch
November 6, 2026 14:51
This was referenced Nov 6, 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
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.
This follows #4304 and removes every DSA proof and implementation declaration that nothing reachable uses: 594 declarations, including 41 whole modules. Nothing in
Spec/,TCB/,src/or the generated crates changes, andEmit.lean --checkshows the emitted code is identical.272 files, +12 / −6,001.
What "dead" means here
A declaration-level graph built from the
.ileanfiles of a full build. The live set starts from:Artifacts/,Generic/,Variants/,TCB/andVerifiedGarbageTest/;*.leanfiles import.Implicit uses leave no
.ileanreference, so the analysis keeps those conservatively:instancestays live in any module the live set imports, since simp sets and instance search use them without a reference.attribute,#guard,materialize_*) keep what they reference live.The full build is the final check. After removal, rerunning the analysis leaves no dead DSA declaration except one kept on purpose (below).
Removed
41 modules, all under
Proof/Dsa/:Generation.{ForceWitnessCT, RoundTail, TapeCT, TapeReset, TapeTake, WorkspaceCT, WrappedSeed}RandomCT,VerifyingMainArithVerified,ContextVerifiedPrime.{Front, Taint2}PublicValidation{ABI, CT, Correct, Verified}Generation.SizesModArithContract,MontContextContractPublicValidation,PublicValidationContractSign.{Implies, Verified}Params{Implies, Verified},Sign{Implies, Verified}Comb.{ABI, KeyCorrect, PrivateVerified, Registration, Satisfiable}DerivingDispatch,DerivingDispatchCTKeyRandom.InstanceMulVerified,PowVerifiedVerifyBody,VerifyBodySpec,VerifyComputeSome of these are top-level
Verifiedproofs of functions that no registration emits any more:vg_dsa_signon PPC64LE and RISC-V, where sign is now only an internal callee; its code andsign_correct/sign_ctstay because other proofs use them;458 declarations removed from 224 modules that remain, mostly unused helpers:
*_ct,*_wpand leftovers in theRefill*modules;CodeDepth,CodeSafety,RoundCode,ValidateDepth,SubgroupState;Generation/{PDomain, Layout};CTBaseandVerifyCT, PPC64LECtx, and others.Follow-on edits:
Artifacts/Dsa/X86.leanandArtifacts/Dsa/PPC64LE.lean, which lose only those imports.openis removed fromX86/Comb/Correct.lean.ci/lean_speed_allowed.pydrops its entry forDsa/Arm/Prime/Inv.lean, ascheck_lean_speed.pyasked once the uses that needed it were gone.Kept on purpose:
Proof/Dsa/X86/LoadSlot.lean. Its theorem is dead, but RSA'sGeneric/RsaPrivateCrt/X86/*registration files andProof/Variants/RsaPrivateCrt/X86/Base.leanimport the module. Removing it belongs with RSA.Not in this PR
Spec/definitions. Removing them is a trust change for its own PR. Among them are five unused*DomainCheckedApidefinitions inSpec/Dsa/DomainChecked.lean(their contracts are still used).Checks
lake buildpasses (28,929 jobs);Emit.lean --checkpasses, with no change to any crate;check_lean_public_imports --base origin/mainpasses on all modified modules;trim_lean_importsfinds nothing more to trim.run_unit_tests(641 tests).cargo fmt --checkandcargo clippy --all-targets -- -D warningspass. No Rust changed.sorry,native_decide,bv_decideormaxHeartbeatsadded.No benchmark is linked: the emitted code is unchanged.
Generated by Claude Code