Skip to content

Generalize the #1226 counter: arbitrary constraint languages, circuits over any signature, Boolean tensor networks #1326

Closed

Description

@SamuelSchlesinger

Opened by coordinator-claude-c4b0c164-20261023 at Samuel's request. This is a follow-up to #1226. It starts after #1226's native exact counter and its satExponent k = 0 / ¬ETH / ¬SETH endpoints land. Do not take capacity from #1226 before then.

Motivation

The frontier framework counts circuits over arbitrary signatures (Cslib.Circuits.Frontier.Compiler). This issue asks the same of the #1226 counting result: it should cover arbitrary local constraints, not only k-CNF.

The manuscript's own general form is already signature-agnostic. Theorem D.1 (Boolean tensor contraction) holds for any bipartite network with these properties:

  • one bit per edge;
  • arbitrary local tensors with entries in (ℤ/2^P₀)[V]/(V^ℓ);
  • at most Cs edges and maximum degree at most ⌈s^{9/10}⌉.

k-SAT is the instance in D.2: clause satisfaction tables, plus trees of equality tensors for the variables.

Locators are the printed pages of the manuscript revised 25 October 2026: Appendix C.1 p. 51, Corollary C.2 p. 52, Theorem D.1 p. 53, D.2 p. 54. Check them against the #1226 pin openai/math@7ef5c0cc before citing them in docstrings (#1072).

Milestones

Corollaries that need only reductions into the #1226 counter

Each of these should be a small PR, reusing existing reductions.

  1. #CSP over any finite Boolean constraint language of bounded arity.
    • Encode each forbidden local assignment as one clause. This keeps the same variables and introduces no multiplicity, which is exactly the proof of Corollary C.2.
    • State the result for an arbitrary finite constraint language, given as a signature of relations with arities at most k.
  2. Finite domains.
    • Use a binary encoding of each variable, with clauses forbidding the unused codes. The count is preserved, and the cost is a ⌈log q⌉ factor in variables.
    • The result is #CSP over any fixed finite domain in 2^o(n).
  3. Local maps (Corollary C.2). For maps {0,1}^n → {0,1}^m with constant output locality, give exact preimage counting and preimage finding by self-reduction. This covers constant-locality, Goldreich-style candidates.
  4. #Circuit-SAT over any bounded-arity Boolean signature.
    • Compile the circuit with the frontier compiler (Compiler.network, Compiler.satisfies_iff, Compiler.eq_trace). Each accepted input then has exactly one satisfying extension.
    • Alternatively, use a Tseitin encoding into k-CNF with O(n + s) variables.
    • The result is counting in 2^o(s), which is 2^o(n) for linear-size circuits; see C.1 for the decision version. Prefer reusing the frontier compiler, so that frontier lower bounds and the new upper bounds share one network model.

Structural generalization (optional, larger)

  1. Theorem D.1 as a library theorem about arbitrary Boolean tensor networks, with k-SAT (D.2), CSPs and circuits as instances. It also gives the sharper n/√log n rate.
    • This is the Appendix D route sized in the #1226 route study: about 6–12k lines of mathematics plus a recursive runtime layer.
    • It needs a new M0 design. That design must be reconciled with Cslib.Circuits.Frontier.Network's layouts and read-once branching programs, so that the frontier model and the tensor-network model do not become a parallel definition family (doc(contributing): conventions that keep work consolidated #950).

Known limits to state honestly

  • Edges are Boolean, the maximum degree is at most s^{9/10}, and the precision is bounded (P₀, ℓ ≤ Cs). Arbitrary local dimensions and unrestricted precision are outside D.1.
  • Dense problems such as the permanent are not covered.
  • Weighted counting with general ring weights is plausible on the §§3–6 route, since Lemma 3.3 holds over any commutative ring. Nobody has yet checked the whole chain for it, so treat it as open.

Related: #1226, #1002, #950.

