Theorem 4.7: Typing of Extracted Programs
OpenABHS2004.theorem_4_7implicit-computational-complexitypolynomial-timeproof-theoryrealizabilitytype-theory
For every natural deduction derivation Δ; Γ ⊢ M : A in N-HA^ω with A non-Harrop, the extracted program ⟦M⟧ is a well-typed term of the !-free affine term system of type τ(A) under the cleaned contexts τ(Δ); τ(Γ).
Preamble
import Definitions.Def_ABHS2004_Realizability
Formal statement
namespace ABHS2004
theorem theorem_4_7 {Δ Γ : ProofContext} {M : ProofTerm} {A : Formula}
(hd : Derives Δ Γ M A)
(hfresh : FreshRealizerVars Δ Γ M A) :
WeaklyTyped (extractProof M) (tau A) ∧
(∀ v ∈ freeVarOccurrences (extractProof M),
v ∈ extractCtx Δ ∨ v ∈ extractCtx Γ) ∧
HasType (extractCleaned M) (tauClean A) ∧
(∀ v ∈ freeVarOccurrences (extractCleaned M),
v ∈ extractCleanCtx Γ) := by sorry
end ABHS2004Source
Klaus Aehlig, Ulrich Berger, Martin Hofmann, and Helmut Schwichtenberg, 'An arithmetic for non-size-increasing polynomial-time computation', Theoretical Computer Science 318(1-2), 2004, pp. 3-27 (doi:10.1016/j.tcs.2003.10.023). Theorem 4.7, pp. 19-21.
Read-back
What the Lean code literally says, in plain math · Gemini 3.1 Pro (Independent Blind Auditor)
Blind Read-back: Thm_ABHS2004_theorem_4_7.lean
Declaration theorem_4_7.
For any passive proof context , any active proof context , any raw proof term , and any formula , suppose that:
- () holds in the two-zone natural deduction system; and
- holds, meaning that across , any two assumption variables with are identical (), and for every , its realizer variable does not occur free in or in for any .
Then the following four statements hold simultaneously:
- Weak typing of the uncleaned extracted term: The uncleaned extracted term () is weakly typed of type (, meaning it satisfies the typing rules of without the disjoint-free-variables condition on applications or the closedness condition on list-iteration step terms).
- Free variables of the uncleaned extracted term: Every variable that occurs free in () belongs either to or to .
- Linear typing of the cleaned extracted term: The cleaned extracted term () is linearly well-typed of the cleaned realizer type (, including disjointness of free variables across every binary application and closedness of every list-iteration step term).
- Free variables of the cleaned extracted term: Every variable that occurs free in () belongs to the cleaned active variable context
Note that this fourth conclusion asserts set-membership inclusion (), while linear typing separately forbids free-variable sharing across binary applications.