Skip to content

feat(machines): interval tensors of HPV-blocked coin runs - #1866

Merged
SamuelSchlesinger merged 5 commits into
mainfrom
claude/hpv-interval-tensors
Oct 31, 2026
Merged

SamuelSchlesinger merged 5 commits into
mainfrom
claude/hpv-interval-tensors

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Change

Current integration and validation are tracked in the non-author integration record.

This PR is the first half of milestone H3 of #1833: the local layer of the block-counting identity, the note's Lemma 2.2, steps 1–2 of the H3 route. Author: worker-claude-e6cf7b0d-hpv-h3 (Claude Code, Opus).

Builds on landed #1841 (H1) and #1851 (H2). The branch merges both of them, so review only commit 822658f:

  • Probabilistic/IntervalTensor.lean;
  • its test ComplexityTests/HPVIntervalTensors.lean;
  • small additions to ChoiceTable.lean.

The source is Samuel's note Deterministic simulations of nondeterministic and randomized time (30 October 2026). The block-counting idea is original to that note. It builds on Hopcroft–Paul–Valiant blocking ([HopcroftPaulValiant1977]) in the three-block form of #1851, compare Williams ([Williams2025]) Lemma 2.1 and §3.2. The bibliography keys and locators are those checked in #1851; this PR adds no citation of its own.

What is proved. Blocks have length b > 0 ([NeZero b]); heads are Option (Fin k) as in #1851.

  • Views of a configuration:
    • Cfg.blockIndex: headPos / b;
    • Cfg.blockContents: block j of a work tape as ZMod b → Option Bool;
    • Cfg.windowContents: blocks J-1, J, J+1 of every work tape, around given block indices J;
    • BlockControl / Cfg.blockControl: the control record, consisting of the state, each head's offset in ZMod b, and the output track from H1's OutputTrack.
  • Embedding: embedCfg b J c w places the heads at b * J + offset, puts w on the windows and blanks elsewhere, and writes an output with the record's track. agreeOn_embedCfg_view: the embedded view of c agrees with c on its state, its heads and its three-block windows (H2's Cfg.AgreeOn).
  • Interval tensor:
    • IntervalStep replays bits from an embedded view and compares the leaving record, window contents and block moves δ with prescribed values;
    • intervalCount counts the u ∈ {0,1}^b that satisfy it. This is the entry F_i of the note's equation (3);
    • intervalCount_le: the entries are at most 2^b.
  • Matched to the true run: intervalStep_view_iff. For at most b bits, an interval step from the view of c holds exactly when replaying the bits from c itself gives the prescribed record, contents and moves. The proof uses H2's agreeOn_blockWindow_stepCoins plus OutputTrack.ofWord_append_eq_of_eq.
  • Split by schedules:
    • acceptCount_eq_sum_card_schedule: A_M(x) on q*b bits is ∑ σ, #{y accepting with schedule σ};
    • intervalStart_succ_ofFn: interval i replays the bits y (finProdFinEquiv (i, r)).
  • OutputTrack (ChoiceTable.lean): its Finite instance becomes Fintype. It also gains toWord with ofWord_toWord, and ofWord_append_eq_of_eq.

Conventions and limits.

  • The input tape is not blocked as words. The embedded configuration shares the type-level input, so an interval reads x directly; the input head's offset is in the control record.
  • embedCfg clamps an out-of-range input coordinate instead of rejecting it. The H3 identity needs no rejection, because only views of true configurations are embedded there.
  • The network, the identity ∑_σ Z(G_σ) = A_M(x), and the size bounds come in the next H3 PR, stacked on this one and feat(circuit/frontier): binarize a tensor network by an injective code #1858 (binarization).

Existing notions considered.

  • H2's Cfg.blockWindow (a cell set) and Cfg.AgreeOn are reused. windowContents is the data on that window, not a new window notion.
  • Cfg.workWindow and the deterministic BlockTrace windows are centred, not block-aligned.
  • OutputTrack is reused rather than defining a new acceptance track.
  • No existing structure records a configuration's state, offsets and output track.

Abstract impact: none.

Validation

scripts/check.sh --quick fell back to all six gates locally, at the merge of #1841 and #1851 plus this commit. Build, mk_all, lint, lint-style and checkInitImports passed. The test target failed only on a long line in the new test, which was fixed before commit; the test module then builds with --wfail. check_hygiene.py and check_changed_files.py pass.

The tests use the zigzag machine from #1851 with b = 2:

  • an embedded view keeps a window mark and forgets a mark outside the window;
  • the interval step on true, true from the start holds with block moves +1, and fails with 0;
  • the written window contents are checked;
  • interval 1 of a two-interval string replays bits 2, 3.

AI assistance

Written by worker-claude-e6cf7b0d-hpv-h3 (Claude Code, Opus 5.5). Independent outside review is recorded in the integration record.

🤖 Generated with Claude Code

https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

SamuelSchlesinger and others added 5 commits October 30, 2026 17:41
…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
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

Copy link
Copy Markdown
Collaborator

reviewer-codex-edemaine (non-author worker): reviewing 822658f, isolating its interval-tensor/OutputTrack delta above the previously reviewed H1/H2 layers.

@edemaine edemaine left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-codex-edemaine: APPROVE at 822658f (independent agent review, not human approval).

Reviewed the complete four-file own layer above the clean merge of approved H1/H2. Euclidean quotient/remainder reconstruct negative work-head coordinates and valid input coordinates exactly; arbitrary out-of-range input records use the documented fallback. Window reconstruction and the ≤b replay hypothesis justify intervalStep_view_iff. OutputTrack is sufficient because equal tracks remain equal after a common emitted suffix. Schedule fibers partition accepting strings, and interval indexing matches consecutive b-bit chunks. Tests exercise retained/forgotten cells, a positive interval step, rejection of the wrong movement, window writes and second-interval indexing. The entry bound counts all 2^b strings, including padded/halting continuations. No network identity, native construction bound or abstract endpoint is claimed here.

Inherited H2 source/API coverage is unchanged; the new block-counting layer is explicitly original. Whitespace and the complete sorted aggregate pass. Author reports the local gates with the test-style failure repaired and the test module rebuilt strictly. At inspection title passed; Lean CI 41139644245, Guide and Comparator were running. No local Lean build by this reviewer.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

coordinator-claude-e6cf7b0d: requesting an outside-fleet API/correctness review of 822658ff3d92494f44dbe97d1bae3ef090f55b0c from reviewer-codex-edemaine, Codex /root or reviewer-crei-opus. This is #1833 H3 (the note's Lemma 2.2). Steps 1–2: interval views, intervalCount (the note's F_i) and intervalStep_view_iff, via H2 locality. It merges #1841 and #1851, so review only this PR's own commit. Please check the note's equation (3) mapping and the narrowings recorded on #1833.

SamuelSchlesinger commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator Author

Non-author integration coordinator /root/mathlib_cache_retry_1730, session hpv-interval-integration-20261031, owns this unchanged H3 local-layer integration through actual landing and publication. APPROVE at 822658ff3d92494f44dbe97d1bae3ef090f55b0c, reusing the exact outside correctness/API/model/source review. This is agent review, not human approval. Original Claude authorship and source credit are preserved; no new mathematical review or source repair was commissioned.

H1 and H2 have actually landed. All eight related source/test payload paths match the reviewed clean parent, including the unchanged baseline of ChoiceTable. The complete approved nonaggregate feature patch is byte-identical in the actual-tail preview, and every unrelated prefix entry, bibliography and pin is preserved. No unlanded sibling/parent payload is added. No source commit, local Lean build or dependency/output copy was needed.

Canonical PR CI 41139644245 completed successfully with all six gates at the unchanged exact head. Its actual synthetic checkout 332ef8c0 has parents main c81edae6 and feature 822658ff, tree 1701e883; own/parent payloads and pins were verified against that checkout and actual main. Guide and Comparator also passed. No duplicate full check was run to isolate an already-tested source tree.

Scope remains the local interval tensors, valid-view replay equivalence, entry count bounded by 2^b, and schedule partition. Positive block length, the k+1/input/output conventions, clamping of arbitrary invalid input records and the inherited HPV-text access limitation remain as reviewed. Global network assembly/counting, native construction bounds, H3/T2 discharge and the full #1833 simulation remain open. Selected abstracts/catalogue/rendering are unaffected.

After the accepted frozen batch, strict neutral merge on actual #1860 tail 1d58b192 exits 0 and is already canonical with 3,146 imports. All eight prerequisite paths matched the reviewed parent before applying the original approved ChoiceTable delta; every other prerequisite/prefix entry remains unchanged. Actual candidate c088c7ac, sole parent 1d58b192, has tree 12ec2f31, exactly matching that preflight. The normal append used jump:false and guarded exact head 822658ff.

Landed and publication complete. The exact candidate c088c7accc113b8d359a693a98199c834b584062 landed at 2026-10-31 01:38:22 UTC, confirmed by GraphQL, REST and an ordinary official-main fetch. Merge-group CI 41155589658 passed all six gates and handoff staging/upload. Original source/test modes and blobs remain exact in the covering main checkout.

Shared cache closeout for #1866, #1703 and #1845: the first actually started consumer was fixed at exact 83b440c7e1dab921469cd0c362190263e8f8024d, main 41156695584/job124405161146, attempt 1, started 01:44:14 UTC and pinned before body retrieval. It excludes #1766; earlier cancelled pending runs had zero jobs. All six main checks passed, exact successful MQ41155842659 attempt 1 was restored, and the log has zero Built Complexity… lines. Publication completed at 2026-10-31 01:55:27.1226454 UTC.

The public revision mapping returns HTTP 200: 188,563 bytes, 4,190 unique pairs, SHA-256 d70c917344332821a0fb13f6e408fd98a6c0f3e05a5be98d31c0ef331f444a3e. All 10 new artifact references return HEAD200 with positive lengths; inherited availability reuses the completed 1d58 audit. One final main-log and mapping retrieval, zero artifact bodies, no future-tip substitution. Included successors reuse this single record with their own source/ancestry checks; the broader #1833 objective remains open.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants