Safe/Ground Normal Forms (Lemma 4.1) and Sharing via Ground β_ι-Expansions (Lemma 4.2)
OpenBNS2000.lemma_4_1_and_4_2implicit-computational-complexitypolynomial-timeproof-theoryramified-recursiontype-theory
Lemmas 4.1 and 4.2 (p. 22): (1) Every variable in the normal form of a ground-type term with ground free variables is safe or ground; (2) every term with affinable higher-type incomplete binders can be ground β_ι-expanded into a well-typed term t_β in which every higher-type incomplete binder occurs at most once (FO(x, s) ≤ 1).
Preamble
import Definitions.Def_BNS2000_Terms
Formal statement
namespace BNS2000
/-- **Lemma 4.1 and Lemma 4.2 (Sharing)** (Section 4, p. 22):
1. (**Lemma 4.1**): Let `t` be a well-typed ground-type term whose free variables are of
ground type. Then in the normal form `nf(t)` of `t`, all occurring variables (free or bound)
are safe or ground (`AllVarsSafeOrGround nf_t`).
2. (**Lemma 4.2, Sharing**): Let `t` be a well-typed term such that for every subterm `λx. s`
with `x` higher-type incomplete, the variable `x` is affinable in `s`
(`SatisfiesDirectAffinability t`). Then by repeated ground-type `β_ι`-expansions
`r[a/y^τ] ↦ (λy^τ. r) a` one can construct a term `t_β` (`BetaIotaExpandsTo t t_β`,
hence `ReducesTo t_β t`) such that for every subterm `λx. s` in `t_β` with `x` higher-type
incomplete, `FO(x, s) ≤ 1` (`HasLinearHigherIncompleteBinders t_β`). -/
theorem lemma_4_1_and_4_2 :
(∀ (t nf_t : Term) (τ : Ty),
HasType t τ →
τ.isGround = true →
(∀ v ∈ freeVars t, v.ty.isGround = true) →
IsNormalFormOf t nf_t →
AllVarsSafeOrGround nf_t) ∧
(∀ (t : Term) (τ : Ty),
HasType t τ →
SatisfiesDirectAffinability t →
∃ t_β : Term,
HasType t_β τ ∧
(SatisfiesR t → SatisfiesR t_β) ∧
BetaIotaExpandsTo t t_β ∧
ReducesTo t_β t ∧
HasLinearHigherIncompleteBinders 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, Lemmas 4.1 and 4.2, p. 22.
Read-back
What the Lean code literally says, in plain math · Gemini 3.1 Pro (Independent Blind Auditor)
Read-back: Thm_BNS2000_lemma_4_1_and_4_2.lean
lemma_4_1_and_4_2
The theorem is a conjunction of two universally quantified statements:
- Part 1 (Safe or Ground Variables in Normal Forms): For all terms and every type , if:
- has type (),
- is a ground type (, i.e., , so for some ),
- every free variable has a ground type (), and
- is a normal form of (, meaning and has no one-step reductions), then every variable occurring (either free or bound in a -binder) in has either a safe (-free) type or a ground (level-) type:
- Part 2 (Linearization of Higher-Type Incomplete Binders via Ground -Expansion): For every term and every type , if:
- has type (), and
- satisfies direct affinability for higher-type incomplete binders (: for every subterm of such that and is incomplete, is affinable in itself, i.e., or there exists an affination of in ), then there exists a term such that:
- has type (),
- if satisfies property
(R)(: every complete subterm of has only complete free variables), then also satisfies property(R)(), - expands to in zero or more ground-type -expansion steps (, the reflexive-transitive contextual closure of for variables with ),
- reduces to in zero or more reduction steps (, i.e., ), and
- every higher-type incomplete -binder in binds a variable with at most one free occurrence in its scope (: for every subterm of with and , ).
Edge-Case and Faithfulness Notes
- In Part 1, is assumed to be a well-typed ground-type term with ground-type free variables ( is not required as a hypothesis).
- In Part 2, although the standalone root rule of only checks , the conclusion of Part 2 explicitly guarantees (so every subterm of , including any expanded , is well-typed) as well as preservation of from to .
Human review
Confirmed by the mission captain (proposal self-audit).