Correctness of the finite-alphabet multitape simulator #
The tape invariant uses coordinates relative to each work head. Initialization copies the input to its symbol tracks, then rewinds those heads; simulation preserves all relative cells.
structure
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.Sim
(M : FiniteMultiTapeMachine)
{input : List Bool}
(c : M.Cfg)
(d : Turing.Cfg (Fintype.card (M.K × M.Γ)) Bool (Control M.Q) input)
:
Relative tape contents agree and the simulator is running the source control.
The controls correspond.
No output is emitted before source halting.
- tape (i : Fin (Fintype.card (M.K × M.Γ))) (z : ℤ) : d.workTapes i (d.workTapePos i + z) = encode ((c.tapes ((trackEquiv M) i).1).nth z) ((trackEquiv M) i).2
Every track agrees at every offset from its head.
Instances For
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.Sim.read
{M : FiniteMultiTapeMachine}
{input : List Bool}
{c : M.Cfg}
{d : Turing.Cfg (Fintype.card (M.K × M.Γ)) Bool (Control M.Q) input}
(h : Sim M c d)
(k : M.K)
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.Sim.step
{M : FiniteMultiTapeMachine}
{input : List Bool}
{c c' : M.Cfg}
{d : Turing.Cfg (Fintype.card (M.K × M.Γ)) Bool (Control M.Q) input}
(h : Sim M c d)
(hs : M.step c = some c')
:
Sim M c' (Turing.MultiTapeTM.step d)
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.Sim.halt
{M : FiniteMultiTapeMachine}
{input : List Bool}
{c : M.Cfg}
{d : Turing.Cfg (Fintype.card (M.K × M.Γ)) Bool (Control M.Q) input}
(h : Sim M c d)
(hs : M.step c = none)
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.Sim.run
{M : FiniteMultiTapeMachine}
{input : List Bool}
{c c' : M.Cfg}
{d : Turing.Cfg (Fintype.card (M.K × M.Γ)) Bool (Control M.Q) input}
(h : Sim M c d)
(t : ℕ)
(hs : runSteps M.step t (some c) = some c')
:
Sim M c' (Turing.MultiTapeTM.runFrom d t)
noncomputable def
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.inputContents
(M : FiniteMultiTapeMachine)
(bits : List Bool)
(i : Track M)
(z : ℤ)
:
The track contents after copying an input prefix.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.inputContents_append
(M : FiniteMultiTapeMachine)
(bits : List Bool)
(b : Bool)
(i : Track M)
:
inputContents M (bits ++ [b]) i = if ((trackEquiv M) i).1 = M.inputTape then
Function.update (inputContents M bits i) (↑bits.length) (encode (M.inputSymbol b) ((trackEquiv M) i).2)
else inputContents M bits i
noncomputable def
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.copyCfg
(M : FiniteMultiTapeMachine)
(w : List Bool)
(t : ℕ)
(ht : t ≤ w.length)
:
Turing.Cfg (Fintype.card (M.K × M.Γ)) Bool (Control M.Q) w
The configuration after copying an input prefix of length t.
Equations
- One or more equations did not get rendered due to their size.
Instances For
noncomputable def
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.rewindCfg
(M : FiniteMultiTapeMachine)
(w : List Bool)
(t : ℕ)
(ht : t ≤ w.length)
:
Turing.Cfg (Fintype.card (M.K × M.Γ)) Bool (Control M.Q) w
The configuration with t input cells left to rewind.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.copyCfg_zero
(M : FiniteMultiTapeMachine)
(w : List Bool)
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.copyCfg_step
(M : FiniteMultiTapeMachine)
(w : List Bool)
(t : ℕ)
(ht : t < w.length)
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.copyCfg_end
(M : FiniteMultiTapeMachine)
(w : List Bool)
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.rewindCfg_step
(M : FiniteMultiTapeMachine)
(w : List Bool)
(t : ℕ)
(ht : t + 1 ≤ w.length)
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.runFrom_add
(M : FiniteMultiTapeMachine)
{w : List Bool}
(d : Turing.Cfg (Fintype.card (M.K × M.Γ)) Bool (Control M.Q) w)
(t u : ℕ)
:
Turing.MultiTapeTM.runFrom d (t + u) = Turing.MultiTapeTM.runFrom (Turing.MultiTapeTM.runFrom d t) u
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.runFrom_succ
(M : FiniteMultiTapeMachine)
{w : List Bool}
(d : Turing.Cfg (Fintype.card (M.K × M.Γ)) Bool (Control M.Q) w)
(t : ℕ)
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.run_copy
(M : FiniteMultiTapeMachine)
(w : List Bool)
(t : ℕ)
(ht : t ≤ w.length)
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.run_rewind
(M : FiniteMultiTapeMachine)
(w : List Bool)
(t : ℕ)
(ht : t ≤ w.length)
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.rewindCfg_zero_sim
(M : FiniteMultiTapeMachine)
(w : List Bool)
:
Sim M (M.init w) (Turing.MultiTapeTM.step (rewindCfg M w 0 ⋯))
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.init_sim
(M : FiniteMultiTapeMachine)
(w : List Bool)
:
Sim M (M.init w) (Turing.MultiTapeTM.runFrom (Turing.MultiTapeTM.initCfg w) (2 * w.length + 2))
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.computes_proof
(M : FiniteMultiTapeMachine)
(w : List Bool)
(b : Bool)
(T : ℕ)
(h : MultiTapeHaltsIn M w b T)
:
(machine M).ComputesInTimeAndSpace w [b] (2 * w.length + T + 3)
(Turing.MultiTapeTM.spaceUsed (Turing.MultiTapeTM.initCfg w) (2 * w.length + T + 3))
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeBridge.decidableInTimeAndSpace
(M : FiniteMultiTapeMachine)
(L : List Bool → Bool)
(T : ℕ → ℕ)
(h : ∀ (w : List Bool), MultiTapeHaltsIn M w (L w) (T w.length))
:
theorem
Complexity.DepthThreeLowerBound.FiniteMultiTapeMachine.mem_P_proof
{M : FiniteMultiTapeMachine}
{L : List Bool → Bool}
{p : Polynomial ℕ}
(h : ∀ (w : List Bool), MultiTapeHaltsIn M w (L w) (Polynomial.eval w.length p))
: