Samplinglib
Lean gate not recorded for this source state main · ed709a7f320d
Registry leaf card · gaussian.reflectedPosterior.compactMeanC1

gaussian_reflected_mean_c1

compiled Samplinglib leaf Not mapped explicit smoke test

- Compact C1 observables have C1 means under the literal reflected Gaussian posterior. No input moment, density or analytic certificate is assumed.

Plain-English statement

- Compact C1 observables have C1 means under the literal reflected Gaussian posterior. No input moment, density or analytic certificate is assumed.

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_reflected_mean_c1
    {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
    [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E]
    (μ : Measure E) [IsProbabilityMeasure μ] {η : ℝ} (hη : 0 < η)
    {f : E → ℝ} (hf : ContDiff ℝ 1 f) (hc : HasCompactSupport f) :
    let R := fun y : E => μ.tilted (fun x => -‖x-y‖^2/(2*η))
    let S := fun y : E => (R y).map (fun x : E => (2:ℝ) • x-y)
    ContDiff ℝ 1 (fun y : E => ∫ u, f u ∂S y)
 := by
  let K := fun y x : E => Real.exp (-‖y-x‖^2/(2*η))
  let K' := fun y x : E => (-K y x/η) • innerSL ℝ (y-x)
  let F := fun y x : E => K y x * f ((2:ℝ) • x-y)
  let G := fun y x : E => K y x • (-fderiv ℝ f ((2:ℝ) • x-y)) +
    f ((2:ℝ) • x-y) • K' y x
  let N := fun y : E => ∫ x, F y x ∂μ
  let D := fun y : E => ∫ x, G y x ∂μ
  let Z := fun y : E => ∫ x, K y x ∂μ
  have hdfC : Continuous (fderiv ℝ f) := hf.continuous_fderiv one_ne_zero
  obtain ⟨Mf, hMf⟩ := hc.exists_bound_of_continuous hf.continuous
  obtain ⟨Md, hMd⟩ := (hc.fderiv ℝ).exists_bound_of_continuous hdfC
  have hMf0 : 0 ≤ Mf := (norm_nonneg (f 0)).trans (hMf 0)
  have hK (y x : E) : 0 < K y x ∧ K y x ≤ 1 ∧ K y x * ‖y-x‖^2 ≤ 2*η := by
    have hp : 0 < K y x := Real.exp_pos _
    have h1 : K y x ≤ 1 := Real.exp_le_one_iff.mpr
      (div_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr (sq_nonneg _)) (by positivity))
    have hb := Real.mul_exp_neg_le_exp_neg_one (‖y-x‖^2/(2*η))
    have he : Real.exp (-1) ≤ 1 := Real.exp_le_one_iff.mpr (by norm_num)
    have hb' : K y x * (‖y-x‖^2/(2*η)) ≤ 1 := by
      simpa [K, mul_comm, neg_div] using hb.trans he
    have heq : K y x * (‖y-x‖^2/(2*η)) = (K y x * ‖y-x‖^2)/(2*η) := by ring
    rw [heq, div_le_iff₀ (by positivity)] at hb'
    exact ⟨hp,h1,by simpa using hb'⟩
  have hKderiv (y x : E) : HasFDerivAt (fun z => K z x) (K' y x) y := by
    have hd := (((hasFDerivAt_id y).sub_const x).norm_sq.const_mul (-1/(2*η))).exp
    convert hd using 1
    · funext z; dsimp only [K,id]; congr 1; ring
    · ext v
      have he : -‖y-x‖^2/(2*η) = (-1/(2*η))*‖y-x‖^2 := by ring
      simp only [K',K,he,smul_apply,ContinuousLinearMap.comp_apply,
        ContinuousLinearMap.id_apply,smul_eq_mul,innerSL_apply_apply,id]
      ring
  have hKbound (y x : E) : ‖K' y x‖ ≤ (1+2*η)/η := by
    obtain ⟨hp,h1,h2⟩ := hK y x
    have hr : ‖y-x‖ ≤ 1+‖y-x‖^2 := by nlinarith [sq_nonneg (‖y-x‖-1)]
    have hb : K y x * ‖y-x‖ ≤ 1+2*η := by
      calc
        _ ≤ K y x * (1+‖y-x‖^2) := mul_le_mul_of_nonneg_left hr hp.le
        _ ≤ 1+2*η := by nlinarith
    dsimp only [K']
    rw [norm_smul,Real.norm_eq_abs,abs_div,abs_neg,abs_of_pos hp,
      abs_of_pos hη,innerSL_apply_norm,div_mul_eq_mul_div,div_le_div_iff_of_pos_right hη]
    exact hb
  have hGbound (y x : E) : ‖G y x‖ ≤ Md + Mf*((1+2*η)/η) := by
    have hk := hK y x
    calc
      _ ≤ ‖K y x • (-fderiv ℝ f ((2:ℝ) • x-y))‖ +
          ‖f ((2:ℝ) • x-y) • K' y x‖ := norm_add_le _ _
      _ = K y x * ‖fderiv ℝ f ((2:ℝ) • x-y)‖ +
          ‖f ((2:ℝ) • x-y)‖ * ‖K' y x‖ := by
            rw [norm_smul,norm_smul,norm_neg,Real.norm_eq_abs,abs_of_pos hk.1]
      _ ≤ 1*Md + Mf*((1+2*η)/η) := add_le_add
        (mul_le_mul hk.2.1 (hMd _) (norm_nonneg _) (by norm_num))
        (mul_le_mul (hMf _) (hKbound y x) (norm_nonneg _) hMf0)
      _ = _ := by ring
  have hFmeas (y : E) : AEStronglyMeasurable (F y) μ := by
    apply Continuous.aestronglyMeasurable
    have hk : Continuous (K y) := by unfold K; fun_prop
    exact hk.mul (hf.continuous.comp (by fun_prop))
  have hGmeas (y : E) : AEStronglyMeasurable (G y) μ := by
    apply Continuous.aestronglyMeasurable
    dsimp only [G,K',K]
    have hd : Continuous (fun x : E => fderiv ℝ f ((2:ℝ) • x-y)) :=
      hdfC.comp (by fun_prop)
    have ho : Continuous (fun x : E => f ((2:ℝ) • x-y)) := hf.continuous.comp (by fun_prop)
    fun_prop
  have hFI (y : E) : Integrable (F y) μ := by
    apply (integrable_const Mf).mono' (hFmeas y)
    filter_upwards with x
    dsimp only [F]
    rw [norm_mul,Real.norm_eq_abs,abs_of_pos (hK y x).1]
    calc
      _ ≤ 1*Mf := mul_le_mul (hK y x).2.1 (hMf _) (norm_nonneg _) (by norm_num)
      _ = _ := one_mul _
  have hFderiv (y x : E) : HasFDerivAt (fun z => F z x) (G y x) y := by
    have ha := (hasFDerivAt_id (𝕜 := ℝ) y).const_sub ((2:ℝ) • x)
    have ho := (hf.differentiable_one ((2:ℝ) • x-y)).hasFDerivAt.comp y ha
    have ho' : HasFDerivAt (fun z : E => f ((2:ℝ) • x-z))
        (-fderiv ℝ f ((2:ℝ) • x-y)) y := by
      convert ho using 1 <;> first | rfl | (ext v; simp)
    exact (hKderiv y x).mul ho'
  have hdN (y : E) : HasFDerivAt N (D y) y := by
    apply hasFDerivAt_integral_of_dominated_of_fderiv_le (s := Set.univ)
      (bound := fun _ => Md+Mf*((1+2*η)/η)) Filter.univ_mem
    · exact Filter.Eventually.of_forall hFmeas
    · exact hFI y
    · exact hGmeas y
    · exact Filter.Eventually.of_forall (fun x z _ => hGbound z x)
    · exact integrable_const _
    · exact Filter.Eventually.of_forall (fun x z _ => hFderiv z x)
  have hDC : Continuous D := by
    apply continuous_of_dominated hGmeas
      (bound := fun _ => Md+Mf*((1+2*η)/η))
      (fun y => Filter.Eventually.of_forall (fun x => hGbound y x)) (integrable_const _)
    filter_upwards with x
    dsimp only [G,K',K]
    have hd : Continuous (fun y : E => fderiv ℝ f ((2:ℝ) • x-y)) := hdfC.comp (by fun_prop)
    have ho : Continuous (fun y : E => f ((2:ℝ) • x-y)) := hf.continuous.comp (by fun_prop)
    fun_prop
  have hNC : ContDiff ℝ 1 N := contDiff_one_iff_hasFDerivAt.mpr ⟨D,hDC,hdN⟩
  have hparent := GaussianConvolutionRegularity.gaussian_convolution_potential_c2 μ hη
  have hZC : ContDiff ℝ 2 Z := hparent.2.2.1
  have hZ (y : E) : Z y ≠ 0 := by
    have hp := hparent.2.1 y
    intro hz
    change 0 < ((Real.sqrt (2*Real.pi*η))⁻¹)^Module.finrank ℝ E * Z y at hp
    rw [hz,mul_zero] at hp
    exact lt_irrefl _ hp
  have hKI (y : E) : Integrable (K y) μ := by
    apply (integrable_const (1:ℝ)).mono' (by unfold K; fun_prop)
    filter_upwards with x
    rw [Real.norm_eq_abs,abs_of_pos (hK y x).1]
    exact (hK y x).2.1
  have hmean (y : E) :
      (∫ u, f u ∂((μ.tilted (fun x => -‖x-y‖^2/(2*η))).map
        (fun x : E => (2:ℝ) • x-y))) = N y / Z y := by
    have hlike : Integrable (fun x : E => Real.exp (-‖x-y‖^2/(2*η))) μ := by
      simpa only [K,norm_sub_rev] using hKI y
    have : IsProbabilityMeasure (μ.tilted (fun x => -‖x-y‖^2/(2*η))) :=
      isProbabilityMeasure_tilted hlike
    have hobs : Integrable (fun x : E => f ((2:ℝ) • x-y))
        (μ.tilted (fun x => -‖x-y‖^2/(2*η))) := by
      apply (integrable_const Mf).mono' (hf.continuous.comp (by fun_prop)).aestronglyMeasurable
      exact Filter.Eventually.of_forall (fun x => hMf _)
    have hmapI : Integrable f ((μ.tilted (fun x => -‖x-y‖^2/(2*η))).map
        (fun x : E => (2:ℝ) • x-y)) :=
      (integrable_map_measure hf.continuous.aestronglyMeasurable (by fun_prop)).mpr hobs
    rw [integral_map (by fun_prop) hmapI.aestronglyMeasurable,integral_tilted]
    have hw (x : E) : Real.exp (-‖x-y‖^2/(2*η)) = K y x := by
      dsimp [K]; rw [norm_sub_rev x y]
    simp_rw [hw,smul_eq_mul]
    rw [← integral_div]
    apply integral_congr_ae
    filter_upwards with x
    dsimp [N,Z,F]
    ring
  change ContDiff ℝ 1 (fun y : E => ∫ u, f u ∂((μ.tilted
    (fun x => -‖x-y‖^2/(2*η))).map (fun x : E => (2:ℝ) • x-y)))
  simp_rw [hmean]
  exact hNC.div (hZC.of_le (by norm_num)) hZ

end
end AutoSamplingTheory.TechnicalLemmas.Measure.GaussianReflectedMean

Proof architecture

Shared Gaussian posterior compact-observer regularity; no SALD admission

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.
  • `exact` closes the current goal with an already typed term.

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.
  • Totalized `fderiv` values must not be read as a differentiability theorem.
  • Genuine differentiability is localized to the hypotheses shown in the Lean statement.
  • Pointwise support, topological support, and compact support retain distinct meanings.
  • Almost-everywhere hypotheses depend on the stated measure and representative.
  • Density statements retain normalization and absolute-continuity prerequisites.
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.