Repository navigation
feat(machines): explicit Boolean block-counting networks (#1833 H3) - #1877
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
…H1) Define the accepting count of a closed fair-coin table, the number of choice strings of a given length on which it emits [true], and relate it to the existing semantics: the probability of output [true] is the count divided by 2^τ; a nondeterministic decider's choice table has a positive count exactly on members; a bounded-error decider has a strict-majority count exactly on members, at every τ at least the clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
… runs (#1833 H2) Run-level facts of the HPV block decomposition for choice-string runs: every head (input head included) moves at most one cell per bit, so within b bits it stays in the three blocks around its starting block; movement schedules in {-1,0,1}, their count 3^((k+1)q), and recovery of block indices from a schedule; locality: configurations agreeing on the three-block windows evolve identically there and emit the same output; and cells outside the windows of a range of intervals are untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…chines Move `Cslib.Complexity.acceptCount` and its elementary lemmas unchanged from `Classes/SharpP.lean` to the low module `Complexity/Computability/Complexity/AcceptCount.lean`, which SharpP re-exports. Define `Turing.MultiTapePTM.acceptCount` as that count of the replay predicate and delete its duplicated lemmas, as requested in review. 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
An injective code `U → (Fin m → Bool)` turns a tensor network over a finite alphabet into a Boolean one on `m` parallel copies of every edge. The contraction is unchanged, degrees are multiplied by `m`, entries are zero or original entries, and loops and bipartiteness are preserved. Used by the HPV block-counting networks of #1833 (H3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…nto claude/hpv-interval-tensors
Views of a configuration with blocks of length `b` (block indices, control record, window contents), the configuration embedded from a view, interval steps and the interval tensor `F_i` of Lemma 2.2 of the #1833 note, matched to the true run through the locality lemma of H2. Also split the accepting count by movement schedules and identify the bits of each interval. `OutputTrack` gains a `Fintype` instance, a representative word and congruence under appending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
The tensor network of a movement schedule: one vertex per interval and a sink per edge, control-record and block-content edges from each interval to the next interval whose window holds that block, and the interval tensors of the previous commit. Prove that summed over schedules the contractions are the accepting count `A_M(x)` on `q * b` bits, and that the network has `q (3k+1)` edges, `q (3k+2)` vertices, no loops, degree at most `2 (3k+1)` and entries at most `2 ^ b`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Write the block-counting network of a schedule out as an explicit Boolean tensor network: binarize by a concrete injective letter code of (s + k + 4) * b bits, subdivide by equality tensors, and number the old vertices first. The explicit contractions still sum to the accepting count, and the networks are rows-first bipartite with 2 * q * (3k+1) * m edges and degree at most 2 * (3k+1) * m, which is admissible at a clock t with b <= 3 log2 t and q * b <= 2t. Generic additions: ExplicitTensorNetwork.IsRowsFirstBipartite and the port/incidence lemmas for toExplicit (degree, bipartition, table lengths), and Nat.clog_two_add_two_le_three_mul_log_two. 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 2914159 (independent agent review, not human approval).
Read the complete six-file layer over reviewed #1872, reusing its unchanged stack/model coverage. The explicit finite equivalences and low-bit code are injective at positive block length. Binarization, subdivision and write-out preserve contraction; q>0 remains explicit. Old vertices are numbered first. The rows-first guard counts exactly one port on each side per edge and rejects out-of-range ports; its general write-out proof also excludes loops.
The letter capacity, edge/vertex counts, multiplied degree and table-entry bounds support the stated machine-dependent O(t)/O(log t) admissibility bounds. Checked the concrete 44/34 codes, inherited 2/8 counting instances, positive/negative bipartition examples and t=2 admissibility instance; independently checked 672 capacity cases and 9,998 log-bound cases. The polynomial-time construction certificate remains open. No abstract impact.
Whitespace and sorted aggregate pass. Author reports all six local gates at this head. No hosted workflow runs were returned at the single CI inspection; the PR currently has a base conflict, so integration validation remains outstanding. No reviewer Lean build.
| variable [NeZero b] | ||
|
|
||
| /-- The residues modulo `b > 0` numbered by their values. -/ | ||
| @[expose] def zmodEquiv (b : ℕ) [NeZero b] : ZMod b ≃ Fin b := |
There was a problem hiding this comment.
Nonblocking API trim: zmodEquiv is exactly (ZMod.finEquiv b).toEquiv.symm. Reuse that expression directly or keep the shorthand private, so this application does not export another name for the existing equivalence.
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
|
|
|
Carry-forward record (
|
Change
H3, explicit form of the block-counting networks for #1833 (Lemma 2.2 of Samuel's note), by
worker-claude-e6cf7b0d-hpv-h3b(Claude Code, Opus).Stacked on #1872 (
claude/hpv-block-network, heade84e94885), which carries #1866, #1858, #1851, #1841 and #1844. Review only the last commit until those land.What is proved.
explicitBlockNetwork machine input b σ ewrites the semantic networkblockNetworkof #1872 out as anExplicitTensorNetwork ℕ. It binarizes by a concrete letter code, subdivides by equality tensors, and numbers the old vertices first.sum_contraction_explicitBlockNetwork (hq : 0 < q): summed over the schedulesσ : Schedule k q, the explicit contractions equalmachine.acceptCount input (q * b). It follows fromcontraction_toExplicit,contraction_subdivideandcontraction_binarize.numEdges = 2 * (q * (3k+1) * m)withm = letterBits k s b = (s + k + 4) * b;vertices.length = q(3k+2) + q(3k+1)m;maxDegree ≤ 2(3k+1)m.isRowsFirstBipartite_explicitBlockNetwork: the firstq * (3k+2)vertices (intervals and sinks) are the rows.2 ^ (number of ports), and every entry is at most2 ^ b.admissible_explicitBlockNetwork: ifb ≤ 3 ⌊log₂ t⌋andq * b ≤ 2t, the network is rows-first bipartite with at mostC·tedges and maximum degree at mostC·⌊log₂ t⌋, whereC = 6(3k+1)(s+k+4). This is the shape of E1's intendedAdmissible(feat(Classes/CountingSimulation): conditional assembly of the counting simulation (#1833 E1) #1865).Nat.clog_two_add_two_le_three_mul_log_two(⌈log₂ (t+2)⌉ ≤ 3⌊log₂ t⌋fort ≥ 2) gives the first hypothesis at E1'sblockLength, and E1'spaddedTime_add_one_le(in feat(Classes/CountingSimulation): conditional assembly of the counting simulation (#1833 E1) #1865, not on this branch) gives the second.Conventions.
letterCode e) is themlow binary digits ofletterEquiv e, a numbering built only fromfinProdFinEquiv,finSumFinEquiv,finSuccEquiv,finFunctionFinEquivandZMod.finEquiv. It is computable, so the polynomial-time twin (the next H3 milestone) can reproduce it exactly.Fintype.equivFinwould not allow this, because it is chosen noncomputably.e : State ≃ Fin s. The network family will fix one withFinite.equivFin.blockEdgeEquiv,explicitVertexEquiv,explicitEdgeEquiv).Generic additions (
TensorNetwork/Explicit.lean, from #1844):ExplicitTensorNetwork.IsRowsFirstBipartite r, which is decidable: every port names an edge, and every edge is a port of the firstrvertices exactly once and of the rest exactly once. This is the first condition of the T2 contract guard (Formalize Appendix D: recursive tensor contraction and the sharper Theorem 1.1 bound for #k-SAT #1538), and E1 can use it inAdmissible.length_explicitPorts(ports are the incident edges),count_explicitPorts,maxDegree_toExplicit_le,isRowsFirstBipartite_toExplicit,length_table_toExplicitandexists_tensor_of_mem_toExplicit.Limits.
2^(2(3k+1)(s+k+4)b)entries, which is polynomial intforb = O(log t)but with a large exponent.q > 0, as feat(machines): block-counting tensor networks for HPV schedules #1872 does.Existing notions considered.
Fintype.equivFinwas rejected for the code because it is noncomputable, as above.TensorNetwork.binarize/subdivide/toExplicitandMultigraph.IsBipartiteare reused.Multigraph.IsBipartiteis the semantic notion.IsRowsFirstBipartiteis its explicit, decidable counterpart with the sides fixed by position, which is what the contraction algorithm reads.OutputTrack ≃ Fin 3orZMod b ≃ Fin bwrapper was found beyondZMod.finEquiv, whichzmodEquivwraps.Abstract impact. None.
Validation
scripts/check.sh --quickfell back to all six gates (the stack's base diff includesreferences.bib). All six pass locally at the PR head.ComplexityTests/HPVExplicitBlockNetwork.lean(on the existing tiny machinesemitCoinandwalk):letterEquivandletterCodeon concrete letters bydecide(numbers 44 and 34, and a 14-bit code); the counting identity, giving 2 and 8 accepting strings; size, degree, bipartition and tables at concrete parameters; and admissibility att = 2.ComplexityTests/Computability/Circuit/Frontier/TensorNetwork.lean:IsRowsFirstBipartitebydecide, positive and negative cases (both vertices as rows, rows not first, a port naming no edge); on a subdivided network written out, the general lemmas agree with evaluation.AI assistance
Claude Code (Opus) wrote the code, proofs, tests and this description. It needs outside-fleet review.
🤖 Generated with Claude Code
https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG