Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Probabilistic.IntervalTensor

Interval tensors of a choice-string run #

The local pieces of the block-counting identity, Lemma 2.2 of the note Deterministic simulations of nondeterministic and randomized time (30 October 2026) formalized in issue #1833, which builds on the blocking of Hopcroft, Paul and Valiant [HPV77] in the three-block form of CslibFrontier.Computability.Machines.Turing.MultiTape.Probabilistic.Blocks (compare [Wil25], Lemma 2.1 and §3.2). The proof idea is original to that note.

Fix a block length b > 0. A configuration of a fair-coin table over Bool is seen through

Conversely, Turing.embedCfg builds a configuration from block indices, a control record and window contents, with blank cells outside the windows and an output of the right track. The interval step Turing.MultiTapePTM.IntervalStep replays the bits of a time interval from such an embedded configuration and compares the record, window contents and block indices it leaves with prescribed ones. The interval tensor Turing.MultiTapePTM.intervalCount counts the bit strings u ∈ {0,1}^b doing so: the entry F_i of the note's equation (3).

Matching the true run (Turing.MultiTapePTM.intervalStep_view_iff). Embedding the view of a configuration c gives a configuration that agrees with c on its state, its heads and its windows, and whose output has the same track. By the locality of runs (Turing.MultiTapePTM.agreeOn_blockWindow_stepCoins), an interval step from the view of c holds exactly when the true replay from c leaves the prescribed record, contents and block indices. The input tape is not blocked as a word: it is fixed by input, which the embedded configuration shares.

Splitting the count by schedules (Turing.MultiTapePTM.acceptCount_eq_sum_card_schedule). The accepting count A_M(x) on q * b bits is the sum, over the movement schedules σ of q intervals, of the number of accepting choice strings with schedule σ. The bits of interval i of a choice string y : Fin (q * b) → Bool are y (finProdFinEquiv (i, r)) for r < b (Turing.MultiTapePTM.intervalStart_succ_ofFn).

Main definitions #

Main results #

References #

Views of a configuration #

def Turing.Cfg.blockIndex {k : ℕ} {Symbol State : Type} (b : ℕ) {input : List Symbol} (c : Cfg k Symbol State input) (head : Option (Fin k)) :

The block index of every head, with blocks of length b: a head at coordinate p is in block p / b.

def Turing.Cfg.blockContents {k : ℕ} {Symbol State : Type} (b : ℕ) {input : List Symbol} (c : Cfg k Symbol State input) (h : Fin k) (j : ℤ) :
ZMod b → Option Symbol

The contents of block j of work tape h, with blocks of length b: the cells b * j + r for r < b.

def Turing.Cfg.windowContents {k : ℕ} {Symbol State : Type} (b : ℕ) {input : List Symbol} (J : Option (Fin k) → ℤ) (c : Cfg k Symbol State input) :
Fin k → Fin 3 → ZMod b → Option Symbol

The contents of the three blocks J h - 1, J h, J h + 1 around block indices J on every work tape h; entry d : Fin 3 is block J h + d - 1.

@[reducible, inline]
abbrev Turing.BlockControl (k : ℕ) (State : Type) (b : ℕ) :

A control record with blocks of length b: a state, the offset of every head in its block, and the track of the output.

def Turing.Cfg.blockControl {k : ℕ} {State : Type} (b : ℕ) {input : List Bool} (c : Cfg k Bool State input) :
BlockControl k State b

The control record of a configuration: its state, the offset p mod b of every head, and the track of its output.

def Turing.inputPosOfCoord (input : List Bool) (p : ℤ) :
Fin (input.length + 2)

The input head position with coordinate p, that is, stored position p + 1, or the left end when p + 1 is out of range.

def Turing.windowCell {k : ℕ} (b : ℕ) (J : Option (Fin k) → ℤ) (w : Fin k → Fin 3 → ZMod b → Option Bool) (h : Fin k) (z : ℤ) :

Cell z of work tape h of the configuration with window contents w at block indices J: the entry of w if z lies in one of the three blocks around J h, and blank otherwise.

def Turing.embedCfg {k : ℕ} {State : Type} (b : ℕ) {input : List Bool} (J : Option (Fin k) → ℤ) (c : BlockControl k State b) (w : Fin k → Fin 3 → ZMod b → Option Bool) :
Cfg k Bool State input

The configuration with block indices J, control record c and window contents w: every head at b * J + offset, the work tapes holding w on the windows and blank elsewhere, and an output with the track of c.

@[simp]
theorem Turing.ofWord_output_embedCfg {k : ℕ} {State : Type} {b : ℕ} {input : List Bool} (J : Option (Fin k) → ℤ) (c : BlockControl k State b) (w : Fin k → Fin 3 → ZMod b → Option Bool) :

The embedded configuration has the output track of its record.

theorem Turing.agreeOn_embedCfg_view {k : ℕ} {State : Type} {b : ℕ} [NeZero b] {input : List Bool} (c : Cfg k Bool State input) :

An embedded view agrees with the configuration. Embedding the block indices, control record and window contents of c gives a configuration with the state, heads and window contents of c.

Interval steps and interval tensors #

def Turing.MultiTapePTM.IntervalStep {k : ℕ} {State : Type} (machine : MultiTapePTM k Bool State) (b : ℕ) (input : List Bool) (J : Option (Fin k) → ℤ) (δ : Option (Fin k) → SignType) (cIn : BlockControl k State b) (wIn : Fin k → Fin 3 → ZMod b → Option Bool) (coins : List Bool) (cOut : BlockControl k State b) (wOut : Fin k → Fin 3 → ZMod b → Option Bool) :

An interval step. Replaying coins from the configuration embedded at block indices J with entering control record cIn and window contents wIn leaves the control record cOut, the contents wOut of the same windows, and moves the block of every head h by δ h.

noncomputable def Turing.MultiTapePTM.intervalCount {k : ℕ} {State : Type} (machine : MultiTapePTM k Bool State) (b : ℕ) (input : List Bool) (J : Option (Fin k) → ℤ) (δ : Option (Fin k) → SignType) (cIn : BlockControl k State b) (wIn : Fin k → Fin 3 → ZMod b → Option Bool) (cOut : BlockControl k State b) (wOut : Fin k → Fin 3 → ZMod b → Option Bool) :

The interval tensor: the number of bit strings u ∈ {0,1}^b whose replay is an interval step from the entering record cIn and contents wIn at block indices J to the leaving record cOut and contents wOut, moving the blocks by δ. This is the entry F_i of the note's equation (3).

theorem Turing.MultiTapePTM.intervalCount_le {k : ℕ} {State : Type} (machine : MultiTapePTM k Bool State) (b : ℕ) (input : List Bool) (J : Option (Fin k) → ℤ) (δ : Option (Fin k) → SignType) (cIn : BlockControl k State b) (wIn : Fin k → Fin 3 → ZMod b → Option Bool) (cOut : BlockControl k State b) (wOut : Fin k → Fin 3 → ZMod b → Option Bool) :
machine.intervalCount b input J δ cIn wIn cOut wOut ≤ 2 ^ b

An interval tensor entry is at most the number 2 ^ b of bit strings.

theorem Turing.MultiTapePTM.intervalStep_view_iff {k : ℕ} {State : Type} (machine : MultiTapePTM k Bool State) {input : List Bool} (b : ℕ) [NeZero b] (c : Cfg k Bool State input) {coins : List Bool} (hlen : coins.length ≤ b) (δ : Option (Fin k) → SignType) (cOut : BlockControl k State b) (wOut : Fin k → Fin 3 → ZMod b → Option Bool) :
machine.IntervalStep b input (Cfg.blockIndex b c) δ (Cfg.blockControl b c) (Cfg.windowContents b (Cfg.blockIndex b c) c) coins cOut wOut ↔ Cfg.blockControl b (machine.stepCoins coins c) = cOut ∧ Cfg.windowContents b (Cfg.blockIndex b c) (machine.stepCoins coins c) = wOut ∧ ∀ (head : Option (Fin k)), Cfg.blockIndex b (machine.stepCoins coins c) head = Cfg.blockIndex b c head + ↑(δ head)

Interval steps from a view are the true replay. For at most b bits, an interval step from the view of c (its block indices, control record and window contents) holds exactly when replaying the bits from c itself leaves the prescribed record and window contents and moves the blocks by δ.

Splitting the accepting count #

theorem Turing.MultiTapePTM.acceptCount_eq_sum_card_schedule {k : ℕ} {State : Type} (machine : MultiTapePTM k Bool State) (input : List Bool) (b q : ℕ) :
machine.acceptCount input (q * b) = ∑ σ : Schedule k q, {y : Fin (q * b) → Bool | machine.runClosedCoins (List.ofFn y) input = [true] ∧ machine.schedule b q (List.ofFn y) (Cfg.init machine.initial input) = σ}.card

The accepting count split by schedules. The accepting choice strings of q intervals of b bits are counted schedule by schedule.

theorem Turing.MultiTapePTM.intervalStart_succ_ofFn {k : ℕ} {State : Type} (machine : MultiTapePTM k Bool State) {input : List Bool} {q b : ℕ} (y : Fin (q * b) → Bool) (c : Cfg k Bool State input) (i : Fin q) :
machine.intervalStart b (List.ofFn y) c (↑i + 1) = machine.stepCoins (List.ofFn fun (r : Fin b) => y (finProdFinEquiv (i, r))) (machine.intervalStart b (List.ofFn y) c ↑i)

The bits of an interval. For a choice string y of q intervals of b bits, interval i replays the bits y (finProdFinEquiv (i, r)), r < b.