Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.BigO.FiniteCases

Finite case analysis within asymptotic bounds #

A computed key of a fixed finite type selects one of finitely many branches, each of which receives the original input. The dispatch chains Turing.MultiTapeTM.ComputableInO.ite over an enumeration of the key type, testing the key against each value; since the enumeration is fixed, its length only affects the hidden constant. Neither the key nor the result type needs an inhabitant. The same chaining gives the disjunction of a fixed finite list of computed Booleans.

Main results #

theorem Turing.MultiTapeTM.ComputableInO.finite_cases {α β : Type} {encIn : α ↪ List Bool} {Tag : Type} [Finite Tag] {encOut : β ↪ List Bool} {tagEncoding : Tag ↪ List Bool} {key : α → Tag} {branch : Tag → α → β} {T₀ S₀ T S : α → ℕ} (hkey : ComputableInO key encIn tagEncoding T₀ S₀) (hbranch : ∀ (tag : Tag), ComputableInO (branch tag) encIn encOut T S) :
ComputableInO (fun (a : α) => branch (key a) a) encIn encOut (fun (a : α) => T₀ a + T a) fun (a : α) => S₀ a + S a

A computed key of a fixed finite type selects a branch on the original input, within the key's bounds plus a common bound for the branches. This also handles an empty key type (and hence an empty input type).

theorem Turing.MultiTapeTM.ComputableInO.list_any {α : Type} {encIn : α ↪ List Bool} {ι : Type} (l : List ι) {p : ι → α → Bool} {T S : α → ℕ} (hp : ∀ i ∈ l, ComputableInO (p i) encIn encBool T S) :
ComputableInO (fun (a : α) => l.any fun (i : ι) => p i a) encIn encBool (fun (a : α) => T a + (encIn a).length) S

The disjunction of a fixed finite list of computed Booleans, within their common bounds. The time bound also charges the input length, which pays for the constant answer of the empty list.