Register-Machine Evaluation and Linear Step/Register Bounds for R-Free RS-Terms (Theorem 4.3 & Corollary 4.4)
OpenBNS2000.theorem_4_3_and_4_4implicit-computational-complexitypolynomial-timeproof-theoryramified-recursiontype-theory
Theorem 4.3 and Corollary 4.4 (pp. 23-24): Every R-free RS-term t of ground type evaluated on numeral environment n⃗ via NFEval computes its numeral normal form nf(t[n⃗/x⃗]) in at most 2|t| steps using at most |t| registers of length at most |t| + max |n_i|.
Preamble
import Definitions.Def_BNS2000_Terms
Formal statement
namespace BNS2000
/-- **Theorem 4.3 and Corollary 4.4 (Base Normalisation)** (Section 4, p. 24):
1. (**Theorem 4.3**): For every `R`-free `RS`-term `t` of ground type and numeral environment
`n⃗; x⃗` (`IsNumeralEnv env`) such that `FV(t) ⊆ x⃗`:
(i) the register-machine algorithm `nf(t; n⃗; x⃗)` (`NFEval`) computes the numeral normal form
`out = nf(t[n⃗/x⃗])` in at most `2 |t|` steps,
(ii) the number of used registers is `≤ |t| + #n⃗`, and
(iii) the maximum length `maxLen` of any term occurring in the computation satisfies
`maxLen ≤ |t| + max |nᵢ|`.
2. (**Corollary 4.4, Base Normalisation**): For every closed `R`-free `RS`-term `t` of ground
type, the numeral `nf(t)` is computed in at most `2 |t|` steps using `≤ |t|` registers,
with every term occurring in the computation having length `≤ |t|`. -/
theorem theorem_4_3_and_4_4 :
(∀ (t : Term) (τ : Ty) (env : List (Var × Term)),
IsRSTerm t →
isRFree t = true →
HasType t τ →
τ.isGround = true →
IsNumeralEnv env →
(∀ v ∈ freeVars t, v ∈ env.map Prod.fst) →
∃ (out : Term) (steps regs maxLen : Nat),
NFEval t env out steps regs maxLen ∧
IsNormalFormOf (substEnv t env) out ∧
isNumeral out = true ∧
steps ≤ 2 * termLength t ∧
regs ≤ termLength t + env.length ∧
maxLen ≤ termLength t + maxEnvTermLength env) ∧
(∀ (t : Term) (τ : Ty),
IsRSTerm t →
isRFree t = true →
IsClosed t →
HasType t τ →
τ.isGround = true →
∃ (out : Term) (steps regs maxLen : Nat),
NFEval t [] out steps regs maxLen ∧
IsNormalFormOf t out ∧
isNumeral out = true ∧
steps ≤ 2 * termLength t ∧
regs ≤ termLength t ∧
maxLen ≤ termLength t) := by
sorry
end BNS2000Source
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 4, Theorem 4.3 and Corollary 4.4, pp. 23-24.
Read-back
What the Lean code literally says, in plain math · Gemini 3.1 Pro (Independent Blind Auditor)
Read-back: Thm_BNS2000_theorem_4_3_and_4_4.lean
theorem_4_3_and_4_4
The theorem is a conjunction of two universally quantified statements:
- Part 1 (Theorem 4.3 — Register-Machine Normalization in a Numeral Environment): For every term , type , and environment list , if:
- is an -term (, meaning is a well-typed -term in which every free or bound variable has safe or ground type, every free higher-type variable satisfies , and every subterm with satisfies ),
- contains no recursor constant (),
- has type (),
- is a ground type (, i.e., ),
- is a numeral environment (, meaning the variables are pairwise distinct and each satisfies and , so for a binary numeral ), and
- every free variable is among (), then there exist an output term and natural numbers such that:
- holds (the inductive register-machine evaluation relation produces from and with cost parameters , , and ),
- is a normal form of the substituted term (),
- is a numeral (), and
- the resource bounds hold:
- Part 2 (Corollary 4.4 — Base Normalization of Closed Ground -Free -Terms): For every term and type , if:
- is an -term (),
- contains no recursor constant (),
- is closed (, i.e., ),
- has type (), and
- is a ground type (), then there exist an output term and natural numbers such that:
- holds in the empty environment ,
- is a normal form of (),
- is a numeral (), and
- the resource bounds hold:
Edge-Case and Faithfulness Notes
- In Part 1, because every numeral in is closed (contains no variables) and the bound variables are pairwise distinct, the sequential substitution is identical to simultaneous substitution .
- When , and , so Part 2 is the exact specialization of Part 1 to .
Human review
Confirmed by the mission captain (proposal self-audit).