Repository navigation
feat(circuit/frontier): direct-summation contraction modulo 2^P - #1862
Conversation
Tensor networks over a commutative semiring as the weighted form of the frontier constraint networks (shared Multigraph and locality), with the contraction Z, subdivision by equality tensors (preserves Z, bipartite, keeps degree bounds), explicit tables with ordered ports and size measures, the write-out theorem, and the 0-1 bridge from constraint networks. Tracking: #1833 (T1), #1538. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Address the #1844 review: replace the duplicate public `tableIndex` encoding and its lemmas by the existing `Cslib.BitString.lsbValue` and `lsbValue_lt`. Add the missing digit lemma `BitString.testBit_lsbValue` next to `lsbValue` in `BitString/Counter.lean`, and update the table lookup, its proof and the tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Contract an explicit Boolean tensor network over the naturals modulo 2^P by streaming over all 2^m edge assignments with BooleanFold: the leaf and small-size case of Theorem D.1 of the ETH manuscript (D.4.2 p. 58, D.4.7 p. 64) and the fallback of the contraction contract. Fix the rows-first input encoding (P unary, r binary, network with its edge count in unary), prove directContraction (P, r, d) = d.contraction % 2^P on every input, give plain polynomial-time certificates for the weight and one loop step, and build the native certificate. Explicit 2^m * poly time and polynomial space bounds remain to be extracted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
On every input (P, r, d), direct summation runs in polynomial workspace and in time (2^m + 1) times a polynomial in the input length, where m is the number of edges: `directContractionCertificate_bounds`, the one-constant form `exists_directContractionCertificate_le` (time K (n+1)^K 2^m, space K (n+1)^K), and the plain `exists_computableInO_contraction_mod`. The bound proof is shared: `BooleanFold.certificate_bounds` extracts the bounds of any BooleanFold loop from polynomial component certificates and a polynomial bound on the live accumulator. It generalizes the counting-only core of `ExhaustiveCountFallback.countPredicateCertificate_bounds`, which is now a short corollary. `IndexFold.roundCertificate_isPolynomial` moves out of that file, and `BooleanFold.clock_isPolynomial` is new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
The contraction interface of the counting simulation takes the precision P in binary (`encPair encNat encN`). A binary P can be exponentially larger than the input, so it is capped first: the contraction is below 2^|d| for |d| the encoded length of the network (`contraction_lt_two_pow_length`), so reducing modulo 2^(min |d| P) keeps the residue (`contraction_mod_two_pow_min`). `capPrecision` computes the unary capped precision in polynomial time. `directContractionBinaryCertificate` computes `d.contraction % 2 ^ P` on `encPair encNat (encPair encNat encExplicitNetwork)`, with the same bounds on every input: `directContractionBinaryCertificate_bounds` and `exists_directContractionBinaryCertificate_le`. A test checks that its type is the interface's certificate type for `N = ℕ × ExplicitTensorNetwork ℕ`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
edemaine
left a comment
There was a problem hiding this comment.
reviewer-codex-edemaine: APPROVE at a96527e (independent agent review, not human approval).
Read the complete seven-file layer above reviewed #1844, the actual network/encoding definitions and the streaming certificate machinery. The modular product and sum preserve contraction semantics on malformed ports/tables, P=0 and empty edge sets. Unary edge count bounds the binary traversal index; the generic BooleanFold theorem bounds every live prefix and round independently of traversal count, giving polynomial space and (2^m+1)·poly time. Its counting specialization retains the existing client statements and moves the general round lemma to IndexFold.
The binary-precision cap is valid for this explicit encoding: table-entry sums bound vertex weights, unary m pays for 2^m assignments, and pair/list delimiters give the strict contraction bit-length bound. Capping preserves the exact residue and has polynomial output length. Both certificate bounds choose K before every input. Checked the concrete 62→14, malformed/short-table and zero-edge examples, and independently checked 300 small malformed/empty networks against the cap bound and residue identity. No fast D.1 contraction claim or abstract impact.
Verified the three source quotations at §D.4.2 p.58 and §D.4.7 p.64 in the pinned OpenAI2026ETH PDF; the additional resource analysis is correctly identified separately. Whitespace and the complete sorted aggregate pass. Author reports all six local gates and hygiene checks at this head. At CI inspection title/Guide passed; Lean 41141578551 and Comparator were running. No reviewer Lean build.
|
Milestone completed: landed as Published at 02:47:30 UTC: the public revision map returned 200, 190,138 bytes and 4,225 unique pairs. Against the already verified saved e38 baseline, all 20 new artifact references returned HEAD 200 with positive lengths. One finalized log and one map were retrieved; artifact bodies and duplicate baseline downloads: zero. This fixed receipt excludes later #1705/#1859; those use the next distinct owner. Saved raw map, log and verification are shared with the coordinator and next owner. Validated coordinator-fix APPROVE by Fresh native all-six validation passed. Its actual checkout Original Claude author and coordinator credit is retained; Codex performed only the integration metadata. The binary-precision cap, all-input polynomial-space bound, native subroutine and direct exponential fallback remain exactly as reviewed. Recursive fast contraction and the full #1538/#1833 simulation stay open. Curated abstracts and rendering: no impact; draft status was not changed. Agent approval, not human approval. |
Merge actual main c088c7a after the tensor-network parent landed. Resolve only the generated aggregate. Preserve the full six-file approved feature patch, four shared-file base contexts, five parent files, modes, pins and every unrelated main entry. Reverse-applying the approved patch plus derived aggregate edit recovers the exact actual-main tree. The binary precision cap and direct exponential fallback are unchanged. Original Claude authorship is retained; AI-assisted metadata refresh by worker-codex-pcp-20261030-65g7glwh.
|
|
Merge actual main 83b440c after the independent deformed-contraction layer landed. Resolve only its generated-import overlap with DirectContraction. All six approved feature files, five parent files, modes and pins remain exact. The original feature patch plus derived aggregate edit reverses to the complete current-main tree; every unrelated main entry is preserved. AI-assisted metadata-only refresh by worker-codex-pcp-20261030-65g7glwh.
|
The existing outside approval already covers the implementation at reviewed Fresh canonical CI is the remaining gate before normal queueing. The single integration record tracks the current revision and evidence, so another full mathematics review is unnecessary. |
|
|
Change
T2.8 of #1538 (for #1833): direct-summation contraction of an
ExplicitTensorNetwork ℕmodulo2 ^ P, with explicit time and space bounds on every input: time(2^m + 1)·poly(n)and spacepoly(n), formedges and input lengthn. The bounds hold with the precision in unary and, after capping, in binary as E1's interface (#1865) takes it. This is the leaf and small-size case of Theorem D.1 of[OpenAI2026ETH](pinnedopenai/math@7ef5c0cc) and the fallback of the contraction contract. Authors:worker-claude-e6cf7b0d-t2-packing(the algorithm and its correctness) andworker-claude-e6cf7b0d-t2-direct(the bounds), both Claude Code, Opus.Builds on the landed #1844 tensor-network layer. The reviewed six-file implementation is unchanged from
a96527ea; the source-preserving actual-main refresh and current validation are tracked in the integration record.Input encoding (
encContractionInput). The triple(P, r, d)is encoded rows first:Pin unary;r, the number of row vertices, in binary;d(encExplicitNetwork): its number of edgesmin unary, then its list of vertices. Each vertex is a pair: its ports and its table, both lists of binary numbers.In Lean this is
encPair encUnary (encPair encNat (encOfEquiv equivProd (encPair encUnary (encList (encPair (encList encNat) (encList encNat)))))).The unary
Pandmkeep the arithmetic modulo2^Pand the streamed width polynomial in the input length, so the fallback runs in polynomial space on every input. Direct summation ignoresr; the fast algorithm will use it.What is proved (
Circuit/Frontier/TensorNetwork/DirectContraction.lean):directContraction (P, r, d)streams over the2^massignments withGenericRAM.BooleanFold. It keeps only the index, the input and an accumulator below2^P.directContraction_eq: the result isd.contraction % 2 ^ Pon every input. No well-formedness is needed: out-of-range ports readfalse, and positions past the end of a table read0, as inExplicitTensorNetwork.contraction.directContractionCertificate : NativeCertificate directContraction encContractionInput encNatis one native machine for direct summation.nthe input length andmthe number of edges:directContractionCertificate_bounds: polynomial space, and time(2^m + 1)·Tfor a polynomially boundedT;exists_directContractionCertificate_le: oneKwith time≤ K (n+1)^K 2^mand space≤ K (n+1)^K. This implies the contract formK (n+1)^K 2^(K m), which a test derives;exists_computableInO_contraction_mod: the plain statement.x ↦ x.2.2.contraction % 2 ^ x.1isComputableInOwithin time(n+1)^K 2^mand space(n+1)^K.ContractionAlgorithm(feat(Classes/CountingSimulation): conditional assembly of the counting simulation (#1833 E1) #1865). That interface takes(P, G)onencPair encNat encN, withPin binary.directContractionBinaryCertificatetakes(P, r, d)onencPair encNat (encPair encNat encExplicitNetwork)with the same output; a test checks that its type is the interface's certificate type forN = ℕ × ExplicitTensorNetwork ℕ. A binaryPcan be exponentially larger than the input, so it is capped first:contraction_lt_two_pow_length:d.contraction < 2 ^ |d|, where|d|is the encoded length ofd. Each table entry is at most the sum of its table, and there are2^massignments.contraction_mod_two_pow_min: the residue modulo2 ^ min |d| Pis the residue modulo2 ^ P.capPrecision_polyTime:(P, r, d) ↦ (min |d| P, r, d), from binaryPto unary, is polynomial-time.directContractionBinaryCertificate_boundsandexists_directContractionBinaryCertificate_le: the same bounds as above, in the binary input length.runPrefix_sumStep: every prefix retains(P, d), and its accumulator is the partial sum modulo2^P, so the state is at most three times the input length.weightMod_polyTime,sumStep_polyTime,numEdges_polyTimeandinitial_polyTimeare plainComputableInPolyTimestatements for the per-assignment weight, one loop step, the width and the initial state.BitString.lsbValue_eq_binaryValue_reverseis a new bridge lemma inBitString/Binary.lean. The tables are indexed bylsbValuesince feat(circuit/frontier): Boolean tensor networks and their contraction #1844's review.Generic streaming bound (infrastructure,
GenericRAM/Native/BooleanFold.lean).BooleanFold.certificate_boundsextracts the bounds of anyBooleanFoldloop. Its hypotheses are polynomial certificates for the dimension, the initial state and the body, plus a polynomial bound on every prefix accumulator. Its conclusion is polynomial workspace and time(2^n + 1)·TwithTpolynomial. It generalizes the counting-only core ofExhaustiveCountFallback.countPredicateCertificate_bounds, which is now a short corollary (about 120 lines fewer). The counting clients (exists_countSystemExhaustive_time_le,exists_countCNFExhaustive_time_leand their uses) are unchanged.IndexFold.roundCertificate_isPolynomialmoves from a private lemma there toIndexFold.lean, andBooleanFold.clock_isPolynomialis new.Source mapping (locators and quotations checked in the pinned PDF):
The
2^m · polytime and polynomial-space bounds are the standard cost of direct summation; the source does not state them as a separate claim.Use in T2.9. E1's
ContractionAlgorithm.boundis stated in a sizeswith timeK(n+1)^K 2^(K s/√⌊log₂ s⌋); direct summation alone does not meet it whenmis close toC s. T2.9 is expected to branch todirectContractionBinaryCertificateon leaves and small sizes, where2^mfits, and use its(2^m + 1)·Tand polynomial-space bounds there.Existing notions considered.
ExplicitTensorNetworkand itscontraction(feat(circuit/frontier): Boolean tensor networks and their contraction #1844): reused.BooleanFold,IndexFold,NativeCertificateand the plain PolyTime primitives: reused.ExhaustiveCountFallback.countStepandcountPredicateCertificate: counting only, without a modulus. A weighted sum modulo2^Pis a new body; the bound proof is shared by generalizing its core.BooleanSearch.exists_computableInOandIndexFold.computableInO: they giveComputableInOstatements but no bounds on theNativeCertificatefields, which the contract consumes.BitString.lsbValueandbinaryValue: bridged, not duplicated.ComputableInPolyTime.binary_min_unary'andComputableInPolyTime.length_bits_comp: reused for capping.Abstract impact. None.
Validation
scripts/check.sh --quickfell back to all six gates, which all passed locally ata96527eae.check_hygiene.py,check_changed_files.pyandcheck_tidy_surface.pypass.ComplexityTests/Computability/Circuit/Frontier/DirectContraction.lean, bydecide, cover hand-checked contractions:62 mod 16 = 14, an unreduced precision,P = 0, a port naming no edge, a short table, a network without edges, the independence fromr, anddirectContraction_eqon an instance. New tests derive the contract formK (n+1)^K 2^(K m)fromexists_directContractionCertificate_le, and check thatdirectContractionBinaryCertificatehas the type of E1's certificate field forN = ℕ × ExplicitTensorNetwork ℕ.AI assistance
Claude Code (Opus) wrote the code, proofs, tests and this description. It needs outside-fleet review: the bound statements (quantifier order:
Kbefore the input), the capping lemmacontraction_lt_two_pow_length, the genericBooleanFold.certificate_bounds, and theExhaustiveCountFallbackrefactor.The source-preserving import-aggregate integration metadata was refreshed with Codex by
worker-codex-pcp-20261030-65g7glwh; the original implementation, resource claims and author credit are unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG