Skip to content

feat(complexity): bound shared-seed counting-sparsification errors - #8934

Merged
SamuelSchlesinger merged 4 commits into
mainfrom
feat/8457-sparsify-seed-error
Nov 27, 2026
Merged

SamuelSchlesinger merged 4 commits into
mainfrom
feat/8457-sparsify-seed-error

Conversation

@edemaine

@edemaine edemaine commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #8457. CountingSparsify.acceptCount_search_pos_error_le bounds the two-sided error of testing positivity after the counting-sparsification search. Each leaf routine reads its prefix of the shared seed. The proof uses the search's leaf-count bound and the prefix union bound. It applies the per-leaf assumptions with the root's variable support, the leaf clause bound, and the encoded-length bound supplied by nodeBound.

The result applies to valid declared inputs through searchDeclaredWith_eq_ite_mul, so the remaining randomized transfer can use the existing context-carrying machine and quantitative power budget. Theorem 7.1(a)

The strict focused build of CslibFrontierTests.Computability.Complexity.FineGrained.CountingSparsification passed on 51cc035a4c. The client uses the encoded leaf length to set its seed width and checks the case where one of four leaf prefixes gives a wrong answer. Hygiene, projection chains, encoding readability, and git diff --check passed. The merge simulation against origin/main at 66957ec822 was clean.

Implemented with Codex. Requesting independent review of the revised proof and caller contract.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

CLAIM review head=da36b33eef29e922a173eed6785619572111210a by=reviewer-agy-8934 until=2026-11-27T07:55Z

Base automatically changed from feat/8457-prefix-union-bound to main November 27, 2026 07:23

@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.

REQUEST_CHANGES at da36b33 by reviewer-agy-8934

Independent non-authoring agent review (reviewer-agy-8934; agent review, not human review or platform approval) of da36b33eef29e922a173eed6785619572111210a.

Summary

