refactor: delete 9 zero-consumer partition/free-energy, magnetization/Mayer and J = 0 pseudo-mass wrapper modules (safe-to-delete batch 4) - #4754
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…h 4) Deletes the nine fully-dead modules of issue #4746 Item A batch 4: 31 declarations, 712 lines, all of them zero-consumer thin Z^d Lambda-layer or along-exhaustion wrappers. Concrete/LatticeGraphCorrelation/ PartitionFreeEnergyBoundsAlongExBridges.lean (4 decls, 78 lines) PartitionFreeEnergyMonotonicityFreeEnergyAlongEx.lean (3 decls, 56 lines) PartitionFreeEnergyRegularity.lean (4 decls, 87 lines) PartitionFunctionGeneralAnalyticity.lean (5 decls, 83 lines) PartitionFunctionSymmetryCubicAbsH.lean (2 decls, 42 lines) MagnetizationCorrelationBasic.lean (4 decls, 72 lines) MayerFilterConnected.lean (4 decls, 96 lines) MayerVdBounds.lean (3 decls, 81 lines) PseudoMass/FromParamsHZero/JZeroJointRegularity.lean (2 decls, 117 lines) The batch is the union of the three cascade-0 groups of the 32 lane-eligible fully-dead modules, so no declaration anywhere else loses its last consumer. Library wiring: 8 import lines drop from Umbrella/PartitionAndPerStage.lean (5) and Umbrella/MagnetizationAndMayer.lean (3). Deleting JZeroJointRegularity.lean would leave PseudoMass/FromParamsHZero.lean an empty umbrella and break its only consumer (FromParamsBounds/LogBounds.lean, which reached Mathlib through that one line), so the umbrella is repointed at JZeroHRegularity, which the deleted module itself imported. The public import surface is unchanged. Documentation retraction, in the same commit because the build never reads docs: * docs/index.md: 4 module-directory bullets removed; the nested-brace family label at the free-energy monotonicity row split so it no longer names the 3 deleted members; the BddAbove_freeEnergyAlongExhaustion_latticeGraph* family label dropped (it lost every member); 4 wrapper-count claims re-measured (PR #1595 12 -> 9, PR #1610 20 -> 15, PR #1611 24 -> 20, PR #1613 20 -> 16). * tex/proof-guide.tex: the same 4 counts, plus the 4 "now live in" sentences that named the deleted child modules. * 11 in-library module doc comments that pointed at the deleted modules. The PR #1611 and PR #1613 count claims are retractions the batch-4 design did not list; they were found by measuring every layer of each affected wrapper family rather than by trusting the scanner, which cannot see prose counts. Script recalibration: * scripts/test_dead_candidate_scan.py: the ferromagnetic family pin moves SAFE 47 -> 46 and UNCERTAIN 77 -> 78 (one declaration moves away from safe-to-delete, the safe direction), and three docs/index.md line pins shift by the 8 removed bullet lines. * scripts/test_audit_gate.py: the floors are NOT lowered. The comment blocks are corrected: they recorded 2003/1996 as "measured", which were the counts from before PR #4751's deletion, making the derived "46 below" false. Measured now: 1984 / 1977 / 2014 against floors 1957 / 1950 / 1977. * scripts/audit/citation_baseline.tsv: 4 rows hand-moved from AMBIGUOUS to BASENAME_ONLY. Deleting one of two files sharing a basename makes the tex citation resolve uniquely, which is a class change and not new erosion; the gating finding total is unchanged at 960. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…e fresh-measurement comment The comment block rewritten for this batch claims to be measured on this branch, but it carried the previous block's `Concrete` (869) figure unchanged. Re-measured on this commit: the eight largest library directories are Concrete 851, AmbientLattice 275, ClusterExpansion 205, TransferMatrix 109, Peierls 105, AmbientComplexAnalyticity 76, Inequalities 71, Conditioning 48. 869 was the count from before PR #4751 deleted its ten modules (859 at fd7a2a7, 851 here). The block's claim still holds after the correction: with iter_checked_files() = 1984 against CHECKED_FILE_FLOOR = 1957, losing the smallest of those eight (Conditioning, 48) drops the count to 1936 and trips the floor. Comment only; no test or floor changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
phasetr
marked this pull request as ready for review
July 28, 2026 09:29
phasetr
added a commit
that referenced
this pull request
Jul 28, 2026
…le Concrete directory size Adds the batch-4 record to the local mirror of issue #4746: 9 modules / 31 declarations / 712 lines deleted, the same-commit docs/index.md and tex/proof-guide.tex retraction, the two-sweep condition (v) result (7 verdict moves, all protective, 0 violations), and every gate re-measured on the merged main ee98192. Also corrects one figure the mirror carried in its F1 note: the largest library directory is Concrete 851, not 869. 869 predated PR #4751's ten-module deletion (859 at fd7a2a7). The same stale figure was fixed in scripts/test_audit_gate.py inside PR #4754. Adds an F1 update for batch 4: the floors were not lowered, so the measured slack is 27 / 27 / 37 and the F1 decision stays due before batch 5. Remaining scope re-derived on the merged main: 23 modules left on the tier-2 tracked list; freshly measured population 199 fully dead raw / 194 excluding Lemma_17_5_2 / 146 lane-eligible. .self-local/ only; no library, docs, tex or script change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
phasetr
added a commit
that referenced
this pull request
Jul 28, 2026
…le Concrete directory size (#4755) Part of #4746. Syncs `.self-local/issues/4746.md` with the merged state of Item A batch 4 (PR #4754, main `ee981926`) and repairs one stale figure the mirror carried. * New section recording batch 4: 9 modules / 31 declarations / 712 lines deleted, the same-commit `docs/index.md` + `tex/proof-guide.tex` retraction (four re-measured wrapper counts, the nested-brace label split, the one family label that lost all its members, 12 in-library doc comments), the two-sweep condition (v) result (7 verdict moves, all protective, **0 violations**), and every gate re-measured on the merged main. * Ratchet: the floors were **not** lowered by batch 4. The mirror's F1 table is updated to the measured slack 27 / 27 / 37, and the F1 note's `Concrete, 869` figure is corrected to **851** — 869 predated PR #4751's ten-module deletion (859 at `fd7a2a71`). The same stale figure was fixed in `scripts/test_audit_gate.py` inside #4754. * Remaining scope re-derived on the merged main: 23 modules left on the tier-2 tracked list; freshly measured population 199 fully dead raw / 194 excluding `Lemma_17_5_2` / **146 lane-eligible** (157 before: 9 deleted here plus 2 that left the set because this PR's documentation retraction protected their declarations). * Records that the three scanner fail-open constructs are already filed as a child item of Item A. `.self-local/` only; no library, docs, tex or script change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This was referenced Jul 28, 2026
phasetr
added a commit
that referenced
this pull request
Jul 28, 2026
…l body drift (#4760) ## Purpose Part of #4746. Sync the local mirror `.self-local/issues/4746.md` to the canonical GitHub issue #4746 state after PR #4759 merged (main `ecdaf2e5`, Item F F-2/F-3 fix, `MAX_CHARGED_GLOB_MATCHES = 10`). ## Change - Resynced the mirror's `## Summary` section verbatim from the canonical GitHub issue body (title, Item A figures, ratchet retraction, Item F promoted/re-diagnosed state). The mirror's Summary had drifted from canonical since the 2026-07-28 governance re-verification (PR #4758 only touched the Progress/Follow-ups sections, not the Summary header/title/Item-A figures). - Added a Progress entry recording PR #4759 MERGED (main `ecdaf2e5`): F-2/F-3 fixed by raising `MAX_CHARGED_GLOB_MATCHES` to 10, documentation-invariance double sweep (`SAFE_after ⊆ SAFE_before`), and retrospective audit against batches 1-4 (PRs #4747/#4749/#4751/#4754) finding zero erroneous deletions. - Recorded the residual fail-open surfaced by the independent review of #4759 (issue comment #4746 (comment)): namespace-qualified wildcard tokens that resolve to zero declarations are invisible to the report (no verdict, no family label, no coverage warning) — 58 occurrences / 46 distinct expanded names / 36 distinct source tokens on current docs, with a live false-safe example at `tex/proof-guide.tex:3861`. This residual is not a regression of #4759 (identical pre-#4759) and is recorded as an unauthorized follow-up candidate. ## Scope `.self-local/issues/4746.md` only (mirror sync; no library/docs/tex changes). ## Test plan - [x] Diff confined to `.self-local/issues/4746.md`. - [x] Content verified against `gh issue view 4746` (canonical body + comment 5105348942) at write time. - [x] No Japanese in PR body/commit message.
phasetr
added a commit
that referenced
this pull request
Jul 28, 2026
…e file-count floors (#4746 Item F1) (#4766) `CheckedFilesTest`'s three blanket floors (`CHECKED_FILE_FLOOR`, `LIB_FILE_FLOOR`, `V4_FILE_FLOOR`) were calibrated a few dozen files below the measured count, so every deletion batch of the #4746 safe-to-delete lane had to lower them: 2003/1996 (#4749) -> 1993/1986 (#4751) -> 1984/1977 (#4754). The ratchet described the deletions instead of constraining them, and the file's own standing decision was that the first batch which would actually trip a floor must land F1 (per-directory assertions) rather than recalibrate again. Measured on `f8911169` the slack is 6 further file deletions on two of the three floors, so that batch is the next one. F1-a: pin `LIB_TOP_LEVEL_DIRS` (25 directories, measured) and assert it both against a census of what the scan enumerates and against an independent disk traversal. A filter such as `if "Peierls" not in p.parts` now fails by name at any library size, with no constant to move; a directory the deletion lane empties disappears from both sides at once, so no recalibration follows. F1-b: `LIB_DIR_FLOORS`, coarse per-directory floors for the eight directories at 40+ files plus the loose bucket (Concrete 843 -> 600, AmbientLattice 275 -> 180, ClusterExpansion 205 -> 150, TransferMatrix 109 -> 80, Peierls 105 -> 80, AmbientComplexAnalyticity 76 -> 55, Inequalities 71 -> 50, Conditioning 48 -> 35, loose 39 -> 25). Parity only requires one surviving file per directory; these keep the big ones populated. `assertGreaterEqual`, not the strict comparison the blanket floors use. F1-c: with directory loss now asserted directly, the blanket floors are derived from a budget rather than from today's measurement: 200 further deleted modules below the 2026-07-29 measurement (1964/1957/1994), rounded down to a multiple of ten, giving 1760/1750/1790. Their residual job -- the two ways the exact `git ls-files` comparison can be made vacuous -- does not need a tight floor. F1-d: two mutation tests. `iter_checked_files` filtered on "Peierls" loses the directory from the census while staying above the blanket floor; the same function thinned to three `Conditioning` files keeps parity and the blanket floors green and trips only the per-directory floor. No change to `scripts/audit_gate.py`; V1/V2/V4 read the same 1964/1964/1994 files as before. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.
Part of #4746 (Item A, batch 4).
Deletes the nine fully-dead modules of batch 4 — 31 declarations, 712 lines —
and retracts every documentation claim that counted them. The batch is the union
of the three cascade-0 groups of the 32 lane-eligible fully-dead modules, so no
declaration anywhere else in the library loses its last consumer.
Measured on
fd7a2a71(git ls-remote origin mainat branch time) in athrow-away worktree with an APFS-cloned warm
.lake.What was deleted
Concrete/LatticeGraphCorrelation/PartitionFreeEnergyBoundsAlongExBridges.leanConcrete/LatticeGraphCorrelation/PartitionFreeEnergyMonotonicityFreeEnergyAlongEx.leanConcrete/LatticeGraphCorrelation/PartitionFreeEnergyRegularity.leanConcrete/LatticeGraphCorrelation/PartitionFunctionGeneralAnalyticity.leanConcrete/LatticeGraphCorrelation/PartitionFunctionSymmetryCubicAbsH.leanConcrete/LatticeGraphCorrelation/MagnetizationCorrelationBasic.leanConcrete/LatticeGraphCorrelation/MayerFilterConnected.leanConcrete/LatticeGraphCorrelation/MayerVdBounds.leanPseudoMass/FromParamsHZero/JZeroJointRegularity.leanThe line total is 712, not the 721 the batch-4 design recorded: the design's
per-file figures are each one higher than
wc -l, andgit diff --statcharges712 deletions.
Build jobs go 5015 → 5006. No build-time claim is made. Own elaboration cost
of these modules is at or below the per-module import-only baseline (issue #4724),
so the wall-clock effect is not measurable and none is asserted.
Declaration-level double confirmation
The 31 declarations were re-extracted independently of the design, with a
line-folding-aware extractor (a same-line
^theorem NAMEregex silently missesevery wrapped declaration, and did so on a first pass here). All 31 names and
their line numbers reproduce the design's appendix exactly.
A boundary-aware reference check over every tracked file (not only
IsingModel/,docs/,tex/) found 0 genuine references. The four rawgit grephits are all prefix collisions with surviving siblings, and none is areference to a deleted declaration:
PartitionFreeEnergyBoundsFeAlongExId.lean:46…_nonneg_of_ferromagnetic— different identifierPartitionFunctionSymmetryLog.lean:63,64,PartitionFunctionSymmetryLogCubic.lean:29,39log_…prefix — different identifiersPolymerFreeEnergyEpsilonSharpening.lean:31…_minus_one_pow_at_zero— different identifierRequirement (i):
--leancross-checkpython3 scripts/dead_candidate_scan.py <31 names> --lean, run against the greenpre-deletion build (scanner blob
7f47c6bd, unmodified), exit 0:Every one of the 31 carries the reason "no reference outside the delete set, no
citation in the scanned documentation".
Requirement (v): the two sweeps
Both sweeps run the full-library scan (
--pattern '.', 10,868 scanneddeclarations) on the pre-deletion library, changing only the documentation.
Condition (v) assertion: 0 violations. No declaration outside the delete set
moves toward
safe-to-delete. All seven verdict moves are in the protectivedirection, and they are quoted rather than summarised:
The first three are the point of the surgical brace split: replacing the nested
brace by two exact labels turns a citation the scanner could not resolve into
citations it can. The 29 declarations the design predicted could be stranded by a
careless line rewrite are all still
published-result.An independent fail-closed re-expansion of every backticked token in
docs/index.mdand every\texttt{}/\path{}token intex/proof-guide.tex(recursive brace expansion,
*as zero-or-more, cross-checked against afolding-aware index of all 10,963 library declarations) confirms the design's
result and adds nothing: of every family token that covers at least one deleted
name, exactly one loses all of its members —
`BddAbove_freeEnergyAlongExhaustion_latticeGraph*`atdocs/index.md, whichthis PR drops. Every other covering token keeps survivors (e.g.
`correlation_*_latticeGraph`19 members → 17,`freeEnergyAlongExhaustion_latticeGraph_*`103 → 98).Documentation retraction
Prose counts are invisible to the scanner, so each affected wrapper family was
measured layer by layer instead. Two of the four count retractions below were
not in the batch-4 design and were found by that measurement.
docs/index.mdPR #1595 /tex§18.512 new thin wrappers (3 abstracts × 4 layers)12 … ; the three ℤ^d Λ-layer wrappers had no consumers and were deleted in PR #4754, leaving 9 across three layersdocs/index.mdPR #1610 /tex§18.620 thin wrappers (5 abstracts × 4 layers)20 … leaving 15 across three layersdocs/index.mdPR #1611 /tex§18.624 thin wrappers (8 abstracts × 3 missing layers)24 … leaving 20 across the remaining layersdocs/index.mdPR #1613 /tex§18.520 thin wrappers (5 abstracts × 4 layers)20 … leaving 16PR #1613 loses 4 and not 5 because the ℤ^d Λ-layer
mayerPartialSum_Λ_latticeGraph_analyticOnNhdlives in another module andsurvives; the retraction says so.
Family labels and module lists:
docs/index.mdmodule-directory bulletsdocs/index.md§4.6 monotonicity row`freeEnergyAlongExhaustion_latticeGraph{,_cubicExhaustion}_{upper_bound,monotone_{J,h,beta}}`(8 members, 3 deleted)`…latticeGraph{,_cubicExhaustion}_upper_bound`+`…latticeGraph_cubicExhaustion_monotone_{J,h,beta}`docs/index.md§4.6 bounds row, and `BddAbove_freeEnergyAlongExhaustion_latticeGraph*` now live in `PartitionFreeEnergyBounds.lean`(2 members, both deleted)`PartitionFreeEnergyBounds.lean` and its child modulestex×4 "now live in …" sentencesdocs/index.md:1411(`correlation_*_latticeGraph`, 17 of 19 survive) anddocs/index.md:1983are deliberately left alone, as the design determined.The retraction sentences describe the removed wrappers by layer, never by
name. A first draft named them, and sweep 2 caught it immediately: 11 of the 31
flipped to
published-resultbecause the retraction itself had become a citationof a declaration about to stop existing.
12 in-library module doc comments that pointed at the deleted modules were
corrected in the same commit: four parent-module "Moved:"/"Removed:" sections
(
Magnetization.lean:66,PartitionFreeEnergyBounds.lean:102,PartitionFreeEnergyMonotonicity.lean:46andPartitionFunctionSymmetry.lean:75)and eight "extracted from
X.lean" provenance notes. Five of those eight were the basename trap: asame-named module survives under
AmbientLattice/SpecialCases/, so the referencewould silently re-resolve to the wrong file instead of dangling. This closure was
not enumerated by the design.
Ratchet and floor recalibration
scripts/test_dead_candidate_scan.pytest_ferromagnetic_family_counts:SAFE 47 → 46,UNCERTAIN 77 → 78;LOAD_BEARING(64),PUBLISHED(35), the 223 total andtest_zero_consumer_count(112) are unchanged. Exactly one declaration moves,and it moves away from
safe-to-delete:freeEnergyAlongExhaustion_latticeGraph_nonneg_of_ferromagneticsafe-to-delete → uncertain, because the deleted sibling was the other memberof the
nonneg*component of its family label. The docstring records themechanism.
docs/index.mdline pins (1200/1201/1809 → 1192/1193/1801) shift by the8 removed bullet lines. Same three rows, different numbers.
scripts/test_audit_gate.py— the floors are not lowered.fd7a2a71iter_checked_files()CHECKED_FILE_FLOOR1957iter_lib_files()LIB_FILE_FLOOR1950iter_v4_files()V4_FILE_FLOOR1977The comment block claimed "Measured 2026-07-27 …
iter_checked_files()= 2003and
iter_lib_files()= 1996 … The floors sit 46 below the measured counts".Both halves were wrong: 2003/1996 were the counts from before PR #4751 deleted
its ten modules, so on
fd7a2a71the real gap was 36, not 46. The block isrewritten against the fresh measurement, and it now records the standing
decision that the next batch that would actually trip a floor must land F1
(per-directory assertions) rather than another recalibration.
A follow-up commit fixes one figure the rewritten block had carried over unchanged:
the largest library directory is
Concrete851, not 869. 869 predates PR #4751'sten-module deletion (859 at
fd7a2a71). Re-measured on this branch, the eight largestare
Concrete851,AmbientLattice275,ClusterExpansion205,TransferMatrix109,Peierls105,AmbientComplexAnalyticity76,Inequalities71,Conditioning48 —so the block's claim survives the correction: losing the smallest of the eight takes
iter_checked_files()from 1984 to 1936, belowCHECKED_FILE_FLOOR1957.scripts/audit/citation_baseline.tsv— 4 rows hand-moved fromAMBIGUOUStoBASENAME_ONLY(MayerFilterConnected.lean,MayerVdBounds.lean×2,PartitionFreeEnergyRegularity.lean,PartitionFunctionGeneralAnalyticity.lean).Deleting one of two files that share a basename makes the tex citation resolve
uniquely, which is a class change, not erosion: gating findings stay at 960.
--update-baselinerefuses a row that rises and directs the change to a handedit so the diff shows it, which is what this is.
Verification, all re-measured here
lake buildwarning, 0error(the 2info:ringnotes are present onfd7a2a71too)scripts/audit_gate.pyaxiom(1984 files), V2 no sorry/admit/native_decide (1984 files), V3 13 capstones all{propext, Classical.choice, Quot.sound}, V4 no Japanese (2014 files)grep -rn "sorry" IsingModel/fd7a2a71lake exe GKSTestscripts/citation_audit.pydead_candidate_scan.py --self-testpython3 -m unittest scripts.test_audit_gatecitation_audit.py --self-testtex/,docs/,README.md,IsingModel/,scripts/Final check on a synthesized tree
A separate throw-away worktree at
fd7a2a71(pre-deletion library) carryingthis commit's
docs/index.mdandtex/proof-guide.tex, scanned with theunmodified scanner:
and the full-library sweep on that same tree reports 0 condition-(v)
violations. So the documentation in this commit still justifies deleting
exactly these 31 declarations and nothing else.
On the merged tree, no exact name among the 31 and none of the five uniquely
named deleted modules occurs anywhere in
IsingModel/,docs/ortex/. Thefour shared basenames that remain (
MayerVdBounds.lean,MayerFilterConnected.lean,PartitionFreeEnergyRegularity.lean,PartitionFunctionGeneralAnalyticity.lean)all resolve to the surviving
AmbientLattice/SpecialCases/modules.Follow-up recorded, not fixed here
The three scanner fail-open constructs found while validating this batch are
recorded as a child item of #4746 and are deliberately out of scope for this PR:
nested braces, a bare trailing
*with no separating underscore, and*read asone-or-more. All three are fail-open on the deletion side, the same polarity
class as #4745. The affected sites in this batch were handled by hand and
verified by the independent expander above.
🤖 Generated with Claude Code