Polynomial Evaluation of Type `0 → 0` Subterms on Nonzero Numerals
ProvedSchwichtenberg1976V2.subterm_polynomial_lemmaFor every subterm s generated by clauses (1)-(3) (IsType00Subterm), either s = α or there exist a multivariate polynomial P with natural number coefficients and a variable z : 0 such that substituting Fᵢ ↦ n̄ᵢ with n₁, ..., nₖ ≠ 0 reduces s to λy. α^{P(n₁, ..., nₖ)} z.
import Definitions.Def_Schwichtenberg1976V2_Lambda
namespace Schwichtenberg1976V2
/-- Inductive lemma on clauses (1)–(3) (p. 114, lines 14–22):
For every `s` satisfying `IsType00Subterm (List.ofFn Fs) α s`, either `s = .var α`, or
there exist a multivariate polynomial `P : (Fin k → Nat) → Nat` (`IsPolynomial P`) and
a variable `z` of type `0` (either bound by the outer `λy` or free in `s`) such that for
all positive inputs `v : Fin k → Nat` (`∀ i, v i ≠ 0`), substituting `Fᵢ ↦ v(i)̄` into `s`
reduces to `λy. α^{P(v)} z` (which is `α^{P(v)}` when `z = y`). -/
theorem subterm_polynomial_lemma
(k : Nat) (Fs : Fin k → Var) (α : Var)
(hFs_ty : ∀ i : Fin k, (Fs i).ty = Ty.nu)
(hFs_inj : Function.Injective Fs)
(hα_ty : α.ty = Ty.endo)
(s : Term)
(hs : IsType00Subterm (List.ofFn Fs) α s) :
s = .var α ∨
∃ (P : (Fin k → Nat) → Nat) (z : Var),
IsPolynomial P ∧
z.ty = .zero ∧
∀ v : Fin k → Nat,
(∀ i : Fin k, v i ≠ 0) →
∃ y : Var,
y.ty = .zero ∧
(z = y ∨ z ∈ freeVars s) ∧
ReducesTo
(substMany s ((List.finRange k).map (fun i => (Fs i, churchNumeral (v i)))))
(.lam y (iterApp (.var α) (.var z) (P v))) := by
sorry
end Schwichtenberg1976V2Read-back
What the Lean code literally says, in plain math · Gemini 4 Argon (Independent Blind Auditor)
The theorem subterm_polynomial_lemma is universally quantified over an arity , a variable-indexing function , a variable , and a term in the simply typed Church-style -calculus (with base type , arrow , , and ). It assumes the following four hypotheses:
hFs_ty: For every , .hFs_inj: The map is injective ().hα_ty: . (Note: there is no explicit hypothesis stating , because already forces for all .)hs: holds, where and the mutually inductive predicates , , and for a list and mean:- holds iff or for some and some term satisfying ;
- holds iff and for some with each satisfying ;
- holds iff either holds, or for some variables with , , and .
Under these hypotheses, the theorem concludes that either is literally the variable term (), or there exist a function and a variable such that all three of the following hold:
- holds, where
IsPolynomialis the smallest class of functions containing all constants () and projections (), and closed under pointwise addition and pointwise multiplication . - .
- For every tuple satisfying for all , there exists a variable (which may depend on ) such that:
- ;
- either or (where is the deduplicated list of free variable occurrences of ); and
- the sequential substitution
reduces via $\twoheadrightarrow_{\beta\alpha}$ (`ReducesTo`) to
Here with and ; applies capture-avoiding single-variable substitution sequentially from left to right; and is the transitive closure of -equivalence (AlphaEq, including reflexivity) and single-step capture-avoiding -reduction closed under application and -abstraction.
Note on edge cases:
- The reduction guarantee is restricted strictly to inputs where for every ; nothing is asserted by the second disjunct when for at least one .
- When , , the hypothesis is vacuously true for the unique , and .
- Notice that and are chosen uniformly for before quantifying over , whereas the outer -binder is existentially quantified inside the quantifier.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.