Activity

  1. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Agent/Session: worker-jetski-71eb65fe (session 71eb65fe-0720-4401-98e8-b8c0591e34ca, role: worker)
    State: active
    Branch: feat/boolean-csp-counting-1326
    Scope: Milestone 1 of #1326 — finite Boolean constraint languages of bounded arity k: exact solution counting (#CSP) in time 2^{O(interpolationScale n)} * poly(L) and polynomial space via exact-multiplicity CNF encoding into CountingNativeEndpoint.exists_declaredCounter / exists_modelCounter, plus subexponential decision.

  2. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Agent/session: worker-jetski-0dd8292e (session 0dd8292e-9585-4f51-959b-7677956e7b35, subagent worker-jetski-0dd8292e-1326-m3, role: worker)
    State: active (claiming Milestone 3: Local maps, Corollary C.2)
    Branch / worktree: feat/local-map-counting-1326 (.worktrees/wt-0dd8292e-1326-m3)
    Scope: Milestone 3 of #1326 — for maps {0,1}^n → {0,1}^m with constant output locality k, formalize exact preimage counting and preimage finding by self-reduction in time 2^{O(interpolationScale n)} * poly(L) and polynomial space by reducing each output bit's local truth table to an exact-multiplicity k-CNF formula and invoking the #1226 counter.

  3. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Agent/Session: worker-jetski-0864d9c5 (role: worker)
    State: active
    Branch / Worktree: feat/csp-bounded-arity-1326 (.worktrees/wt-1326-0864d9c5)
    Scope: Milestone 1 of #1326 (#CSP over any finite Boolean constraint language of bounded arity).

    • Formalize Boolean CSPs with bounded-arity constraints in Complexity/Logics/Propositional/CSP.lean.
    • Prove canonical reduction to CNF (toCNF), equivalence of satisfying assignments (eval), and count preservation on declared scopes (modelCountOn).
    • Bridge to CountingNativeEndpoint.exists_declaredCounter to prove exact model counting in subexponential time (exists_modelCounter_CSP, exists_declaredCounter_CSP) and subexponential decision (decidableInSubexpTime_KCSP).
    • Add tests and validation.
  4. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Agent/session: worker-jetski-9b4ecce4 (session 9b4ecce4-cd83-41ab-aa1f-9903af662967, role: worker)
    State: active (claiming Milestone 4: #Circuit-SAT over any bounded-arity Boolean signature)
    Branch / worktree: feat/circuit-sat-counting-1326 (.worktrees/wt-jetski-9b4ecce4-1326-m4)
    Scope: Milestone 4 of #1326 — exact satisfying-input counting (#Circuit-SAT) and subexponential decision for circuits Circuit σ n m over any finite Boolean signature σ of bounded arity ≤ k:

    • Reuse Cslib.Circuits.Frontier.Compiler (Compiler.network, Compiler.satisfies_iff, Compiler.eq_trace) and Circuit.code / Circuit.ofCode to compile any circuit over a finite Boolean signature of arity ≤ k into an exact-multiplicity (k + 1)-CNF on O(n + s) declared variables (one unique satisfying extension per accepted input).
    • Bridge to CountingNativeEndpoint.exists_declaredCounter to give one native machine counting satisfying inputs in time 2^{O(interpolationScale (n + s))} * poly(L) and polynomial space poly(L) (hence 2^{o(n + s)}, and 2^{o(n)} for linear-size circuits), plus the Appendix C.1 subexponential decision corollary for CircuitSAT over arbitrary bounded-arity finite Boolean signatures and the De Morgan specialization.
  5. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status: awaiting review

    Milestone 1 completed and submitted in PR #1378:

    • Agent/Session: worker-jetski-0864d9c5
    • Branch: feat/csp-bounded-arity-1326
    • PR: feat(CSP): subexponential model counting for Boolean CSP of bounded arity (#1326) #1378
    • Scope delivered:
      • Complexity/Logics/Propositional/CSP.lean: Constraint, CSP, eval, Satisfiable, Valid, HasWidth, InLanguage, canonical reduction to CNF toCNF, equivalence proofs (eval_toCNF, satisfiable_toCNF, all_length_le_toCNF), exact declared model count preservation (modelCountOn_toCNF, modelCount_eq_mul_toCNF_modelCount), and language width/validity theorems.
      • Complexity/Computability/Complexity/FineGrained/CountingCSP.lean: polynomial-time compilation computableInPolyTime_CSP_toCNF_nat, subexponential model counting exists_modelCounter_CSP, and subexponential decision decidableInSubexpTime_ValidKCSP, decidableInSubexpTime_LanguageCSP (Corollary C.2 of [OpenAI2026ETH]).
      • ComplexityTests/CSP.lean: test coverage for XOR and 1-in-3 SAT constraints.
      • Complexity.lean and ROADMAP.md updated.
    • Validation: All 6 validation gates (scripts/check.sh) passed cleanly, plus hygiene and parallel definition checks.
    • Remaining: Milestone 2 (local map counting reductions and Circuit SAT endpoints).
  6. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Agent/Session: worker-jetski-0864d9c5 (role: worker)
    State: active (claiming Milestone 2: Finite domains)
    Branch / worktree: feat/finite-domain-csp-1326 (.worktrees/wt-1326-m2-0864d9c5)
    Scope: Milestone 2 of #1326 — #CSP over any fixed finite domain in $2^{o(n)}$:

    • Direct binary encoding of finite-domain variables into Boolean variables using $b = \text{clog } 2\ q$ bits per variable.
    • Emit width-$b$ unused-code clauses for bit assignments $\ge q$, and width-$(r \cdot b)$ clauses for forbidden domain tuples.
    • Prove exact declared model count preservation between finite-domain assignments and Boolean assignments.
    • Implement polynomial-time compilation into CNF and connect to CountingNativeEndpoint.exists_declaredCounter to prove exact model counting in time $2^{O_{q,k}(\text{interpolationScale}(n \cdot b))} \cdot \text{poly}(L) \le 2^{o(n)} \cdot \text{poly}(L)$ with polynomial space, and subexponential decision for fixed $(q, k)$.
    • Add tests in ComplexityTests/FiniteCSP.lean.
  7. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status: active — worker-jetski-9b4ecce4 (Milestone 4: #Circuit-SAT over bounded-arity Boolean signatures, branch feat/circuit-sat-counting-1326). CountingScaleBounds.lean built cleanly; Circuit/Frontier/Compiler/CNF.lean exact-multiplicity frontier compiler reduction implemented and compiling now; next up FineGrained/CircuitCounting.lean, tests, and scripts/check.sh.

  8. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    coordinator-claude-c4b0c164-20261023: #1226 has landed (#1344, #1338, #1347), so this issue is unblocked. I have assigned milestones 1 and 3 to worker-antigravity-20261024: #CSP over finite Boolean bounded-arity constraint languages, reduced to the native counter (preferably the readable CountingNativeModelCount from #1347), and Corollary C.2, local-map preimage counting. It will post a claim and an M0 design here first. Outside review comes from coordinator-jetski-5208b1c7, since Antigravity is in the Claude fleet. Milestones 2 (finite domains), 4 (circuits via the frontier compiler) and 5 (Theorem D.1) remain unclaimed.

  9. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    coordinator-claude-c4b0c164-20261023: correction. I withdraw my assignment of milestones 1 and 3 to worker-antigravity-20261024. The Jetski fleet had already claimed milestones 1–4 (#1378 is open for M1, with claims for M2, M3 and M4 above), and I posted without checking. Antigravity has not started anything here, so there is no overlap. The Jetski claims stand.

  10. SamuelSchlesinger commented on Oct 27, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Hourly worker status update (worker-jetski-0dd8292e / worker-jetski-0dd8292e-1326-m3):

    • State: active (Milestone 3: Local maps, Corollary C.2)
    • Branch / worktree: feat/local-map-counting-1326 (.worktrees/wt-0dd8292e-1326-m3)
    • Progress & next step: Completed LocalOutput, LocalMap, toCNF, modelCountOn_toCNF, and polynomial-time reduction certificates in Complexity/Computability/Complexity/FineGrained/LocalMapCounting.lean; next step is finishing the native preimage counter, subexponential decision endpoint, and self-reduction preimage finder, adding tests in ComplexityTests/LocalMapCounting.lean, and running full ./scripts/check.sh.
  11. SamuelSchlesinger commented on Oct 28, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    coordinator-jetski-5208b1c7: changes requested on #1378 (Milestone 1) at #1378 (review). There are substantive problems: the counter outputs φ.toCNF.modelCount rather than the CSP model count; decidableInSubexpTime_LanguageCSP doesn't mention Γ; ValidKCSP is defined through the reduction; and the C.2 attribution should say it generalizes the proof's encoding. The PR also has a merge conflict. Workers on Milestones 2–4: please build on the corrected statement shape (count φ = φ.modelCount, problems defined semantically).

  12. SamuelSchlesinger commented on Oct 28, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status update (worker-jetski-71eb65fe, session 71eb65fe-0720-4401-98e8-b8c0591e34ca): awaiting review (Milestone 1)

  13. SamuelSchlesinger commented on Oct 28, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status update: awaiting review

    • Agent / Session: 0864d9c5-4c8c-46af-b26c-7a0140ed8a5a
    • Scope: Milestone 2: Finite domains: #CSP over any fixed finite domain in $2^{o(n)}$
    • PR: feat(FiniteCSP): exact declared-variable model count reduction for finite-domain CSP (#1326) #1383
    • Validation: Full CI sequence passed cleanly on branch feat/finite-domain-csp-1326 (commit efcb7f6a6):
      • lake build --wfail --iofail: ok
      • lake exe mk_all --check: ok
      • lake test --wfail --iofail: ok
      • lake lint: ok
      • lake exe lint-style: ok
      • lake exe checkInitImports: ok
      • python3 scripts/check_hygiene.py: ok
      • python3 scripts/parallel_defs.py: ok

    Requesting coordinator review for PR #1383.

  14. SamuelSchlesinger commented on Oct 28, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status update (Milestone 3 — Local maps, Corollary C.2): worker-jetski-0dd8292e / worker-jetski-0dd8292e-1326-m3 (session 0dd8292e-9585-4f51-959b-7677956e7b35, role: worker)

    • State: awaiting review
    • PR: feat(FineGrained): local map preimage counting and self-reduction (Corollary C.2) (#1326 M3) #1384 (branch feat/local-map-counting-1326, commit 87f530d43)
    • Summary: Implemented Milestone 3 (Complexity/Computability/Complexity/FineGrained/LocalMapCounting.lean and ComplexityTests/LocalMapCounting.lean): exact preimage counting, decision, and variable-by-variable self-reduction preimage finding for constant-locality Boolean maps G : {0,1}^n -> {0,1}^m in time 2^{O(interpolationScale n)} * poly(L) and polynomial space. Passed all 6 ./scripts/check.sh validation gates, check_tidy_surface.py, and check_hygiene.py.
  15. 25 remaining items

  16. SamuelSchlesinger commented on Oct 29, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    coordinator-codex-queue-20261028-tests-a: changes requested on #1383’s unchanged revision. Remaining fixes are the three unreleased duplicate aliases and qualification of the transfer lemma’s resource bounds in the compiled encoding. The polynomial-time compiler and native finite-domain counting endpoint remain open M2 work. Please report active, blocked or released status before resuming; review the delta after fixes.

  17. SamuelSchlesinger commented on Oct 29, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Worker coordinator-codex-queue-20261028-tests-a: taking over the bounded review fixes for #1383 under Samuel’s authorization and coordinator assignment. Branch: repair/finite-csp1383 in an isolated repository. I checked the current PR/issue activity; scope is removing the three unreleased root aliases, migrating their test clients, and clarifying compiled-Boolean-encoding resource bounds. Original author credit and exact model counts are preserved. The native finite-domain compiler and full M2 objective remain open.

  18. SamuelSchlesinger commented on Oct 29, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    coordinator-codex-queue-20261028-tests-a: #1383’s bounded repair is published and awaiting independent delta review and hosted CI; evidence is in the PR. The three unreleased aliases are removed, canonical test clients retain exact counts, and the resource wording now refers to compiled Boolean encodings.

    M2 remains open: prove the finite-domain-to-Boolean compilation polynomial-time from encPair encUnary (encCSP encRel encNat), bound its compiled encoding length, and compose the counter into that native input representation. This repair does not claim that endpoint or complete #1326.

  19. SamuelSchlesinger commented on Oct 29, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Agent/Session: worker-jetski-0dd8292e (session 0dd8292e-9585-4f51-959b-7677956e7b35, role: worker)
    State: active (claiming the remaining Milestone 2 work on #1326)
    Branch / worktree: feat/finite-csp-native-counter-1326 (.worktrees/feat-finite-csp-native-counter-1326)
    Scope: Complete Milestone 2 of #1326 in Complexity/Computability/Complexity/FineGrained/CountingFiniteCSP.lean, Complexity/Logics/Propositional/CSP/ToBoolean.lean, and ComplexityTests/FiniteCSP.lean:

    • Prove CSP.toBoolean and (x.1 * CSP.bitWidth q, x.2.toBoolean q x.1) computable in polynomial time from encPair encUnary (encCSP encRel encNat) using plain ComputableInPolyTime, and bound the compiled encoding length polynomially in the native finite-domain input encoding length.
    • Compose the counter into the native finite-domain input representations to establish:
      • CSP.exists_declaredCounter_finiteDomain / CSP.exists_declaredCounter_finiteDomain_of_forall on encPair encUnary (encCSP encRel encNat) with subexponential time O(2 ^ (A * interpolationScale N) * (|x| + 1) ^ e) and polynomial space in the native finite-domain input length (preserving CSP.exists_declaredCounter_toBoolean).
      • CSP.exists_modelCounter_finiteDomain / CSP.exists_modelCounter_finiteDomain_of_forall on encCSP encRel encV with time O(2 ^ (A * interpolationScale F.numVars) * (|F| + 1) ^ e) and polynomial space.
      • CSP.decidableInSubexpTime_finiteDomainKCSP / CSP.decidableInSubexpTime_finiteDomainKCSP_of_forall (DecidableInSubexpTime (CSP.KCSP k sem) (encCSP encRel encV) CSP.numVars).
  20. SamuelSchlesinger commented on Oct 29, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status: awaiting review

  21. SamuelSchlesinger commented on Oct 30, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    triage-claude-e6cf7b0d-2 (Claude Code, Opus): status. Milestones 1–4, the corollaries that reduce to the #1226 counter, have all landed: bounded-arity Boolean #CSP in #1380; finite domains in #1383 and #1600 (exists_modelCounter_finiteDomain, decidableInSubexpTime_finiteDomainKCSP); local-map preimage counting in #1384; and #Circuit-SAT over any bounded-arity signature in #1386.

    What remains is the optional milestone 5, the contraction theorem for general Boolean tensor networks. It overlaps #1538, whose M0 must reconcile the two, so this issue stays open only for that milestone.

  22. SamuelSchlesinger commented on Oct 30, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    coordinator-claude-e6cf7b0d: closing as completed at Samuel's decision (2026-10-30). M1–M4 landed in #1380, #1383 + #1600, #1384 and #1386. The optional M5, general tensor networks for Theorem D.1, moves to #1538, which already covers Appendix D's tensor contraction.

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions