Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Bounding Theorem — Polynomial-Time Normalization of Closed Level-1 RA-Terms (Theorem 5.1)

Open
BNS2000.theorem_5_1

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

implicit-computational-complexitypolynomial-timeproof-theoryramified-recursiontype-theory

Theorem 5.1 (p. 26): Every closed RA-term t of first-order type σ₁ → ⋯ → σ_k → τ normalizes on numerals n₁, ..., n_k in polynomial time (≤ p_t(∑ |n_i|) steps and register size) via reduction to an equivalent closed R-free RS-term of length ≤ p_t(∑ |n_i|).

Preamble
import Definitions.Def_BNS2000_Terms
Formal statement
namespace BNS2000

/-- **Theorem 5.1 (Bounding)** (Section 5, p. 26):
Let `t` be a closed `RA`-term of type `σ₁ → ⋯ → σₖ → τ`, where `σ₁, ..., σₖ, τ` are all
ground types. Then there exists a polynomial `p_t : Nat → Nat` (`IsUnivariatePoly p_t`)
such that for all numerals `n₁, ..., nₖ` of types `σ₁, ..., σₖ` respectively, there exists
a closed `R`-free `RS`-term `u` of type `τ` equivalent to `t n₁ ... nₖ` of length
`|u| ≤ p_t(∑ |nᵢ|)` whose numeral normal form `nf(t n⃗) = nf(u)` is computed by `NFEval`
in at most `p_t(∑ |nᵢ|)` steps using registers of size at most `p_t(∑ |nᵢ|)`. -/
theorem theorem_5_1
    (k : Nat) (σs : Fin k → Ty) (τ : Ty) (t : Term)
    (ht : IsRATerm t)
    (hclosed : IsClosed t)
    (hty : HasType t (Ty.arrMany (List.ofFn σs) τ))
    (hσs : ∀ i : Fin k, (σs i).isGround = true)
    (hτ : τ.isGround = true) :
    ∃ p_t : Nat → Nat,
      IsUnivariatePoly p_t ∧
      ∀ ns : Fin k → Term,
        (∀ i : Fin k, HasType (ns i) (σs i) ∧ isNumeral (ns i) = true) →
        let m := (List.finRange k).foldr (fun i acc => termLength (ns i) + acc) 0
        ∃ (u nf_val : Term) (steps regs maxLen : Nat),
          IsRSTerm u ∧
          isRFree u = true ∧
          IsClosed u ∧
          HasType u τ ∧
          TermEquiv u (Term.appMany t (List.ofFn ns)) ∧
          NFEval u [] nf_val steps regs maxLen ∧
          IsNormalFormOf (Term.appMany t (List.ofFn ns)) nf_val ∧
          isNumeral nf_val = true ∧
          termLength u ≤ p_t m ∧
          steps ≤ p_t m ∧
          regs ≤ p_t m ∧
          maxLen ≤ p_t m := by
  sorry

end BNS2000
Source
Stephen Bellantoni, Karl-Heinz Niggl, and Helmut Schwichtenberg, 'Higher type recursion, ramification and polynomial time', Annals of Pure and Applied Logic 104, 2000, pp. 17-30 (doi:10.1016/S0168-0072(00)00006-3). Section 5, Theorem 5.1, p. 26.
Read-back

What the Lean code literally says, in plain math · Gemini 3.1 Pro (Independent Blind Auditor)

Read-back: Thm_BNS2000_theorem_5_1.lean

theorem_5_1

Let k∈Nk \in \mathbb{N}k∈N be a natural number, σ0,…,σk−1∈Ty\sigma_0, \dots, \sigma_{k-1} \in \mathsf{Ty}σ0​,…,σk−1​∈Ty be a family of kkk types indexed by Fin(k)\mathsf{Fin}(k)Fin(k), τ∈Ty\tau \in \mathsf{Ty}τ∈Ty be a return type, and t∈Termt \in \mathsf{Term}t∈Term be a term such that:

  • ttt is an RA\mathsf{RA}RA-term (IsRATerm(t)\mathsf{IsRATerm}(t)IsRATerm(t), meaning ttt is well-typed and satisfies both (R) and (A)),
  • ttt is closed (IsClosed(t)\mathsf{IsClosed}(t)IsClosed(t), i.e., freeVars(t)=[]\mathsf{freeVars}(t) = []freeVars(t)=[]),
  • ttt has the iterated arrow type σ0→σ1→⋯→σk−1→τ\sigma_0 \to \sigma_1 \to \cdots \to \sigma_{k-1} \to \tauσ0​→σ1​→⋯→σk−1​→τ (HasType(t,Ty.arrMany(List.ofFn(σ⃗),τ))\mathsf{HasType}(t, \mathsf{Ty.arrMany}(\mathsf{List.ofFn}(\vec{\sigma}), \tau))HasType(t,Ty.arrMany(List.ofFn(σ),τ))),
  • for every i∈Fin(k)i \in \mathsf{Fin}(k)i∈Fin(k), σi\sigma_iσi​ is a ground type (isGround(σi)=true\mathsf{isGround}(\sigma_i) = \mathsf{true}isGround(σi​)=true, i.e., l(σi)=0l(\sigma_i) = 0l(σi​)=0), and
  • τ\tauτ is a ground type (isGround(τ)=true\mathsf{isGround}(\tau) = \mathsf{true}isGround(τ)=true, i.e., l(τ)=0l(\tau) = 0l(τ)=0).

Then there exists a function pt:N→Np_t : \mathbb{N} \to \mathbb{N}pt​:N→N such that:

  1. ptp_tpt​ is a univariate polynomial with natural-number coefficients (IsUnivariatePoly(pt)\mathsf{IsUnivariatePoly}(p_t)IsUnivariatePoly(pt​)); and
  2. for every kkk-tuple of terms n⃗=(n0,…,nk−1):Fin(k)→Term\vec{n} = (n_0, \dots, n_{k-1}) : \mathsf{Fin}(k) \to \mathsf{Term}n=(n0​,…,nk−1​):Fin(k)→Term such that for each i∈Fin(k)i \in \mathsf{Fin}(k)i∈Fin(k), HasType(ni,σi)\mathsf{HasType}(n_i, \sigma_i)HasType(ni​,σi​) and isNumeral(ni)=true\mathsf{isNumeral}(n_i) = \mathsf{true}isNumeral(ni​)=true (meaning ni=!mibin_i = !^{m_i} b_ini​=!mi​bi​ for a binary numeral bib_ibi​), setting
m=∑i=0k−1∣ni∣,m = \sum_{i=0}^{k-1} |n_i|,m=i=0∑k−1​∣ni​∣,

there exist terms u,nf_val∈Termu, \mathsf{nf\_val} \in \mathsf{Term}u,nf_val∈Term and natural numbers steps,regs,maxLen∈N\mathsf{steps}, \mathsf{regs}, \mathsf{maxLen} \in \mathbb{N}steps,regs,maxLen∈N such that:

  • uuu is a closed RRR-free RS\mathsf{RS}RS-term of type τ\tauτ (IsRSTerm(u)∧isRFree(u)=true∧IsClosed(u)∧HasType(u,τ)\mathsf{IsRSTerm}(u) \wedge \mathsf{isRFree}(u) = \mathsf{true} \wedge \mathsf{IsClosed}(u) \wedge \mathsf{HasType}(u, \tau)IsRSTerm(u)∧isRFree(u)=true∧IsClosed(u)∧HasType(u,τ)),
  • uuu and the left-associated application t n0⋯nk−1t\, n_0 \cdots n_{k-1}tn0​⋯nk−1​ are term-equivalent (TermEquiv(u,Term.appMany(t,[n0,…,nk−1]))\mathsf{TermEquiv}(u, \mathsf{Term.appMany}(t, [n_0, \dots, n_{k-1}]))TermEquiv(u,Term.appMany(t,[n0​,…,nk−1​])), i.e., they share a common normal form),
  • the register-machine evaluation relation NFEval(u,[],nf_val,steps,regs,maxLen)\mathsf{NFEval}(u, [], \mathsf{nf\_val}, \mathsf{steps}, \mathsf{regs}, \mathsf{maxLen})NFEval(u,[],nf_val,steps,regs,maxLen) holds in the empty environment [][][],
  • nf_val\mathsf{nf\_val}nf_val is a normal form of t n0⋯nk−1t\, n_0 \cdots n_{k-1}tn0​⋯nk−1​ (IsNormalFormOf(Term.appMany(t,[n0,…,nk−1]),nf_val)\mathsf{IsNormalFormOf}(\mathsf{Term.appMany}(t, [n_0, \dots, n_{k-1}]), \mathsf{nf\_val})IsNormalFormOf(Term.appMany(t,[n0​,…,nk−1​]),nf_val)),
  • nf_val\mathsf{nf\_val}nf_val is a numeral (isNumeral(nf_val)=true\mathsf{isNumeral}(\mathsf{nf\_val}) = \mathsf{true}isNumeral(nf_val)=true), and
  • the length of uuu and the evaluation cost parameters are all bounded by pt(m)p_t(m)pt​(m):
∣u∣≤pt(m),steps≤pt(m),regs≤pt(m),maxLen≤pt(m).|u| \le p_t(m), \qquad \mathsf{steps} \le p_t(m), \qquad \mathsf{regs} \le p_t(m), \qquad \mathsf{maxLen} \le p_t(m).∣u∣≤pt​(m),steps≤pt​(m),regs≤pt​(m),maxLen≤pt​(m).

Edge-Case and Faithfulness Notes

  • When k=0k = 0k=0, List.ofFn(σ⃗)=[]\mathsf{List.ofFn}(\vec{\sigma}) = []List.ofFn(σ)=[], Ty.arrMany([],τ)=τ\mathsf{Ty.arrMany}([], \tau) = \tauTy.arrMany([],τ)=τ, m=0m = 0m=0, and Term.appMany(t,[])=t\mathsf{Term.appMany}(t, []) = tTerm.appMany(t,[])=t.
  • Every clause in the docstring (|u| ≤ p_t(∑ |nᵢ|), steps ≤ p_t(∑ |nᵢ|), regs ≤ p_t(∑ |nᵢ|), and maxLen ≤ p_t(∑ |nᵢ|)) is explicitly represented as a conjunct in the formal statement.
Human review
  • Endorsed by Shuze Chen · Nov 20, 2026

  • Endorsed by kmehltretter82 · Nov 20, 2026

    Confirmed by the mission captain (proposal self-audit).

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