Documentation

CslibFrontier.Computability.Complexity.Classes.FunctionTime

Deterministic function time #

FTIME encIn encOut t consists of functions computed by one finite-control binary multi-tape machine in time c₁ * t n + c₂ on an input whose encoding has length n, for constants fixed before the input. The output encoding is explicit and workspace may have any length-dependent bound. This is the function analogue of DTIME, using the same native computation predicate; it is not a class of decision problems.

For natural-valued counting functions, use the binary output encoding Turing.MultiTapeTM.encNat. No extra output-length charge is imposed beyond writing the encoded output within the time bound.

Main definitions #

Main results #

def Cslib.Complexity.FTIME {α β : Type} (encIn : α ↪ List Bool) (encOut : β ↪ List Bool) (t : ℕ → ℕ) :
Set (α → β)

Functions computed in time O(t n) by finite-control binary native machines. The output encoding is explicit; workspace has an arbitrary bound depending on encoded input length.

theorem Cslib.Complexity.mem_FTIME {α β : Type} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {t : ℕ → ℕ} {f : α → β} :
f ∈ FTIME encIn encOut t ↔ ∃ (c₁ : ℕ) (c₂ : ℕ) (s : ℕ → ℕ), Turing.MultiTapeTM.ComputableInTimeAndSpace f encIn encOut (fun (a : α) => c₁ * t (encIn a).length + c₂) fun (a : α) => s (encIn a).length

Membership exposes one machine with an affine time bound and arbitrary length-dependent workspace.

theorem Cslib.Complexity.FTIME_mono {α β : Type} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {t₁ t₂ : ℕ → ℕ} (h : ∀ (n : ℕ), t₁ n ≤ t₂ n) :
FTIME encIn encOut t₁ ⊆ FTIME encIn encOut t₂

Increasing the time bound preserves function-time membership.

theorem Cslib.Complexity.FTIME.of_computableInTimeAndSpace {α β : Type} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {t : ℕ → ℕ} {f : α → β} {s : ℕ → ℕ} (h : Turing.MultiTapeTM.ComputableInTimeAndSpace f encIn encOut (fun (a : α) => t (encIn a).length) fun (a : α) => s (encIn a).length) :
f ∈ FTIME encIn encOut t

An exact length-dependent time/workspace certificate implies function-time membership.