Documentation

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

Bit words within a fixed workspace budget #

Budget-preserving fun_prop rules for words of bits held in registers: a test of every bit, the binary counter Cslib.BitString.increment, the word that repeats a bit to a width given in unary, the value of a word, concatenation and a unary number in binary. Each costs space linear in its arguments, which the caller's certificates already pay for, so a body of Turing.MultiTapeTM.ComputableInSpace.loopWith or Turing.MultiTapeTM.ComputableInSpace.recWith that steps a counter or compares stored words is composed by space without a hand-written certificate. Stored words are compared by Turing.MultiTapeTM.ComputableInSpace.budget_decideEq.

Main results #

theorem Turing.MultiTapeTM.ComputableInSpace.budget_bitsAll {α : Type} {encIn : α ↪ List Bool} {Bs : α → ℕ} (p : Bool → Bool) {l : α → List Bool} (hl : ComputableInSpace l encIn encBits Bs) :
ComputableInSpace (fun (x : α) => (l x).all p) encIn encBool Bs

Whether every bit of a word satisfies p, within the budget. With p := id this is the overflow test of a binary counter.

theorem Turing.MultiTapeTM.ComputableInSpace.budget_bitsIncrement {α : Type} {encIn : α ↪ List Bool} {Bs : α → ℕ} {l : α → List Bool} (hl : ComputableInSpace l encIn encBits Bs) :
ComputableInSpace (fun (x : α) => Cslib.BitString.increment (l x)) encIn encBits Bs

The successor of a binary counter, least significant bit first, within the budget.

theorem Turing.MultiTapeTM.ComputableInSpace.budget_bitsReplicate {α : Type} {encIn : α ↪ List Bool} {Bs : α → ℕ} (b : Bool) {n : α → ℕ} (hn : ComputableInSpace n encIn encUnary Bs) :
ComputableInSpace (fun (x : α) => List.replicate (n x) b) encIn encBits Bs

The word that repeats a fixed bit, of a width given in unary, within the budget.

theorem Turing.MultiTapeTM.ComputableInSpace.budget_ofBits {α : Type} {encIn : α ↪ List Bool} {Bs : α → ℕ} {l : α → List Bool} (hl : ComputableInSpace l encIn encBits Bs) :
ComputableInSpace (fun (x : α) => ofBits (l x)) encIn encNat Bs

The value of a word, least significant bit first, within the budget.

theorem Turing.MultiTapeTM.ComputableInSpace.budget_bitsAppend {α : Type} {encIn : α ↪ List Bool} {Bs : α → ℕ} {l₁ l₂ : α → List Bool} (h₁ : ComputableInSpace l₁ encIn encBits Bs) (h₂ : ComputableInSpace l₂ encIn encBits Bs) :
ComputableInSpace (fun (x : α) => l₁ x ++ l₂ x) encIn encBits Bs

The concatenation of two words, within the budget.

theorem Turing.MultiTapeTM.ComputableInSpace.budget_unaryToNat {α : Type} {encIn : α ↪ List Bool} {Bs n : α → ℕ} (hn : ComputableInSpace n encIn encUnary Bs) :

A number given in unary, in binary, within the budget.