Skip to content

Fix dead-sweep candidate extraction to require internal-dependency + docs/tex citation checks (10/22 false positives found in Profile.lean audit) #4639

Description

@phasetr

Motivation

During the PseudoMass/Profile.lean reference-0 audit for #4637's PR-3, dev-design found that
the original 22-declaration candidate list (extracted by Lean-importer count alone, i.e. "0
importers") was overcounted: 10/22 were false positives — 7 are live via internal dependency
closure (used within the same file/namespace, just not imported from elsewhere), 3 are cited by
docs/index.md as GJ §17.5 results (docs/tex citation, not a Lean import). True reference-0 count
was 12/22.

Proposal

Change the standing operating procedure for "dead sweep" candidate extraction (used by
dev-refactoring / lean-refactoring dead-code passes) from import-count-only to a two-part
condition:

  1. Internal dependency closure: a declaration counts as "referenced" if any other declaration
    in the repository (including in the same file/namespace) depends on it, not just cross-file
    importers.
  2. docs/tex name citation: a declaration counts as "referenced" if its name is cited in
    docs/index.md or tex/proof-guide.tex (i.e. it is presented as a book-progress result),
    even if nothing in IsingModel/ imports it.

Only declarations satisfying neither condition should be proposed as reference-0 deletion
candidates.

Scope

This is a general operating-procedure correction for future dead-code / reference-0 sweeps
project-wide, not specific to the alternatingConnectedSubgraphSum cleanup tracked in #4637 (kept
separate so #4637 can close on its own scope without pulling in unrelated process changes).

Acceptance

  • lean-refactoring (or equivalent dead-sweep tooling/checklist) updated to require both checks
    before flagging a declaration as a deletion candidate.
  • Re-verify this against the next dead-sweep candidate list before batch deletion.

Related: #4637 (PR-3 Profile.lean scope reduction, 22 → 12, exhibits the false-positive rate this
issue fixes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions