Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Corollary 2.22: Polynomial Step and Space Bounds for Closed Terms

Open
ABHS2004.corollary_2_22

by kmehltretter82 · Oct 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

implicit-computational-complexitypolynomial-timeproof-theoryrealizabilitytype-theory

For every well-typed closed term M : ρ of the !-free affine term system, its normal form is computable in |M|^{2^{d+1}} steps with intermediate terms of size at most |M|^{2^d}, where d is the nesting depth of it in M.

Preamble
import Definitions.Def_ABHS2004_TermSystem
Formal statement
namespace ABHS2004

theorem corollary_2_22 {r : Term} {ρ : Ty} (ht : HasType r ρ) :
    (∀ (n : Nat) (r' : Term), RedStepBounded n r r' → theta n r' < theta n r) ∧
    (∀ (k : Nat) (r' : Term), RedSteps k r r' → k ≤ theta (freeVarCount r) r) := by sorry

end ABHS2004
Source
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). Corollary 2.22, 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_corollary_2_22.lean

Declaration corollary_2_22. For any raw term r∈Termr \in \mathrm{Term}r∈Term and any finite linear type ρ∈Ty\rho \in \mathrm{Ty}ρ∈Ty such that rrr is linearly well-typed of type ρ\rhoρ (HasType(r,ρ)\mathrm{HasType}(r, \rho)HasType(r,ρ)), the following two properties hold simultaneously:

  1. Strict decrease of ϑn\vartheta_nϑn​ under bounded-free-variable reduction: For every natural number n∈Nn \in \mathbb{N}n∈N (including n=0n = 0n=0) and every term r′∈Termr' \in \mathrm{Term}r′∈Term, if r→nr′r \to_n r'r→n​r′ (RedStepBounded(n,r,r′)\mathrm{RedStepBounded}(n, r, r')RedStepBounded(n,r,r′), meaning r′r'r′ is obtained from rrr by converting a redex subterm s↦s′s \mapsto s's↦s′ not under any λ\lambdaλ such that the number of free-variable occurrences with multiplicity in the redex sss satisfies freeVarCount(s)≤n\mathrm{freeVarCount}(s) \le nfreeVarCount(s)≤n), then
ϑn(r′)<ϑn(r),\vartheta_n(r') < \vartheta_n(r),ϑn​(r′)<ϑn​(r),

where ϑn:Term→N\vartheta_n : \mathrm{Term} \to \mathbb{N}ϑn​:Term→N (theta(n,⋅)\mathrm{theta}(n, \cdot)theta(n,⋅)) is defined recursively by ϑn(x)=ϑn(c)=1\vartheta_n(x) = \vartheta_n(c) = 1ϑn​(x)=ϑn​(c)=1, ϑn(t u)=ϑn(t)+ϑn(u)\vartheta_n(t\,u) = \vartheta_n(t) + \vartheta_n(u)ϑn​(tu)=ϑn​(t)+ϑn​(u), ϑn(λx. t)=ϑn(t)+1\vartheta_n(\lambda x.\, t) = \vartheta_n(t) + 1ϑn​(λx.t)=ϑn​(t)+1, and ϑn(t{u})=ϑn(t)+(#n(t)+1) ϑn(u)\vartheta_n(t\{u\}) = \vartheta_n(t) + (\#_n(t) + 1)\,\vartheta_n(u)ϑn​(t{u})=ϑn​(t)+(#n​(t)+1)ϑn​(u), with #n(t)\#_n(t)#n​(t) (hashBound(n,t)\mathrm{hashBound}(n, t)hashBound(n,t)) equal to mmm if ttt is a list term of length m≤nm \le nm≤n and equal to nnn otherwise. 2. Upper bound on reduction sequence length: For every step count k∈Nk \in \mathbb{N}k∈N (including k=0k = 0k=0) and every term r′∈Termr' \in \mathrm{Term}r′∈Term, if rrr reduces to r′r'r′ in kkk steps of unrestricted one-step reduction (RedSteps(k,r,r′)\mathrm{RedSteps}(k, r, r')RedSteps(k,r,r′), i.e., r=r0→r1→⋯→rk=r′r = r_0 \to r_1 \to \cdots \to r_k = r'r=r0​→r1​→⋯→rk​=r′), then

k≤ϑfreeVarCount(r)(r),k \le \vartheta_{\mathrm{freeVarCount}(r)}(r),k≤ϑfreeVarCount(r)​(r),

where freeVarCount(r)=∣freeVarOccurrences(r)∣∈N\mathrm{freeVarCount}(r) = |\mathrm{freeVarOccurrences}(r)| \in \mathbb{N}freeVarCount(r)=∣freeVarOccurrences(r)∣∈N is the number of free variable occurrences in rrr counted with multiplicity.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me