Fixed-time repetition of probabilistic Turing machines #
This file defines the machine underlying bounded-error amplification. For a
machine tm : NTM n, a repetition count k, and a fixed per-run time T,
NTM.repeatAtTime tm k T performs k sequential T-step runs and returns
their strict-majority verdict.
Every run gets a fresh bank of n + 1 work tapes: n tapes simulate tm's
work tapes and the last tape simulates its output tape. The real input tape is
rewound between runs, while the real output tape is reserved for the final
majority bit. Each run occupies exactly 2 * T + 2 transitions: T simulated
steps, T + 1 fixed rewind steps, and one finish step. In particular, early
halting does not shift the random-bit slots used by later runs.
The two leading transitions park every tape at cell one and then position the
first simulated configuration at cell zero. Thus the complete fixed schedule
has length 2 + k * (2 * T + 2), and simulated choice (j, t) is consumed at
global position 2 + j * (2 * T + 2) + t.
The degenerate cases are intentional: zero repetitions output 0, and a
zero-step run votes according to the initial configuration of tm.
Main definitions #
NTM.RepeatQ— finite control states for fixed-time repetitionNTM.repeatTapeIdx,NTM.repeatWorkIdx,NTM.repeatOutputIdx— fresh-bank layoutNTM.repeatAtTimeStride,NTM.repeatAtTimeSteps,NTM.repeatChoiceIdx— scheduleNTM.repeatAcceptEvent— the source machine's single-run accepting eventNTM.repeatAtTime— the repeated majority-vote machine
Tape-bank layout and fixed schedule #
Index a local tape in repetition j's fresh bank. The local bank has
n + 1 tapes: the first n simulate work tapes and the last simulates the
output tape.
Equations
Instances For
Physical work-tape index simulating work tape i in repetition j.
Equations
Instances For
Physical work-tape index simulating the output tape in repetition j.
Equations
Instances For
The bank and local index represented by a physical repetition tape.
Equations
Instances For
Decoding a freshly constructed bank index recovers its two coordinates.
Fresh-bank indexing is injective in the pair of coordinates.
Number of transitions from the beginning of one simulated run to the next.
Equations
- Complexity.NTM.repeatAtTimeStride T = 2 * T + 2
Instances For
Global choice position used for simulated step t of repetition j.
Equations
- Complexity.NTM.repeatChoiceIdx T j t = ⟨2 + ↑j * Complexity.NTM.repeatAtTimeStride T + ↑t, ⋯⟩
Instances For
Control state and transition helpers #
Finite control for repeatAtTime. votes records completed-run verdicts.
During rewind, the Boolean flags say which heads have already bounced off
cell zero and are parked at cell one.
- setup {n : ℕ} {tm : NTM n} {k T : ℕ} : tm.RepeatQ k T
- begin {n : ℕ} {tm : NTM n} {k T : ℕ} : tm.RepeatQ k T
- run {n : ℕ} {tm : NTM n} {k T : ℕ} (j : Fin k) (t : Fin T) (q : tm.Q) (votes : Fin k → Bool) : tm.RepeatQ k T
- rewind {n : ℕ} {tm : NTM n} {k T : ℕ} (j : Fin k) (r : Fin (T + 1)) (q : tm.Q) (votes : Fin k → Bool) (inputDone : Bool) (bankDone : Fin (n + 1) → Bool) : tm.RepeatQ k T
- finish {n : ℕ} {tm : NTM n} {k T : ℕ} (j : Fin k) (q : tm.Q) (votes : Fin k → Bool) : tm.RepeatQ k T
- halt {n : ℕ} {tm : NTM n} {k T : ℕ} : tm.RepeatQ k T
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.setup Complexity.NTM.RepeatQ.setup = isTrue ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.setup Complexity.NTM.RepeatQ.begin = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.setup (Complexity.NTM.RepeatQ.run j t q votes) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.setup (Complexity.NTM.RepeatQ.rewind j r q votes inputDone bankDone) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.setup (Complexity.NTM.RepeatQ.finish j q votes) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.setup Complexity.NTM.RepeatQ.halt = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.begin Complexity.NTM.RepeatQ.setup = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.begin Complexity.NTM.RepeatQ.begin = isTrue ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.begin (Complexity.NTM.RepeatQ.run j t q votes) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.begin (Complexity.NTM.RepeatQ.rewind j r q votes inputDone bankDone) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.begin (Complexity.NTM.RepeatQ.finish j q votes) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.begin Complexity.NTM.RepeatQ.halt = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.run j t q votes) Complexity.NTM.RepeatQ.setup = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.run j t q votes) Complexity.NTM.RepeatQ.begin = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.run j t q votes) (Complexity.NTM.RepeatQ.rewind j_1 r q_1 votes_1 inputDone bankDone) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.run j t q votes) (Complexity.NTM.RepeatQ.finish j_1 q_1 votes_1) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.run j t q votes) Complexity.NTM.RepeatQ.halt = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.rewind j r q votes inputDone bankDone) Complexity.NTM.RepeatQ.setup = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.rewind j r q votes inputDone bankDone) Complexity.NTM.RepeatQ.begin = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.rewind j r q votes inputDone bankDone) (Complexity.NTM.RepeatQ.run j_1 t q_1 votes_1) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.rewind j r q votes inputDone bankDone) (Complexity.NTM.RepeatQ.finish j_1 q_1 votes_1) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.rewind j r q votes inputDone bankDone) Complexity.NTM.RepeatQ.halt = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.finish j q votes) Complexity.NTM.RepeatQ.setup = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.finish j q votes) Complexity.NTM.RepeatQ.begin = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.finish j q votes) (Complexity.NTM.RepeatQ.run j_1 t q_1 votes_1) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.finish j q votes) (Complexity.NTM.RepeatQ.rewind j_1 r q_1 votes_1 inputDone bankDone) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq (Complexity.NTM.RepeatQ.finish j q votes) Complexity.NTM.RepeatQ.halt = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.halt Complexity.NTM.RepeatQ.setup = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.halt Complexity.NTM.RepeatQ.begin = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.halt (Complexity.NTM.RepeatQ.run j t q votes) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.halt (Complexity.NTM.RepeatQ.rewind j r q votes inputDone bankDone) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.halt (Complexity.NTM.RepeatQ.finish j q votes) = isFalse ⋯
- Complexity.NTM.instDecidableEqRepeatQ.decEq Complexity.NTM.RepeatQ.halt Complexity.NTM.RepeatQ.halt = isTrue ⋯
Instances For
Advance the fixed simulation counter after one source-machine transition,
entering the rewind phase after the last of the T simulation slots.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Advance the fixed rewind counter using the completion flags computed by
the current rewind transition, entering finish after the last rewind slot.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Update a rewind-completion flag after observing a tape head.
Equations
- Complexity.NTM.repeatRewindDone done head = (done || decide (head = Complexity.Γ.start))
Instances For
Rewind an unfinished tape toward cell zero, bounce to cell one on ▷, and
park a finished tape. The ▷ case always moves right, including on malformed
control states, so the machine satisfies δ_right_of_start globally.
Equations
- Complexity.NTM.repeatRewindDir done head = if head = Complexity.Γ.start then Complexity.Dir3.right else if done = true then Complexity.Dir3.stay else Complexity.Dir3.left
Instances For
Guard an arbitrary proposed direction with the machine model's mandatory rightward move on the left-end marker.
Equations
- Complexity.NTM.repeatSafeDir head dir = if head = Complexity.Γ.start then Complexity.Dir3.right else dir
Instances For
Apply repeatSafeDir to every direction in a transition result.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Read the simulated work heads in repetition j's bank.
Equations
- Complexity.NTM.repeatWorkReads wHeads j i = wHeads (Complexity.NTM.repeatWorkIdx j i)
Instances For
Position every tape of bank j at cell zero; all other banks idle.
Equations
- Complexity.NTM.repeatPositionBankDirs wHeads j i = if (Complexity.NTM.repeatTapeCoord i).1 = j then Complexity.TM.moveLeftDir (wHeads i) else Complexity.TM.idleDir (wHeads i)
Instances For
Updated rewind-completion flags for the active bank.
Equations
- Complexity.NTM.repeatRewindBankDone wHeads j done i = Complexity.NTM.repeatRewindDone (done i) (wHeads (Complexity.NTM.repeatTapeIdx j i))
Instances For
Choices are ignored after the simulated machine halts, but cells are
preserved and any head on ▷ bounces right. This consumes the rest of the
run's fixed T-bit slot without shifting later blocks.
Equations
- Complexity.NTM.repeatPaddingDirs iHead wHeads oHead = (Complexity.TM.idleDir iHead, fun (i : Fin (k * (n + 1))) => Complexity.TM.idleDir (wHeads i), Complexity.TM.idleDir oHead)
Instances For
Repetition machine #
Repeat tm exactly k times for T simulated transitions per run and
write the strict-majority verdict to the real output tape.
The machine has k * (n + 1) work tapes, split into fresh banks. Its exact
fixed running time is repeatAtTimeSteps k T; only the positions specified by
repeatChoiceIdx affect simulated runs.
Equations
- One or more equations did not get rendered due to their size.