Corollary 4.9: Syntactic Characterization of Polynomial Time
OpenAehligSchwichtenberg2002.corollary_4_9Every function on binary lists/words definable by a closed term of type !B → ... → !B → B in the affine non-size-increasing λ-calculus with higher-type iteration is computable in polynomial time.
import Definitions.Def_AehligSchwichtenberg2002_Bounds
namespace AehligSchwichtenberg2002
theorem corollary_4_9 {k : Nat} {t : Term}
(ht : HasType [] t (Ty.lolliMany (List.replicate k Ty.bin) Ty.bin)) :
∃ B : Nat → Nat,
IsPolyBoundedOfDegree B (Nat.max (braceDepth t) 1) ∧
∀ (Γ : Context) (ls : List Term) (ns : List Nat),
ls.length = k →
ValidBinListInputs Γ ls ns →
∃ (steps m : Nat) (w : Term),
RedSteps steps (Term.appMany t ls) w ∧
IsNormal w ∧
listEntryCount w = some m ∧
m ≤ sumListLengths ns ∧
steps ≤ B (sumListLengths ns) := by sorry
end AehligSchwichtenberg2002Read-back
What the Lean code literally says, in plain math · Gemini 3.1 Pro (Independent Blind Auditor)
Read-back: Thm_AehligSchwichtenberg2002_corollary_4_9.lean
Theorem corollary_4_9
Let be a natural number (the number of list arguments) and let be a raw term. Assume that is typed in the empty context as a -ary iterated linear function on binary lists (ht):
(HasType [] t (Ty.lolliMany (List.replicate k Ty.bin) Ty.bin)).
Then there exists a bounding function satisfying both of the following conditions:
- Polynomial growth bound of degree : holds; that is, there exist constants such that for all ,
where is the maximum nesting depth of braces in . (Note that when , the exponent in the polynomial bound is , i.e., an affine bound , rather than degree .)
2. Bounded normalization and non-size-increasing output on valid binary-list inputs: For every context , every list of raw terms of length (ls.length = k), and every list of natural numbers , if holds—meaning that starting from the empty context , each input has a context disjoint from the union of the preceding input contexts, with , such that every variable has type , , is in normal form (IsNormal l_i), and —then there exist natural numbers and a raw term such that:
- the iterated application (
Term.appMany t ls) reduces to in exactly one-step reductions (RedSteps steps (Term.appMany t ls) w), - is in normal form (
IsNormal w), - ,
- the output list entry count is at most the sum of the input list entry counts:
- and the number of reduction steps is bounded by evaluated at the sum of the input list entry counts:
Edge cases and representation details:
- When ,
List.replicate 0 Ty.binis , so the hypothesis is , the only valid input lists are and with and , and the conclusion states that normalizes in steps to a normal form with (i.e., ). - The complexity bound counts the number of term-rewriting steps in
RedStep(weak reduction at the root or under applications), rather than bit-level or Turing-machine time steps. - Each canonical binary-list input is required to be a normal term of type in a -only context with ; in particular, contains distinct free variables of type (in the first arguments of ), and the pairwise disjointness in
ValidBinListInputsforces the input lists to use disjoint sets of -variables.