Lemma 2.1: Syntactic Polynomial Max-Output-Length Bound for Bellantoni-Cook Programs
ProvedBC1992.lemma_2_1_length_boundProves monotonicity of syntactic polynomials Poly and Lemma 2.1 of Bellantoni and Cook (1992): for every Bellantoni-Cook program , normal arguments with , and safe arguments ,
where is synthesized by structural recursion on , together with specializations to purely normal programs (), unary programs (), and uniform normal-and-safe length bounds ().
import Definitions.Def_BC1992_Syntax
namespace BC1992
/-- **Lemma 2.1 (Bellantoni & Cook 1992 — Syntactic Polynomial Output-Length Bound)**:
1. Every syntactic polynomial `p : Poly` is monotone on `Nat`.
2. For every `f : Fn n m`, normal inputs `xs` with `∀ x ∈ xs, x.length ≤ N`, and safe inputs `ys`,
`(f.eval xs ys).length ≤ f.sizePoly.eval N + Fn.maxLen ys`.
3. When `f : Fn n 0` has no safe inputs (`ys = []`), `(f.eval xs []).length ≤ f.sizePoly.eval N`.
4. For a unary program `f : Fn 1 0` and input word `x : Word`,
`(f.eval [x] []).length ≤ f.sizePoly.eval x.length`.
5. When all normal inputs `xs` and safe inputs `ys` have length at most `K`,
`(f.eval xs ys).length ≤ f.fullSizePoly.eval K`. -/
theorem lemma_2_1_length_bound :
(∀ (p : Poly) {n m : Nat}, n ≤ m → p.eval n ≤ p.eval m) ∧
(∀ {n m : Nat} (f : Fn n m) (xs ys : List Word) {N : Nat},
(∀ x ∈ xs, x.length ≤ N) →
(f.eval xs ys).length ≤ f.sizePoly.eval N + Fn.maxLen ys) ∧
(∀ {n : Nat} (f : Fn n 0) (xs : List Word) {N : Nat},
(∀ x ∈ xs, x.length ≤ N) →
(f.eval xs []).length ≤ f.sizePoly.eval N) ∧
(∀ (f : Fn 1 0) (x : Word),
(f.eval [x] []).length ≤ f.sizePoly.eval x.length) ∧
(∀ {n m : Nat} (f : Fn n m) (xs ys : List Word) {K : Nat},
(∀ x ∈ xs, x.length ≤ K) →
(∀ y ∈ ys, y.length ≤ K) →
(f.eval xs ys).length ≤ f.fullSizePoly.eval K) := by
sorry
end BC1992Read-back
What the Lean code literally says, in plain math · Gemini 4 Argon (Independent Blind Auditor)
Overview
Thm_BC1992_lemma_2_1_length_bound.lean states Lemma 2.1 of Bellantoni & Cook (1992): the output length of every Bellantoni–Cook program is bounded by a polynomial in the maximum length of the normal inputs plus the single (unmultiplied) maximum length of the safe inputs.
Detailed Read-Back of Theorem Conjuncts
theorem lemma_2_1_length_bound is a 5-way conjunction:
- Monotonicity of Syntactic Polynomials:
- Core Safe-Recursion Output-Length Bound (Lemma 2.1): For all , every BC program , normal argument list , safe argument list , and bound :
i.e., .
3. Specialization to Safe-Free Programs (Fn n 0):
For all , , , and :
- Specialization to Unary Closed Programs (
Fn 1 0): For every and input word :
- Uniform Normal-and-Safe Bound (
fullSizePoly): For all , , , and :
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.