Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Combinators.BoundedPrefix

Evaluating functions that depend only on a bounded suffix prefix #

If f : α × List Bool → β is computable in polynomial time on encPair encA encBits, cap : α → ℕ is unary polynomial-time on encA, and f (a, raw) = f (a, raw.take (cap a + 1)) for all a and raw, then f is computed by a single deterministic multi-tape Turing machine whose worst-case time and space on (a, raw) are bounded by polynomials in (encA a).length alone, completely independent of raw.length.

This eliminates arbitrary raw-input length dependence for bounded-length verifiers (for example, cryptographic verifiers that reject oversized prover strings before parsing them).

theorem Turing.MultiTapeTM.computableInTimeAndSpace_boundedPrefix {α β : Type} {encA : α ↪ List Bool} {encB : β ↪ List Bool} {cap : α → ℕ} {f : α × List Bool → β} (hcap : ComputableInPolyTime cap encA encUnary) (hf : ComputableInPolyTime f (encPair encA encBits) encB) (hagree : ∀ (a : α) (raw : List Bool), f (a, raw) = f (a, List.take (cap a + 1) raw)) :
∃ (k : ℕ) (State : Type) (_ : Finite State) (tm : MultiTapeTM k Bool State) (t : ℕ → ℕ) (s : ℕ → ℕ), Cslib.PolynomiallyBounded t ∧ Cslib.PolynomiallyBounded s ∧ tm.ComputesFunInTimeAndSpace (encPair encA encBits) encB f (fun (p : α × List Bool) => t (encA p.1).length) fun (p : α × List Bool) => s (encA p.1).length

Any polynomial-time function f : α × List Bool → β whose value on (a, raw) depends only on raw.take (cap a + 1) — where cap : α → ℕ is unary polynomial-time — can be computed by one multi-tape Turing machine whose worst-case time and space on (a, raw) are bounded by polynomials in (encA a).length alone, independent of raw.length.