Samplinglib
Lean gate not recorded for this source state main · ed709a7f320d
Registry leaf card · gaussian-polynomial-joint-risk

gaussian_polynomial_joint_risk_first_variation

compiled Samplinglib leaf Not mapped explicit smoke test

Actual joint-Gaussian polynomial risk first variation and linear convexity, with finite label second moment explicit and no independence hypothesis. Independent fresh compilation and whole-module current-context semantic review accepted. Final root/reader gates and postmerge purification separate. No spatial gradient regularity, SDE or stochastic convergence claim.

Plain-English statement

Actual joint-Gaussian polynomial risk first variation and linear convexity, with finite label second moment explicit and no independence hypothesis. Independent fresh compilation and whole-module current-context semantic review accepted. Final root/reader gates and postmerge purification separate. No spatial gradient regularity, SDE or stochastic convergence claim.

Scope guard. This card records a compiled local declaration. Its mathematical scope is exactly the Lean statement below; the Registry note and source correspondence may describe motivation but do not strengthen it.
Lean learning studio · mathematics → formal proof

Read the mathematics first, then descend into Lean

You do not need to know Lean before opening this panel. The page keeps the paper-level theorem, rigorous proof obligations, exact Lean declaration, and proof dependencies as separate layers so a first-time reader can move down one layer at a time.

BeginnerWhy this theorem exists → intuition → statement → one hand calculation. Hide proof-engineering detail.
RigorousExpose assumptions, hidden measure/limit/domain issues, proof route, and rigorous references.
Lean learnerOpen the exact declaration, proof tree/network, syntax glossary, and line-by-line explanation.

Proof architecture

Start with the tree when learning: prerequisites sit below the theorem and downstream results sit above it. Switch to the network when you want to understand where this declaration lives in the local formal library. Every mapped node is clickable.

Loading source-derived dependency evidence…

Graph rule: only dependencies found by the ASTIS source scan are drawn. Missing tactic indirection is treated as an under-approximation; the site never invents an edge just to make a prettier graph.

How to read the exact Lean declaration

Read a Lean theorem left-to-right exactly as you would unpack a mathematical sentence: name → ambient types → automatically inferred structures → explicit hypotheses → conclusion → proof. Then read the proof top-to-bottom as transformations of the current goal.

  1. NameWhat reusable mathematical fact is being created?
  2. ParametersWhich symbols are arbitrary, and which structures are inferred by typeclass search?
  3. PropositionAfter the colon, translate the Lean expression back into a paper statement.
  4. Proof actionsAfter by, ask what each tactic does to the mathematical goal—not only what syntax it uses.

Syntax used on this page

This glossary is filtered to syntax that actually occurs in the declaration above. Open a symbol only when you meet it, rather than memorizing Lean grammar in advance.

Source voice and ASTIS voice stay separate

When Samplinglib shows a short quotation from Chewi, it is labeled as a source excerpt and linked to the canonical book page. Intuition, expanded proof steps, hidden regularity assumptions, and Lean explanations are ASTIS-authored commentary. A quotation never substitutes for a formal proof, and an ASTIS explanation is never attributed to the textbook author.

Lean statement

