Documentation

CslibFrontier.Computability.Machines.ReadMachine.Tidy

Resource certificates for read-machine simulations #

If the halting test, the address and the step of a read machine have plain charged resource certificates with time bound T and space bound S on its states, then Turing.ReadMachine.toStepMachine has a resource certificate on its states, which add the position of the head. Its space bound Turing.ReadMachine.stateS adds to S twice the length of the encoded pair of state and position, plus 4; its time bound Turing.ReadMachine.stateT is the position plus one, times the square of the sum of T and that space bound.

Main results #

Computing within fixed budgets #

theorem Turing.ReadMachine.budget_comp {γ β δ : Type} {encIn : γ ↪ List Bool} {encB : β ↪ List Bool} {encD : δ ↪ List Bool} {Bt Bs : γ → ℕ} {f : γ → β} {g : β → δ} {Tg Sg : β → ℕ} (hg : MultiTapeTM.ComputableInO g encB encD Tg Sg) (hf : MultiTapeTM.ComputableInO f encIn encB Bt Bs) (hT : MultiTapeTM.BigOLe (fun (x : γ) => Tg (f x)) Bt) (hS : MultiTapeTM.BigOLe (fun (x : γ) => Sg (f x)) Bs) :
MultiTapeTM.ComputableInO (fun (x : γ) => g (f x)) encIn encD Bt Bs

Composition within the budgets.

theorem Turing.ReadMachine.budget_comp_linear {γ β δ : Type} {encIn : γ ↪ List Bool} {encB : β ↪ List Bool} {encD : δ ↪ List Bool} {Bt Bs : γ → ℕ} {f : γ → β} {g : β → δ} (hg : MultiTapeTM.ComputableInO g encB encD (fun (b : β) => (encB b).length) fun (b : β) => (encB b).length) (hf : MultiTapeTM.ComputableInO f encIn encB Bt Bs) (hst : MultiTapeTM.BigOLe Bs Bt) :
MultiTapeTM.ComputableInO (fun (x : γ) => g (f x)) encIn encD Bt Bs

Composition with a map computed in linear time and space, within the budgets.

theorem Turing.ReadMachine.budget_prod {γ β δ : Type} {encIn : γ ↪ List Bool} {encB : β ↪ List Bool} {encD : δ ↪ List Bool} {Bt Bs : γ → ℕ} {f : γ → β} {g : γ → δ} (hf : MultiTapeTM.ComputableInO f encIn encB Bt Bs) (hg : MultiTapeTM.ComputableInO g encIn encD Bt Bs) :
MultiTapeTM.ComputableInO (fun (x : γ) => (f x, g x)) encIn (MultiTapeTM.encPair encB encD) Bt Bs

Pairs within the budgets.

theorem Turing.ReadMachine.budget_ite {γ β : Type} {encIn : γ ↪ List Bool} {encB : β ↪ List Bool} {Bt Bs : γ → ℕ} {c : γ → Bool} {f g : γ → β} (hc : MultiTapeTM.ComputableInO c encIn MultiTapeTM.encBool Bt Bs) (hf : MultiTapeTM.ComputableInO f encIn encB Bt Bs) (hg : MultiTapeTM.ComputableInO g encIn encB Bt Bs) :
MultiTapeTM.ComputableInO (fun (x : γ) => if c x = true then f x else g x) encIn encB Bt Bs

Conditionals within the budgets.

theorem Turing.ReadMachine.budget_const {γ β : Type} {encIn : γ ↪ List Bool} {encB : β ↪ List Bool} {Bt Bs : γ → ℕ} (b : β) (hl : MultiTapeTM.BigOLe (fun (x : γ) => (encIn x).length) Bs) (hst : MultiTapeTM.BigOLe Bs Bt) :
MultiTapeTM.ComputableInO (fun (x : γ) => b) encIn encB Bt Bs

A constant within the budgets.

theorem Turing.ReadMachine.budget_finite {γ β δ : Type} {encIn : γ ↪ List Bool} {encB : β ↪ List Bool} {encD : δ ↪ List Bool} {Bt Bs : γ → ℕ} {f : γ → β} [Finite β] (g : β → δ) (hf : MultiTapeTM.ComputableInO f encIn encB Bt Bs) (hst : MultiTapeTM.BigOLe Bs Bt) :
MultiTapeTM.ComputableInO (fun (x : γ) => g (f x)) encIn encD Bt Bs

A function of finitely many values, within the budgets.

theorem Turing.ReadMachine.pairFalse_inSpace {α : Type} {enc : α ↪ List Bool} {B : α × Bool → ℕ} (hB : ∀ (x : α), ((MultiTapeTM.encPair enc MultiTapeTM.encBool) (x, false)).length ≤ B (x, false)) :

Pairing a state with the bit false, within any space budget at least the encoded pair length.

