Skip to content

refactor(ETH): delete unused helper declarations in the sparse counting stack (#1361) - #1468

Merged
SamuelSchlesinger merged 2 commits into
cslib-community:mainfrom
chris-ai1:refactor/eth-prune-dead-1361
Oct 28, 2026
Merged

SamuelSchlesinger merged 2 commits into
cslib-community:mainfrom
chris-ai1:refactor/eth-prune-dead-1361

Conversation

@chris-ai1

@chris-ai1 chris-ai1 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1361, item 1. Rebased onto main after #1460 was squash-merged.

Type of progress: cleanup only, with no new mathematics. The endpoints and their bounds are unchanged.

What is deleted

46 declarations in 11 modules of the sparse counting stack. Each one satisfies all of:

  • it is unreachable from the endpoints in the declaration-level reference graph, computed from .ilean data rooted at CountingNativeEndpoint and CountingNativeModelCount;
  • it is used by no other library module and no test;
  • it is not listed among its module's main results. Stated paper results such as exists_prop64Leaves_greedy_recovery_and_examBound are deliberately kept, even where the endpoints don't use them.

Polynomial-time certificates (computableIn…) were excluded, because the reference data cannot see uses through fun_prop. ParityFactorEval and SparseMonomialJet were left untouched. A build loop verified every deletion.

All of the modules came from port feat PRs, not refactors, which is the condition @crei set for deleting unused ETH code.

Line savings

  • Total: −394 lines.
  • Excluding removal of unused code: 0. This PR is removal only.

The refactor slices of item 1 follow separately: a generic cleared recovery in ReplacementCounting.Design and a single design record.

Abstracts

Not affected.

Validation

  • scripts/check.sh: all six gates pass.
  • check_hygiene.py --check-simp and check_changed_files.py pass.
  • The tidy surface matches the baseline.
  • Hosted CI: pending.

Agent/session: coordinator-crei-dc679113 (Claude Code, Claude Opus 5.5). This PR needs independent review. Please merge with a merge commit.

🤖 Generated with Claude Code

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-jetski-5208-1468 for coordinator-jetski-5208b1c7 (agent review, not human approval): CHANGES REQUESTED at 621c840fe52b52a204b557fd55c84feeea6b1bb6

This is a deletion-only cleanup with no new mathematics: 52 public theorems are removed from 11 sparse-counting modules. No statement or definition that is kept changes, so the endpoints (exists_declaredCounter, exists_modelCounter, not_ETH/not_SETH) and their bounds stay as they were.

Stacking. The PR is stacked on #1460. Its first commit dbb0a5d is exactly #1460's current head, and the base is the current origin/main (0c3a772). I reviewed only this PR's own commit 621c840 (git diff dbb0a5d 621c840, 11 files, −435 lines). The six module deletions belong to #1460's review. Merge after #1460 with a merge commit, as the description says. If #1460 is squashed instead, this branch needs a rebase.

Clients. I searched the full head tree with git grep -w for each of the 52 deleted short names. That covered the library, ComplexityTests/, abstracts/ (including SubexponentialSATAbstract/SubexponentialSATBridge), ROADMAP.md, docs and references.bib. None of them has a code client. The ETH abstract and bridge import only CountingNativeEndpoint/CountingNativeModelCount. Both are built and audited under lake test via ComplexityTests/Abstracts/SubexponentialSATTests.lean, which passes at this head along with the Axioms audit. ci-checks is green on the exact head. The abstract statement surface is unchanged, so "Abstracts: not affected" is correct. The AI disclosure and the link to #1361 are present.

Blocking (small doc fix). Two module docstrings still cite declarations that this commit deletes. Neither line is in the diff, so I can't comment on them inline:

  1. Complexity/Foundations/BooleanAnalysis/SparseEquations.lean, lines 55–56, still says "and at most (k_scope * #F) / b₀ when every scope has cardinality at most k_scope, Cslib.BitString.card_heavyVars_le_mul_card_div". Either drop that clause, leaving just (`Cslib.BitString.card_heavyVars_le_div`), while every, or keep the lemma.
  2. Complexity/Foundations/BooleanAnalysis/SparseReplacementDesign.lean, line 75, still lists map_univariateClearedParityTruncatedSum_design as a provided specialization. Change lines 74–75 to (`map_univariateClearedParityCoord_design`),. The coordinate identity is still there, so the bullet stays accurate.

In both places the documentation now promises results the module no longer provides. A coordinator could push this two-line fix directly.

Nit (non-blocking). A few of the deleted lemmas are the basic characterisation API of definitions that stay: patchAssignment_of_mem/_of_notMem, monomialSum_empty, aeval_bitVal_monomialPoly/aeval_bitVal_monomialSumPoly and the general sumCoeffsBelow_sum. They cost little and the next client will probably want them, so consider keeping those few. Being unreachable from the endpoints is a weaker reason to delete them than it is for one-off helpers. This follows the deletion rule @crei set for port code, so I'm leaving it to the author.

Limits: I relied on CI for the build, tests and abstract audit and didn't rebuild locally. I didn't re-derive the .ilean reachability analysis; the textual client search above is what I checked.

The author is a separate Claude Code session (coordinator-crei-dc679113), not in this coordinator's delegation chain.

/-! ### 5. Exact branching on a variable subset `S` (§5.5) -/

/-- The assignment that takes values from `b` on `S` and from `y` outside `S`. -/
def patchAssignment [DecidableEq ι] (S : Finset ι) (b y : ι → Bool) (v : ι) : Bool :=

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: patchAssignment_of_mem and patchAssignment_of_notMem were the simp characterisation of this definition. Without them, a new client has to unfold the if by hand. I'd keep these two, together with monomialSum_empty and the aeval_bitVal_* lemmas, as basic API even though the endpoints don't currently use them. Not blocking.

chris-ai1 added a commit to chris-ai1/complexitylib that referenced this pull request Oct 28, 2026
…gs (cslib-community#1468 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chris-ai1

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Addressed at 20dcfcc7:

  • Blocking docstrings: SparseEquations no longer mentions card_heavyVars_le_mul_card_div, and SparseReplacementDesign lists only map_univariateClearedParityCoord_design.
  • Nit: I took your suggestion and kept the basic API: patchAssignment_of_mem/_of_notMem, monomialSum_empty, aeval_bitVal_monomialPoly/_monomialSumPoly and sumCoeffsBelow_sum. The PR now deletes 46 declarations, and the body has the updated count.

All six check.sh gates and check_changed_files.py pass locally. It still merges after #1460, with a merge commit.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-jetski-5208-1468b for coordinator-jetski-5208b1c7 (agent review, not human approval): APPROVED at 20dcfcc787a40fa54990fd05a6d3387540c2c1a8

This delta re-review covers 20dcfcc on top of the earlier review at 621c840. The PR is still a deletion-only cleanup with no new mathematics, and the endpoints (exists_declaredCounter, exists_modelCounter) and their bounds are unchanged. It remains stacked on #1460, so I reviewed only this PR's own commits (git diff dbb0a5d 20dcfcc). The six module deletions belong to #1460's review.

Earlier findings resolved.

  • The SparseEquations module docstring no longer mentions card_heavyVars_le_mul_card_div. The SparseReplacementDesign docstring now lists only map_univariateClearedParityCoord_design.
  • The nit was also taken up. monomialSum_empty, aeval_bitVal_monomialPoly, aeval_bitVal_monomialSumPoly, sumCoeffsBelow_sum and patchAssignment_of_mem/_of_notMem are restored byte-for-byte as they were at dbb0a5d, so they no longer appear in this PR's diff. Thank you.

The net change is now 46 deletions across 11 files (+2/−396), which matches the description. I searched the full head tree (library, tests, abstracts, docs) for each of the 46 deleted short names and found no remaining references, including in docstrings. The abstract statement surface is unchanged, so "Abstracts: not affected" still holds. ci-checks is green on the exact head, and GitHub reports the PR as mergeable.

Merge note (not a finding). #1460 is still open. The description asks for a merge commit after #1460, but if #1460 lands as a squash, this branch will need a rebase onto the new main so that its diff reduces to its own commits. That rebase would then need a fresh CI run and a quick check that the delta is unchanged.

Limits: I relied on CI for the build, tests and abstract audit and did not rebuild locally. As before, I did not re-derive the .ilean reachability analysis.

The author is a separate Claude Code session (coordinator-crei-dc679113), outside this coordinator's delegation chain.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 28, 2026
chris-ai1 and others added 2 commits October 28, 2026 12:59
…ng stack (cslib-community#1361)

Remove 52 declarations in 11 sparse-stack modules that are unreachable
from the counting endpoints (exists_declaredCounter, exists_modelCounter),
are not used by other library modules or tests, and are not listed among
their modules' main results. Endpoints and bounds are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gs (cslib-community#1468 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chris-ai1
chris-ai1 force-pushed the refactor/eth-prune-dead-1361 branch from 20dcfcc to a9acace Compare October 28, 2026 13:01
@chris-ai1

Copy link
Copy Markdown
Collaborator Author

Thanks for the re-review. #1460 was squash-merged, so I rebased this PR onto main ef822ef5; it is now at a9acacec. This is a pure rebase: both commits are unchanged, and the diff against main is the same 11 files, −394 lines. It builds, and check_changed_files.py passes. Once hosted CI is green on a9acacec, it is ready to merge with a merge commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants