Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Universal.Clocked

Clocked runs of Boolean and word-output machines #

Turing.MultiTapeTM.Universal.runBool d w t runs the machine described by d on the bit word w for t steps with the universal function, and returns the bit it has output if it has halted with a single bit, and none otherwise. Turing.MultiTapeTM.Universal.runWord d w t is the word-output analogue: if the machine halts within t steps, it decodes the emitted symbol numbers to bits via (· != 0) and returns some o, and none otherwise. With the number of steps in unary, both are polynomial-time (Turing.MultiTapeTM.Universal.computableInPolyTime_runBool, Turing.MultiTapeTM.Universal.computableInPolyTime_runWord).

Every computable Boolean function has a description whose clocked runs are sound and eventually complete (Turing.MultiTapeTM.IsComputable.exists_runBool): a run never returns a wrong bit, and returns the right one once it is allowed enough steps. Delayed diagonalization uses this to compare computable sets on short words within a polynomial time budget, without knowing how long the machines take, while Levin's universal search uses runWord to collect candidate witnesses.

Main definitions #

Main results #

The bit output by the machine described by d on the bit word w within t steps: some b if it has halted with output [b], none otherwise.

theorem Turing.MultiTapeTM.Universal.computableInPolyTime_runBool {α : Type} {input : α ↪ List Bool} {d : α → Desc} {w : α → List Bool} {t : α → ℕ} (hd : ComputableInPolyTime d input eDesc) (hw : ComputableInPolyTime w input encBits) (ht : ComputableInPolyTime t input encUnary) :
ComputableInPolyTime (fun (a : α) => runBool (d a) (w a) (t a)) input (encOption encBool)

Clocked runs are polynomial-time with the number of steps in unary.

The bit word output by the machine described by d on the bit word w within t steps: some o if it has halted, with its emitted symbol numbers decoded via (· != 0), and none otherwise.

theorem Turing.MultiTapeTM.Universal.runWord_eq_some_iff {d : Desc} {w o : List Bool} {t : ℕ} :
runWord d w t = some o ↔ ∃ (u : List ℕ), universal (d, List.map (⇑eBit) w, t) = (u, true) ∧ List.map (fun (x : ℕ) => x != 0) u = o
theorem Turing.MultiTapeTM.Universal.runWord_mono {d : Desc} {w o : List Bool} {t₁ t₂ : ℕ} (ht : t₁ ≤ t₂) (h : runWord d w t₁ = some o) :
runWord d w t₂ = some o

Once a described machine halts, giving it more steps preserves its output word.

A machine halted within t steps emits a word of length at most t.

theorem Turing.MultiTapeTM.Universal.runWord_desc {k : ℕ} {State : Type} [Fintype State] (eS : State ↪ ℕ) (tm : MultiTapeTM k Bool State) (w : List Bool) (t : ℕ) :

On the description of a finite binary machine, runWord returns its output iff the machine has halted within t steps.

theorem Turing.MultiTapeTM.Universal.runWord_desc_of_halted {k : ℕ} {State : Type} [Fintype State] (eS : State ↪ ℕ) (tm : MultiTapeTM k Bool State) {w : List Bool} {t T : ℕ} (hhalt : (runFrom (tm.initCfg w) t).Halted) (hT : t ≤ T) :
runWord (desc eS eBit tm) w T = some (runFrom (tm.initCfg w) t).output

If a finite binary machine halts within t steps on w, then runWord on its description for any T ≥ t steps returns its output.

theorem Turing.MultiTapeTM.Universal.computableInPolyTime_runWord {α : Type} {input : α ↪ List Bool} {d : α → Desc} {w : α → List Bool} {t : α → ℕ} (hd : ComputableInPolyTime d input eDesc) (hw : ComputableInPolyTime w input encBits) (ht : ComputableInPolyTime t input encUnary) :
ComputableInPolyTime (fun (a : α) => runWord (d a) (w a) (t a)) input (encOption encBits)

Clocked word-output runs are polynomial-time with the number of steps in unary.

theorem Turing.MultiTapeTM.IsComputable.exists_runBool {α : Type} {enc : α ↪ List Bool} {f : α → Bool} (hf : IsComputable f enc encBool) :
∃ (d : Universal.Desc), (∀ (a : α) (t : ℕ) (b : Bool), Universal.runBool d (enc a) t = some b → b = f a) ∧ ∀ (a : α), ∃ (T : ℕ), ∀ (t : ℕ), T ≤ t → Universal.runBool d (enc a) t = some (f a)

Clocked runs of a computable Boolean function. A computable f has a description whose clocked runs never return a wrong bit and return the right one from some number of steps on.