Documentation

Complexity.Computability.Machines.Turing.MultiTape.Internal.LinearPrimitives

Direct linear-time and workspace certificates #

Machine normalization and composition preserve a common linear bound. No output-space condition is added: intermediate output is bounded by the actual clock of the first machine.

Main results #

theorem Turing.MultiTapeTM.ComputableInLinearTimeAndSpace.of_transducer {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encMid : β ↪ List Bool} {Q : Type} [Finite Q] (τ : Transducer Bool Q) {f : α → β} (h : ∀ (a : α), encMid (f a) = τ.run τ.q₀ (encIn a)) :

A finite transducer gives a common linear bound from its actual clock and zero workspace.

theorem Turing.MultiTapeTM.ComputableInLinearTimeAndSpace.of_frame {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encMid : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encMid (f a) = frame (encIn a)) :

Frame the encoded input using the shared streaming machine.

theorem Turing.MultiTapeTM.ComputableInLinearTimeAndSpace.of_unframe {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encMid : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encMid (f a) = unframe (encIn a)) :

Read the first framed word, including the prescribed behavior on incomplete frames.

theorem Turing.MultiTapeTM.ComputableInLinearTimeAndSpace.of_dropFrame {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encMid : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encMid (f a) = dropFrame (encIn a)) :

Drop the first framed word using the same shared parser.

theorem Turing.MultiTapeTM.ComputableInLinearTimeAndSpace.of_eq {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encMid : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encMid (f a) = encIn a) :

Reuse the copy machine when the encoded output is the encoded input.

theorem Turing.MultiTapeTM.ComputableInLinearTimeAndSpace.const {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encMid : β ↪ List Bool} (b : β) :
ComputableInLinearTimeAndSpace (fun (x : α) => b) encIn encMid

A fixed encoded output takes constant time and no workspace.

theorem Turing.MultiTapeTM.ComputableInLinearTimeAndSpace.of_finite {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encMid : β ↪ List Bool} [Finite α] (f : α → β) :

A fixed function on a finite domain is realized by its finite lookup machine.

theorem Turing.MultiTapeTM.ComputableInLinearTimeAndSpace.comp {α : Type u_1} {β : Type u_2} {γ : Type u_3} {encIn : α ↪ List Bool} {encMid : β ↪ List Bool} {encOut : γ ↪ List Bool} {f : β → γ} {g : α → β} (hf : ComputableInLinearTimeAndSpace f encMid encOut) (hg : ComputableInLinearTimeAndSpace g encIn encMid) :
ComputableInLinearTimeAndSpace (fun (a : α) => f (g a)) encIn encOut

Compose linear certificates; the clock bounds the stored intermediate word.