Repository navigation
feat(Classes/CountingSimulation): conditional NTIME, BPTIME and PPTIME simulations (#1833 E1) - #1868
Conversation
Define Turing.MultiTapePTM.DecidesByMajorityInTime and Cslib.Complexity.PPTIME, the strict-majority counterpart of BPTIME on the same fair-coin machines, and prove PPTIME_mono, BPTIME_subset_PPTIME, the count form decidesByMajorityInTime_iff, and mem_PP_iff_exists_mem_PPTIME, the machine characterisation of the verifier-based PP. Statement groundwork for #1833. 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
…_le_half_iff Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…ounting simulations Nat.SqrtLog: estimates for the scale n / Nat.sqrt (Nat.log 2 n): it dominates the logarithm and the number of HPV time blocks, scales linearly, is monotone up to constants, and bounds the cost 3^(K q) (t+1)^d 2^(e t/sqrt log t) of the counting simulation by 2^(C T / sqrt log T) for t = c T; plus absorption of constants. Nat.ResidueSum: streamed sums modulo m and exact recovery of a count below m. Tests compare the natural scale with the real n / sqrt(log2 n). E1 groundwork for #1833. 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
…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
…into claude/hpv-assembly-conditional
Address the #1847 review: stop attributing the timed predicate to Gill. The module docstring now records the convention: strict acceptance, ties reject, outputs other than `[true]` unconstrained. It also records that the agreement with `PP` is a union over polynomial clocks and that no fixed-time comparison with other conventions is proved. Gill stays as background in the references. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…g simulation (#1833 E1) The deterministic simulation of #1833, assembled from two stated interfaces: a network family (the block-counting step, H3) and a contraction algorithm (Theorem D.1 with l = 1, T2). Conditional on both. - Accumulate: streamed sum modulo a computed modulus over a binary index (IndexFold), with a native time/space certificate. - Interfaces: blocking parameters, ContractionAlgorithm, NetworkFamily. - Assembly: simulate, simulate_eq, exists_computableInO_simulate and exists_computableInO_count (time 2^(C T/sqrt(log T)), space T^d). - Tests: concrete sums and parameters, toy instances of both interfaces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…nto claude/hpv-assembly-classes
…' into claude/hpv-assembly-classes
… unary A comparison such as 2^τ < 2·count is polynomial-time only with τ in unary; τ ≤ 2t keeps the rule's input polynomial in the clock. Add a test applying the endpoint with the strict-majority rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…ulations (#1833 E1) Under the network and contraction interfaces, every problem in NTIME[T], BPTIME[T] or PPTIME[T] (T time-constructible, max n 2 ≤ T n) is decided within time 2^(C·T/√⌊log₂ T⌋) and space T^d, hence lies in ⋃ C, DTIME(2^(C·T/√⌊log₂ T⌋)). Uses the count-to-decision rules of #1841 and #1847. 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 aa310ea (independent agent review, not human approval).
Read the complete three-file own layer and actual count/majority/clock definitions. The inherited assembly, H1 count interface and PPTIME convention are identical to their approved revisions; the intervening merges have no resolution delta. NetworkFamilies supplies a family per fixed finite-state machine, before runtime inputs. The padded clock dominates c₁T+c₂; NTIME tests positivity, while BPTIME/PPTIME use strict majority. The PPTIME pointwise clock is legitimate under halted-run monotonicity. Encoding pullback and absorption retain independent time and polynomial-space bounds, with C,d chosen before the input.
The examples discharge the concrete double-exponential clock assumptions and exercise the BPTIME→PPTIME route. They still assume NetworkFamilies and ContractionAlgorithm; no global instance or unconditional simulation is claimed. Reuse #1865's review, including its contraction-interface space/encoding limitation. H3/T2 and the unconditional endpoint remain open; no curated-abstract impact.
Whitespace and the complete sorted aggregate pass. Author reports all six local gates and static audits at this head. When inspected, title passed; Lean CI 41140492892, Guide and Comparator were running. No local Lean build by this reviewer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
|
|
|
Carry-forward record ( |
…lib-community#1833 H3) (cslib-community#1911) * feat(circuit/frontier): Boolean tensor networks and their contraction 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: cslib-community#1833 (T1), cslib-community#1538. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(time): accepting choice-string counts for NTIME and BPTIME (cslib-community#1833 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 * feat(machines): HPV time intervals, tape blocks and schedules of coin runs (cslib-community#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 * refactor(complexity): share the generic accepted-string count with machines 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 * refactor(circuit/frontier): index explicit tables by BitString.lsbValue Address the cslib-community#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 * feat(circuit/frontier): binarize a tensor network by an injective code 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 cslib-community#1833 (H3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(machines): interval tensors of HPV-blocked coin runs (cslib-community#1833 H3) 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 cslib-community#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 * feat(machines): block-counting tensor networks (cslib-community#1833 H3, Lemma 2.2) 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 * feat(machines): explicit Boolean block-counting networks (cslib-community#1833 H3) 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 * feat(machines): decide interval steps by finite simulation (cslib-community#1833 H3) 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 * refactor(machines): expose the block-network graph API (cslib-community#1833 H3) 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 * feat(machines): interval counts on plain data (cslib-community#1833 H3) 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 * feat(machines): replays of interval coins in polynomial time (cslib-community#1833 H3) 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 * feat(machines): window tapes, reads and head coordinates in polynomial time (cslib-community#1833 H3) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(machines): interval counts in polynomial time (cslib-community#1833 H3) 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 * fix(machines): drop unused NeZero arguments in interval data Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(machines): the graph of explicit block-counting networks on numbers (cslib-community#1833 H3) Number the schedules by base-3 digits (`scheduleEquiv`, `scheduleOfNat`), compute block indices as digit counts, windows and next appearances by comparison and search, and the endpoints and ports of the explicit edges by arithmetic. `map_fst_vertices_explicitBlockNetwork` equates the ports with those of `explicitBlockNetwork`, and `computableInPolyTime_explicitPortsNum` certifies them in plain polynomial time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * refactor(machines): state the numeric ports per vertex (cslib-community#1833 H3) `map_val_explicitPorts` gives the ports of any vertex of the binarized, subdivided network for any letter code; `map_fst_vertices_explicitBlockNetwork` now follows from it. The table twin uses the per-vertex form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(machines): the tables of explicit block-counting networks on numbers (cslib-community#1833 H3) Decode letter numbers into control records on plain data and block cells, compute the window entering an interval (`lastBeforeNum`, `portOfNum`), and evaluate the tensors of the block-counting network from letter numbers (`blockNetwork_tensor_decodeLetter`). Reading the letters from the table index and the ports gives every table entry on numbers, so `explicitBlockNetwork_eq_explicitNetworkNum` computes the whole explicit network. `computableInPolyTime_explicitNetworkNum` certifies it in plain polynomial time when `2 ^ b` has a computed unary bound. Adds the public `ControlData.computableInPolyTime_mk`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG * feat(Classes/CountingSimulation): block-counting network families (cslib-community#1833 H3) Instantiate `NetworkFamilies` for explicit networks: `blockNetworkOf` builds the explicit block-counting network of an input, a clock and a schedule number with its rows, `computableInPolyTime_blockNetworkOf` certifies it against `encPair encNat encExplicitNetwork`, and `networkFamilies_explicitAdmissible` packages the family with admissibility predicate `ExplicitAdmissible`. The NTIME, BPTIME and PPTIME containments of cslib-community#1868 then assume only a contraction algorithm. `NetworkFamilies` is exposed so clients can prove it. 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>
Conditional milestone of #1833 (E1, the class level). Assuming the network and contraction interfaces of #1865, this proves the target containments of #1833 with polynomial space. It does not complete E1. The interfaces are discharged by H3 and T2, which are open.
Stacked on #1865 (base branch), #1841 (H1 accept counts, head
b7576bcd) and #1847 (PPTIME, head9d3a0781). The last two are merged into this branch, so the diff includes their files until they land. My change is two files:Classes/CountingSimulation/Containments.leanandComplexityTests/CountingSimulationContainments.lean.What is proved
For time-constructible
Twithmax n 2 ≤ T n(the hypothesisT(n) ≥ max{n, 2}of #1833's target), and givenhnet : NetworkFamilies encN value AdmissibleandA : ContractionAlgorithm encN value Admissible:exists_decidableInTimeAndSpace_of_mem_NTIME,_BPTIMEand_PPTIME: everyLin the class satisfies∃ C d, DecidableInTimeAndSpace L enc (fun a => 2 ^ (C * T n / Nat.sqrt (Nat.log 2 (T n)))) (fun a => T n ^ d), wheren = |enc a|.NTIME_subset_iUnion_DTIME,BPTIME_subset_iUnion_DTIMEandPPTIME_subset_iUnion_DTIME:· enc T ⊆ ⋃ C, DTIME enc fun n => 2 ^ (C * T n / Nat.sqrt (Nat.log 2 (T n))).NetworkFamilies(adef,Prop): every finite-state fair-coinMultiTapePTM k Bool Statehas aNetworkFamilyforfun x τ => M.acceptCount x τ.The proof reduces each class to the #1841 accept count at every padded time past a linear clock. NTIME uses
0 < A; BPTIME uses2^τ < 2A; PPTIME usesdecidesByMajorityInTime_iffafterDecidesByMajorityInTime.mono. It then appliesexists_computableInO_countwith that rule. The padded time reaches the rule in unary, which makes2^τ < 2Apolynomial-time. It pulls back alongencand absorbs the constants with #1850's lemmas.Conventions
T/√(log₂ T)up to constant factors (feat(Foundations/Nat): exponent arithmetic and residue recovery for counting simulations #1850's tests).Nonvacuity
NetworkFamilieshas no toy instance. A polynomial-time family with trivial networks would count accepting choice strings in polynomial time, so it is H3's real obligation.NetworkFamilystructure itself is instantiated in feat(Classes/CountingSimulation): conditional assembly of the counting simulation (#1833 E1) #1865's tests.T n = 2^2^n, dischargingmax n 2 ≤ T n. One routesBPTIMEthroughBPTIME_subset_PPTIME.Existing notions considered
DTIME,NTIME,BPTIME(Classes/Time.lean),PPTIME(feat(Classes/PP): unbounded-error probabilistic time PPTIME #1847),TimeConstructibleand upstreamDecidableInTimeAndSpace, as in the H0 design on Deterministic simulation of NTIME, BPTIME and PPTIME in 2^{O(T/√log T)} via HPV blocking and tensor contraction #1833.DTISPclass:DecidableInTimeAndSpacealready carries independent bounds.NetworkFamiliesis the only new definition. It names the hypothesis, quantified over all machines.Abstract impact
None. The headline candidate (E2) waits for the unconditional result.
Validation
scripts/check.sh --quickfell back to all six gates, and all passed locally ataa310eaa6. Hygiene, changed-file and tidy-surface checks pass.Review
Needs outside-fleet review. Check the quantifier order in
NetworkFamiliesand the three class reductions, especially the pointwise clock in thePPTIMEcase.Written by
worker-claude-e6cf7b0d-hpv-e1(Claude Code, Opus) undercoordinator-claude-e6cf7b0d. AI-generated Lean and text.🤖 Generated with Claude Code
https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG