Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Probabilistic.Blocks

Time intervals and tape blocks of a choice-string run #

The blocking idea of Hopcroft, Paul and Valiant [HPV77], in the form of Lemma 2.1 of the note Deterministic simulations of nondeterministic and randomized time (30 October 2026) formalized in issue #1833. It uses three neighbouring tape blocks instead of making the machine block-respecting (compare [Wil25], Lemma 2.1 and §3.2). The statements here are the run-level facts of that lemma, for the replay Turing.MultiTapePTM.stepCoins of a fair-coin table on a list of choice bits.

Time is cut into intervals of b steps: interval i starts at Turing.MultiTapePTM.intervalStart b coins c i, after the first i * b bits. Each tape is cut into blocks B_j = [b j, b (j + 1)), so a head at coordinate p (Turing.Cfg.headPos) is in block p / b at offset p % b. The blocked heads are the input head and the k work heads; the write-only output tape is never read and is not blocked.

All statements hold for every block length b > 0 and number q of intervals; the choice q = ⌈t / b⌉ and the bound 2 ≤ b ≤ t of the note only matter for counting.

Main definitions #

Main results #

References #

Block arithmetic #

def Turing.Cfg.blockWindow {k : ℕ} {Symbol State : Type} {input : List Symbol} (b : ℕ) (c : Cfg k Symbol State input) (i : Fin k) :

The three blocks of length b around the block of each work head: the cells a work head can visit within b steps.

Head movement #

theorem Turing.MultiTapePTM.abs_headPos_stepCoins_sub_le {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) (coins : List Bool) (c : Cfg k Symbol State input) (head : Option (Fin k)) :
|(machine.stepCoins coins c).headPos head - c.headPos head| ≤ ↑coins.length

A head moves at most one cell per replayed bit.

theorem Turing.MultiTapePTM.headPos_stepCoins_mem_Ico {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) {b : ℕ} (hb : 0 < b) {coins : List Bool} (hlen : coins.length ≤ b) (c : Cfg k Symbol State input) (head : Option (Fin k)) :
(machine.stepCoins coins c).headPos head ∈ Set.Ico (↑b * (c.headPos head / ↑b - 1)) (↑b * (c.headPos head / ↑b + 2))

Three blocks. Within b replayed bits, a head stays in the three blocks of length b around its starting block.

theorem Turing.MultiTapePTM.abs_blockIndex_stepCoins_sub_le {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) {b : ℕ} (hb : 0 < b) {coins : List Bool} (hlen : coins.length ≤ b) (c : Cfg k Symbol State input) (head : Option (Fin k)) :
|(machine.stepCoins coins c).headPos head / ↑b - c.headPos head / ↑b| ≤ 1

Within b replayed bits, the block index of a head changes by at most one.

theorem Turing.MultiTapePTM.workTapes_stepCoins_eq_of_lt_abs {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) (coins : List Bool) (c : Cfg k Symbol State input) {i : Fin k} {z : ℤ} (hz : ↑coins.length < |z - c.workTapePos i|) :
(machine.stepCoins coins c).workTapes i z = c.workTapes i z

A work-tape cell farther from the head than the number of replayed bits is unchanged.

theorem Turing.MultiTapePTM.agreeOn_stepCoins {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) {W : Fin k → Set ℤ} {c c' : Cfg k Symbol State input} (h : Cfg.AgreeOn W c c') (coins : List Bool) (hpos : ∀ j < coins.length, ∀ (i : Fin k), (machine.stepCoins (List.take j coins) c).workTapePos i ∈ W i) :
Cfg.AgreeOn W (machine.stepCoins coins c) (machine.stepCoins coins c') ∧ ∃ (e : List Symbol), (machine.stepCoins coins c).output = c.output ++ e ∧ (machine.stepCoins coins c').output = c'.output ++ e

Locality of a run. If two configurations agree on cells W, and the work heads of the first stay in W before each replayed bit, then after replaying the same bits they still agree on W and have appended the same word to their outputs.

theorem Turing.MultiTapePTM.agreeOn_blockWindow_stepCoins {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) {b : ℕ} (hb : 0 < b) {coins : List Bool} (hlen : coins.length ≤ b) {c c' : Cfg k Symbol State input} (h : Cfg.AgreeOn (Cfg.blockWindow b c) c c') :
Cfg.AgreeOn (Cfg.blockWindow b c) (machine.stepCoins coins c) (machine.stepCoins coins c') ∧ ∃ (e : List Symbol), (machine.stepCoins coins c).output = c.output ++ e ∧ (machine.stepCoins coins c').output = c'.output ++ e

An interval is determined by its window. Two configurations agreeing on the three blocks around each work head of the first still agree there after at most b replayed bits, and have appended the same word to their outputs.

theorem Turing.MultiTapePTM.workTapes_stepCoins_eq_of_notMem_blockWindow {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) {b : ℕ} (hb : 0 < b) {coins : List Bool} (hlen : coins.length ≤ b) (c : Cfg k Symbol State input) {i : Fin k} {z : ℤ} (hz : z ∉ Cfg.blockWindow b c i) :
(machine.stepCoins coins c).workTapes i z = c.workTapes i z

Within b replayed bits, a work-tape cell outside the three blocks around its head is unchanged.

Time intervals and schedules #

noncomputable def Turing.MultiTapePTM.intervalStart {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) (b : ℕ) (coins : List Bool) (c : Cfg k Symbol State input) (i : ℕ) :
Cfg k Symbol State input

The configuration at the start of time interval i, of b steps each: replay the first i * b bits.

@[simp]
theorem Turing.MultiTapePTM.intervalStart_zero {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) (b : ℕ) (coins : List Bool) (c : Cfg k Symbol State input) :
machine.intervalStart b coins c 0 = c
theorem Turing.MultiTapePTM.intervalStart_succ {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) (b : ℕ) (coins : List Bool) (c : Cfg k Symbol State input) (i : ℕ) :
machine.intervalStart b coins c (i + 1) = machine.stepCoins (List.take b (List.drop (i * b) coins)) (machine.intervalStart b coins c i)

Interval i + 1 starts after replaying the b bits of interval i.

theorem Turing.MultiTapePTM.length_intervalCoins_le (b : ℕ) (coins : List Bool) (i : ℕ) :
(List.take b (List.drop (i * b) coins)).length ≤ b

The bits of an interval number at most b.

@[reducible, inline]

A movement schedule of q intervals: the change, in {-1, 0, 1}, of the block index of the input head (none) and of each work head (some i) across each interval.

theorem Turing.MultiTapePTM.card_schedule (k q : ℕ) :
Fintype.card (Schedule k q) = 3 ^ ((k + 1) * q)

There are 3 ^ ((k + 1) * q) movement schedules of q intervals.

noncomputable def Turing.MultiTapePTM.schedule {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) (b q : ℕ) (coins : List Bool) (c : Cfg k Symbol State input) :

The movement schedule of the run replaying coins from c, in q intervals of b bits: the change of the block index of every head across every interval.

theorem Turing.MultiTapePTM.coe_schedule {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) {b : ℕ} (hb : 0 < b) (q : ℕ) (coins : List Bool) (c : Cfg k Symbol State input) (i : Fin q) (head : Option (Fin k)) :
↑(machine.schedule b q coins c i head) = (machine.intervalStart b coins c (↑i + 1)).headPos head / ↑b - (machine.intervalStart b coins c ↑i).headPos head / ↑b

A schedule entry is the change of block index across the interval.

theorem Turing.MultiTapePTM.blockIndex_intervalStart {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) {b : ℕ} (hb : 0 < b) {q : ℕ} (coins : List Bool) (c : Cfg k Symbol State input) (head : Option (Fin k)) {i : ℕ} (hi : i ≤ q) :
(machine.intervalStart b coins c i).headPos head / ↑b = c.headPos head / ↑b + ∑ j : Fin i, ↑(machine.schedule b q coins c (Fin.castLE hi j) head)

Schedules determine block indices. At the start of interval i ≤ q, the block index of a head is its starting block index plus the schedule entries of the earlier intervals.

theorem Turing.MultiTapePTM.workTapes_intervalStart_succ_eq {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) {b : ℕ} (hb : 0 < b) (coins : List Bool) (c : Cfg k Symbol State input) (i : ℕ) {h : Fin k} {z : ℤ} (hz : z ∉ Cfg.blockWindow b (machine.intervalStart b coins c i) h) :
(machine.intervalStart b coins c (i + 1)).workTapes h z = (machine.intervalStart b coins c i).workTapes h z

Across interval i, a work-tape cell outside the window of interval i is unchanged.

theorem Turing.MultiTapePTM.workTapes_intervalStart_eq_of_notMem_blockWindow {k : ℕ} {Symbol State : Type} {input : List Symbol} (machine : MultiTapePTM k Symbol State) {b : ℕ} (hb : 0 < b) (coins : List Bool) (c : Cfg k Symbol State input) {h : Fin k} {z : ℤ} {i₁ i₂ : ℕ} (hle : i₁ ≤ i₂) (hz : ∀ (i : ℕ), i₁ ≤ i → i < i₂ → z ∉ Cfg.blockWindow b (machine.intervalStart b coins c i) h) :
(machine.intervalStart b coins c i₂).workTapes h z = (machine.intervalStart b coins c i₁).workTapes h z

Untouched blocks. A work-tape cell outside the windows of intervals i₁, …, i₂ - 1 has the same contents at the start of interval i₂ as at the start of interval i₁.