Repository navigation
feat(machines): interval counts in polynomial time (#1833 H3) - #1897
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
Interval steps replay coins on configurations whose work tapes are functions on Z. Decide them by a simulation on finite storage (LocalCfg: BiTape work tapes with absolute head positions and the output track): coin steps preserve the representation, the embedded window is represented by loading its 3b cells into tapes (BiTape.ofCells), and the control record, block indices and window contents are read back. So the interval tensors are counts of a decidable finite condition, the first step of the polynomial-time certificate of the block-counting networks. Expose IntervalStep and intervalCount, which the bridge unfolds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Make firstAfter/lastBefore and their characterizations public, add firstAfter_eq_none_iff, expose inWindow, IntervalHolds and edgeTarget, and state the sources, targets and tensors of blockNetwork as public lemmas, so that a computable twin of the network can be proved equal to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Restate the interval tensor on plain data: control records with offsets as natural numbers and windows as their 3b cells. Block indices and offsets are compared without division (z = b q + r with r < b), and the count runs over the enumeration of coin strings. localIntervalCount_eq_intervalCount relates it to the semantic interval tensor; a test evaluates it on a concrete machine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Encode finite storage (encLocalCfg) and certify one coin step by finite dispatch on the control, read symbols and coin, with a constant bound on the growth of the encoding; replays are then a fold with additive growth (computableInPolyTime_localRun). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…l time (#1833 H3) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
The arguments of an interval count (IntervalData) with their encoding; the finite storage of the embedded window and the interval test after the replay are polynomial-time, so computableInPolyTime_localIntervalCount counts the 2^b coin strings in polynomial time whenever they are polynomially many in the input. The test instantiates the certificate on a concrete machine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
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 df307b8 (independent agent review).
Read the complete five-file own layer over #1878, retaining the unchanged lower-stack reviews. The plain-data bridge preserves control, output track, signed head coordinates and every cell of the original three-block window. Euclidean division handles negative coordinates correctly. The enumeration counts each b-bit coin string once, matching intervalCount.
The certificate is uniform for a fixed finite-state machine and fixed tape count. Unary block lengths, offsets and input positions account for materialized storage; binary absolute coordinates use bounded-list lookup and bounded unary conversion rather than traversing huge displacements. Constant additive encoded growth justifies replay; the explicit 2^b(2b+1) budget covers the entire coin-list encoding and unary answer. This supplies local tensor evaluation, not the remaining graph/table/NetworkFamilies assembly. The exposed graph definitions and new characterization preserve the existing graph semantics.
Tests evaluate one qualifying two-coin replay, a rejected output track, the semantic bridge, and an inhabited polynomial budget. Independent signed-coordinate and replay checks agree. Whitespace and the 3,088-module aggregate pass; no curated-abstract impact. Hosted Lean CI 41159568816, Guide and title passed; Comparator was running when inspected. Author reports all six local gates plus the final module/test/lint rerun. No reviewer Lean build. Live head rechecked before posting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
|
|
|
Carry-forward record ( |
Change
H3, polynomial-time construction, step 1: interval counts in polynomial time, for #1833 (item 1 of the H3b handoff), by
worker-claude-e6cf7b0d-hpv-h3c(Claude Code, Opus).Stacked on #1878 (
claude/hpv-network-polytime), which carries #1877, #1872 and #1858. Review only the last six commits until those land.The interval tensor of the block-counting networks (the note's
F_i,intervalCount) is now computable in polynomial time from plain data, whenever its2 ^ bcoin strings are polynomially many in the input. This is the machine-simulation part of thepolyTimefield of E1'sNetworkFamily; the graph, the tables and the assembly remain.What is proved.
Probabilistic/IntervalCount.lean: the interval count on plain data.ControlData,controlData), and each window is the list of its3bcells (windowCells).localStartDatais the finite storage of the embedded window; on the data of a record and window contents it islocalStart(byrfl).LocalIntervalStepDatacompares the state, the output track, the head coordinates and the window cells after the replay. Block indices and offsets need no division:intCast_eq_and_ediv_eq_iffsays thatzhas block indexqand offsetrmodulobexactly whenz = b q + r.val.localIntervalCountcounts the coin strings ofenumList bsatisfying the condition.localIntervalCount_eq_intervalCountequates it withintervalCount.Probabilistic/IntervalCount/PolyTime.lean: the certificate, all in plainComputableInPolyTime.encLocalCfgencodes finite storage: the control and track by rank, the input position in unary, the work tapes with all stored cells (encBiTape), and the head positions in binary (encIntBin).finite_cases, asviewStepBdoes. A step adds at most a constant to the encoded length, socomputableInPolyTime_localRunfollows fromfoldlWithInput_of_bounded_growth.BiTape.ofCells, viaStackTape.ofList), reads at integer displacements, the head coordinates, the input position of a coordinate, and the final test are certified.computableInPolyTime_localIntervalCount: for computed argumentsd : α → IntervalData k Statewith2 ^ b * (2 b + 1) ≤ size |input|for a polynomially boundedsize,fun a => (d a).count machineis polynomial-time, with the count in unary. In the network constructionb = ⌈log₂ (t + 2)⌉withtin unary, so2 ^ b ≤ 2 (t + 2).IntervalData.computableInPolyTime_mkassembles the arguments from certified components.BlockNetwork.lean(feat(machines): block-counting tensor networks for HPV schedules #1872): the blocker for the graph twin is removed.firstAfter,lastBeforeand their characterizations are public, with a newfirstAfter_eq_none_iff.inWindow,IntervalHoldsandedgeTargetare@[expose], andblockNetwork_src,blockNetwork_tgtandblockNetwork_tensor_{interval,controlSink,blockSink}are public lemmas. No statement there changes.Existing notions considered.
encFiniteCfgand its rules are the analogue forFiniteCfg, which stores the input and the whole output;LocalCfg(#1878) does not, so it needs its own encoding, built from the sameencBiTape,encPiandencFiniteand following thefiniteCfg_*rule pattern.IntervalDataonly bundles the arguments oflocalIntervalCountfor one encoding. The plainintBinrules have no addition or sign test, so privateintBin_add'(two subtractions) andintBin_isNeg'(the sign bit ofencIntBin) are local; they are candidates forPolyTime/Int/Binary.leanif another client needs them.Limits. This does not yet give the
polyTimefield. Remaining, recorded on #1833:scheduleBlock,edgeTarget, ports), now unblocked;ControlDataand window cells, check validity, and evaluate withcomputableInPolyTime_localIntervalCount;encPair encNat encExplicitNetwork(feat(circuit/frontier): direct-summation contraction modulo 2^P #1862) and theNetworkFamiliesinstance.Abstract impact. None.
Validation
scripts/check.sh --quick(falls back to all six gates because the stack's diff frommainincludesreferences.bib): all six gates pass locally (build,mk_all --check, test, lint, lint-style,checkInitImports); the last commit drops two unused instance arguments thatlake lintflagged, after which the module, the test andlake lintwere rerun.ComplexityTests/HPVIntervalCount.lean, on the one-tapewalkmachine of feat(machines): explicit Boolean block-counting networks (#1833 H3) #1877/feat(machines): decide interval steps by finite simulation (#1833 H3) #1878:decideevaluates the count on plain data: of the four coin strings of two bits, exactly one (true, false) leaves the recordc₁and windoww₁; with trackothernone does;intervalCount … = 1follows throughlocalIntervalCount_eq_intervalCount;computableInPolyTime_localIntervalCountis instantiated with a satisfiable budget (2 ^ 2 * 5 ≤ 20).Needs outside-fleet review (correctness and API). No new axioms; no
sorry; no heartbeat overrides.AI assistance
Written by Claude Code (Opus) as
worker-claude-e6cf7b0d-hpv-h3c, undercoordinator-claude-e6cf7b0d.🤖 Generated with Claude Code
https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG