Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Existence of Uniform Realizers for Definite and Goal Formulas (Theorem 5.2)

Open
BBS2002.theorem_5_2

by kmehltretter82 · Oct 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

classical-logicprogram-extractionproof-theoryrealizabilitytype-theory

Theorem 5.2 (pp. 13-14): For every definite formula D and goal formula G, there exist terms t = ⟦N_D⟧ and s = ⟦H_G⟧ such that for any comprehension term A = λy A₀, (12) Z ⊢ D → t mr_A D^X and (13) Z ⊢ w mr_A G^X → (G → A(v)) → A(s w v).

Superseded by BBS2002.V2.theorem_5_2. The original declaration incorrectly required closed uniform realizers. V2 permits the formulas' free object parameters, while choosing realizers independently of the comprehension term.

Preamble
import Definitions.Def_BBS2002_Extraction
Formal statement
namespace BBS2002

/-- Theorem 5.2 (Section 5, pp. 13–14):
For every definite formula `D` and goal formula `G` (and any type `ν` with closed `dummy : ν`),
there exist `t : Option Term` and `s : Term` (specifically `t = ⟦N_D⟧` and `s = ⟦H_G⟧` extracted
from the `Z^X`-derivations `N_D : D → D^X` and `H_G : G^X → (G → X) → X` of Lemma 3.1(4),(6))
such that for every comprehension term `A = λy^ν A₀`:
- (12) `Z ⊢ D → t mr_A D^X`,
- (13) `Z ⊢ w mr_A G^X → (G → A(v)) → A(s w v)`. -/
theorem theorem_5_2
    (ν : Ty) (dummy : Term)
    (hDummyTy : HasType dummy ν)
    (hDummyClosed : IsClosedTerm dummy)
    (D G : Formula)
    (hD : IsDefiniteFormula D)
    (hG : IsGoalFormula G) :
    (∃ t : Option Term,
      (match tau ν (substBotWithX D), t with
       | none, none => True
       | some ρ, some t₀ => HasType t₀ ρ ∧ IsClosedTerm t₀
       | _, _ => False) ∧
      ∀ comp : CompTerm ν,
        Provable SysConfig.Z (.imp D (mrFormula ν comp t (substBotWithX D)))) ∧
    (∃ s : Term,
      IsClosedTerm s ∧
      (match tau ν (substBotWithX G) with
       | none => HasType s (.arr ν ν)
       | some ρ => HasType s (.arr ρ (.arr ν ν))) ∧
      ∀ (comp : CompTerm ν) (w : Option Var) (v : Var),
        v.ty = ν →
        (match tau ν (substBotWithX G), w with
         | none, none => True
         | some ρ, some wVar =>
             wVar.ty = ρ ∧
             wVar ≠ v ∧
             wVar ∉ freeVarsFormula G ∧
             (wVar = comp.var ∨ wVar ∉ freeVarsFormula comp.body)
         | _, _ => False) →
        v ∉ freeVarsFormula G →
        (v = comp.var ∨ v ∉ freeVarsFormula comp.body) →
        Provable SysConfig.Z
          (.imp
            (mrFormula ν comp (w.map Term.var) (substBotWithX G))
            (.imp
              (.imp G (comp.apply (.var v)))
              (comp.apply (applyGoalRealizer s w (.var v)))))) := by
  sorry

end BBS2002
Source
Ulrich Berger, Wilfried Buchholz, and Helmut Schwichtenberg, 'Refined program extraction from classical proofs', Annals of Pure and Applied Logic 114(1-3), 2002, pp. 3-25 (doi:10.1016/S0168-0072(01)00073-2). Section 5, Theorem 5.2, pp. 15-16 (preprint pp. 13-14).
Read-back

What the Lean code literally says, in plain math · Gemini 3.1 Pro (Independent Blind Auditor)

Independent Mathematical Read-Back: Thm_BBS2002_theorem_5_2.lean

theorem_5_2 (Uniform Realizers for Definite and Goal Formulas). For any simple type ν:Ty\nu : \mathrm{Ty}ν:Ty, any fallback term dummy:Term\mathrm{dummy} : \mathrm{Term}dummy:Term that is closed and of type ν\nuν (HasType dummy ν and IsClosedTerm dummy), any definite formula D:FormulaD : \mathrm{Formula}D:Formula (IsDefiniteFormula D), and any goal formula G:FormulaG : \mathrm{Formula}G:Formula (IsGoalFormula G), both of the following hold, where CX=substBotWithX(C)=C[⊥:=X]C^X = \mathrm{substBotWithX}(C) = C[\bot := X]CX=substBotWithX(C)=C[⊥:=X]:

  1. Realizer for the definite formula DDD: There exists an optional System T\mathsf{T}T term t:Option Termt : \mathrm{Option}\,\mathrm{Term}t:OptionTerm (depending only on ν\nuν, dummy\mathrm{dummy}dummy, and DDD, and independent of the comprehension term comp\mathrm{comp}comp) such that:
    • if τν(DX)=none\tau_\nu(D^X) = \mathrm{none}τν​(DX)=none (∗*∗), then t=nonet = \mathrm{none}t=none (ε\varepsilonε); if τν(DX)=some ρ\tau_\nu(D^X) = \mathrm{some}\,\rhoτν​(DX)=someρ, then t=some t0t = \mathrm{some}\,t_0t=somet0​ for a closed System T\mathsf{T}T term t0t_0t0​ of type ρ\rhoρ (HasType t₀ ρ and IsClosedTerm t₀); and the mismatched cases (none,some _)(\mathrm{none}, \mathrm{some}\,\_)(none,some_) and (some _,none)(\mathrm{some}\,\_, \mathrm{none})(some_,none) do not occur;
    • for every comprehension term comp:CompTerm ν\mathrm{comp} : \mathrm{CompTerm}\,\nucomp:CompTermν (representing A=λyν. A0\mathcal{A} = \lambda y^\nu.\, A_0A=λyν.A0​), intuitionistic arithmetic ZZZ proves (Provable SysConfig.Z)
Z⊢D→(t  mrA  DX).Z \vdash D \to (t \;\mathsf{mr}_{\mathcal{A}}\; D^X).Z⊢D→(tmrA​DX).
  1. Realizer for the goal formula GGG: There exists a closed System T\mathsf{T}T term s:Terms : \mathrm{Term}s:Term (IsClosedTerm s, depending only on ν\nuν, dummy\mathrm{dummy}dummy, and GGG, and independent of comp\mathrm{comp}comp, www, and vvv) such that:
    • if τν(GX)=none\tau_\nu(G^X) = \mathrm{none}τν​(GX)=none (∗*∗), then sss has type ν→ν\nu \to \nuν→ν; if τν(GX)=some ρ\tau_\nu(G^X) = \mathrm{some}\,\rhoτν​(GX)=someρ, then sss has type ρ→(ν→ν)\rho \to (\nu \to \nu)ρ→(ν→ν);
    • for every comprehension term comp:CompTerm ν\mathrm{comp} : \mathrm{CompTerm}\,\nucomp:CompTermν (A=λyν. A0\mathcal{A} = \lambda y^\nu.\, A_0A=λyν.A0​), every optional variable w:Option Varw : \mathrm{Option}\,\mathrm{Var}w:OptionVar, and every object variable v:Varv : \mathrm{Var}v:Var satisfying:
      • v.ty=νv.\mathrm{ty} = \nuv.ty=ν,
      • if τν(GX)=none\tau_\nu(G^X) = \mathrm{none}τν​(GX)=none then w=nonew = \mathrm{none}w=none, whereas if τν(GX)=some ρ\tau_\nu(G^X) = \mathrm{some}\,\rhoτν​(GX)=someρ then w=some wvarw = \mathrm{some}\,w_{\mathrm{var}}w=somewvar​ with wvar.ty=ρw_{\mathrm{var}}.\mathrm{ty} = \rhowvar​.ty=ρ, wvar≠vw_{\mathrm{var}} \neq vwvar​=v, wvar∉freeVarsFormula(G)w_{\mathrm{var}} \notin \mathrm{freeVarsFormula}(G)wvar​∈/freeVarsFormula(G), and (wvar=y∨wvar∉freeVarsFormula(A0))(w_{\mathrm{var}} = y \lor w_{\mathrm{var}} \notin \mathrm{freeVarsFormula}(A_0))(wvar​=y∨wvar​∈/freeVarsFormula(A0​)) (with mismatched none/some\mathrm{none}/\mathrm{some}none/some cases forbidden),
      • v∉freeVarsFormula(G)v \notin \mathrm{freeVarsFormula}(G)v∈/freeVarsFormula(G), and
      • v=y∨v∉freeVarsFormula(A0)v = y \lor v \notin \mathrm{freeVarsFormula}(A_0)v=y∨v∈/freeVarsFormula(A0​), intuitionistic arithmetic ZZZ proves
Z⊢(w.map(Term.var)  mrA  GX)→(G→A(v))→A(applyGoalRealizer(s,w,v)),Z \vdash \bigl(w.\mathrm{map}(\mathrm{Term.var}) \;\mathsf{mr}_{\mathcal{A}}\; G^X\bigr) \to \bigl(G \to \mathcal{A}(v)\bigr) \to \mathcal{A}\bigl(\mathrm{applyGoalRealizer}(s, w, v)\bigr),Z⊢(w.map(Term.var)mrA​GX)→(G→A(v))→A(applyGoalRealizer(s,w,v)),
 where $\mathrm{applyGoalRealizer}(s, w, v)$ is $s\, v$ when $w = \mathrm{none}$ and $s\, w_{\mathrm{var}}\, v$ when $w = \mathrm{some}\,w_{\mathrm{var}}$.
Human review
  • Endorsed by Shuze Chen · Oct 31, 2026

    Confirmed by the moderator at approval.

  • Endorsed by kmehltretter82 · Oct 31, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me