theorem gaussian_polynomial_joint_risk_first_variation
    {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
    [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E]
    (P : Measure (E × ℝ)) [IsProbabilityMeasure P]
    (hGaussian : P.map Prod.fst = ProbabilityTheory.stdGaussian E)
    (p : Polynomial ℝ)
    (hlabel : MemLp (fun z : E × ℝ => z.2) 2 P) :
    let U := {w : E // ‖w‖ = 1}
    let predictor : Measure U → E → ℝ := fun rho x => ∫ w : U, p.eval ⟪w.1,x⟫_ℝ ∂rho
    let risk : Measure U → ℝ := fun rho => ∫ z, (predictor rho z.1 - z.2)^2 ∂P
    let potential : Measure U → U → ℝ := fun rho w =>
      2 * ∫ z, (predictor rho z.1 - z.2) * p.eval ⟪w.1,z.1⟫_ℝ ∂P
    (∀ rho : Measure U, IsProbabilityMeasure rho →
      Integrable (fun z : E × ℝ => (predictor rho z.1 - z.2)^2) P ∧
      ∀ w : U, Integrable (fun z : E × ℝ =>
        (predictor rho z.1 - z.2) * p.eval ⟪w.1,z.1⟫_ℝ) P) ∧
    ∀ rho0 rho1 : Measure U, IsProbabilityMeasure rho0 → IsProbabilityMeasure rho1 →
      let curve : ℝ → Measure U := fun t =>
        ENNReal.ofReal (1-t) • rho0 + ENNReal.ofReal t • rho1
      Integrable (potential rho0) rho0 ∧ Integrable (potential rho0) rho1 ∧
      HasDerivWithinAt (fun t => risk (curve t))
        ((∫ w, potential rho0 w ∂rho1) - (∫ w, potential rho0 w ∂rho0))
        (Set.Icc (0 : ℝ) 1) 0 ∧
      risk rho0 + ((∫ w, potential rho0 w ∂rho1) - (∫ w, potential rho0 w ∂rho0)) ≤
        risk rho1 := by
  classical
  letI : CompleteSpace E := FiniteDimensional.complete ℝ E
  dsimp only
  let U := {w : E // ‖w‖ = 1}
  let K : U → E → ℝ := fun w x => p.eval ⟪w.1,x⟫_ℝ
  let predictor : Measure U → E → ℝ := fun rho x => ∫ w, K w x ∂rho
  let risk : Measure U → ℝ := fun rho => ∫ z, (predictor rho z.1-z.2)^2 ∂P
  let potential : Measure U → U → ℝ := fun rho w =>
    2 * ∫ z, (predictor rho z.1-z.2) * K w z.1 ∂P
  change (∀ rho : Measure U, IsProbabilityMeasure rho →
    Integrable (fun z : E × ℝ => (predictor rho z.1-z.2)^2) P ∧
      ∀ w : U, Integrable (fun z : E × ℝ => (predictor rho z.1-z.2) * K w z.1) P) ∧
    ∀ rho0 rho1 : Measure U, IsProbabilityMeasure rho0 → IsProbabilityMeasure rho1 →
      let curve : ℝ → Measure U := fun t => ENNReal.ofReal (1-t) • rho0 + ENNReal.ofReal t • rho1
      Integrable (potential rho0) rho0 ∧ Integrable (potential rho0) rho1 ∧
      HasDerivWithinAt (fun t => risk (curve t))
        ((∫ w, potential rho0 w ∂rho1)-(∫ w, potential rho0 w ∂rho0)) (Set.Icc (0 : ℝ) 1) 0 ∧
      risk rho0 + ((∫ w, potential rho0 w ∂rho1)-(∫ w, potential rho0 w ∂rho0)) ≤ risk rho1
  obtain ⟨hf,hcont,havg⟩ := AutoSamplingTheory.TechnicalLemmas.Probability.GaussianPolynomialAveraging.gaussian_polynomial_parameter_average_L2 (E := E) p
  have hmarg : MeasurePreserving (Prod.fst : E × ℝ → E) P (stdGaussian E) :=
    ⟨measurable_fst,hGaussian⟩
  let T : Lp ℝ 2 (stdGaussian E) →L[ℝ] Lp ℝ 2 P :=
    (Lp.compMeasurePreservingₗᵢ ℝ Prod.fst hmarg).toContinuousLinearMap
  let hfP : ∀ w : U, MemLp (fun z : E × ℝ => K w z.1) 2 P :=
    fun w => (hf w).comp_measurePreserving hmarg
  let feature : U → Lp ℝ 2 P := fun w => (hfP w).toLp (fun z => K w z.1)
  let label : Lp ℝ 2 P := hlabel.toLp (fun z : E × ℝ => z.2)
  let mean : Measure U → Lp ℝ 2 P := fun rho => ∫ w, feature w ∂rho
  have hFint (rho : Measure U) (hrho : IsProbabilityMeasure rho) : Integrable feature rho := by
    have h := T.integrable_comp (havg rho hrho).2.1
    exact h
  have hMeanClass (rho : Measure U) (hrho : IsProbabilityMeasure rho) :
      ∃ hpred : MemLp (fun z : E × ℝ => predictor rho z.1) 2 P,
        hpred.toLp (fun z => predictor rho z.1) = mean rho := by
    obtain ⟨hscalar,hint,hmean,hident⟩ := havg rho hrho
    let hpred : MemLp (fun z : E × ℝ => predictor rho z.1) 2 P :=
      hmean.comp_measurePreserving hmarg
    refine ⟨hpred, ?_⟩
    calc
      hpred.toLp (fun z => predictor rho z.1) = T (hmean.toLp (predictor rho)) := rfl
      _ = T (∫ w, (hf w).toLp (K w) ∂rho) := congrArg T hident
      _ = mean rho := (T.integral_comp_comm hint).symm
  have hMeanAE (rho : Measure U) (hrho : IsProbabilityMeasure rho) :
      (fun z => mean rho z) =ᵐ[P] (fun z : E × ℝ => predictor rho z.1) := by
    obtain ⟨hpred,hident⟩ := hMeanClass rho hrho
    rw [← hident]
    exact hpred.coeFn_toLp
  have hResidual (rho : Measure U) (hrho : IsProbabilityMeasure rho) :
      (fun z => (mean rho-label) z) =ᵐ[P] (fun z : E × ℝ => predictor rho z.1-z.2) := by
    filter_upwards [Lp.coeFn_sub (mean rho) label, hMeanAE rho hrho,hlabel.coeFn_toLp]
      with z hsub hm hy
    simp only [Pi.sub_apply] at hsub
    rw [hsub,hm,hy]
  have hRisk (rho : Measure U) (hrho : IsProbabilityMeasure rho) :
      risk rho = ‖mean rho-label‖^2 := by
    rw [← real_inner_self_eq_norm_sq, L2.inner_def]
    apply integral_congr_ae
    filter_upwards [hResidual rho hrho] with z hz
    simp only [risk,Real.inner_apply,hz,pow_two]
  have hPot (rho : Measure U) (hrho : IsProbabilityMeasure rho) :
      potential rho = fun w => 2 * ⟪mean rho-label,feature w⟫_ℝ := by
    funext w
    change 2 * (∫ z, (predictor rho z.1-z.2) * K w z.1 ∂P) = _
    rw [L2.inner_def]
    congr 1
    apply integral_congr_ae
    filter_upwards [hResidual rho hrho,(hfP w).coeFn_toLp] with z hr hw
    change feature w z = K w z.1 at hw
    simp only [Real.inner_apply,hr,hw]
  refine ⟨?_,?_⟩
  · intro rho hrho
    obtain ⟨hpred,hident⟩ := hMeanClass rho hrho
    exact ⟨(hpred.sub hlabel).integrable_sq,fun w =>
      (hpred.sub hlabel).integrable_mul (hfP w)⟩
  · intro rho0 rho1 h0 h1
    letI : IsProbabilityMeasure rho0 := h0
    letI : IsProbabilityMeasure rho1 := h1
    dsimp only
    let curve : ℝ → Measure U := fun t => ENNReal.ofReal (1-t) • rho0 + ENNReal.ofReal t • rho1
    have hc := AutoSamplingTheory.TechnicalLemmas.Analysis.ProbabilitySegmentRisk.quadratic_feature_probability_segment
      rho0 rho1 feature label (hFint rho0 h0) (hFint rho1 h1)
    dsimp only at hc
    rcases hc with ⟨hprops,hpot0,hpot1,hderiv,hbre,hsupport⟩
    rw [hPot rho0 h0]
    refine ⟨hpot0,hpot1,?_,?_⟩
    · apply hderiv.congr_of_mem
      · intro t ht
        exact hRisk (curve t) (hprops t ht).1
      · exact ⟨le_rfl,zero_le_one⟩
    · rw [hRisk rho0 h0,hRisk rho1 h1]
      exact hsupport

end AutoSamplingTheory.TechnicalLemmas.Probability.GaussianPolynomialRisk

Proof architecture

Generic probability-law calculus and feature averaging; no model completion

Lean proof walkthrough

  • Read the quantified variables and typeclass brackets as part of the mathematical statement; inferred arguments are not missing assumptions.
  • `intro` introduces quantified hypotheses into the local proof context.
  • `have` creates a named intermediate mathematical fact.
  • `calc` records an equality or inequality chain matching a paper calculation.
  • `rw` rewrites by an established identity.
  • `simp` normalizes through registered definitional and theorem rewrites.
  • `apply` reduces the goal to the hypotheses of a reusable theorem.
  • `refine` instantiates a reusable theorem while leaving explicit subgoals.

Why the statement has this shape

The declaration is kept at the reusable level recorded by its Registry tags and direct consumers. Explicit measures, spaces, wrappers, and regularity hypotheses expose interfaces that paper notation often infers. A theorem card explains those interfaces but never widens the compiled statement.

Hidden assumptions and non-claims

  • Measurability is represented explicitly or must be supplied by a dependency.
  • Integrability is an input or proved output; a displayed integral alone does not supply it.
  • Pointwise support, topological support, and compact support retain distinct meanings.
  • Almost-everywhere hypotheses depend on the stated measure and representative.
Common pitfall. A wrapper or display identity is not a new analytic theorem merely because it has its own Lean name. Check the statement, hypotheses, and downstream consumers before interpreting its mathematical contribution.