Theorem 2.25: Polynomial-Time Soundness of the Affine Term Calculus
OpenABHS2004.theorem_2_25implicit-computational-complexitypolynomial-timeproof-theoryrealizabilitytype-theory
Every numerical function f : ℕ^n → ℕ represented by a closed term M of the !-free affine term system is computable in polynomial time (IsPolyTimeComputable f).
Preamble
import Definitions.Def_ABHS2004_TermSystem
Formal statement
namespace ABHS2004
theorem theorem_2_25 {τs : List Ty} {τ : Ty} {r : Term}
(hdata_in : ∀ σ ∈ τs, IsDataType σ)
(hdata_out : IsDataType τ)
(ht : HasType r (Ty.lolliMany τs τ))
(hac : IsAlmostClosed r) :
∃ (B : Nat → Nat) (k : Nat),
BoundedByPolyOfDegree B (Nat.max (iterNesting r) 1) ∧
∀ ws : List Term,
ValidDataInputs r τs ws →
∃ (steps : Nat) (w : Term),
RedSteps steps (Term.appMany r ws) w ∧
IsDataObject τ w ∧
steps ≤ B (totalTermLength ws) ∧
termLength w ≤ totalTermLength ws + k ∧
freeVarCount w ≤ totalFreeVarCount ws + k := by sorry
end ABHS2004Source
Klaus Aehlig, Ulrich Berger, Martin Hofmann, and Helmut Schwichtenberg, 'An arithmetic for non-size-increasing polynomial-time computation', Theoretical Computer Science 318(1-2), 2004, pp. 3-27 (doi:10.1016/j.tcs.2003.10.023). Theorem 2.25, p. 14.
Read-back
What the Lean code literally says, in plain math · Gemini 3.1 Pro (Independent Blind Auditor)
Blind Read-back: Thm_ABHS2004_theorem_2_25.lean
Declaration theorem_2_25.
For any finite list of input types (including the empty list ), any output type , and any program term , suppose that:
- every is a data type (, meaning is generated from using , , and only);
- is a data type ();
- is linearly well-typed of the iterated linear function type (); and
- is almost closed (, meaning every free variable occurrence in has type ).
Then there exist a bounding function and an additive constant such that:
- is bounded by a polynomial of degree at most (, meaning there exist such that for all , where is the maximum nesting depth of the list iterator in , counting only in the right-hand argument of ); and
- for every list of input terms satisfying —meaning that , each is a data object of type (), and the free variables of are pairwise disjoint—there exist a step count and an output term such that:
- the iterated application () reduces to in exactly reduction steps ();
- is a data object of type (, i.e., is linearly well-typed of type , almost closed, and in normal form);
- the number of reduction steps is bounded by applied to the sum of the syntactic lengths of the inputs:
- the syntactic length of is bounded by the sum of the syntactic lengths of the inputs plus :
- the number of free-variable occurrences in (counted with multiplicity) is bounded by the sum of the free-variable counts of the inputs plus :