theorem Turing.ReadMachine.comp_pairFalse_inSpace {β : Type} {encB : β ↪ List Bool} {α : Type} {enc : α ↪ List Bool} {B : α × Bool → ℕ} (hB : ∀ (x : α), ((MultiTapeTM.encPair enc MultiTapeTM.encBool) (x, false)).length ≤ B (x, false)) {f : α × Bool → β} (h : MultiTapeTM.ComputableInSpace f (MultiTapeTM.encPair enc MultiTapeTM.encBool) encB B) :
MultiTapeTM.ComputableInSpace (fun (x : α) => f (x, false)) enc encB fun (x : α) => B (x, false)

Evaluating a function of a state and a bit at the bit false, within the space budget of the step.

@[reducible, inline]

The input of a step of the simulating machine.

@[reducible, inline]
abbrev Turing.ReadMachine.inLen {σ : Type} (encS : σ ↪ List Bool) (p : (σ × ℕ) × Option Bool) :

The length of the input of a step.

@[reducible, inline]
abbrev Turing.ReadMachine.spaceB {σ : Type} (encS : σ ↪ List Bool) (S : σ → ℕ) (p : (σ × ℕ) × Option Bool) :

The space budget of a step.

@[reducible, inline]
abbrev Turing.ReadMachine.timeB {σ : Type} (encS : σ ↪ List Bool) (T S : σ → ℕ) (p : (σ × ℕ) × Option Bool) :

The time budget of a step.

theorem Turing.ReadMachine.spaceB_le_timeB {σ : Type} {encS : σ ↪ List Bool} {T S : σ → ℕ} (p : (σ × ℕ) × Option Bool) :
spaceB encS S p ≤ timeB encS T S p
theorem Turing.ReadMachine.inLen_le_spaceB {σ : Type} {encS : σ ↪ List Bool} {S : σ → ℕ} (p : (σ × ℕ) × Option Bool) :
inLen encS p ≤ spaceB encS S p
theorem Turing.ReadMachine.inLen_le_timeB {σ : Type} {encS : σ ↪ List Bool} {T S : σ → ℕ} (p : (σ × ℕ) × Option Bool) :
inLen encS p ≤ timeB encS T S p
theorem Turing.ReadMachine.budget_proj {σ : Type} {encS : σ ↪ List Bool} {T S : σ → ℕ} :
MultiTapeTM.ComputableInO (fun (p : (σ × ℕ) × Option Bool) => p.1.1) (encStepIn encS) encS (timeB encS T S) (spaceB encS S) ∧ MultiTapeTM.ComputableInO (fun (p : (σ × ℕ) × Option Bool) => p.1.2) (encStepIn encS) MultiTapeTM.encNat (timeB encS T S) (spaceB encS S) ∧ MultiTapeTM.ComputableInO (fun (p : (σ × ℕ) × Option Bool) => p.2) (encStepIn encS) (MultiTapeTM.encOption MultiTapeTM.encBool) (timeB encS T S) (spaceB encS S)

The projections of the input are within the budgets.

theorem Turing.ReadMachine.lt_bigOLe {σ : Type} {encS : σ ↪ List Bool} {T S : σ → ℕ} {u : (σ × ℕ) × Option Bool → ℕ} (h : MultiTapeTM.BigOLe u (spaceB encS S)) :
MultiTapeTM.BigOLe (fun (p : (σ × ℕ) × Option Bool) => (p.1.2 + 1) * (u p + 1) ^ 2) (timeB encS T S)

The time of a comparison with the head position is within the time budget.

theorem Turing.ReadMachine.sq_bigOLe {σ : Type} {encS : σ ↪ List Bool} {T S : σ → ℕ} {u : (σ × ℕ) × Option Bool → ℕ} (h : MultiTapeTM.BigOLe u (spaceB encS S)) :
MultiTapeTM.BigOLe (fun (p : (σ × ℕ) × Option Bool) => (u p + 1) ^ 2) (timeB encS T S)

A square of something within the space budget is within the time budget.

The step of the simulating machine, written with its components.

theorem Turing.ReadMachine.stepBy_eq {σ : Type} {m : ReadMachine σ} (p : (σ × ℕ) × Option Bool) :
m.stepBy p = m.toStepMachine.step p.1 p.2
@[reducible, inline]
abbrev Turing.ReadMachine.stateT {σ : Type} (encS : σ ↪ List Bool) (T S : σ → ℕ) (q : σ × ℕ) :

The time bound of a state of the simulating machine.

@[reducible, inline]
abbrev Turing.ReadMachine.stateS {σ : Type} (encS : σ ↪ List Bool) (S : σ → ℕ) (q : σ × ℕ) :

The space bound of a state of the simulating machine.

theorem Turing.ReadMachine.inLen_le {σ : Type} {encS : σ ↪ List Bool} (p : (σ × ℕ) × Option Bool) :

The simulating step machine has a resource certificate, if the halting test, address and step have plain resource certificates with the given state bounds.

The simulating step machine has a resource certificate for some time bound, if the halting test, address and step are computable within the space bound S of the states. The time bound collects the time bounds of the three certificates.