The prefix-union-bound reduction inside Cslib.Complexity.Sparsify.acceptCount_search_error_le (iterate_step leaf-path Finset, exists_search_leaves formula deduplication, and the two-sided != BruteForce.search cover argument via acceptCount_le_sum_of_take_cover) is mathematically clean and proves both false-negative and false-positive seed-count bounds without overclaiming arXiv:2611.02650v2 Theorem 7.1(a). However, checking the API against its downstream callers in Randomized.lean and #8457 exposes two concrete issues that should be resolved before landing:

  1. Caller-blocking omission in hwidth (and herror) leaf invariants (Sparsification.lean:387-392).
    acceptCount_search_error_le scopes hwidth and herror only to formulas ψ : CNF ℕ satisfying (∀ c ∈ ψ, c.length ≤ k) and ψ.length ≤ occBound K α * φ.numVars + 1:

    (hwidth : ∀ ψ : CNF ℕ, (∀ c ∈ ψ, c.length ≤ k) →
      ψ.length ≤ occBound K α * φ.numVars + 1 → width ψ ≤ n)

    Because CNF ℕ allows arbitrary binary-encoded natural-number variable labels (encNat), (encCNF ψ).length is unbounded over that domain: for any k ≥ 1 and φ = [], the single-clause formulas ψ_m := [[(2 ^ m, true)]] satisfy ∀ c ∈ ψ_m, c.length ≤ k and ψ_m.length = 1 ≤ occBound K α * φ.numVars + 1, while (encCNF ψ_m).length → ∞ as m → ∞.
    In SolvesWithErrorInTimeO (Randomized.lean:362-369), a seeded solver (ℓ, V₀) for SolvesWithErrorInExpTime or SolvesWithErrorInPowerExpTime only bounds ℓ ψ (and thus the amplified leaf width width ψ = (2 * r ψ) * ℓ ψ from computableInO_amplifySeededMajority) through ((encCNF ψ).length + 1) ^ e (for example ℓ ψ = (encCNF ψ).length). For every such solver, no finite shared seed length n : ℕ satisfies hwidth. Likewise, herror omits ψ.vars.toFinset ⊆ φ.vars.toFinset (needed both to bound ψ.numVars ≤ φ.numVars directly and for declared-range leaf verifiers after denseRelabel, cf. CountingSparsify.search_pos_iff_of_normalized and CountingPowerSearch.lean:324).

    • Requested fix: Expose or pass the leaf support and encoding-length invariants that Sparsification.lean already establishes on every leaf ψ ∈ leaves — specifically ψ.vars.toFinset ⊆ φ.vars.toFinset (from exists_of_mem_walk) and (encCNF ψ).length ≤ nodeBound K α φ (from length_encCNF_walk_le, making nodeBound public as CountingSparsification.lean does, or providing Normalized K ψ alongside ψ.vars.toFinset ⊆ φ.vars.toFinset and the encoded-length bound) — in exists_search_leaves, hwidth, and herror. Also add a test client in CslibFrontierTests/FineGrained/Sparsification.lean whose width ψ depends on (encCNF ψ).length and exercises nontrivial ε > 0 (the current test uses constant width := fun _ => 0 and ε := 0, which masked the unbounded-label issue).
  2. Target search alignment with #8457 (arXiv:2611.02650v2 Theorem 7.1(a)) vs. CountingSparsify (policy/taste.md).
    The PR description frames this theorem as the search error transfer toward #8457 Theorem 7.1(a) (rSH variable-count equivalence under a subunit power saving 0 < p < 1), noting that carrying the seed through the machine and choosing the power-budget schedule remain. Note that in the deterministic Theorem 2.4 / Corollary 2.5 development (CountingPowerSearch.lean, #8853 / #8856), the power-saving transfer KSAT_numVars_of_size was built on CountingSparsify.searchDeclaredWith, not Sparsify.search, because:

    • CountingQuantitative.lean (#8793) proved the subunit power-budget leaf and clause bounds (countingPowerBudget, countingThresholdBase) for CountingSparsify.CountingTreeBound, whereas Sparsify only has fixed-parameter exists_sum_choose_le;
    • CountingSparsificationUniform.lean (exists_computableInO_searchDeclaredWith) already certifies multitape runtime with an arbitrary captured runtime context {C : Type} {encC : C ↪ List Bool} (so instantiating C := List Bool, encC := encBits carries the shared seed without building a parallel Sparsify.stepWith machine layer); and
    • CountingSparsify.searchDeclaredWith_pos_iff_of_normalized (#8853) already reduces decision to {0, 1} leaf outputs (0 < searchDeclaredWith ...).
      Under policy/taste.md ("A declaration has a caller" and "Replace, do not accumulate"), please either:
    • prove the #8457 Theorem 7.1(a) shared-seed error transfer on CountingSparsify.search / CountingSparsify.searchDeclaredWith so #8457 reuses CountingSparsify's existing context-carrying machine certificate and quantitative power budget rather than duplicating them on Sparsify (deleting Sparsify.acceptCount_search_error_le if nothing in #8457 or an open rETH task calls Sparsify.search), or
    • if Sparsify.acceptCount_search_error_le is retained for fixed-parameter rETH clauses-to-variables (SolvesWithErrorInExpTime), state that scope accurately in the PR description and confirm its concrete caller while avoiding a duplicate runtime-budget + context-carrying stack on Sparsify.

Other checks & review limits

  • What should not exist (policy/taste.md): exists_search_leaves is appropriately private, and extending private theorem iterate_step with the leaf-path Finset avoids re-unfolding exists_iterate_searchStep. Aside from item 2 above (ensuring acceptCount_search_error_le sits on the search #8457 actually calls), no other declaration in the diff is redundant.
  • Proof hygiene & static checks: Checked check_hygiene.py --check-simp, check_projection_chains.py, check_encoding_readability.py, check_timem.py, proof_copies.py --all, and check_pr_names.py --strict: all clean (0 projection chains, 0 repeated compound encodings, 0 copied proof blocks, no sorry/axiom/native_decide/maxHeartbeats overrides).
  • Limits: Independent agent review of the diff, surrounding Sparsification / CountingSparsification / Randomized / AcceptCount modules, caller contracts, and static checks at da36b33eef29e922a173eed6785619572111210a (source-checks passed; lean-checks was still running during review). Not human review.

@edemaine edemaine changed the title feat(complexity): bound shared-seed sparsification errors feat(complexity): bound shared-seed counting-sparsification errors Nov 27, 2026
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

CLAIM review head=51cc035a4c2255175a922cdbce8146ebb7e2e576 by=reviewer-agy-8934 until=2026-11-27T08:27Z

@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.

APPROVE at 51cc035 by reviewer-agy-8934

Independent non-authoring agent review (reviewer-agy-8934; agent review, not human review) of 51cc035a4c2255175a922cdbce8146ebb7e2e576 (CI run 45960103717).

  • Round 2 delta & caller contract: Both Round 1 findings are cleanly resolved (Sparsification.lean and its test file are untouched relative to main). Cslib.Complexity.CountingSparsify.acceptCount_search_pos_error_le proves:
    theorem acceptCount_search_pos_error_le (hM2 : 2 ≤ M) {k B L_coeff : ℕ}
        (hkK : k ≤ K) (hTB : CountingTreeBound M K B L_coeff hM hK)
        {φ : CNF ℕ} (hφ : ∀ c ∈ φ, c.length ≤ k)
        (V : CNF ℕ × List Bool → ℕ) (width : CNF ℕ → ℕ) (n : ℕ) {ε : ℝ} (hε : 0 ≤ ε)
        (hleaf : ∀ ψ : CNF ℕ, CountingNormalized K ψ → (∀ c ∈ ψ, c.length ≤ k) →
          isSparse (countingThreshold M) K ψ = true → ψ.vars.toFinset ⊆ φ.vars.toFinset →
          ψ.length ≤ occBound K M * φ.numVars + 1 → (encCNF ψ).length ≤ nodeBound K L_coeff φ →
          width ψ ≤ n ∧ (acceptCount (fun p => decide (0 < V p) != decide (0 < p.1.modelCount))
            ψ (width ψ) : ℝ) ≤ ε * (2 : ℝ) ^ width ψ) :
        (acceptCount (fun p => decide (0 < search M K k B
          (fun ψ => V (ψ, p.2.take (width ψ))) p.1) != decide (0 < p.1.modelCount)) φ n : ℝ) ≤
          (2 : ℝ) ^ (φ.numVars / B + 1) * (ε * (2 : ℝ) ^ n)
    Name, docstring, module ## Main results, and PR title/body accurately state this shared-seed positivity error bound without overclaiming arXiv:2611.02650v2 Theorem 7.1(a) (#8457 stays open for wiring the seed-carrying machine and power-budget amplification schedule). All six leaf invariants (CountingNormalized K ψ, clause width ≤ k, isSparse, ψ.vars.toFinset ⊆ φ.vars.toFinset, clause count ≤ occBound K M * φ.numVars + 1, and (encCNF ψ).length ≤ nodeBound K L_coeff φ — where nodeBound depends on (K, L_coeff, φ) rather than the seed) match CountingPowerSearch.lean (declaredSearch_resources) and searchDeclaredWith_eq_ite_mul, allowing {0, 1} Bool.toNat leaf verifiers from computableInO_amplifySeededMajority (#8924) to bound width ψ by a seed-independent n and transfer two-sided error across CountingSparsify.searchDeclaredWith.
  • What should not exist (policy/taste.md) & test coverage: No new public definitions or files are introduced. private theorem search_pos_iff_exists_leaf cleanly extracts the leaf-positivity equivalence shared across search_pos_iff_of_normalized and acceptCount_search_pos_error_le (4 call sites total). Leaving the searchDeclaredWith positivity specialization as a caller-side searchDeclaredWith_eq_ite_mul + acceptCount_congr step avoids a redundant public wrapper. Looked across both changed files and found nothing to delete, merge, or privatize. The test client in CslibFrontierTests/Computability/Complexity/FineGrained/CountingSparsification.lean exercises an (encCNF ψ).length-dependent width, nodeBound, and a nontrivial ε = 1 / 4 prefix error (1 wrong 2-bit prefix out of 4).
  • Reuse, hygiene & CI advisory notices: Hosted source-checks, lean-checks (140375845954), and ci-checks passed on 51cc035a4c2255175a922cdbce8146ebb7e2e576: Parallel-definition 0/0 declarations, Duplicate-statement 0/3 theorems, PR description names 1/1 declared, and Repeated-proof-block 1 candidate between search_pos_iff_of_normalized (lines 545–548) and acceptCount_search_pos_error_le (lines 796–799) — inspected and resolved (those 4 lines bind the walked leaf state and pass the individual leaf lemmas, with acceptCount_search_pos_error_le after section Sizes additionally passing length_encCNF_walk_le; a tuple-packaging lemma would restate all 5–6 conclusions without simplifying either site per CONTRIBUTING.md).
  • Limits: Independent agent review of the diff, proof arguments, caller compatibility with CountingPowerSearch.lean / Randomized.lean, test client, and CI checks at 51cc035a4c2255175a922cdbce8146ebb7e2e576; not human review.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit c3cb897 Nov 27, 2026
10 checks passed
@SamuelSchlesinger
SamuelSchlesinger deleted the feat/8457-sparsify-seed-error branch November 27, 2026 08:04
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