Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.InSpace.IterateUntil

Iterating until a test holds, within space #

Turing.MultiTapeTM.ComputableInSpace.iterate runs a step a computed number of times, and charges the binary counter. A simulation whose running time is not computable needs a loop that stops when a test on the state holds instead. Such a loop is computable within the space of the start, of the rounds and of the states, whatever the number of rounds.

The loop runs on options: a round (Turing.MultiTapeTM.ComputableInSpace.untilStep) takes a step unless the test holds, and then returns none, whose encoding is empty. The machine is Turing.MultiTapeTM.iterateWhile, which repeats a round until the empty word.

Main results #

theorem Turing.MultiTapeTM.ComputableInSpace.iterateWhileSome {α β : Type} {encIn : α ↪ List Bool} {encB : β ↪ List Bool} {f : Option β → Option β} {Sf : Option β → ℕ} (hf : ComputableInSpace f (encOption encB) (encOption encB) Sf) (hnone : f none = none) {start : α → Option β} {Si : α → ℕ} (hstart : ComputableInSpace start encIn (encOption encB) Si) {r Q B : α → ℕ} (hr : ∀ (x : α), f^[r x + 1] (start x) = none) (hlt : ∀ (x : α), ∀ j ≤ r x, f^[j] (start x) ≠ none) (hspace : ∀ (x : α), ∀ j ≤ r x, Sf (f^[j] (start x)) ≤ Q x) (hstate : ∀ (x : α), ∀ j ≤ r x, ((encOption encB) (f^[j] (start x))).length ≤ B x) :
ComputableInSpace (fun (x : α) => f^[r x] (start x)) encIn (encOption encB) fun (x : α) => Si x + Q x + B x

Iterating a round on options until it returns none, within the space of the start, of the rounds and of the states. The number of rounds r x need not be computable.

theorem Turing.MultiTapeTM.ComputableInSpace.iterateUntil {α β : Type} {encIn : α ↪ List Bool} {encB : β ↪ List Bool} {init : α → β} {step : β → β} {done : β → Bool} {n Si Q B : α → ℕ} {Ss Sd : β → ℕ} (hinit : ComputableInSpace init encIn encB Si) (hstep : ComputableInSpace step encB encB Ss) (hdone : ComputableInSpace done encB encBool Sd) (hn : ∀ (x : α), done (step^[n x] (init x)) = true) (hlt : ∀ (x : α), ∀ j < n x, done (step^[j] (init x)) = false) (hspace : ∀ (x : α), ∀ j ≤ n x, Ss (step^[j] (init x)) + Sd (step^[j] (init x)) ≤ Q x) (hstate : ∀ (x : α), ∀ j ≤ n x, (encB (step^[j] (init x))).length ≤ B x) :
ComputableInSpace (fun (x : α) => step^[n x] (init x)) encIn encB fun (x : α) => Si x + Q x + B x

Iterating a step until a test holds, within the space of the start, of the rounds and of the states. The number of steps n x, the first at which the test holds, need not be computable.