Samplinglib
Lean gate not recorded for this source state main · 9bb7a7394ab0

Probability: mathematical reading route

Read the statements and derivations in source order. Every result has its own optional Lean statement and proof. Source assumptions, library reuse and unproved boundaries are kept explicit.

  1. Almost-everywhere equal variables have the same pushforward
  2. Integrate a test function through a pushforward measure
  3. Transfer a supplied weak derivative from samples to laws
  4. Transfer the derivative to a separately named law path
  5. A dominated pathwise derivative yields a weak derivative of the law
  6. A dominated derivative for a named law path
  7. Componentwise a.e. equality preserves the joint image law
  8. Extract the first marginal of a joint image law
  9. Extract the second marginal of a joint image law
  10. Swap the coordinate order of a joint image law
  11. Match the conditional distribution and mapped conditional-expectation kernel
  12. Transfer a chosen conditional integral version between equal kernels
  13. The conditional integral is almost-everywhere strongly measurable on the sample space
  14. The conditional integral is integrable on the sample space
  15. The conditional integral is almost-everywhere strongly measurable under the conditioning law
  16. The conditional integral is integrable under the conditioning law
  17. Integrating the conditional average recovers the joint integral
  18. Disintegration written with a named conditioning law
  19. A.e. strong measurability under a named conditioning law
  20. Integrability under a named conditioning law
  21. A chosen a.e. version inherits conditional-integral regularity
  22. Record the name and provenance of a measure
  23. Record a forward-KL expression and its status
  24. Record a Fisher-information expression and its status
  25. Record a log-Sobolev inequality as an obligation
  26. Record a Poincaré inequality as an obligation
  27. Record a proposed continuity-equation velocity
  28. Record the intended labels of a guided tilt
  29. Record the cited entropy-duality interface
  30. Construct a source-cited DV proof-obligation record
  31. Populate the paper-facing DV interface without claiming its proof
  32. The square-root density squares back to the density
  33. Rewrite the square-root test's entropy integrand
  34. Transfer a supplied unit-mass identity
  35. The Radon–Nikodym density has unit nonnegative integral
  36. The real Radon–Nikodym density also has unit integral
  37. The squared square-root Radon–Nikodym test has unit mass
  38. Transport the density entropy integral to the log-likelihood measure
  39. Rewrite the square-root test entropy as a log-likelihood integral
  40. The scalar square-root/logarithm coefficients give a factor of one quarter
  41. Apply the scalar coefficient identity to supplied derivative values
  42. Sum the scalar Fisher-chain factor over finitely many coordinates
  43. Name the finite-coordinate Dirichlet and Fisher expressions
  44. Integrate the a.e. finite-coordinate Fisher-chain identity
  45. Extract the one-quarter factor from supplied integral representations
  46. Rearrange a supplied variational upper bound
  47. Extract one admissible scalar value from a known supremum
  48. An integrable exponential moment remains integrable at a smaller nonnegative scale
  49. Prove the selected-test entropy bound by exponential tilting
  50. Use an upper-scale exponential moment for the selected scaled test
  51. Divide the scaled entropy bound by its positive scale
  52. Preserve an external nonnegative coefficient in the energy bound
  53. Write the tilted-backend test bound in additive form
  54. Record the remaining LSI-to-KL/Fisher proof target
Samplinglib mathematical lesson

Almost-everywhere equal variables have the same pushforward

AutoSamplingTheory.lawMapEqOfAEEq · theorem · Teaching coverage

Read this first

Mathematical statement

On measurable spaces Ω and E, let P be any measure and X,Y:Ω→E any functions. If X=Y P-almost everywhere, their pushforward measures are equal. No measurability assumption is present in this totalized-map identity.

\[X=Y\quad P\text{-a.e.}\ \Longrightarrow\ X_\#P=Y_\#P.\]
Lean statement · lawMapEqOfAEEq

The hypothesis compares two functions outside a P-null set; the conclusion compares measures, not sample values at every input.

Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

theorem lawMapEqOfAEEq {Ω E : Type*} [MeasurableSpace Ω] [MeasurableSpace E]
    {P : Measure Ω} {X Y : Ω → E}
    (hXY : X =ᵐ[P] Y) :
    Measure.map X P = Measure.map Y P

Exact module and namespace context

Proof roadmap

  1. 1Keep the same equivalence class

    An almost-everywhere change of a map does not change its Mathlib pushforward. The imported map-congruence theorem applies directly, including its totalized non-a.e.-measurable case.

Full assumptions and notation

All objects and hypotheses

  • Ω and E are arbitrary measurable spaces; P is any measure on Ω, with no finiteness or probability hypothesis.
  • X,Y are arbitrary functions Ω→E; hXY asserts their P-almost-everywhere equality.

Notation and interpretation

Pushforward law

P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

\[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
A.e. and strong measurability

A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

\[f=g\quad\mu\text{-a.e.}\]

Mathematical proof

1. Keep the same equivalence class

An almost-everywhere change of a map does not change its Mathlib pushforward. The imported map-congruence theorem applies directly, including its totalized non-a.e.-measurable case.

\[X_\#P=Y_\#P\quad\text{whenever }X=Y\ P\text{-a.e.}\]
Corresponding Lean step

Measure.map_congr hXY

Lean verification

The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

Lean proof · lawMapEqOfAEEq

The proof applies the existing pushforward-congruence theorem once. It does not construct a process or establish either variable's measurability.

Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

Download module (.lean)
theorem lawMapEqOfAEEq {Ω E : Type*} [MeasurableSpace Ω] [MeasurableSpace E]
    {P : Measure Ω} {X Y : Ω → E}
    (hXY : X =ᵐ[P] Y) :
    Measure.map X P = Measure.map Y P := by
  exact Measure.map_congr hXY

Exact module and namespace context

Scope and omitted-condition boundaries
  • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
  • Measure.map is totalized: without AEMeasurable assumptions, this is not a claim that the expression is the usual nondegenerate distribution of an arbitrary nonmeasurable random variable.
  • No pointwise equality, process construction, conditional drift, or density theorem.
Sources, dependencies, and reuse

Source and reuse

Samplinglib parents called

    Mathlib API called (external library)

    • MeasureTheory.Measure.map_congr

    Mathematical sources

    Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

    Samplinglib mathematical lesson

    Integrate a test function through a pushforward measure

    AutoSamplingTheory.lawMapIntegral · theorem · Teaching coverage

    Read this first

    Mathematical statement

    Let P be any measure on measurable Ω and let X:Ω→E be P-almost-everywhere measurable. If B is a real normed vector space and φ:E→B is almost-everywhere strongly measurable under X#P, then the integral of φ against X#P equals the integral of φ∘X against P. No integrability or completeness assumption is imposed by this equality.

    \[\int_E\varphi(x)\,d(X_\#P)(x)=\int_\Omega\varphi(X(\omega))\,dP(\omega).\]
    Lean statement · lawMapIntegral

    The vector-space assumptions tell Lean how to form the Bochner integral. The two measurability hypotheses concern different domains and measures.

    Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

    theorem lawMapIntegral {Ω E B : Type*} [MeasurableSpace Ω]
        [MeasurableSpace E] [NormedAddCommGroup B] [NormedSpace ℝ B]
        {P : Measure Ω} {X : Ω → E} {φ : E → B}
        (hX : AEMeasurable X P)
        (hφ : AEStronglyMeasurable φ (Measure.map X P)) :
        (∫ x, φ x ∂Measure.map X P) = ∫ ω, φ (X ω) ∂P

    Exact module and namespace context

    Proof roadmap

    1. 1Use the pushforward integration identity

      The imported change-of-variables theorem needs the map's a.e. measurability and the test's a.e. strong measurability under its image measure; the supplied assumptions match precisely.

    Full assumptions and notation

    All objects and hypotheses

    • Ω and E are arbitrary measurable spaces; P is any measure on Ω, with no finiteness or probability hypothesis.
    • B has NormedAddCommGroup and NormedSpace ℝ structures; completeness is not assumed.
    • X:Ω→E is AEMeasurable under P; φ:E→B is AEStronglyMeasurable under X#P.

    Notation and interpretation

    Pushforward law

    P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

    \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
    A.e. and strong measurability

    A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

    \[f=g\quad\mu\text{-a.e.}\]
    Integrability and Bochner integrals

    L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

    \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

    Mathematical proof

    1. Use the pushforward integration identity

    The imported change-of-variables theorem needs the map's a.e. measurability and the test's a.e. strong measurability under its image measure; the supplied assumptions match precisely.

    \[\int \varphi\,d(X_\#P)=\int\varphi\circ X\,dP.\]
    Corresponding Lean step

    integral_map hX hφ

    Lean verification

    The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

    Lean proof · lawMapIntegral

    A single rewrite replaces integration under the image measure by integration of the composed test. No differentiation or integrability proof occurs.

    Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

    Download module (.lean)
    theorem lawMapIntegral {Ω E B : Type*} [MeasurableSpace Ω]
        [MeasurableSpace E] [NormedAddCommGroup B] [NormedSpace ℝ B]
        {P : Measure Ω} {X : Ω → E} {φ : E → B}
        (hX : AEMeasurable X P)
        (hφ : AEStronglyMeasurable φ (Measure.map X P)) :
        (∫ x, φ x ∂Measure.map X P) = ∫ ω, φ (X ω) ∂P := by
      rw [integral_map hX hφ]

    Exact module and namespace context

    Scope and omitted-condition boundaries
    • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
    • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
    • This is a bookkeeping equality, not time differentiability, a generator identity or a Fokker–Planck equation.
    Sources, dependencies, and reuse

    Source and reuse

    Samplinglib parents called

      Mathlib API called (external library)

      • MeasureTheory.integral_map

      Mathematical sources

      Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

      Samplinglib mathematical lesson

      Transfer a supplied weak derivative from samples to laws

      AutoSamplingTheory.lawMapIntegralHasDerivAtOfSample · theorem · Teaching coverage

      Read this first

      Mathematical statement

      Under the time-indexed measurability hypotheses, suppose the real function s↦∫φ(X_s(ω))dP has derivative g at s₀. Then s↦∫φ(x)d((X_s)#P)(x) has the same derivative g at s₀. The analytic derivative is assumed, not derived.

      \[\left.\frac d{ds}\int_\Omega\varphi(X_s(\omega))\,dP\right|_{s=s_0}=g \ \Longrightarrow\ \left.\frac d{ds}\int_E\varphi(x)\,d((X_s)_\#P)\right|_{s=s_0}=g.\]
      Lean statement · lawMapIntegralHasDerivAtOfSample

      The universal time hypotheses support equality of the entire two integral functions, while the derivative is asserted only at s₀.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      theorem lawMapIntegralHasDerivAtOfSample {Ω E : Type*}
          [MeasurableSpace Ω] [MeasurableSpace E]
          {P : Measure Ω} {X : ℝ → Ω → E} {φ : E → ℝ} {s0 g : ℝ}
          (hX : ∀ s, AEMeasurable (X s) P)
          (hφ : ∀ s, AEStronglyMeasurable φ (Measure.map (X s) P))
          (hderiv : HasDerivAt (fun s => ∫ ω, φ (X s ω) ∂P) g s0) :
          HasDerivAt (fun s => ∫ x, φ x ∂Measure.map (X s) P) g s0

      Exact module and namespace context

      Proof roadmap

      1. 1Identify both functions at every time

        Apply the pushforward-integral identity separately at each s. Functional extensionality turns these pointwise equalities into equality of the two real functions.

      2. 2Transfer the existing derivative

        Equal functions have the same derivative assertion at the same point. Replace G by F in the supplied derivative theorem.

      Full assumptions and notation

      All objects and hypotheses

      • Ω and E are arbitrary measurable spaces; P is any measure on Ω, with no finiteness or probability hypothesis.
      • X:ℝ→Ω→E is a time-indexed family, φ:E→ℝ is a fixed real test, and s₀,g are real numbers.
      • For every real s, X_s is P-a.e. measurable and φ is a.e. strongly measurable under (X_s)#P.
      • hderiv is HasDerivAt of the sample-space integral function, with derivative value g at s₀.

      Notation and interpretation

      Pushforward law

      P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

      \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
      A.e. and strong measurability

      A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

      \[f=g\quad\mu\text{-a.e.}\]
      Integrability and Bochner integrals

      L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

      \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
      Derivatives

      Derivative premises are never silently promoted to derived path regularity. The dominated differentiation units explicitly distinguish eventually-near-time assumptions from a.e.-sample, all-times-in-one-neighborhood assumptions.

      \[\operatorname{HasDerivAt}(F,g,s_0)\ \Longrightarrow\ F\text{ is differentiable at }s_0\text{ and }F'(s_0)=g.\]

      Mathematical proof

      1. Identify both functions at every time

      Apply the pushforward-integral identity separately at each s. Functional extensionality turns these pointwise equalities into equality of the two real functions.

      \[F(s):=\int\varphi\,d((X_s)_\#P)=G(s):=\int\varphi(X_s)\,dP\quad\forall s.\]
      Corresponding Lean step

      hfun; funext s; lawMapIntegral (hX s) (hφ s)

      2. Transfer the existing derivative

      Equal functions have the same derivative assertion at the same point. Replace G by F in the supplied derivative theorem.

      \[F=G,\quad G'(s_0)=g\ \Longrightarrow\ F'(s_0)=g.\]
      Corresponding Lean step

      simpa [hfun] using hderiv

      Lean verification

      The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

      Lean proof · lawMapIntegralHasDerivAtOfSample

      The proof first names the equality of functions, then rewrites the already supplied derivative. It supplies no pathwise derivative or domination estimate.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      Download module (.lean)
      theorem lawMapIntegralHasDerivAtOfSample {Ω E : Type*}
          [MeasurableSpace Ω] [MeasurableSpace E]
          {P : Measure Ω} {X : ℝ → Ω → E} {φ : E → ℝ} {s0 g : ℝ}
          (hX : ∀ s, AEMeasurable (X s) P)
          (hφ : ∀ s, AEStronglyMeasurable φ (Measure.map (X s) P))
          (hderiv : HasDerivAt (fun s => ∫ ω, φ (X s ω) ∂P) g s0) :
          HasDerivAt (fun s => ∫ x, φ x ∂Measure.map (X s) P) g s0 := by
        have hfun :
            (fun s => ∫ x, φ x ∂Measure.map (X s) P) =
              (fun s => ∫ ω, φ (X s ω) ∂P) := by
          funext s
          exact lawMapIntegral (hX s) (hφ s)
        simpa [hfun] using hderiv

      Exact module and namespace context

      Scope and omitted-condition boundaries
      • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
      • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
      • The derivative is an explicit premise; no generator, process, weak PDE or new differentiability result is inferred.
      Sources, dependencies, and reuse

      Source and reuse

      Samplinglib parents called

      Mathlib API called (external library)

      No direct Mathlib call recorded; see the Samplinglib parents.

      Mathematical sources

      Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

      Samplinglib mathematical lesson

      Transfer the derivative to a separately named law path

      AutoSamplingTheory.lawIntegralHasDerivAtOfMeasureMapEqAndSample · theorem · Teaching coverage

      Read this first

      Mathematical statement

      Let ρ:ℝ→Measure E be a named path of measures with ρ_s=(X_s)#P for every s. Assume X_s is P-a.e. measurable, φ is ρ_s-a.e. strongly measurable at every time, and the sample integral has derivative g at s₀. Then the integral of φ under ρ_s also has derivative g at s₀.

      \[\rho_s=(X_s)_\#P\ (\forall s),\quad \left.\frac d{ds}\int\varphi(X_s)\,dP\right|_{s_0}=g \ \Longrightarrow\ \left.\frac d{ds}\int\varphi\,d\rho_s\right|_{s_0}=g.\]
      Lean statement · lawIntegralHasDerivAtOfMeasureMapEqAndSample

      ρ is an additional named object, and its equality with the image measure is a supplied assumption rather than a definition inferred from its name.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      theorem lawIntegralHasDerivAtOfMeasureMapEqAndSample {Ω E : Type*}
          [MeasurableSpace Ω] [MeasurableSpace E]
          {P : Measure Ω} {X : ℝ → Ω → E} {ρ : ℝ → Measure E}
          {φ : E → ℝ} {s0 g : ℝ}
          (hρ : ∀ s, ρ s = Measure.map (X s) P)
          (hX : ∀ s, AEMeasurable (X s) P)
          (hφ : ∀ s, AEStronglyMeasurable φ (ρ s))
          (hderiv : HasDerivAt (fun s => ∫ ω, φ (X s ω) ∂P) g s0) :
          HasDerivAt (fun s => ∫ x, φ x ∂ρ s) g s0

      Exact module and namespace context

      Proof roadmap

      1. 1Move measurability to the mapped measure

        Substitute ρ_s=(X_s)#P in the test's measurability assumption.

      2. 2Reuse the mapped-law derivative adapter

        With these exact measurability assumptions and the supplied derivative, obtain the derivative for the pushforward-law integral.

      3. 3Replace the pushforward path by its name

        The named-law equality gives equality of the two law-integral functions at every time, so the derivative transfers once more.

      Full assumptions and notation

      All objects and hypotheses

      • Ω and E are arbitrary measurable spaces; P is any measure on Ω, with no finiteness or probability hypothesis.
      • X:ℝ→Ω→E, ρ:ℝ→Measure E, φ:E→ℝ, s₀,g∈ℝ.
      • For every s, ρ_s=(X_s)#P, X_s is P-a.e. measurable, and φ is ρ_s-a.e. strongly measurable.
      • The sample-space integral function has derivative g at s₀.

      Notation and interpretation

      Pushforward law

      P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

      \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
      A.e. and strong measurability

      A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

      \[f=g\quad\mu\text{-a.e.}\]
      Integrability and Bochner integrals

      L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

      \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
      Derivatives

      Derivative premises are never silently promoted to derived path regularity. The dominated differentiation units explicitly distinguish eventually-near-time assumptions from a.e.-sample, all-times-in-one-neighborhood assumptions.

      \[\operatorname{HasDerivAt}(F,g,s_0)\ \Longrightarrow\ F\text{ is differentiable at }s_0\text{ and }F'(s_0)=g.\]

      Mathematical proof

      1. Move measurability to the mapped measure

      Substitute ρ_s=(X_s)#P in the test's measurability assumption.

      \[\varphi\text{ is }\rho_s\text{-a.e. strongly measurable}\Longrightarrow\varphi\text{ is }(X_s)_\#P\text{-a.e. strongly measurable}.\]
      Corresponding Lean step

      hφMap; simpa [hρ s] using hφ s

      2. Reuse the mapped-law derivative adapter

      With these exact measurability assumptions and the supplied derivative, obtain the derivative for the pushforward-law integral.

      \[\left(\int\varphi\,d((X_s)_\#P)\right)'_{s_0}=g.\]
      Corresponding Lean step

      lawMapIntegralHasDerivAtOfSample hX hφMap hderiv

      3. Replace the pushforward path by its name

      The named-law equality gives equality of the two law-integral functions at every time, so the derivative transfers once more.

      \[\int\varphi\,d\rho_s=\int\varphi\,d((X_s)_\#P)\quad\forall s.\]
      Corresponding Lean step

      hfun; funext; rw [hρ s]; simpa [hfun] using hmap

      Lean verification

      The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

      Lean proof · lawIntegralHasDerivAtOfMeasureMapEqAndSample

      Both changes are equalities of functions or measures; the middle line reuses the previously proved derivative adapter. No new differentiation argument occurs.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      Download module (.lean)
      theorem lawIntegralHasDerivAtOfMeasureMapEqAndSample {Ω E : Type*}
          [MeasurableSpace Ω] [MeasurableSpace E]
          {P : Measure Ω} {X : ℝ → Ω → E} {ρ : ℝ → Measure E}
          {φ : E → ℝ} {s0 g : ℝ}
          (hρ : ∀ s, ρ s = Measure.map (X s) P)
          (hX : ∀ s, AEMeasurable (X s) P)
          (hφ : ∀ s, AEStronglyMeasurable φ (ρ s))
          (hderiv : HasDerivAt (fun s => ∫ ω, φ (X s ω) ∂P) g s0) :
          HasDerivAt (fun s => ∫ x, φ x ∂ρ s) g s0 := by
        have hφMap :
            ∀ s, AEStronglyMeasurable φ (Measure.map (X s) P) := by
          intro s
          simpa [hρ s] using hφ s
        have hmap :
            HasDerivAt
              (fun s => ∫ x, φ x ∂Measure.map (X s) P) g s0 :=
          lawMapIntegralHasDerivAtOfSample
            (P := P) (X := X) (φ := φ) hX hφMap hderiv
        have hfun :
            (fun s => ∫ x, φ x ∂ρ s) =
              fun s => ∫ x, φ x ∂Measure.map (X s) P := by
          funext s
          rw [hρ s]
        simpa [hfun] using hmap

      Exact module and namespace context

      Scope and omitted-condition boundaries
      • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
      • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
      • Named-law reuse wrapper; all analytic derivative hypotheses remain external.
      Sources, dependencies, and reuse

      Source and reuse

      Samplinglib parents called

      Mathlib API called (external library)

      No direct Mathlib call recorded; see the Samplinglib parents.

      Mathematical sources

      Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

      Samplinglib mathematical lesson

      A dominated pathwise derivative yields a weak derivative of the law

      AutoSamplingTheory.lawMapIntegralHasDerivAtOfDominated · theorem · Teaching coverage

      Read this first

      Mathematical statement

      On arbitrary measurable Ω and E with measure P, suppose the full neighborhood, measurability, integrability, pathwise differentiability and integrable domination conditions listed below hold. If the integral of the sample derivative at s₀ equals g, the test integral under the pushforward law s↦(X_s)#P has derivative g at s₀.

      \[\left|\partial_s\varphi(X_s(\omega))\right|\le b(\omega),\ b\in L^1(P) \quad\Longrightarrow\quad \left.\frac d{ds}\int\varphi\,d((X_s)_\#P)\right|_{s_0} =\int D(s_0,\omega)\,dP(\omega)=g.\]
      Lean statement · lawMapIntegralHasDerivAtOfDominated

      There are two local quantifiers: eventually in time for measurability, and almost every sample followed by every time in U for differentiation and domination. They cannot be interchanged silently.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      theorem lawMapIntegralHasDerivAtOfDominated {Ω E : Type*}
          [MeasurableSpace Ω] [MeasurableSpace E]
          {P : Measure Ω} {X : ℝ → Ω → E} {φ : E → ℝ} {s0 g : ℝ}
          {sampleDeriv : ℝ → Ω → ℝ} {neighborhood : Set ℝ}
          {bound : Ω → ℝ}
          (hX : ∀ s, AEMeasurable (X s) P)
          (hφ : ∀ s, AEStronglyMeasurable φ (Measure.map (X s) P))
          (hneighborhood : neighborhood ∈ 𝓝 s0)
          (hFMeas :
            ∀ᶠ s in 𝓝 s0, AEStronglyMeasurable (fun ω => φ (X s ω)) P)
          (hFInt : Integrable (fun ω => φ (X s0 ω)) P)
          (hDerivMeas : AEStronglyMeasurable (sampleDeriv s0) P)
          (hDerivBound :
            ∀ᵐ ω ∂P, ∀ s ∈ neighborhood, ‖sampleDeriv s ω‖ ≤ bound ω)
          (hBoundInt : Integrable bound P)
          (hPathDeriv :
            ∀ᵐ ω ∂P, ∀ s ∈ neighborhood,
              HasDerivAt (fun t => φ (X t ω)) (sampleDeriv s ω) s)
          (hDerivValue : (∫ ω, sampleDeriv s0 ω ∂P) = g) :
          HasDerivAt (fun s => ∫ x, φ x ∂Measure.map (X s) P) g s0

      Exact module and namespace context

      Proof roadmap

      1. 1Fix the sample integrand and its derivative data

        Set F(s,ω)=φ(X_sω) and F′(s,ω)=D(s,ω). The same neighborhood U works outside one P-null set for the derivative and the domination hypotheses; this uniform quantifier order is essential.

      2. 2Apply differentiation under the integral

        Mathlib's dominated local derivative theorem uses the neighborhood and integrable bound to justify the sample-space derivative. It returns integrability of the derivative at s₀ and the derivative identity; this proof selects the identity component.

      3. 3Identify the derivative value

        Replace the integral of D(s₀,·) by the supplied real number g.

      4. 4Transport to the pushforward-law integral

        Reuse equality of test integrals under the image law and on the sample space, with the all-time measurability assumptions.

      Full assumptions and notation

      All objects and hypotheses

      • Ω and E are arbitrary measurable spaces; P is any measure on Ω, with no finiteness or probability hypothesis.
      • X:ℝ→Ω→E, φ:E→ℝ, s₀,g∈ℝ; D:ℝ→Ω→ℝ is the supplied sampleDeriv; U⊆ℝ is the supplied neighborhood; b:Ω→ℝ is the bound.
      • For every s, X_s is P-a.e. measurable and φ is a.e. strongly measurable under its designated law.
      • U belongs to the neighborhood filter of s₀. For all s sufficiently near s₀, ω↦φ(X_sω) is P-a.e. strongly measurable.
      • ω↦φ(X_{s₀}ω) is P-integrable, and D(s₀,·) is P-a.e. strongly measurable.
      • For P-almost every ω, simultaneously for every s∈U, |D(s,ω)|≤b(ω); b is P-integrable.
      • For P-almost every ω, simultaneously for every s∈U, t↦φ(X_tω) has derivative D(s,ω) at s.
      • The integral ∫D(s₀,ω)dP(ω) is supplied to equal g.

      Notation and interpretation

      Pushforward law

      P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

      \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
      A.e. and strong measurability

      A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

      \[f=g\quad\mu\text{-a.e.}\]
      Integrability and Bochner integrals

      L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

      \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
      Derivatives

      Derivative premises are never silently promoted to derived path regularity. The dominated differentiation units explicitly distinguish eventually-near-time assumptions from a.e.-sample, all-times-in-one-neighborhood assumptions.

      \[\operatorname{HasDerivAt}(F,g,s_0)\ \Longrightarrow\ F\text{ is differentiable at }s_0\text{ and }F'(s_0)=g.\]

      Mathematical proof

      1. Fix the sample integrand and its derivative data

      Set F(s,ω)=φ(X_sω) and F′(s,ω)=D(s,ω). The same neighborhood U works outside one P-null set for the derivative and the domination hypotheses; this uniform quantifier order is essential.

      \[F(s,\omega)=\varphi(X_s\omega),\quad\partial_sF(s,\omega)=D(s,\omega),\quad |D(s,\omega)|\le b(\omega)\ (s\in U).\]
      Corresponding Lean step

      F := fun s ω => φ (X s ω); F' := sampleDeriv; neighborhood and bound arguments

      2. Apply differentiation under the integral

      Mathlib's dominated local derivative theorem uses the neighborhood and integrable bound to justify the sample-space derivative. It returns integrability of the derivative at s₀ and the derivative identity; this proof selects the identity component.

      \[\left.\frac d{ds}\int F(s,\omega)\,dP\right|_{s_0}=\int D(s_0,\omega)\,dP.\]
      Corresponding Lean step

      (hasDerivAt_integral_of_dominated_loc_of_deriv_le ... hPathDeriv).2

      3. Identify the derivative value

      Replace the integral of D(s₀,·) by the supplied real number g.

      \[\int D(s_0,\omega)\,dP=g.\]
      Corresponding Lean step

      rw [hDerivValue] at hsample

      4. Transport to the pushforward-law integral

      Reuse equality of test integrals under the image law and on the sample space, with the all-time measurability assumptions.

      \[\left.\frac d{ds}\int\varphi\,d((X_s)_\#P)\right|_{s_0}=g.\]
      Corresponding Lean step

      lawMapIntegralHasDerivAtOfSample hX hφ hsample

      Lean verification

      The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

      Lean proof · lawMapIntegralHasDerivAtOfDominated

      The substantive analytic input is the imported dominated-differentiation theorem. The remaining lines identify its derivative value and reuse the law-map rewrite.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      Download module (.lean)
      theorem lawMapIntegralHasDerivAtOfDominated {Ω E : Type*}
          [MeasurableSpace Ω] [MeasurableSpace E]
          {P : Measure Ω} {X : ℝ → Ω → E} {φ : E → ℝ} {s0 g : ℝ}
          {sampleDeriv : ℝ → Ω → ℝ} {neighborhood : Set ℝ}
          {bound : Ω → ℝ}
          (hX : ∀ s, AEMeasurable (X s) P)
          (hφ : ∀ s, AEStronglyMeasurable φ (Measure.map (X s) P))
          (hneighborhood : neighborhood ∈ 𝓝 s0)
          (hFMeas :
            ∀ᶠ s in 𝓝 s0, AEStronglyMeasurable (fun ω => φ (X s ω)) P)
          (hFInt : Integrable (fun ω => φ (X s0 ω)) P)
          (hDerivMeas : AEStronglyMeasurable (sampleDeriv s0) P)
          (hDerivBound :
            ∀ᵐ ω ∂P, ∀ s ∈ neighborhood, ‖sampleDeriv s ω‖ ≤ bound ω)
          (hBoundInt : Integrable bound P)
          (hPathDeriv :
            ∀ᵐ ω ∂P, ∀ s ∈ neighborhood,
              HasDerivAt (fun t => φ (X t ω)) (sampleDeriv s ω) s)
          (hDerivValue : (∫ ω, sampleDeriv s0 ω ∂P) = g) :
          HasDerivAt (fun s => ∫ x, φ x ∂Measure.map (X s) P) g s0 := by
        have hsample :
            HasDerivAt (fun s => ∫ ω, φ (X s ω) ∂P)
              (∫ ω, sampleDeriv s0 ω ∂P) s0 :=
          (hasDerivAt_integral_of_dominated_loc_of_deriv_le
            (F := fun s ω => φ (X s ω))
            (F' := sampleDeriv)
            (x₀ := s0)
            (s := neighborhood)
            (bound := bound)
            (μ := P)
            hneighborhood hFMeas hFInt hDerivMeas hDerivBound hBoundInt
            hPathDeriv).2
        rw [hDerivValue] at hsample
        exact lawMapIntegralHasDerivAtOfSample (P := P) (X := X) (φ := φ) hX hφ hsample

      Exact module and namespace context

      Scope and omitted-condition boundaries
      • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
      • No finite measure is required, but the bound and base integrand must be integrable. No source-specific path derivative, drift formula, generator or PDE is proved here.
      Sources, dependencies, and reuse

      Source and reuse

      Samplinglib parents called

      Mathlib API called (external library)

      • hasDerivAt_integral_of_dominated_loc_of_deriv_le

      Mathematical sources

      Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

      Samplinglib mathematical lesson

      A dominated derivative for a named law path

      AutoSamplingTheory.lawIntegralHasDerivAtOfMeasureMapEqAndDominated · theorem · Teaching coverage

      Read this first

      Mathematical statement

      Let ρ_s=(X_s)#P at every real s. With φ a.e. strongly measurable under ρ_s and all the dominated sample-derivative hypotheses below, including ∫D(s₀,ω)dP=g, the named weak integral s↦∫φdρ_s has derivative g at s₀.

      \[\rho_s=(X_s)_\#P,\qquad \left.\frac d{ds}\int\varphi\,d\rho_s\right|_{s_0}=\int D(s_0,\omega)\,dP=g.\]
      Lean statement · lawIntegralHasDerivAtOfMeasureMapEqAndDominated

      The extra path ρ changes the name of the law, not the analytic assumptions. Every dominated-differentiation condition is still explicitly required.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      theorem lawIntegralHasDerivAtOfMeasureMapEqAndDominated {Ω E : Type*}
          [MeasurableSpace Ω] [MeasurableSpace E]
          {P : Measure Ω} {X : ℝ → Ω → E} {ρ : ℝ → Measure E}
          {φ : E → ℝ} {s0 g : ℝ}
          {sampleDeriv : ℝ → Ω → ℝ} {neighborhood : Set ℝ}
          {bound : Ω → ℝ}
          (hρ : ∀ s, ρ s = Measure.map (X s) P)
          (hX : ∀ s, AEMeasurable (X s) P)
          (hφ : ∀ s, AEStronglyMeasurable φ (ρ s))
          (hneighborhood : neighborhood ∈ 𝓝 s0)
          (hFMeas :
            ∀ᶠ s in 𝓝 s0, AEStronglyMeasurable (fun ω => φ (X s ω)) P)
          (hFInt : Integrable (fun ω => φ (X s0 ω)) P)
          (hDerivMeas : AEStronglyMeasurable (sampleDeriv s0) P)
          (hDerivBound :
            ∀ᵐ ω ∂P, ∀ s ∈ neighborhood, ‖sampleDeriv s ω‖ ≤ bound ω)
          (hBoundInt : Integrable bound P)
          (hPathDeriv :
            ∀ᵐ ω ∂P, ∀ s ∈ neighborhood,
              HasDerivAt (fun t => φ (X t ω)) (sampleDeriv s ω) s)
          (hDerivValue : (∫ ω, sampleDeriv s0 ω ∂P) = g) :
          HasDerivAt (fun s => ∫ x, φ x ∂ρ s) g s0

      Exact module and namespace context

      Proof roadmap

      1. 1Rewrite the test's measurability measure

        The equality of named and image laws makes the all-time test measurability hypothesis match the dominated mapped-law theorem.

      2. 2Reuse dominated law differentiation

        Pass the complete neighborhood, base-integrability, derivative-measurability, uniform bound, path-derivative and derivative-value data to the established mapped-law theorem.

      3. 3Restore the named path

        Equality at every time identifies the real integral functions, hence transfers the derivative.

      Full assumptions and notation

      All objects and hypotheses

      • Ω and E are arbitrary measurable spaces; P is any measure on Ω, with no finiteness or probability hypothesis.
      • ρ:ℝ→Measure E satisfies ρ_s=(X_s)#P for every s; the designated law for φ's measurability is ρ_s.
      • X:ℝ→Ω→E, φ:E→ℝ, s₀,g∈ℝ; D:ℝ→Ω→ℝ is the supplied sampleDeriv; U⊆ℝ is the supplied neighborhood; b:Ω→ℝ is the bound.
      • For every s, X_s is P-a.e. measurable and φ is a.e. strongly measurable under its designated law.
      • U belongs to the neighborhood filter of s₀. For all s sufficiently near s₀, ω↦φ(X_sω) is P-a.e. strongly measurable.
      • ω↦φ(X_{s₀}ω) is P-integrable, and D(s₀,·) is P-a.e. strongly measurable.
      • For P-almost every ω, simultaneously for every s∈U, |D(s,ω)|≤b(ω); b is P-integrable.
      • For P-almost every ω, simultaneously for every s∈U, t↦φ(X_tω) has derivative D(s,ω) at s.
      • The integral ∫D(s₀,ω)dP(ω) is supplied to equal g.

      Notation and interpretation

      Pushforward law

      P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

      \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
      A.e. and strong measurability

      A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

      \[f=g\quad\mu\text{-a.e.}\]
      Integrability and Bochner integrals

      L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

      \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
      Derivatives

      Derivative premises are never silently promoted to derived path regularity. The dominated differentiation units explicitly distinguish eventually-near-time assumptions from a.e.-sample, all-times-in-one-neighborhood assumptions.

      \[\operatorname{HasDerivAt}(F,g,s_0)\ \Longrightarrow\ F\text{ is differentiable at }s_0\text{ and }F'(s_0)=g.\]

      Mathematical proof

      1. Rewrite the test's measurability measure

      The equality of named and image laws makes the all-time test measurability hypothesis match the dominated mapped-law theorem.

      \[\rho_s=(X_s)_\#P\ \Longrightarrow\ \varphi\text{ is a.e. strongly measurable under }(X_s)_\#P.\]
      Corresponding Lean step

      hφMap

      2. Reuse dominated law differentiation

      Pass the complete neighborhood, base-integrability, derivative-measurability, uniform bound, path-derivative and derivative-value data to the established mapped-law theorem.

      \[\left.\frac d{ds}\int\varphi\,d((X_s)_\#P)\right|_{s_0}=g.\]
      Corresponding Lean step

      lawMapIntegralHasDerivAtOfDominated hX hφMap ...

      3. Restore the named path

      Equality at every time identifies the real integral functions, hence transfers the derivative.

      \[\left(s\mapsto\int\varphi\,d\rho_s\right)=\left(s\mapsto\int\varphi\,d((X_s)_\#P)\right).\]
      Corresponding Lean step

      hfun; simpa [hfun] using hmap

      Lean verification

      The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

      Lean proof · lawIntegralHasDerivAtOfMeasureMapEqAndDominated

      The proof is a named-law reuse wrapper around the dominated derivative theorem; it rewrites the measure in measurability and in the final integral function.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      Download module (.lean)
      theorem lawIntegralHasDerivAtOfMeasureMapEqAndDominated {Ω E : Type*}
          [MeasurableSpace Ω] [MeasurableSpace E]
          {P : Measure Ω} {X : ℝ → Ω → E} {ρ : ℝ → Measure E}
          {φ : E → ℝ} {s0 g : ℝ}
          {sampleDeriv : ℝ → Ω → ℝ} {neighborhood : Set ℝ}
          {bound : Ω → ℝ}
          (hρ : ∀ s, ρ s = Measure.map (X s) P)
          (hX : ∀ s, AEMeasurable (X s) P)
          (hφ : ∀ s, AEStronglyMeasurable φ (ρ s))
          (hneighborhood : neighborhood ∈ 𝓝 s0)
          (hFMeas :
            ∀ᶠ s in 𝓝 s0, AEStronglyMeasurable (fun ω => φ (X s ω)) P)
          (hFInt : Integrable (fun ω => φ (X s0 ω)) P)
          (hDerivMeas : AEStronglyMeasurable (sampleDeriv s0) P)
          (hDerivBound :
            ∀ᵐ ω ∂P, ∀ s ∈ neighborhood, ‖sampleDeriv s ω‖ ≤ bound ω)
          (hBoundInt : Integrable bound P)
          (hPathDeriv :
            ∀ᵐ ω ∂P, ∀ s ∈ neighborhood,
              HasDerivAt (fun t => φ (X t ω)) (sampleDeriv s ω) s)
          (hDerivValue : (∫ ω, sampleDeriv s0 ω ∂P) = g) :
          HasDerivAt (fun s => ∫ x, φ x ∂ρ s) g s0 := by
        have hφMap :
            ∀ s, AEStronglyMeasurable φ (Measure.map (X s) P) := by
          intro s
          simpa [hρ s] using hφ s
        have hmap :
            HasDerivAt
              (fun s => ∫ x, φ x ∂Measure.map (X s) P) g s0 :=
          lawMapIntegralHasDerivAtOfDominated
            (P := P) (X := X) (φ := φ) (sampleDeriv := sampleDeriv)
            (neighborhood := neighborhood) (bound := bound)
            hX hφMap hneighborhood hFMeas hFInt hDerivMeas hDerivBound
            hBoundInt hPathDeriv hDerivValue
        have hfun :
            (fun s => ∫ x, φ x ∂ρ s) =
              fun s => ∫ x, φ x ∂Measure.map (X s) P := by
          funext s
          rw [hρ s]
        simpa [hfun] using hmap

      Exact module and namespace context

      Scope and omitted-condition boundaries
      • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
      • The uniform a.e.-sample/for-all-time hypotheses and integrable domination are not derived. No new weak PDE is asserted.
      Sources, dependencies, and reuse

      Source and reuse

      Samplinglib parents called

      Mathlib API called (external library)

      No direct Mathlib call recorded; see the Samplinglib parents.

      Mathematical sources

      Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

      Samplinglib mathematical lesson

      Componentwise a.e. equality preserves the joint image law

      AutoSamplingTheory.lawMapProdEqOfAEEq · theorem · Teaching coverage

      Read this first

      Mathematical statement

      Let Ω,E,F be measurable spaces, P any measure, X,X′:Ω→E and Y,Y′:Ω→F any functions. If X=X′ P-a.e. and Y=Y′ P-a.e., then the image measures of the paired variables (X,Y) and (X′,Y′) are equal. No separate measurability is assumed.

      \[X=X'\ P\text{-a.e.},\quad Y=Y'\ P\text{-a.e.}\ \Longrightarrow\ (X,Y)_\#P=(X',Y')_\#P.\]
      Lean statement · lawMapProdEqOfAEEq

      There are two a.e. equalities but only one underlying measure. This permits combining them into a joint equality on the same sample space.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      theorem lawMapProdEqOfAEEq {Ω E F : Type*} [MeasurableSpace Ω]
          [MeasurableSpace E] [MeasurableSpace F]
          {P : Measure Ω} {X X' : Ω → E} {Y Y' : Ω → F}
          (hX : X =ᵐ[P] X') (hY : Y =ᵐ[P] Y') :
          Measure.map (fun ω => (X ω, Y ω)) P =
            Measure.map (fun ω => (X' ω, Y' ω)) P

      Exact module and namespace context

      Proof roadmap

      1. 1Combine the two full-measure sets

        A finite intersection of a.e. events is again a.e.; outside the union of the two exceptional null sets, both coordinate equalities hold.

      2. 2Apply map congruence

        Pushforwards do not change under a.e.-equal maps, so the paired image measures agree.

      Full assumptions and notation

      All objects and hypotheses

      • Ω,E,F are measurable spaces; P is any measure on Ω.
      • X,X′:Ω→E and Y,Y′:Ω→F; the two component equalities hold P-almost everywhere.

      Notation and interpretation

      Pushforward law

      P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

      \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
      A.e. and strong measurability

      A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

      \[f=g\quad\mu\text{-a.e.}\]

      Mathematical proof

      1. Combine the two full-measure sets

      A finite intersection of a.e. events is again a.e.; outside the union of the two exceptional null sets, both coordinate equalities hold.

      \[(X(\omega),Y(\omega))=(X'(\omega),Y'(\omega))\quad P\text{-a.e.}\]
      Corresponding Lean step

      filter_upwards [hX,hY]; simp [hx,hy]

      2. Apply map congruence

      Pushforwards do not change under a.e.-equal maps, so the paired image measures agree.

      \[(X,Y)_\#P=(X',Y')_\#P.\]
      Corresponding Lean step

      Measure.map_congr

      Lean verification

      The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

      Lean proof · lawMapProdEqOfAEEq

      The proof establishes equality of ordered pairs on a full-measure set, then reuses pushforward congruence. It does not posit independence of the coordinates.

      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

      Download module (.lean)
      theorem lawMapProdEqOfAEEq {Ω E F : Type*} [MeasurableSpace Ω]
          [MeasurableSpace E] [MeasurableSpace F]
          {P : Measure Ω} {X X' : Ω → E} {Y Y' : Ω → F}
          (hX : X =ᵐ[P] X') (hY : Y =ᵐ[P] Y') :
          Measure.map (fun ω => (X ω, Y ω)) P =
            Measure.map (fun ω => (X' ω, Y' ω)) P := by
        exact Measure.map_congr <| by
          filter_upwards [hX, hY] with ω hx hy
          simp [hx, hy]

      Exact module and namespace context

      Scope and omitted-condition boundaries
      • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
      • As in map_congr, totalized map semantics apply without measurability. No conditional law or coupling construction is supplied.
      Sources, dependencies, and reuse

      Source and reuse

      Samplinglib parents called

        Mathlib API called (external library)

        • MeasureTheory.Measure.map_congr

        Mathematical sources

        Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

        Samplinglib mathematical lesson

        Extract the first marginal of a joint image law

        AutoSamplingTheory.lawMapProdFst · theorem · Teaching coverage

        Read this first

        Mathematical statement

        Let Ω,E,F be measurable spaces and P any measure on Ω. For measurable X:Ω→E and Y:Ω→F, pushing the joint law (X,Y)#P through its first projection gives X#P.

        \[\operatorname{fst}_\#((X,Y)_\#P)=X_\#P.\]
        Lean statement · lawMapProdFst

        The two ordinary measurability hypotheses ensure this is genuine pushforward composition. The result identifies a measure, not a density.

        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

        theorem lawMapProdFst {Ω E F : Type*} [MeasurableSpace Ω]
            [MeasurableSpace E] [MeasurableSpace F]
            {P : Measure Ω} {X : Ω → E} {Y : Ω → F}
            (hX : Measurable X) (hY : Measurable Y) :
            Measure.map Prod.fst (Measure.map (fun ω => (X ω, Y ω)) P) =
              Measure.map X P

        Exact module and namespace context

        Proof roadmap

        1. 1Compose the measurable maps

          The pair map is measurable because both coordinates are. The projection or swap is measurable for product sigma-algebras, so consecutive pushforwards compose.

        2. 2Evaluate the composite

          The selected projection or swap of a pair gives precisely the displayed target map, pointwise on Ω.

        Full assumptions and notation

        All objects and hypotheses

        • Ω,E,F are arbitrary measurable spaces and P is any measure on Ω.
        • X:Ω→E and Y:Ω→F are both measurable, not merely assumed equal in law.

        Notation and interpretation

        Pushforward law

        P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

        \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]

        Mathematical proof

        1. Compose the measurable maps

        The pair map is measurable because both coordinates are. The projection or swap is measurable for product sigma-algebras, so consecutive pushforwards compose.

        \[T_\#((X,Y)_\#P)=(T\circ(X,Y))_\#P.\]
        Corresponding Lean step

        Measure.map_map measurable_fst (hX.prod hY)

        2. Evaluate the composite

        The selected projection or swap of a pair gives precisely the displayed target map, pointwise on Ω.

        \[\operatorname{fst}(X\omega,Y\omega)=X\omega.\]
        Corresponding Lean step

        rfl

        Lean verification

        The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

        Lean proof · lawMapProdFst

        One rewrite composes the maps; the remaining equality follows directly from how a pair's projection or swap is defined.

        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

        Download module (.lean)
        theorem lawMapProdFst {Ω E F : Type*} [MeasurableSpace Ω]
            [MeasurableSpace E] [MeasurableSpace F]
            {P : Measure Ω} {X : Ω → E} {Y : Ω → F}
            (hX : Measurable X) (hY : Measurable Y) :
            Measure.map Prod.fst (Measure.map (fun ω => (X ω, Y ω)) P) =
              Measure.map X P := by
          rw [Measure.map_map measurable_fst (hX.prod hY)]
          rfl

        Exact module and namespace context

        Scope and omitted-condition boundaries
        • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
        • Only orientation/marginal bookkeeping; no independence, conditional kernel, process or density construction.
        Sources, dependencies, and reuse

        Source and reuse

        Samplinglib parents called

          Mathlib API called (external library)

          • MeasureTheory.Measure.map_map
          • measurable_fst
          • Measurable.prod

          Mathematical sources

          Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

          Samplinglib mathematical lesson

          Extract the second marginal of a joint image law

          AutoSamplingTheory.lawMapProdSnd · theorem · Teaching coverage

          Read this first

          Mathematical statement

          Let Ω,E,F be measurable spaces and P any measure on Ω. For measurable X:Ω→E and Y:Ω→F, pushing the joint law (X,Y)#P through its second projection gives Y#P.

          \[\operatorname{snd}_\#((X,Y)_\#P)=Y_\#P.\]
          Lean statement · lawMapProdSnd

          The two ordinary measurability hypotheses ensure this is genuine pushforward composition. The result identifies a measure, not a density.

          Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

          theorem lawMapProdSnd {Ω E F : Type*} [MeasurableSpace Ω]
              [MeasurableSpace E] [MeasurableSpace F]
              {P : Measure Ω} {X : Ω → E} {Y : Ω → F}
              (hX : Measurable X) (hY : Measurable Y) :
              Measure.map Prod.snd (Measure.map (fun ω => (X ω, Y ω)) P) =
                Measure.map Y P

          Exact module and namespace context

          Proof roadmap

          1. 1Compose the measurable maps

            The pair map is measurable because both coordinates are. The projection or swap is measurable for product sigma-algebras, so consecutive pushforwards compose.

          2. 2Evaluate the composite

            The selected projection or swap of a pair gives precisely the displayed target map, pointwise on Ω.

          Full assumptions and notation

          All objects and hypotheses

          • Ω,E,F are arbitrary measurable spaces and P is any measure on Ω.
          • X:Ω→E and Y:Ω→F are both measurable, not merely assumed equal in law.

          Notation and interpretation

          Pushforward law

          P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

          \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]

          Mathematical proof

          1. Compose the measurable maps

          The pair map is measurable because both coordinates are. The projection or swap is measurable for product sigma-algebras, so consecutive pushforwards compose.

          \[T_\#((X,Y)_\#P)=(T\circ(X,Y))_\#P.\]
          Corresponding Lean step

          Measure.map_map measurable_snd (hX.prod hY)

          2. Evaluate the composite

          The selected projection or swap of a pair gives precisely the displayed target map, pointwise on Ω.

          \[\operatorname{snd}(X\omega,Y\omega)=Y\omega.\]
          Corresponding Lean step

          rfl

          Lean verification

          The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

          Lean proof · lawMapProdSnd

          One rewrite composes the maps; the remaining equality follows directly from how a pair's projection or swap is defined.

          Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

          Download module (.lean)
          theorem lawMapProdSnd {Ω E F : Type*} [MeasurableSpace Ω]
              [MeasurableSpace E] [MeasurableSpace F]
              {P : Measure Ω} {X : Ω → E} {Y : Ω → F}
              (hX : Measurable X) (hY : Measurable Y) :
              Measure.map Prod.snd (Measure.map (fun ω => (X ω, Y ω)) P) =
                Measure.map Y P := by
            rw [Measure.map_map measurable_snd (hX.prod hY)]
            rfl

          Exact module and namespace context

          Scope and omitted-condition boundaries
          • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
          • Only orientation/marginal bookkeeping; no independence, conditional kernel, process or density construction.
          Sources, dependencies, and reuse

          Source and reuse

          Samplinglib parents called

            Mathlib API called (external library)

            • MeasureTheory.Measure.map_map
            • measurable_snd
            • Measurable.prod

            Mathematical sources

            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

            Samplinglib mathematical lesson

            Swap the coordinate order of a joint image law

            AutoSamplingTheory.lawMapProdSwap · theorem · Teaching coverage

            Read this first

            Mathematical statement

            Let Ω,E,F be measurable spaces and P any measure on Ω. For measurable X:Ω→E and Y:Ω→F, pushing the joint law (X,Y)#P through coordinate swap gives the joint law (Y,X)#P.

            \[\operatorname{swap}_\#((X,Y)_\#P)=(Y,X)_\#P.\]
            Lean statement · lawMapProdSwap

            The two ordinary measurability hypotheses ensure this is genuine pushforward composition. The result identifies a measure, not a density.

            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

            theorem lawMapProdSwap {Ω E F : Type*} [MeasurableSpace Ω]
                [MeasurableSpace E] [MeasurableSpace F]
                {P : Measure Ω} {X : Ω → E} {Y : Ω → F}
                (hX : Measurable X) (hY : Measurable Y) :
                Measure.map Prod.swap (Measure.map (fun ω => (X ω, Y ω)) P) =
                  Measure.map (fun ω => (Y ω, X ω)) P

            Exact module and namespace context

            Proof roadmap

            1. 1Compose the measurable maps

              The pair map is measurable because both coordinates are. The projection or swap is measurable for product sigma-algebras, so consecutive pushforwards compose.

            2. 2Evaluate the composite

              The selected projection or swap of a pair gives precisely the displayed target map, pointwise on Ω.

            Full assumptions and notation

            All objects and hypotheses

            • Ω,E,F are arbitrary measurable spaces and P is any measure on Ω.
            • X:Ω→E and Y:Ω→F are both measurable, not merely assumed equal in law.

            Notation and interpretation

            Pushforward law

            P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

            \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]

            Mathematical proof

            1. Compose the measurable maps

            The pair map is measurable because both coordinates are. The projection or swap is measurable for product sigma-algebras, so consecutive pushforwards compose.

            \[T_\#((X,Y)_\#P)=(T\circ(X,Y))_\#P.\]
            Corresponding Lean step

            Measure.map_map measurable_swap (hX.prod hY)

            2. Evaluate the composite

            The selected projection or swap of a pair gives precisely the displayed target map, pointwise on Ω.

            \[\operatorname{swap}(X\omega,Y\omega)=(Y\omega,X\omega).\]
            Corresponding Lean step

            rfl

            Lean verification

            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

            Lean proof · lawMapProdSwap

            One rewrite composes the maps; the remaining equality follows directly from how a pair's projection or swap is defined.

            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

            Download module (.lean)
            theorem lawMapProdSwap {Ω E F : Type*} [MeasurableSpace Ω]
                [MeasurableSpace E] [MeasurableSpace F]
                {P : Measure Ω} {X : Ω → E} {Y : Ω → F}
                (hX : Measurable X) (hY : Measurable Y) :
                Measure.map Prod.swap (Measure.map (fun ω => (X ω, Y ω)) P) =
                  Measure.map (fun ω => (Y ω, X ω)) P := by
              rw [Measure.map_map measurable_swap (hX.prod hY)]
              rfl

            Exact module and namespace context

            Scope and omitted-condition boundaries
            • P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately.
            • Only orientation/marginal bookkeeping; no independence, conditional kernel, process or density construction.
            Sources, dependencies, and reuse

            Source and reuse

            Samplinglib parents called

              Mathlib API called (external library)

              • MeasureTheory.Measure.map_map
              • measurable_swap
              • Measurable.prod

              Mathematical sources

              Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

              Samplinglib mathematical lesson

              Match the conditional distribution and mapped conditional-expectation kernel

              AutoSamplingTheory.condDistribAeEqCondExpKernelMap · theorem · Teaching coverage

              Read this first

              Mathematical statement

              Let Ω and γ be Standard Borel measurable spaces, with γ nonempty; let β be any measurable space and μ any finite measure on Ω. For measurable X:Ω→β and Y:Ω→γ and a fixed measurable set S⊆γ, the selected conditional probability of Y∈S given X, evaluated at X(ω), agrees μ-almost everywhere with the conditional-expectation kernel for σ(X), pushed forward by Y and evaluated on S.

              \[q(X\omega,S)=\bigl(Y_\#\,\operatorname{condExpKernel}(\mu,\sigma(X))(\omega)\bigr)(S)\quad\mu\text{-a.e.},\qquad \sigma(X)=\mathcal M_\beta\operatorname{.comap}X.\]
              Lean statement · condDistribAeEqCondExpKernelMap

              The conclusion is equality of two scalar event probabilities for one fixed measurable S. The order of parameter names in the imported theorem is opposite to this adapter's chosen names.

              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

              theorem condDistribAeEqCondExpKernelMap {Ω β γ : Type*}
                  [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                  [StandardBorelSpace Ω] [StandardBorelSpace γ] [Nonempty γ]
                  {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                  (hX : Measurable X) (hY : Measurable Y) {s : Set γ}
                  (hs : MeasurableSet s) :
                  (fun a => ProbabilityTheory.condDistrib Y X μ (X a) s) =ᵐ[μ]
                    fun a =>
                      (ProbabilityTheory.condExpKernel μ
                          ((inferInstance : MeasurableSpace β).comap X)).map Y a s

              Exact module and namespace context

              Proof roadmap

              1. 1Use the conditional-kernel comparison theorem

                Mathlib already compares the conditional distribution of a sampled variable with the image of the sample-space conditional-expectation kernel. Its convention lists the sampled variable first and the conditioning variable second.

              2. 2Match the roles without swapping the meaning

                Set the imported theorem's sampled variable to Y and its conditioning variable to X. Their measurability and S's measurability are exactly the required inputs.

              Full assumptions and notation

              All objects and hypotheses

              • Ω, β, γ have measurable-space structures; Ω and γ are Standard Borel, and γ is nonempty. No Standard Borel assumption on β or Nonempty Ω is required.
              • μ is finite; X:Ω→β and Y:Ω→γ are measurable; S⊆γ is measurable.

              Notation and interpretation

              Pushforward law

              P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

              \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
              A.e. and strong measurability

              A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

              \[f=g\quad\mu\text{-a.e.}\]
              Conditional integral notation

              The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

              \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

              Mathematical proof

              1. Use the conditional-kernel comparison theorem

              Mathlib already compares the conditional distribution of a sampled variable with the image of the sample-space conditional-expectation kernel. Its convention lists the sampled variable first and the conditioning variable second.

              \[\operatorname{condDistrib}(V\mid U;\mu)(U\omega,S)=(V_\#Q_{\sigma(U)}(\omega))(S)\quad\mu\text{-a.e.}\]
              Corresponding Lean step

              ProbabilityTheory.condDistrib_apply_ae_eq_condExpKernel_map

              2. Match the roles without swapping the meaning

              Set the imported theorem's sampled variable to Y and its conditioning variable to X. Their measurability and S's measurability are exactly the required inputs.

              \[V=Y,\quad U=X,\quad q(X\omega,S)=(Y_\#Q_{\sigma(X)}(\omega))(S)\quad\mu\text{-a.e.}\]
              Corresponding Lean step

              (X := Y) (Y := X) hY hX hs

              Lean verification

              The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

              Lean proof · condDistribAeEqCondExpKernelMap

              The proof directly specializes the imported orientation theorem. It does not prove equality of measures on one common full-measure set for all S.

              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

              Download module (.lean)
              theorem condDistribAeEqCondExpKernelMap {Ω β γ : Type*}
                  [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                  [StandardBorelSpace Ω] [StandardBorelSpace γ] [Nonempty γ]
                  {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                  (hX : Measurable X) (hY : Measurable Y) {s : Set γ}
                  (hs : MeasurableSet s) :
                  (fun a => ProbabilityTheory.condDistrib Y X μ (X a) s) =ᵐ[μ]
                    fun a =>
                      (ProbabilityTheory.condExpKernel μ
                          ((inferInstance : MeasurableSpace β).comap X)).map Y a s := by
                exact ProbabilityTheory.condDistrib_apply_ae_eq_condExpKernel_map
                  (μ := μ) (X := Y) (Y := X) hY hX hs

              Exact module and namespace context

              Scope and omitted-condition boundaries
              • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
              • The exceptional set may depend on the fixed event S; do not upgrade this declaration alone to measure-valued a.e. kernel equality.
              • No weak Fokker–Planck equation or KL differentiability result.
              Sources, dependencies, and reuse

              Source and reuse

              Samplinglib parents called

                Mathlib API called (external library)

                • ProbabilityTheory.condDistrib_apply_ae_eq_condExpKernel_map

                Mathematical sources

                Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                Samplinglib mathematical lesson

                Transfer a chosen conditional integral version between equal kernels

                AutoSamplingTheory.condDistribIntegralSampleAeEqOfCondExpKernelMap · theorem · Teaching coverage

                Read this first

                Mathematical statement

                Use the finite-measure conditional-kernel setting with Ω additionally Standard Borel. Suppose q(Xω) and the Y-image of the conditional-expectation kernel for σ(X) are equal as measures μ-a.e. Suppose integrating y↦f(Xω,y) against the latter measure gives a chosen field v(Xω) μ-a.e. Then integrating against q(Xω) also gives v(Xω) μ-a.e. The two a.e. identities are assumptions.

                \[q(X\omega)=R(\omega)\ \mu\text{-a.e.},\quad \int f(X\omega,y)\,dR(\omega)(y)=v(X\omega)\ \mu\text{-a.e.} \ \Longrightarrow\ C(X\omega)=v(X\omega)\ \mu\text{-a.e.}.\]
                Lean statement · condDistribIntegralSampleAeEqOfCondExpKernelMap

                The theorem consumes a measure-valued equality and a selected field version. It does not construct either of those hypotheses.

                Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                theorem condDistribIntegralSampleAeEqOfCondExpKernelMap {Ω β γ F : Type*}
                    [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                    [NormedAddCommGroup F] [NormedSpace ℝ F]
                    [StandardBorelSpace Ω] [StandardBorelSpace γ] [Nonempty γ]
                    {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                    {f : β × γ → F} {field : β → F}
                    (hkernel :
                      (fun a => ProbabilityTheory.condDistrib Y X μ (X a)) =ᵐ[μ]
                        fun a =>
                          (ProbabilityTheory.condExpKernel μ
                            ((inferInstance : MeasurableSpace β).comap X)).map Y a)
                    (hfield :
                      (fun a => ∫ y, f (X a, y)
                          ∂(ProbabilityTheory.condExpKernel μ
                            ((inferInstance : MeasurableSpace β).comap X)).map Y a) =ᵐ[μ]
                        fun a => field (X a)) :
                    (fun a => ∫ y, f (X a, y)
                        ∂ProbabilityTheory.condDistrib Y X μ (X a)) =ᵐ[μ]
                      fun a => field (X a)

                Exact module and namespace context

                Proof roadmap

                1. 1Intersect the two full-measure events

                  Outside one null set both the measure equality and the field equality hold at the same ω.

                2. 2Substitute the equal measure, then the field value

                  An integral depends on its measure argument. Equal measures give equal totalized integrals, after which the supplied field identity closes the equality.

                Full assumptions and notation

                All objects and hypotheses

                • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                • Ω is also Standard Borel; v:β→F is a chosen field; R(ω)=(condExpKernel μ σ(X)).map Y (ω).
                • hkernel gives equality q(Xω)=R(ω) as measures μ-a.e.; this is stronger than a separate eventwise statement with event-dependent null sets.
                • hfield gives the stated integral equality to v(Xω) μ-a.e. No X/Y measurability or f integrability is separately assumed by this substitution theorem.

                Notation and interpretation

                Pushforward law

                P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                A.e. and strong measurability

                A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                \[f=g\quad\mu\text{-a.e.}\]
                Integrability and Bochner integrals

                L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                Conditional integral notation

                The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                Mathematical proof

                1. Intersect the two full-measure events

                Outside one null set both the measure equality and the field equality hold at the same ω.

                \[q(X\omega)=R(\omega),\qquad\int f(X\omega,y)\,dR(\omega)=v(X\omega).\]
                Corresponding Lean step

                filter_upwards [hkernel,hfield]

                2. Substitute the equal measure, then the field value

                An integral depends on its measure argument. Equal measures give equal totalized integrals, after which the supplied field identity closes the equality.

                \[C(X\omega)=\int f(X\omega,y)\,dR(\omega)=v(X\omega).\]
                Corresponding Lean step

                rw [hka,hfa]

                Lean verification

                The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                Lean proof · condDistribIntegralSampleAeEqOfCondExpKernelMap

                A finite intersection combines the a.e. assumptions, and two substitutions identify the integral. No conditional expectation or measurability theorem is re-proved.

                Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                Download module (.lean)
                theorem condDistribIntegralSampleAeEqOfCondExpKernelMap {Ω β γ F : Type*}
                    [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                    [NormedAddCommGroup F] [NormedSpace ℝ F]
                    [StandardBorelSpace Ω] [StandardBorelSpace γ] [Nonempty γ]
                    {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                    {f : β × γ → F} {field : β → F}
                    (hkernel :
                      (fun a => ProbabilityTheory.condDistrib Y X μ (X a)) =ᵐ[μ]
                        fun a =>
                          (ProbabilityTheory.condExpKernel μ
                            ((inferInstance : MeasurableSpace β).comap X)).map Y a)
                    (hfield :
                      (fun a => ∫ y, f (X a, y)
                          ∂(ProbabilityTheory.condExpKernel μ
                            ((inferInstance : MeasurableSpace β).comap X)).map Y a) =ᵐ[μ]
                        fun a => field (X a)) :
                    (fun a => ∫ y, f (X a, y)
                        ∂ProbabilityTheory.condDistrib Y X μ (X a)) =ᵐ[μ]
                      fun a => field (X a) := by
                  filter_upwards [hkernel, hfield] with a hka hfa
                  rw [hka, hfa]

                Exact module and namespace context

                Scope and omitted-condition boundaries
                • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                • No regularity of the chosen field follows from this substitution alone.
                Sources, dependencies, and reuse

                Source and reuse

                Samplinglib parents called

                  Mathlib API called (external library)

                  No direct Mathlib call recorded; see the Samplinglib parents.

                  Mathematical sources

                  Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                  Samplinglib mathematical lesson

                  The conditional integral is almost-everywhere strongly measurable on the sample space

                  AutoSamplingTheory.condDistribIntegralAEStronglyMeasurable · theorem · Teaching coverage

                  Read this first

                  Mathematical statement

                  In the finite-measure conditional-distribution setting and notation below, assume Y is μ-a.e. measurable and X is μ-a.e. measurable. If f is almost-everywhere strongly measurable under the joint image measure λ, then C∘X is almost-everywhere strongly measurable under μ.

                  \[f\in\operatorname{AESM}(\lambda)\Longrightarrow C∘X\in\operatorname{AESM}(μ).\]
                  Lean statement · condDistribIntegralAEStronglyMeasurable

                  The measure attached to the conclusion is the original sample measure μ. The hypothesis concerns the joint measure λ, not every individual conditional fiber.

                  Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                  theorem condDistribIntegralAEStronglyMeasurable {Ω β γ F : Type*}
                      [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                      [NormedAddCommGroup F] [NormedSpace ℝ F]
                      [StandardBorelSpace γ] [Nonempty γ]
                      {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                      {f : β × γ → F}
                      (hX : AEMeasurable X μ) (hY : AEMeasurable Y μ)
                      (hf : AEStronglyMeasurable f (μ.map fun a => (X a, Y a))) :
                      AEStronglyMeasurable
                        (fun a => ∫ y, f (X a, y) ∂ProbabilityTheory.condDistrib Y X μ (X a))
                        μ

                  Exact module and namespace context

                  Proof roadmap

                  1. 1Apply the canonical conditional-integral measurability result

                    Mathlib identifies the first marginal of the joint image measure using the a.e. measurability of Y, and its disintegration backend supplies a strongly measurable version of the conditional integral under that marginal.

                  2. 2Compose with the conditioning variable

                    The supplied a.e. measurability of X transfers the marginal-a.e. strong measurability of C back to sample-space a.e. strong measurability of C∘X.

                  Full assumptions and notation

                  All objects and hypotheses

                  • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                  • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                  • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                  • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                  • Y is μ-a.e. measurable.
                  • X is μ-a.e. measurable.
                  • f is almost-everywhere strongly measurable under λ.

                  Notation and interpretation

                  Pushforward law

                  P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                  \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                  A.e. and strong measurability

                  A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                  \[f=g\quad\mu\text{-a.e.}\]
                  Integrability and Bochner integrals

                  L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                  \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                  Conditional integral notation

                  The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                  \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                  Mathematical proof

                  1. Apply the canonical conditional-integral measurability result

                  Mathlib identifies the first marginal of the joint image measure using the a.e. measurability of Y, and its disintegration backend supplies a strongly measurable version of the conditional integral under that marginal.

                  \[f\text{ is }\lambda\text{-a.e. strongly measurable}\Longrightarrow C\text{ is }m\text{-a.e. strongly measurable}.\]
                  Corresponding Lean step

                  The map-level part inside hf.integral_condDistrib hX hY

                  2. Compose with the conditioning variable

                  The supplied a.e. measurability of X transfers the marginal-a.e. strong measurability of C back to sample-space a.e. strong measurability of C∘X.

                  \[C\in\operatorname{AESM}(m),\quad X\in\operatorname{AEM}(\mu)\Longrightarrow C\circ X\in\operatorname{AESM}(\mu).\]
                  Corresponding Lean step

                  hf.integral_condDistrib hX hY; imported composition support

                  Lean verification

                  The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                  Lean proof · condDistribIntegralAEStronglyMeasurable

                  This is direct reuse of Mathlib's sample-space conditional-integral measurability theorem. The displayed argument explains that theorem's role; ASTIS adds no independent disintegration proof.

                  Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                  Download module (.lean)
                  theorem condDistribIntegralAEStronglyMeasurable {Ω β γ F : Type*}
                      [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                      [NormedAddCommGroup F] [NormedSpace ℝ F]
                      [StandardBorelSpace γ] [Nonempty γ]
                      {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                      {f : β × γ → F}
                      (hX : AEMeasurable X μ) (hY : AEMeasurable Y μ)
                      (hf : AEStronglyMeasurable f (μ.map fun a => (X a, Y a))) :
                      AEStronglyMeasurable
                        (fun a => ∫ y, f (X a, y) ∂ProbabilityTheory.condDistrib Y X μ (X a))
                        μ := by
                    exact hf.integral_condDistrib hX hY

                  Exact module and namespace context

                  Scope and omitted-condition boundaries
                  • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                  • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                  • No specified SALD component version, path law, or weak PDE is constructed.
                  Sources, dependencies, and reuse

                  Source and reuse

                  Samplinglib parents called

                    Mathlib API called (external library)

                    • MeasureTheory.AEStronglyMeasurable.integral_condDistrib

                    Mathematical sources

                    Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                    Samplinglib mathematical lesson

                    The conditional integral is integrable on the sample space

                    AutoSamplingTheory.condDistribIntegralIntegrable · theorem · Teaching coverage

                    Read this first

                    Mathematical statement

                    In the finite-measure conditional-distribution setting and notation below, assume Y is μ-a.e. measurable and X is μ-a.e. measurable. If f is integrable under the joint image measure λ, then C∘X is integrable under μ.

                    \[f\in L^1(\lambda)\Longrightarrow C∘X\in L^1(μ).\]
                    Lean statement · condDistribIntegralIntegrable

                    The measure attached to the conclusion is the original sample measure μ. The hypothesis concerns the joint measure λ, not every individual conditional fiber.

                    Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                    theorem condDistribIntegralIntegrable {Ω β γ F : Type*}
                        [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                        [NormedAddCommGroup F] [NormedSpace ℝ F]
                        [StandardBorelSpace γ] [Nonempty γ]
                        {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                        {f : β × γ → F}
                        (hX : AEMeasurable X μ) (hY : AEMeasurable Y μ)
                        (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                        Integrable
                          (fun a => ∫ y, f (X a, y) ∂ProbabilityTheory.condDistrib Y X μ (X a))
                          μ

                    Exact module and namespace context

                    Proof roadmap

                    1. 1Reuse integrability of the conditional average

                      For an integrable joint integrand, the imported conditional-integral theorem combines a.e. strong measurability with integrability of the norm of the conditional average. The relevant norm bound is controlled by conditional integration of ‖f‖.

                    2. 2Pull marginal integrability back to samples

                      Since X is μ-a.e. measurable and m=X#μ, integrability of C under m implies integrability of C∘X under μ. This is part of the imported sample-space theorem.

                    Full assumptions and notation

                    All objects and hypotheses

                    • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                    • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                    • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                    • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                    • Y is μ-a.e. measurable.
                    • X is μ-a.e. measurable.
                    • f is integrable under λ.

                    Notation and interpretation

                    Pushforward law

                    P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                    \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                    A.e. and strong measurability

                    A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                    \[f=g\quad\mu\text{-a.e.}\]
                    Integrability and Bochner integrals

                    L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                    \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                    Conditional integral notation

                    The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                    \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                    Mathematical proof

                    1. Reuse integrability of the conditional average

                    For an integrable joint integrand, the imported conditional-integral theorem combines a.e. strong measurability with integrability of the norm of the conditional average. The relevant norm bound is controlled by conditional integration of ‖f‖.

                    \[f\in L^1(\lambda)\Longrightarrow C\in L^1(m),\qquad\|C(x)\|\le\int\|f(x,y)\|\,dq(x)(y).\]
                    Corresponding Lean step

                    map-level integrability inside hf.integral_condDistrib hX hY

                    2. Pull marginal integrability back to samples

                    Since X is μ-a.e. measurable and m=X#μ, integrability of C under m implies integrability of C∘X under μ. This is part of the imported sample-space theorem.

                    \[C\in L^1(X_\#\mu)\Longrightarrow C\circ X\in L^1(\mu).\]
                    Corresponding Lean step

                    hf.integral_condDistrib hX hY

                    Lean verification

                    The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                    Lean proof · condDistribIntegralIntegrable

                    This is direct reuse of Mathlib's sample-space conditional-integral integrability theorem. The displayed argument explains that theorem's role; ASTIS adds no independent disintegration proof.

                    Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                    Download module (.lean)
                    theorem condDistribIntegralIntegrable {Ω β γ F : Type*}
                        [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                        [NormedAddCommGroup F] [NormedSpace ℝ F]
                        [StandardBorelSpace γ] [Nonempty γ]
                        {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                        {f : β × γ → F}
                        (hX : AEMeasurable X μ) (hY : AEMeasurable Y μ)
                        (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                        Integrable
                          (fun a => ∫ y, f (X a, y) ∂ProbabilityTheory.condDistrib Y X μ (X a))
                          μ := by
                      exact hf.integral_condDistrib hX hY

                    Exact module and namespace context

                    Scope and omitted-condition boundaries
                    • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                    • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                    • No specified SALD component version, path law, or weak PDE is constructed.
                    Sources, dependencies, and reuse

                    Source and reuse

                    Samplinglib parents called

                      Mathlib API called (external library)

                      • MeasureTheory.Integrable.integral_condDistrib

                      Mathematical sources

                      Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                      Samplinglib mathematical lesson

                      The conditional integral is almost-everywhere strongly measurable under the conditioning law

                      AutoSamplingTheory.condDistribIntegralMapAEStronglyMeasurable · theorem · Teaching coverage

                      Read this first

                      Mathematical statement

                      In the finite-measure conditional-distribution setting and notation below, assume Y is μ-a.e. measurable. If f is almost-everywhere strongly measurable under the joint image measure λ, then C is almost-everywhere strongly measurable under m. No a.e. measurability assumption on X is required by this law-space adapter.

                      \[f\in\operatorname{AESM}(\lambda)\Longrightarrow C\in\operatorname{AESM}(m).\]
                      Lean statement · condDistribIntegralMapAEStronglyMeasurable

                      The measure attached to the conclusion is the conditioning image measure m. The hypothesis concerns the joint measure λ, not every individual conditional fiber.

                      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                      theorem condDistribIntegralMapAEStronglyMeasurable {Ω β γ F : Type*}
                          [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                          [NormedAddCommGroup F] [NormedSpace ℝ F]
                          [StandardBorelSpace γ] [Nonempty γ]
                          {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                          {f : β × γ → F}
                          (hY : AEMeasurable Y μ)
                          (hf : AEStronglyMeasurable f (μ.map fun a => (X a, Y a))) :
                          AEStronglyMeasurable
                            (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                            (μ.map X)

                      Exact module and namespace context

                      Proof roadmap

                      1. 1Apply the canonical conditional-integral measurability result

                        Mathlib identifies the first marginal of the joint image measure using the a.e. measurability of Y, and its disintegration backend supplies a strongly measurable version of the conditional integral under that marginal.

                      Full assumptions and notation

                      All objects and hypotheses

                      • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                      • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                      • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                      • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                      • Y is μ-a.e. measurable.
                      • f is almost-everywhere strongly measurable under λ.

                      Notation and interpretation

                      Pushforward law

                      P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                      \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                      A.e. and strong measurability

                      A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                      \[f=g\quad\mu\text{-a.e.}\]
                      Integrability and Bochner integrals

                      L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                      \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                      Conditional integral notation

                      The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                      \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                      Mathematical proof

                      1. Apply the canonical conditional-integral measurability result

                      Mathlib identifies the first marginal of the joint image measure using the a.e. measurability of Y, and its disintegration backend supplies a strongly measurable version of the conditional integral under that marginal.

                      \[f\text{ is }\lambda\text{-a.e. strongly measurable}\Longrightarrow C\text{ is }m\text{-a.e. strongly measurable}.\]
                      Corresponding Lean step

                      hf.integral_condDistrib_map hY

                      Lean verification

                      The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                      Lean proof · condDistribIntegralMapAEStronglyMeasurable

                      This is direct reuse of Mathlib's law-space conditional-integral measurability theorem. The displayed argument explains that theorem's role; ASTIS adds no independent disintegration proof.

                      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                      Download module (.lean)
                      theorem condDistribIntegralMapAEStronglyMeasurable {Ω β γ F : Type*}
                          [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                          [NormedAddCommGroup F] [NormedSpace ℝ F]
                          [StandardBorelSpace γ] [Nonempty γ]
                          {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                          {f : β × γ → F}
                          (hY : AEMeasurable Y μ)
                          (hf : AEStronglyMeasurable f (μ.map fun a => (X a, Y a))) :
                          AEStronglyMeasurable
                            (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                            (μ.map X) := by
                        exact hf.integral_condDistrib_map hY

                      Exact module and namespace context

                      Scope and omitted-condition boundaries
                      • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                      • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                      • X need not be a.e. measurable in this exact signature; without it, the displayed image measures retain Mathlib's totalized-map semantics.
                      • No specified SALD component version, path law, or weak PDE is constructed.
                      Sources, dependencies, and reuse

                      Source and reuse

                      Samplinglib parents called

                        Mathlib API called (external library)

                        • MeasureTheory.AEStronglyMeasurable.integral_condDistrib_map

                        Mathematical sources

                        Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                        Samplinglib mathematical lesson

                        The conditional integral is integrable under the conditioning law

                        AutoSamplingTheory.condDistribIntegralMapIntegrable · theorem · Teaching coverage

                        Read this first

                        Mathematical statement

                        In the finite-measure conditional-distribution setting and notation below, assume Y is μ-a.e. measurable. If f is integrable under the joint image measure λ, then C is integrable under m. No a.e. measurability assumption on X is required by this law-space adapter.

                        \[f\in L^1(\lambda)\Longrightarrow C\in L^1(m).\]
                        Lean statement · condDistribIntegralMapIntegrable

                        The measure attached to the conclusion is the conditioning image measure m. The hypothesis concerns the joint measure λ, not every individual conditional fiber.

                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                        theorem condDistribIntegralMapIntegrable {Ω β γ F : Type*}
                            [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                            [NormedAddCommGroup F] [NormedSpace ℝ F]
                            [StandardBorelSpace γ] [Nonempty γ]
                            {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                            {f : β × γ → F}
                            (hY : AEMeasurable Y μ)
                            (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                            Integrable
                              (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                              (μ.map X)

                        Exact module and namespace context

                        Proof roadmap

                        1. 1Reuse integrability of the conditional average

                          For an integrable joint integrand, the imported conditional-integral theorem combines a.e. strong measurability with integrability of the norm of the conditional average. The relevant norm bound is controlled by conditional integration of ‖f‖.

                        Full assumptions and notation

                        All objects and hypotheses

                        • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                        • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                        • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                        • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                        • Y is μ-a.e. measurable.
                        • f is integrable under λ.

                        Notation and interpretation

                        Pushforward law

                        P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                        \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                        A.e. and strong measurability

                        A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                        \[f=g\quad\mu\text{-a.e.}\]
                        Integrability and Bochner integrals

                        L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                        \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                        Conditional integral notation

                        The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                        \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                        Mathematical proof

                        1. Reuse integrability of the conditional average

                        For an integrable joint integrand, the imported conditional-integral theorem combines a.e. strong measurability with integrability of the norm of the conditional average. The relevant norm bound is controlled by conditional integration of ‖f‖.

                        \[f\in L^1(\lambda)\Longrightarrow C\in L^1(m),\qquad\|C(x)\|\le\int\|f(x,y)\|\,dq(x)(y).\]
                        Corresponding Lean step

                        hf.integral_condDistrib_map hY

                        Lean verification

                        The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                        Lean proof · condDistribIntegralMapIntegrable

                        This is direct reuse of Mathlib's law-space conditional-integral integrability theorem. The displayed argument explains that theorem's role; ASTIS adds no independent disintegration proof.

                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                        Download module (.lean)
                        theorem condDistribIntegralMapIntegrable {Ω β γ F : Type*}
                            [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                            [NormedAddCommGroup F] [NormedSpace ℝ F]
                            [StandardBorelSpace γ] [Nonempty γ]
                            {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                            {f : β × γ → F}
                            (hY : AEMeasurable Y μ)
                            (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                            Integrable
                              (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                              (μ.map X) := by
                          exact hf.integral_condDistrib_map hY

                        Exact module and namespace context

                        Scope and omitted-condition boundaries
                        • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                        • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                        • X need not be a.e. measurable in this exact signature; without it, the displayed image measures retain Mathlib's totalized-map semantics.
                        • No specified SALD component version, path law, or weak PDE is constructed.
                        Sources, dependencies, and reuse

                        Source and reuse

                        Samplinglib parents called

                          Mathlib API called (external library)

                          • MeasureTheory.Integrable.integral_condDistrib_map

                          Mathematical sources

                          Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                          Samplinglib mathematical lesson

                          Integrating the conditional average recovers the joint integral

                          AutoSamplingTheory.condDistribIntegralMapIntegral · theorem · Teaching coverage

                          Read this first

                          Mathematical statement

                          In the finite-measure conditional setting below, assume X and Y are μ-a.e. measurable and f is integrable under their joint image measure λ. Then integrating the conditional integral C(x) against the conditioning law m=X#μ equals integrating f(Xω,Yω) against μ. This is finite-measure disintegration, without probability normalization.

                          \[\int_\beta\left(\int_\gamma f(x,y)\,dq(x)(y)\right)\,dm(x)=\int_\Omega f(X\omega,Y\omega)\,d\mu(\omega).\]
                          Lean statement · condDistribIntegralMapIntegral

                          The integrability assumption belongs to the joint measure. The conclusion averages over the conditioning law and does not demand integrability on every null fiber.

                          Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                          theorem condDistribIntegralMapIntegral {Ω β γ F : Type*}
                              [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                              [NormedAddCommGroup F] [NormedSpace ℝ F]
                              [StandardBorelSpace γ] [Nonempty γ]
                              {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                              {f : β × γ → F}
                              (hX : AEMeasurable X μ) (hY : AEMeasurable Y μ)
                              (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                              (∫ x, ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x
                                  ∂μ.map X) =
                                ∫ a, f (X a, Y a) ∂μ

                          Exact module and namespace context

                          Proof roadmap

                          1. 1Recover the joint image measure by disintegration

                            The general disintegration theorem with sampled variable Y gives λ=m⊗ₘq. The marginal is finite and q is Markov, providing the s-finiteness needed by the composition-product integral API.

                          2. 2Transfer integrability to the composition-product

                            Because the two joint measures are equal, the supplied integrability of f under λ applies to m⊗ₘq.

                          3. 3Use the iterated-integral identity

                            The composition-product integral theorem identifies the outer conditional average with integration over the reconstructed joint measure.

                          4. 4Return to the original sample space

                            Replace the composition-product by the joint image measure and use the measurable-pair pushforward integration formula.

                          Full assumptions and notation

                          All objects and hypotheses

                          • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                          • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                          • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                          • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                          • X and Y are μ-a.e. measurable, and f is λ-integrable.

                          Notation and interpretation

                          Pushforward law

                          P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                          \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                          A.e. and strong measurability

                          A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                          \[f=g\quad\mu\text{-a.e.}\]
                          Integrability and Bochner integrals

                          L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                          \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                          Conditional integral notation

                          The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                          \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                          Mathematical proof

                          1. Recover the joint image measure by disintegration

                          The general disintegration theorem with sampled variable Y gives λ=m⊗ₘq. The marginal is finite and q is Markov, providing the s-finiteness needed by the composition-product integral API.

                          \[m\otimes_m q=\lambda.\]
                          Corresponding Lean step

                          ProbabilityTheory.compProd_map_condDistrib hY; hcomp

                          2. Transfer integrability to the composition-product

                          Because the two joint measures are equal, the supplied integrability of f under λ applies to m⊗ₘq.

                          \[f\in L^1(\lambda)\Longrightarrow f\in L^1(m\otimes_m q).\]
                          Corresponding Lean step

                          hfComp; rw [hcomp]; exact hf

                          3. Use the iterated-integral identity

                          The composition-product integral theorem identifies the outer conditional average with integration over the reconstructed joint measure.

                          \[\int\!\int f(x,y)\,dq(x)(y)\,dm(x)=\int f\,d(m\otimes_m q).\]
                          Corresponding Lean step

                          (Measure.integral_compProd hfComp).symm

                          4. Return to the original sample space

                          Replace the composition-product by the joint image measure and use the measurable-pair pushforward integration formula.

                          \[\int f\,d\lambda=\int f(X\omega,Y\omega)\,d\mu.\]
                          Corresponding Lean step

                          rw [hcomp]; integral_map (hX.prodMk hY) hf.1

                          Lean verification

                          The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                          Lean proof · condDistribIntegralMapIntegral

                          The proof names the disintegration equality, transports the integrability hypothesis, reverses the iterated-integral theorem, and changes variables through the paired map.

                          Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                          Download module (.lean)
                          theorem condDistribIntegralMapIntegral {Ω β γ F : Type*}
                              [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                              [NormedAddCommGroup F] [NormedSpace ℝ F]
                              [StandardBorelSpace γ] [Nonempty γ]
                              {μ : Measure Ω} [IsFiniteMeasure μ] {X : Ω → β} {Y : Ω → γ}
                              {f : β × γ → F}
                              (hX : AEMeasurable X μ) (hY : AEMeasurable Y μ)
                              (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                              (∫ x, ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x
                                  ∂μ.map X) =
                                ∫ a, f (X a, Y a) ∂μ := by
                            have hcomp := ProbabilityTheory.compProd_map_condDistrib
                              (μ := μ) (X := X) (Y := Y) (mβ := inferInstance) hY
                            have hfComp :
                                Integrable f ((μ.map X) ⊗ₘ ProbabilityTheory.condDistrib Y X μ) := by
                              rw [hcomp]
                              exact hf
                            calc
                              (∫ x, ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x
                                  ∂μ.map X)
                                  = ∫ z, f z ∂((μ.map X) ⊗ₘ
                                      ProbabilityTheory.condDistrib Y X μ) := by
                                    exact (Measure.integral_compProd
                                      (μ := μ.map X) (κ := ProbabilityTheory.condDistrib Y X μ)
                                      hfComp).symm
                              _ = ∫ a, f (X a, Y a) ∂μ := by
                                    rw [hcomp]
                                    rw [integral_map (hX.prodMk hY) hf.1]

                          Exact module and namespace context

                          Scope and omitted-condition boundaries
                          • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                          • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                          • For probability μ this is a two-stage expectation identity. For general finite μ, q(x) has mass one but the outer measure m has total mass μ(Ω); the reconstruction preserves that mass.
                          • No integration by parts, admissible log-ratio test or Fokker–Planck theorem.
                          Sources, dependencies, and reuse

                          Source and reuse

                          Samplinglib parents called

                            Mathlib API called (external library)

                            • ProbabilityTheory.compProd_map_condDistrib
                            • MeasureTheory.Measure.integral_compProd
                            • MeasureTheory.integral_map
                            • AEMeasurable.prodMk

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Disintegration written with a named conditioning law

                            AutoSamplingTheory.condDistribIntegralNamedLawIntegral · theorem · Teaching coverage

                            Read this first

                            Mathematical statement

                            In the finite-measure conditional setting below, let ρ̂ be a measure on β with ρ̂=X#μ. Assume Y is μ-a.e. measurable and X is μ-a.e. measurable, and f is integrable under λ. Then the averaged conditional integral equals the joint sample integral. This only replaces the mapped measure by an equal named measure.

                            \[\widehat\rho=m\Longrightarrow\int C\,d\widehat\rho=\int f(X\omega,Y\omega)\,d\mu.\]
                            Lean statement · condDistribIntegralNamedLawIntegral

                            The named measure is not inferred from notation; its equality to X#μ is an explicit premise. The remaining assumptions are exactly those of the reused theorem.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            theorem condDistribIntegralNamedLawIntegral {Ω β γ F : Type*}
                                [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                                [NormedAddCommGroup F] [NormedSpace ℝ F]
                                [StandardBorelSpace γ] [Nonempty γ]
                                {μ : Measure Ω} [IsFiniteMeasure μ] {hatRho : Measure β}
                                {X : Ω → β} {Y : Ω → γ} {f : β × γ → F}
                                (hhatRho : hatRho = μ.map X)
                                (hX : AEMeasurable X μ) (hY : AEMeasurable Y μ)
                                (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                                (∫ x, ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x
                                    ∂hatRho) =
                                  ∫ a, f (X a, Y a) ∂μ

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Replace the named measure by the image law

                              Use the supplied equality exactly where the measure occurs in the conclusion.

                            2. 2Reuse the canonical law-space theorem

                              After substitution, the goal is the existing disintegration or regularity theorem with unchanged hypotheses.

                            Full assumptions and notation

                            All objects and hypotheses

                            • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                            • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                            • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                            • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                            • ρ̂ is a measure on β and hhatRho gives ρ̂=X#μ.
                            • Y is μ-a.e. measurable.
                            • X is μ-a.e. measurable.
                            • f is integrable under λ.

                            Notation and interpretation

                            Pushforward law

                            P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                            \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                            A.e. and strong measurability

                            A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                            \[f=g\quad\mu\text{-a.e.}\]
                            Integrability and Bochner integrals

                            L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                            \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                            Conditional integral notation

                            The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                            \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                            Mathematical proof

                            1. Replace the named measure by the image law

                            Use the supplied equality exactly where the measure occurs in the conclusion.

                            \[\widehat\rho=m=X_\#\mu.\]
                            Corresponding Lean step

                            rw [hhatRho]

                            2. Reuse the canonical law-space theorem

                            After substitution, the goal is the existing disintegration or regularity theorem with unchanged hypotheses.

                            \[\int C\,dm=\int f(X\omega,Y\omega)\,d\mu.\]
                            Corresponding Lean step

                            exact condDistribIntegralMapIntegral ...

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean proof · condDistribIntegralNamedLawIntegral

                            The proof consists of measure substitution followed by the existing canonical result. The named-law wrapper adds no conditional-law construction or analytic hypothesis.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            theorem condDistribIntegralNamedLawIntegral {Ω β γ F : Type*}
                                [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                                [NormedAddCommGroup F] [NormedSpace ℝ F]
                                [StandardBorelSpace γ] [Nonempty γ]
                                {μ : Measure Ω} [IsFiniteMeasure μ] {hatRho : Measure β}
                                {X : Ω → β} {Y : Ω → γ} {f : β × γ → F}
                                (hhatRho : hatRho = μ.map X)
                                (hX : AEMeasurable X μ) (hY : AEMeasurable Y μ)
                                (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                                (∫ x, ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x
                                    ∂hatRho) =
                                  ∫ a, f (X a, Y a) ∂μ := by
                              rw [hhatRho]
                              exact condDistribIntegralMapIntegral hX hY hf

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                            • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                            • Reuse wrapper, not a separate proof of disintegration.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            A.e. strong measurability under a named conditioning law

                            AutoSamplingTheory.condDistribIntegralNamedLawAEStronglyMeasurable · theorem · Teaching coverage

                            Read this first

                            Mathematical statement

                            In the finite-measure conditional setting below, let ρ̂ be a measure on β with ρ̂=X#μ. Assume Y is μ-a.e. measurable, and f is a.e. strongly measurable under λ. Then C is ρ̂-a.e. strongly measurable. This only replaces the mapped measure by an equal named measure.

                            \[\widehat\rho=m\Longrightarrow C\in \operatorname{AESM}(\widehat\rho).\]
                            Lean statement · condDistribIntegralNamedLawAEStronglyMeasurable

                            The named measure is not inferred from notation; its equality to X#μ is an explicit premise. The remaining assumptions are exactly those of the reused theorem.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            theorem condDistribIntegralNamedLawAEStronglyMeasurable {Ω β γ F : Type*}
                                [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                                [NormedAddCommGroup F] [NormedSpace ℝ F]
                                [StandardBorelSpace γ] [Nonempty γ]
                                {μ : Measure Ω} [IsFiniteMeasure μ] {hatRho : Measure β}
                                {X : Ω → β} {Y : Ω → γ} {f : β × γ → F}
                                (hhatRho : hatRho = μ.map X)
                                (hY : AEMeasurable Y μ)
                                (hf : AEStronglyMeasurable f (μ.map fun a => (X a, Y a))) :
                                AEStronglyMeasurable
                                  (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                                  hatRho

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Replace the named measure by the image law

                              Use the supplied equality exactly where the measure occurs in the conclusion.

                            2. 2Reuse the canonical law-space theorem

                              After substitution, the goal is the existing disintegration or regularity theorem with unchanged hypotheses.

                            Full assumptions and notation

                            All objects and hypotheses

                            • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                            • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                            • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                            • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                            • ρ̂ is a measure on β and hhatRho gives ρ̂=X#μ.
                            • Y is μ-a.e. measurable.
                            • f is a.e. strongly measurable under λ.

                            Notation and interpretation

                            Pushforward law

                            P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                            \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                            A.e. and strong measurability

                            A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                            \[f=g\quad\mu\text{-a.e.}\]
                            Integrability and Bochner integrals

                            L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                            \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                            Conditional integral notation

                            The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                            \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                            Mathematical proof

                            1. Replace the named measure by the image law

                            Use the supplied equality exactly where the measure occurs in the conclusion.

                            \[\widehat\rho=m=X_\#\mu.\]
                            Corresponding Lean step

                            rw [hhatRho]

                            2. Reuse the canonical law-space theorem

                            After substitution, the goal is the existing disintegration or regularity theorem with unchanged hypotheses.

                            \[C\in \operatorname{AESM}(m).\]
                            Corresponding Lean step

                            exact condDistribIntegralMapAEStronglyMeasurable ...

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean proof · condDistribIntegralNamedLawAEStronglyMeasurable

                            The proof consists of measure substitution followed by the existing canonical result. The named-law wrapper adds no conditional-law construction or analytic hypothesis.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            theorem condDistribIntegralNamedLawAEStronglyMeasurable {Ω β γ F : Type*}
                                [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                                [NormedAddCommGroup F] [NormedSpace ℝ F]
                                [StandardBorelSpace γ] [Nonempty γ]
                                {μ : Measure Ω} [IsFiniteMeasure μ] {hatRho : Measure β}
                                {X : Ω → β} {Y : Ω → γ} {f : β × γ → F}
                                (hhatRho : hatRho = μ.map X)
                                (hY : AEMeasurable Y μ)
                                (hf : AEStronglyMeasurable f (μ.map fun a => (X a, Y a))) :
                                AEStronglyMeasurable
                                  (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                                  hatRho := by
                              rw [hhatRho]
                              exact condDistribIntegralMapAEStronglyMeasurable hY hf

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                            • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                            • No AEMeasurable X assumption appears in this named regularity theorem; retain the totalized-map boundary.
                            • Reuse wrapper, not a separate proof of disintegration.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Integrability under a named conditioning law

                            AutoSamplingTheory.condDistribIntegralNamedLawIntegrable · theorem · Teaching coverage

                            Read this first

                            Mathematical statement

                            In the finite-measure conditional setting below, let ρ̂ be a measure on β with ρ̂=X#μ. Assume Y is μ-a.e. measurable, and f is integrable under λ. Then C is integrable under the named law ρ̂. This only replaces the mapped measure by an equal named measure.

                            \[\widehat\rho=m\Longrightarrow C\in L^1(\widehat\rho).\]
                            Lean statement · condDistribIntegralNamedLawIntegrable

                            The named measure is not inferred from notation; its equality to X#μ is an explicit premise. The remaining assumptions are exactly those of the reused theorem.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            theorem condDistribIntegralNamedLawIntegrable {Ω β γ F : Type*}
                                [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                                [NormedAddCommGroup F] [NormedSpace ℝ F]
                                [StandardBorelSpace γ] [Nonempty γ]
                                {μ : Measure Ω} [IsFiniteMeasure μ] {hatRho : Measure β}
                                {X : Ω → β} {Y : Ω → γ} {f : β × γ → F}
                                (hhatRho : hatRho = μ.map X)
                                (hY : AEMeasurable Y μ)
                                (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                                Integrable
                                  (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                                  hatRho

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Replace the named measure by the image law

                              Use the supplied equality exactly where the measure occurs in the conclusion.

                            2. 2Reuse the canonical law-space theorem

                              After substitution, the goal is the existing disintegration or regularity theorem with unchanged hypotheses.

                            Full assumptions and notation

                            All objects and hypotheses

                            • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                            • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                            • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                            • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                            • ρ̂ is a measure on β and hhatRho gives ρ̂=X#μ.
                            • Y is μ-a.e. measurable.
                            • f is integrable under λ.

                            Notation and interpretation

                            Pushforward law

                            P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                            \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                            A.e. and strong measurability

                            A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                            \[f=g\quad\mu\text{-a.e.}\]
                            Integrability and Bochner integrals

                            L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                            \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                            Conditional integral notation

                            The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                            \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                            Mathematical proof

                            1. Replace the named measure by the image law

                            Use the supplied equality exactly where the measure occurs in the conclusion.

                            \[\widehat\rho=m=X_\#\mu.\]
                            Corresponding Lean step

                            rw [hhatRho]

                            2. Reuse the canonical law-space theorem

                            After substitution, the goal is the existing disintegration or regularity theorem with unchanged hypotheses.

                            \[C\in L^1(m).\]
                            Corresponding Lean step

                            exact condDistribIntegralMapIntegrable ...

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean proof · condDistribIntegralNamedLawIntegrable

                            The proof consists of measure substitution followed by the existing canonical result. The named-law wrapper adds no conditional-law construction or analytic hypothesis.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            theorem condDistribIntegralNamedLawIntegrable {Ω β γ F : Type*}
                                [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                                [NormedAddCommGroup F] [NormedSpace ℝ F]
                                [StandardBorelSpace γ] [Nonempty γ]
                                {μ : Measure Ω} [IsFiniteMeasure μ] {hatRho : Measure β}
                                {X : Ω → β} {Y : Ω → γ} {f : β × γ → F}
                                (hhatRho : hatRho = μ.map X)
                                (hY : AEMeasurable Y μ)
                                (hf : Integrable f (μ.map fun a => (X a, Y a))) :
                                Integrable
                                  (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                                  hatRho := by
                              rw [hhatRho]
                              exact condDistribIntegralMapIntegrable hY hf

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                            • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                            • No AEMeasurable X assumption appears in this named regularity theorem; retain the totalized-map boundary.
                            • Reuse wrapper, not a separate proof of disintegration.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            A chosen a.e. version inherits conditional-integral regularity

                            AutoSamplingTheory.condDistribIntegralNamedFieldRegularity · theorem · Teaching coverage

                            Read this first

                            Mathematical statement

                            In the conditional setting below, let ρ̂=X#μ and v:β→F be a chosen field equal to C ρ̂-almost everywhere. If Y is μ-a.e. measurable and f is both a.e. strongly measurable and integrable under λ, then v is a.e. strongly measurable and integrable under ρ̂.

                            \[C=v\quad\widehat\rho\text{-a.e.},\quad C\in\operatorname{AESM}(\widehat\rho)\cap L^1(\widehat\rho) \ \Longrightarrow\ v\in\operatorname{AESM}(\widehat\rho)\cap L^1(\widehat\rho).\]
                            Lean statement · condDistribIntegralNamedFieldRegularity

                            The conclusion is a conjunction of two regularity properties of the chosen field. Its equality to the canonical conditional integral is assumed a.e., not pointwise.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            theorem condDistribIntegralNamedFieldRegularity {Ω β γ F : Type*}
                                [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                                [NormedAddCommGroup F] [NormedSpace ℝ F]
                                [StandardBorelSpace γ] [Nonempty γ]
                                {μ : Measure Ω} [IsFiniteMeasure μ] {hatRho : Measure β}
                                {X : Ω → β} {Y : Ω → γ} {f : β × γ → F} {field : β → F}
                                (hhatRho : hatRho = μ.map X)
                                (hY : AEMeasurable Y μ)
                                (hfMeas : AEStronglyMeasurable f (μ.map fun a => (X a, Y a)))
                                (hfInt : Integrable f (μ.map fun a => (X a, Y a)))
                                (hfield :
                                  (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                                    =ᵐ[hatRho] field) :
                                AEStronglyMeasurable field hatRho ∧ Integrable field hatRho

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Obtain canonical measurability

                              Apply the named-law measurability adapter to C using the explicit joint measurability premise.

                            2. 2Obtain canonical integrability

                              Apply the named-law integrability adapter using the joint integrability premise.

                            3. 3Transfer both properties across a.e. equality

                              A.e. strong measurability and integrability are invariant under changing a function on a null set, so both properties pass to v.

                            Full assumptions and notation

                            All objects and hypotheses

                            • Ω, β and γ are measurable spaces; γ is Standard Borel and nonempty.
                            • μ is a finite measure on Ω, not necessarily a probability; X:Ω→β and Y:Ω→γ are functions.
                            • F is a real normed vector space (NormedAddCommGroup and NormedSpace ℝ); no CompleteSpace assumption is added. The integrand f:β×γ→F is as specified below.
                            • Notation: λ=(ω↦(Xω,Yω))#μ, m=X#μ, q(x)=condDistrib(Y|X;μ)(x), and C(x)=∫f(x,y)dq(x)(y).
                            • ρ̂ is a measure on β equal to X#μ, and v:β→F is a chosen field.
                            • Y is μ-a.e. measurable; hfMeas explicitly supplies AEStronglyMeasurable f λ and hfInt explicitly supplies Integrable f λ (both premises are retained).
                            • hfield supplies C=v ρ̂-a.e.; X a.e. measurability is not separately required.

                            Notation and interpretation

                            Pushforward law

                            P is an arbitrary measure unless explicitly declared finite or a probability. The word law here abbreviates a pushforward measure; probability-language interpretations require normalization separately. Mathlib totalizes map to zero when X is not a.e. measurable; unqualified map-congruence and some law-space adapters intentionally retain that generality.

                            \[(X_\#\mu)(A)=\mu(X^{-1}A)\quad\text{when the measurable pushforward interpretation applies}\]
                            A.e. and strong measurability

                            A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                            \[f=g\quad\mu\text{-a.e.}\]
                            Integrability and Bochner integrals

                            L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                            \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]
                            Conditional integral notation

                            The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted. Finite non-probability measures are reconstructed with their original total mass; any version changes on marginal-null inputs must retain a measurable kernel.

                            \[\lambda=(X,Y)_\#\mu,\quad m=X_\#\mu,\quad q(x)=\operatorname{condDistrib}(Y\mid X;\mu)(x),\quad C(x)=\int f(x,y)\,dq(x)(y)\]

                            Mathematical proof

                            1. Obtain canonical measurability

                            Apply the named-law measurability adapter to C using the explicit joint measurability premise.

                            \[C\in\operatorname{AESM}(\widehat\rho).\]
                            Corresponding Lean step

                            condDistribIntegralNamedLawAEStronglyMeasurable hhatRho hY hfMeas

                            2. Obtain canonical integrability

                            Apply the named-law integrability adapter using the joint integrability premise.

                            \[C\in L^1(\widehat\rho).\]
                            Corresponding Lean step

                            condDistribIntegralNamedLawIntegrable hhatRho hY hfInt

                            3. Transfer both properties across a.e. equality

                            A.e. strong measurability and integrability are invariant under changing a function on a null set, so both properties pass to v.

                            \[C=v\ \widehat\rho\text{-a.e.}\Longrightarrow v\in\operatorname{AESM}(\widehat\rho)\cap L^1(\widehat\rho).\]
                            Corresponding Lean step

                            ⟨hmeas.congr hfield,hint.congr hfield⟩

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean proof · condDistribIntegralNamedFieldRegularity

                            Two reused regularity facts apply to the canonical integral, and their a.e.-congruence rules transfer them to the supplied version.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            theorem condDistribIntegralNamedFieldRegularity {Ω β γ F : Type*}
                                [MeasurableSpace Ω] [MeasurableSpace β] [MeasurableSpace γ]
                                [NormedAddCommGroup F] [NormedSpace ℝ F]
                                [StandardBorelSpace γ] [Nonempty γ]
                                {μ : Measure Ω} [IsFiniteMeasure μ] {hatRho : Measure β}
                                {X : Ω → β} {Y : Ω → γ} {f : β × γ → F} {field : β → F}
                                (hhatRho : hatRho = μ.map X)
                                (hY : AEMeasurable Y μ)
                                (hfMeas : AEStronglyMeasurable f (μ.map fun a => (X a, Y a)))
                                (hfInt : Integrable f (μ.map fun a => (X a, Y a)))
                                (hfield :
                                  (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                                    =ᵐ[hatRho] field) :
                                AEStronglyMeasurable field hatRho ∧ Integrable field hatRho := by
                              have hmeas :
                                  AEStronglyMeasurable
                                    (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                                    hatRho :=
                                condDistribIntegralNamedLawAEStronglyMeasurable hhatRho hY hfMeas
                              have hint :
                                  Integrable
                                    (fun x => ∫ y, f (x, y) ∂ProbabilityTheory.condDistrib Y X μ x)
                                    hatRho :=
                                condDistribIntegralNamedLawIntegrable hhatRho hY hfInt
                              exact ⟨hmeas.congr hfield, hint.congr hfield⟩

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • The selected conditional distribution is a probability kernel, characterized as a conditional law only almost everywhere under the conditioning marginal. No pointwise choice, simultaneous equality on all events from a single-event a.e. theorem, or null-fiber support is asserted.
                            • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                            • Does not choose v or prove its version equality. Both explicit regularity premises remain in the source signature. No whole-PDE regularity follows.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            • MeasureTheory.AEStronglyMeasurable.congr
                            • MeasureTheory.Integrable.congr

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Record the name and provenance of a measure

                            AutoSamplingTheory.MeasureContract · structure · Teaching coverage

                            Read this first

                            Mathematical statement

                            This record stores descriptions of a named measure, its state space, optional density and smoothness labels, and its source. It contains no actual Measure value and no evidence that a density or regularity property exists.

                            \[\operatorname{fields}(\texttt{MeasureContract})=\{\texttt{name},\texttt{stateSpace},\texttt{densityName},\texttt{smoothness},\texttt{source}\}.\]
                            Lean statement · MeasureContract

                            This declaration introduces a record type. Its 5 fields are strings and a source anchor, not mathematical objects satisfying the written claim.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            structure MeasureContract where
                              name : String
                              stateSpace : String
                              densityName : String := ""
                              smoothness : String := ""
                              source : SourceAnchor
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Specify the record's data slots

                              The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            2. 2Provide defaults and routine data operations

                              Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            Full assumptions and notation

                            All objects and hypotheses

                            • name has type String: required label of the measure or law.
                            • stateSpace has type String: required description of its state space.
                            • densityName has type String: optional density label, default empty string.
                            • smoothness has type String: optional regularity description, default empty string.
                            • source has type SourceAnchor: required provenance record.
                            • No ambient measurable space, measure, analytic hypothesis or proof witness is a parameter of this metadata structure. Default fields may be overridden when constructing a record.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Specify the record's data slots

                            The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            \[\text{descriptive fields}+\text{provenance}\longmapsto\text{one record}.\]
                            Corresponding Lean step

                            structure MeasureContract where; listed fields

                            2. Provide defaults and routine data operations

                            Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            \[\operatorname{DecidableEq}(\text{records})\ne\text{decision procedure for the recorded mathematics}.\]
                            Corresponding Lean step

                            field defaults; deriving Repr, DecidableEq

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · MeasureContract

                            There is no theorem proof here. The body declares the fields and their defaults; derived display and equality support are ordinary operations on that data.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            structure MeasureContract where
                              name : String
                              stateSpace : String
                              densityName : String := ""
                              smoothness : String := ""
                              source : SourceAnchor
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • Measure and regularity labels remain text; a record can describe an unproved object.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Record a forward-KL expression and its status

                            AutoSamplingTheory.KLContract · structure · Teaching coverage

                            Read this first

                            Mathematical statement

                            This record stores labels for rho and pi, a written forward-KL expression, source provenance and a status defaulting to contractOnly. It does not define KL as an analytic functional or prove the expression correct.

                            \[\operatorname{fields}(\texttt{KLContract})=\{\texttt{rho},\texttt{pi},\texttt{expression},\texttt{source},\texttt{status}\}.\]
                            Lean statement · KLContract

                            This declaration introduces a record type. Its 5 fields are descriptions, provenance and a status label, not mathematical objects satisfying the written claim.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            structure KLContract where
                              rho : String
                              pi : String
                              expression : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.contractOnly
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Specify the record's data slots

                              The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            2. 2Provide defaults and routine data operations

                              Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            Full assumptions and notation

                            All objects and hypotheses

                            • rho has type String: first measure label.
                            • pi has type String: reference-measure label.
                            • expression has type String: written KL expression.
                            • source has type SourceAnchor: provenance.
                            • status has type ProofStatus: default contractOnly.
                            • No ambient measurable space, measure, analytic hypothesis or proof witness is a parameter of this metadata structure. Default fields may be overridden when constructing a record.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Specify the record's data slots

                            The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            \[\text{descriptive fields}+\text{provenance}\longmapsto\text{one record}.\]
                            Corresponding Lean step

                            structure KLContract where; listed fields

                            2. Provide defaults and routine data operations

                            Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            \[\operatorname{DecidableEq}(\text{records})\ne\text{decision procedure for the recorded mathematics}.\]
                            Corresponding Lean step

                            field defaults; deriving Repr, DecidableEq

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · KLContract

                            There is no theorem proof here. The body declares the fields and their defaults; derived display and equality support are ordinary operations on that data.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            structure KLContract where
                              rho : String
                              pi : String
                              expression : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.contractOnly
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • The order rho, pi records forward KL notation but supplies no absolute continuity, finite entropy or nonnegativity proof.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Record a Fisher-information expression and its status

                            AutoSamplingTheory.FIContract · structure · Teaching coverage

                            Read this first

                            Mathematical statement

                            This record stores labels for the two measures, a Fisher-information expression, source provenance and a status defaulting to contractOnly. It contains no gradient, density or integrability witness.

                            \[\operatorname{fields}(\texttt{FIContract})=\{\texttt{rho},\texttt{pi},\texttt{expression},\texttt{source},\texttt{status}\}.\]
                            Lean statement · FIContract

                            This declaration introduces a record type. Its 5 fields are descriptions, provenance and a status label, not mathematical objects satisfying the written claim.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            structure FIContract where
                              rho : String
                              pi : String
                              expression : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.contractOnly
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Specify the record's data slots

                              The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            2. 2Provide defaults and routine data operations

                              Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            Full assumptions and notation

                            All objects and hypotheses

                            • rho has type String: first measure label.
                            • pi has type String: reference-measure label.
                            • expression has type String: written Fisher-information expression.
                            • source has type SourceAnchor: provenance.
                            • status has type ProofStatus: default contractOnly.
                            • No ambient measurable space, measure, analytic hypothesis or proof witness is a parameter of this metadata structure. Default fields may be overridden when constructing a record.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Specify the record's data slots

                            The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            \[\text{descriptive fields}+\text{provenance}\longmapsto\text{one record}.\]
                            Corresponding Lean step

                            structure FIContract where; listed fields

                            2. Provide defaults and routine data operations

                            Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            \[\operatorname{DecidableEq}(\text{records})\ne\text{decision procedure for the recorded mathematics}.\]
                            Corresponding Lean step

                            field defaults; deriving Repr, DecidableEq

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · FIContract

                            There is no theorem proof here. The body declares the fields and their defaults; derived display and equality support are ordinary operations on that data.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            structure FIContract where
                              rho : String
                              pi : String
                              expression : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.contractOnly
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • Writing a Fisher-information expression does not establish differentiability, Sobolev regularity or finiteness.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Record a log-Sobolev inequality as an obligation

                            AutoSamplingTheory.LSIContract · structure · Teaching coverage

                            Read this first

                            Mathematical statement

                            This record stores a measure label, a constant label, an inequality written as text, its source, and a status defaulting to obligation. No log-Sobolev inequality is asserted as a proposition by this structure.

                            \[\operatorname{fields}(\texttt{LSIContract})=\{\texttt{measureName},\texttt{constantName},\texttt{statement},\texttt{source},\texttt{status}\}.\]
                            Lean statement · LSIContract

                            This declaration introduces a record type. Its 5 fields are descriptions, provenance and a status label, not mathematical objects satisfying the written claim.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            structure LSIContract where
                              measureName : String
                              constantName : String
                              statement : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.obligation
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Specify the record's data slots

                              The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            2. 2Provide defaults and routine data operations

                              Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            Full assumptions and notation

                            All objects and hypotheses

                            • measureName has type String: measure label.
                            • constantName has type String: inequality-constant label.
                            • statement has type String: written inequality.
                            • source has type SourceAnchor: provenance.
                            • status has type ProofStatus: default obligation.
                            • No ambient measurable space, measure, analytic hypothesis or proof witness is a parameter of this metadata structure. Default fields may be overridden when constructing a record.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Specify the record's data slots

                            The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            \[\text{descriptive fields}+\text{provenance}\longmapsto\text{one record}.\]
                            Corresponding Lean step

                            structure LSIContract where; listed fields

                            2. Provide defaults and routine data operations

                            Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            \[\operatorname{DecidableEq}(\text{records})\ne\text{decision procedure for the recorded mathematics}.\]
                            Corresponding Lean step

                            field defaults; deriving Repr, DecidableEq

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · LSIContract

                            There is no theorem proof here. The body declares the fields and their defaults; derived display and equality support are ordinary operations on that data.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            structure LSIContract where
                              measureName : String
                              constantName : String
                              statement : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.obligation
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • No constant convention, positivity, admissible test class or validity of LSI is enforced by string fields.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Record a Poincaré inequality as an obligation

                            AutoSamplingTheory.PIContract · structure · Teaching coverage

                            Read this first

                            Mathematical statement

                            This record stores labels and text for a Poincaré inequality with provenance and a default obligation status. It is metadata rather than a proof of the inequality.

                            \[\operatorname{fields}(\texttt{PIContract})=\{\texttt{measureName},\texttt{constantName},\texttt{statement},\texttt{source},\texttt{status}\}.\]
                            Lean statement · PIContract

                            This declaration introduces a record type. Its 5 fields are descriptions, provenance and a status label, not mathematical objects satisfying the written claim.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            structure PIContract where
                              measureName : String
                              constantName : String
                              statement : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.obligation
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Specify the record's data slots

                              The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            2. 2Provide defaults and routine data operations

                              Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            Full assumptions and notation

                            All objects and hypotheses

                            • measureName has type String: measure label.
                            • constantName has type String: inequality-constant label.
                            • statement has type String: written inequality.
                            • source has type SourceAnchor: provenance.
                            • status has type ProofStatus: default obligation.
                            • No ambient measurable space, measure, analytic hypothesis or proof witness is a parameter of this metadata structure. Default fields may be overridden when constructing a record.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Specify the record's data slots

                            The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            \[\text{descriptive fields}+\text{provenance}\longmapsto\text{one record}.\]
                            Corresponding Lean step

                            structure PIContract where; listed fields

                            2. Provide defaults and routine data operations

                            Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            \[\operatorname{DecidableEq}(\text{records})\ne\text{decision procedure for the recorded mathematics}.\]
                            Corresponding Lean step

                            field defaults; deriving Repr, DecidableEq

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · PIContract

                            There is no theorem proof here. The body declares the fields and their defaults; derived display and equality support are ordinary operations on that data.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            structure PIContract where
                              measureName : String
                              constantName : String
                              statement : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.obligation
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • The structure does not assert a spectral gap, compare Poincaré and LSI constants, or impose a function domain.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Record a proposed continuity-equation velocity

                            AutoSamplingTheory.TransportVelocityContract · structure · Teaching coverage

                            Read this first

                            Mathematical statement

                            This record stores a named measure path, a named velocity field, a continuity equation written as text, provenance and a default contractOnly status. It contains no analytic path or velocity value.

                            \[\operatorname{fields}(\texttt{TransportVelocityContract})=\{\texttt{pathName},\texttt{velocityName},\texttt{continuityEquation},\texttt{source},\texttt{status}\}.\]
                            Lean statement · TransportVelocityContract

                            This declaration introduces a record type. Its 5 fields are descriptions, provenance and a status label, not mathematical objects satisfying the written claim.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            structure TransportVelocityContract where
                              pathName : String
                              velocityName : String
                              continuityEquation : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.contractOnly
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Specify the record's data slots

                              The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            2. 2Provide defaults and routine data operations

                              Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            Full assumptions and notation

                            All objects and hypotheses

                            • pathName has type String: measure-path label.
                            • velocityName has type String: velocity-field label.
                            • continuityEquation has type String: written continuity equation.
                            • source has type SourceAnchor: provenance.
                            • status has type ProofStatus: default contractOnly.
                            • No ambient measurable space, measure, analytic hypothesis or proof witness is a parameter of this metadata structure. Default fields may be overridden when constructing a record.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Specify the record's data slots

                            The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            \[\text{descriptive fields}+\text{provenance}\longmapsto\text{one record}.\]
                            Corresponding Lean step

                            structure TransportVelocityContract where; listed fields

                            2. Provide defaults and routine data operations

                            Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            \[\operatorname{DecidableEq}(\text{records})\ne\text{decision procedure for the recorded mathematics}.\]
                            Corresponding Lean step

                            field defaults; deriving Repr, DecidableEq

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · TransportVelocityContract

                            There is no theorem proof here. The body declares the fields and their defaults; derived display and equality support are ordinary operations on that data.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            structure TransportVelocityContract where
                              pathName : String
                              velocityName : String
                              continuityEquation : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.contractOnly
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • A stored continuity equation does not prove weak differentiability, divergence regularity, boundary behavior or a transport identity.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Record the intended labels of a guided tilt

                            AutoSamplingTheory.GuidedTiltContract · structure · Teaching coverage

                            Read this first

                            Mathematical statement

                            This record stores names for a base path, guide, guided path and terminal target together with a source and default contractOnly status. The intended exponentially tilted relationship is descriptive, not an enforced measure equality.

                            \[\operatorname{fields}(\texttt{GuidedTiltContract})=\{\texttt{basePath},\texttt{guideName},\texttt{guidedPath},\texttt{terminalTarget},\texttt{source},\texttt{status}\}.\]
                            Lean statement · GuidedTiltContract

                            This declaration introduces a record type. Its 6 fields are descriptions, provenance and a status label, not mathematical objects satisfying the written claim.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            structure GuidedTiltContract where
                              basePath : String
                              guideName : String
                              guidedPath : String
                              terminalTarget : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.contractOnly
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Specify the record's data slots

                              The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            2. 2Provide defaults and routine data operations

                              Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            Full assumptions and notation

                            All objects and hypotheses

                            • basePath has type String: base-path label.
                            • guideName has type String: guide label.
                            • guidedPath has type String: tilted-path label.
                            • terminalTarget has type String: terminal target label.
                            • source has type SourceAnchor: provenance.
                            • status has type ProofStatus: default contractOnly.
                            • No ambient measurable space, measure, analytic hypothesis or proof witness is a parameter of this metadata structure. Default fields may be overridden when constructing a record.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Specify the record's data slots

                            The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            \[\text{descriptive fields}+\text{provenance}\longmapsto\text{one record}.\]
                            Corresponding Lean step

                            structure GuidedTiltContract where; listed fields

                            2. Provide defaults and routine data operations

                            Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            \[\operatorname{DecidableEq}(\text{records})\ne\text{decision procedure for the recorded mathematics}.\]
                            Corresponding Lean step

                            field defaults; deriving Repr, DecidableEq

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · GuidedTiltContract

                            There is no theorem proof here. The body declares the fields and their defaults; derived display and equality support are ordinary operations on that data.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            structure GuidedTiltContract where
                              basePath : String
                              guideName : String
                              guidedPath : String
                              terminalTarget : String
                              source : SourceAnchor
                              status : ProofStatus := ProofStatus.contractOnly
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • It proves neither finite normalizer nor target correctness and does not construct the tilted law.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Record the cited entropy-duality interface

                            AutoSamplingTheory.DvVariationalFormulaInterface · structure · Teaching coverage

                            Read this first

                            Mathematical statement

                            This record packages text describing the Donsker–Varadhan variational formula, its intended hypotheses, selected tests, scalar bridges and citation. Status defaults to sourceCited. Every analytic slot is text, not a Lean hypothesis or proved equality.

                            \[\operatorname{fields}(\texttt{DvVariationalFormulaInterface})=\{\texttt{source},\texttt{probabilityMeasures},\texttt{klFunctional},\texttt{testFunctionClass},\texttt{finiteLogMgfPredicate},\texttt{logMgfFunctional},\texttt{variationalFunctional},\texttt{supremumStatement},\texttt{oneSidedConsequence},\texttt{oneSidedScalarBridge},\texttt{citation},\texttt{status}\}.\]
                            Lean statement · DvVariationalFormulaInterface

                            This declaration introduces a record type. Its 12 fields are descriptions, provenance and a status label, not mathematical objects satisfying the written claim.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            structure DvVariationalFormulaInterface where
                              source : SourceAnchor
                              probabilityMeasures : String
                              klFunctional : String
                              testFunctionClass : String
                              finiteLogMgfPredicate : String
                              logMgfFunctional : String
                              variationalFunctional : String
                              supremumStatement : String
                              oneSidedConsequence : String
                              oneSidedScalarBridge : String
                              citation : String
                              status : ProofStatus := ProofStatus.sourceCited
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Specify the record's data slots

                              The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            2. 2Provide defaults and routine data operations

                              Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            Full assumptions and notation

                            All objects and hypotheses

                            • source has type SourceAnchor: provenance.
                            • probabilityMeasures has type String: described measure assumptions.
                            • klFunctional has type String: KL expression.
                            • testFunctionClass has type String: described test class.
                            • finiteLogMgfPredicate has type String: described admissibility predicate.
                            • logMgfFunctional has type String: log moment-generating-functional description.
                            • variationalFunctional has type String: variational-test value description.
                            • supremumStatement has type String: written supremum identity.
                            • oneSidedConsequence has type String: written test-wise consequence.
                            • oneSidedScalarBridge has type String: description of available bridge declarations.
                            • citation has type String: citation text.
                            • status has type ProofStatus: default sourceCited.
                            • No ambient measurable space, measure, analytic hypothesis or proof witness is a parameter of this metadata structure. Default fields may be overridden when constructing a record.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Specify the record's data slots

                            The structure declares exactly the listed fields and their data types. A source anchor is itself provenance data from Core, not a proof of the described statement.

                            \[\text{descriptive fields}+\text{provenance}\longmapsto\text{one record}.\]
                            Corresponding Lean step

                            structure DvVariationalFormulaInterface where; listed fields

                            2. Provide defaults and routine data operations

                            Any listed defaults are filled when omitted. Derived representation and decidable equality let the program display and compare records; they compare data and do not decide analytic truth.

                            \[\operatorname{DecidableEq}(\text{records})\ne\text{decision procedure for the recorded mathematics}.\]
                            Corresponding Lean step

                            field defaults; deriving Repr, DecidableEq

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · DvVariationalFormulaInterface

                            There is no theorem proof here. The body declares the fields and their defaults; derived display and equality support are ordinary operations on that data.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            structure DvVariationalFormulaInterface where
                              source : SourceAnchor
                              probabilityMeasures : String
                              klFunctional : String
                              testFunctionClass : String
                              finiteLogMgfPredicate : String
                              logMgfFunctional : String
                              variationalFunctional : String
                              supremumStatement : String
                              oneSidedConsequence : String
                              oneSidedScalarBridge : String
                              citation : String
                              status : ProofStatus := ProofStatus.sourceCited
                            deriving Repr, DecidableEq

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • No admissibility predicate, supremum functional or theorem is enforced by this data schema; even sourceCited is a metadata label, not certification.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Construct a source-cited DV proof-obligation record

                            AutoSamplingTheory.dvVariationalObligation · def · Teaching coverage

                            Read this first

                            Mathematical statement

                            Given any source anchor, construct a ProofObligation with id probability.dv_variational_formula, the written KL variational-supremum statement, that source, sourceCited status, and a note that the result must be ported or kept as a cited analytic dependency. This creates metadata, not a proof of entropy duality.

                            \[\operatorname{id}=\texttt{probability.dv\_variational\_formula},\qquad \operatorname{status}=\texttt{sourceCited}.\]
                            Lean statement · dvVariationalObligation

                            The function accepts a provenance record and returns a workflow record, not an inequality or an equality of analytic quantities.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            def dvVariationalObligation (source : SourceAnchor) : ProofObligation

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Populate the obligation fields

                              Store the fixed id and variational statement alongside the caller's source anchor.

                            2. 2Keep its unproved status explicit

                              Set sourceCited and attach the port-or-cite note. No term of a variational-identity proposition is returned.

                            Full assumptions and notation

                            All objects and hypotheses

                            • source is any Core SourceAnchor; it is the sole function parameter.
                            • The stored text describes KL(ν‖μ)=sup_Z{EνZ−log Eμexp Z} under the paper's integrability assumptions; those assumptions are text, not formal parameters.
                            • ProofObligation's omitted dependsOn list is empty by default; the supplied note is descriptive.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Populate the obligation fields

                            Store the fixed id and variational statement alongside the caller's source anchor.

                            \[\text{source}\longmapsto(\text{id},\text{statement},\text{source}).\]
                            Corresponding Lean step

                            id, statement, source fields

                            2. Keep its unproved status explicit

                            Set sourceCited and attach the port-or-cite note. No term of a variational-identity proposition is returned.

                            \[\text{result type}=\texttt{ProofObligation}\ne\text{proof of KL duality}.\]
                            Corresponding Lean step

                            status := ProofStatus.sourceCited; note field

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · dvVariationalObligation

                            The body initializes named data fields. The word sourceCited preserves the intended cited-dependency status and supplies no proof certificate.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            def dvVariationalObligation (source : SourceAnchor) : ProofObligation where
                              id := "probability.dv_variational_formula"
                              statement := "KL(nu || mu) = sup_Z { E_nu[Z] - log E_mu[exp Z] } under the paper's integrability assumptions."
                              source := source
                              status := ProofStatus.sourceCited
                              note := "Port from Mathlib/SLT or keep as cited analytic dependency until formalized."

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • No Boucheron supremum equality has been proved by this constructor. The passed anchor is not validated here.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            Populate the paper-facing DV interface without claiming its proof

                            AutoSamplingTheory.dvVariationalFormulaInterface · def · Teaching coverage

                            Read this first

                            Mathematical statement

                            Given a source anchor, populate the DvVariationalFormulaInterface with the existing paper-facing textual description: common probability measures, KL with source-specific side conditions, measurable real tests with finite log-mgf, the variational supremum expression, its one-sided consequence, descriptions of available scalar/tilting bridges, the Boucheron–Lugosi–Massart Corollary 4.15 citation, and sourceCited status. These are stored descriptions only.

                            \[\text{recorded target: }\mathrm{KL}(\nu\|\mu)=\sup_Z\left\{\mathbb E_\nu Z-\log\mathbb E_\mu e^Z\right\};\qquad \text{record status: sourceCited}.\]
                            Lean statement · dvVariationalFormulaInterface

                            This lower-case function returns the upper-case interface record. None of its textual analytic clauses is a theorem hypothesis or conclusion.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            def dvVariationalFormulaInterface (source : SourceAnchor) :
                                DvVariationalFormulaInterface

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Record the intended domain and functionals

                              Write the measure assumptions, real measurable test class, finite-log-mgf predicate and two functional expressions into their textual slots.

                            2. 2Record target and bridge descriptions separately

                              The supremum identity remains source-cited. The one-sided consequence and names of existing scalar and tilted-backend bridges describe available narrower results, without converting the supremum identity into a proved theorem.

                            3. 3Attach provenance and the retained status

                              Store the caller's source, fixed citation text and sourceCited label.

                            Full assumptions and notation

                            All objects and hypotheses

                            • source:SourceAnchor is the only parameter; no measures, test functions, absolute-continuity proofs or admissibility witnesses are passed.
                            • All twelve data fields of DvVariationalFormulaInterface are populated. The reference to SALD appendix.tex:73–79 is an existing source comment, not a new independent reading or source-fidelity verdict.

                            Notation and interpretation

                            Analytic values versus metadata

                            Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                            \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                            Construction and meaning

                            1. Record the intended domain and functionals

                            Write the measure assumptions, real measurable test class, finite-log-mgf predicate and two functional expressions into their textual slots.

                            \[\text{recorded }V(Z)=\mathbb E_\nu Z-\log\mathbb E_\mu e^Z.\]
                            Corresponding Lean step

                            probabilityMeasures through variationalFunctional fields

                            2. Record target and bridge descriptions separately

                            The supremum identity remains source-cited. The one-sided consequence and names of existing scalar and tilted-backend bridges describe available narrower results, without converting the supremum identity into a proved theorem.

                            \[V(Z)\le\mathrm{KL}\Longrightarrow\mathbb E_\nu Z\le\mathrm{KL}+\log\mathbb E_\mu e^Z\quad\text{(recorded bridge shape)}.\]
                            Corresponding Lean step

                            supremumStatement, oneSidedConsequence, oneSidedScalarBridge

                            3. Attach provenance and the retained status

                            Store the caller's source, fixed citation text and sourceCited label.

                            \[\operatorname{status}=\texttt{sourceCited},\quad\operatorname{source}=\text{supplied anchor}.\]
                            Corresponding Lean step

                            source, citation, status fields

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean construction · dvVariationalFormulaInterface

                            The body is a record literal containing descriptions and citations. Existing theorem names appear inside a string, so they are documentary references rather than Lean proof dependencies.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            def dvVariationalFormulaInterface (source : SourceAnchor) :
                                DvVariationalFormulaInterface where
                              source := source
                              probabilityMeasures := "mu and nu are probability distributions on the same measurable space."
                              klFunctional := "KL(nu || mu), with the paper's absolute-continuity and finite-entropy side conditions supplied by each theorem block."
                              testFunctionClass := "real-valued measurable random variables Z on the common space."
                              finiteLogMgfPredicate := "log E_mu[exp(Z)] < +infty."
                              logMgfFunctional := "Z |-> log E_mu[exp(Z)]."
                              variationalFunctional := "Z |-> E_nu[Z] - log E_mu[exp(Z)]."
                              supremumStatement := "KL(nu || mu) = sup_Z { E_nu[Z] - log E_mu[exp(Z)] }, where the supremum is over finite-log-mgf tests."
                              oneSidedConsequence := "For every admissible Z, E_nu[Z] <= KL(nu || mu) + log E_mu[exp(Z)]."
                              oneSidedScalarBridge := "AutoSamplingTheory.dvVariationalOneSidedConsequenceScalar proves the real-order rearrangement from E_nu[Z] - logMgf <= KL to E_nu[Z] <= KL + logMgf; AutoSamplingTheory.dvVariationalOneSidedFromSupremumScalar additionally proves the scalar step from admissible-test membership plus the source supremum identity to that one-sided bound; AutoSamplingTheory.dvVariationalTiltedRightOneSidedConsequence combines the Mathlib tilted backend with the scalar rearrangement under explicit selected-test hypotheses."
                              citation := "Boucheron, Lugosi, and Massart, Concentration Inequalities, Corollary 4.15, cited by SALD appendix.tex:73."
                              status := ProofStatus.sourceCited

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                            • Names embedded in oneSidedScalarBridge are not formal theorem dependencies.
                            • Do not present the stored test class or finite-log-mgf clause as a proved sufficient hypothesis for the full supremum equality.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                            Mathlib API called (external library)

                            No direct Mathlib call recorded; see the Samplinglib parents.

                            Mathematical sources

                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                            Samplinglib mathematical lesson

                            The square-root density squares back to the density

                            AutoSamplingTheory.lsiKlFiSqrtDensitySquareScalar · theorem · Teaching coverage

                            Read this first

                            Mathematical statement

                            For every nonnegative real number r, the square of its nonnegative real square root equals r.

                            \[r\ge0\Longrightarrow(\sqrt r)^2=r.\]
                            Lean statement · lsiKlFiSqrtDensitySquareScalar

                            The density interpretation is optional motivation. The formal parameter is only a real number with a nonnegativity proof.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            theorem lsiKlFiSqrtDensitySquareScalar {r : Real} (hr : 0 ≤ r) :
                                (Real.sqrt r) ^ 2 = r

                            Exact module and namespace context

                            Proof roadmap

                            1. 1Apply the defining square-root identity

                              The nonnegativity hypothesis is exactly what the real square-root theorem requires.

                            Full assumptions and notation

                            All objects and hypotheses

                            • r is a real number and hr supplies 0≤r; no measure or density construction is assumed.

                            Mathematical proof

                            1. Apply the defining square-root identity

                            The nonnegativity hypothesis is exactly what the real square-root theorem requires.

                            \[(\sqrt r)^2=r\quad(r\ge0).\]
                            Corresponding Lean step

                            Real.sq_sqrt hr

                            Lean verification

                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                            Lean proof · lsiKlFiSqrtDensitySquareScalar

                            The proof directly reuses the existing real square-root theorem, without any differentiation or integration.

                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                            Download module (.lean)
                            theorem lsiKlFiSqrtDensitySquareScalar {r : Real} (hr : 0 ≤ r) :
                                (Real.sqrt r) ^ 2 = r := by
                              exact Real.sq_sqrt hr

                            Exact module and namespace context

                            Scope and omitted-condition boundaries
                            • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                            Sources, dependencies, and reuse

                            Source and reuse

                            Samplinglib parents called

                              Mathlib API called (external library)

                              • Real.sq_sqrt

                              Mathematical sources

                              Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                              Samplinglib mathematical lesson

                              Rewrite the square-root test's entropy integrand

                              AutoSamplingTheory.lsiKlFiSqrtDensityEntropyIntegrandScalar · theorem · Teaching coverage

                              Read this first

                              Mathematical statement

                              For every real r≥0, the expression (√r)² log((√r)²) equals r log r, using Mathlib's real logarithm convention, including its value at zero.

                              \[r\ge0\Longrightarrow(\sqrt r)^2\log((\sqrt r)^2)=r\log r.\]
                              Lean statement · lsiKlFiSqrtDensityEntropyIntegrandScalar

                              The theorem is equality of two real numbers. It does not assume or assert that either expression is integrable under any measure.

                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                              theorem lsiKlFiSqrtDensityEntropyIntegrandScalar {r : Real} (hr : 0 ≤ r) :
                                  (Real.sqrt r) ^ 2 * Real.log ((Real.sqrt r) ^ 2) = r * Real.log r

                              Exact module and namespace context

                              Proof roadmap

                              1. 1Substitute the square identity in both occurrences

                                Replace the multiplicative factor and the logarithm's argument by r using the already proved square-root equality.

                              Full assumptions and notation

                              All objects and hypotheses

                              • r∈ℝ and 0≤r. The real logarithm is totalized; Real.log 0=0, so the displayed identity includes r=0.

                              Mathematical proof

                              1. Substitute the square identity in both occurrences

                              Replace the multiplicative factor and the logarithm's argument by r using the already proved square-root equality.

                              \[(\sqrt r)^2=r\Longrightarrow(\sqrt r)^2\log((\sqrt r)^2)=r\log r.\]
                              Corresponding Lean step

                              rw [lsiKlFiSqrtDensitySquareScalar hr]

                              Lean verification

                              The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                              Lean proof · lsiKlFiSqrtDensityEntropyIntegrandScalar

                              A rewrite uses the same equality wherever the squared square root occurs, including inside the logarithm.

                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                              Download module (.lean)
                              theorem lsiKlFiSqrtDensityEntropyIntegrandScalar {r : Real} (hr : 0 ≤ r) :
                                  (Real.sqrt r) ^ 2 * Real.log ((Real.sqrt r) ^ 2) = r * Real.log r := by
                                rw [lsiKlFiSqrtDensitySquareScalar hr]

                              Exact module and namespace context

                              Scope and omitted-condition boundaries
                              • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                              • No finite-entropy or analytic zero-density admissibility theorem is asserted.
                              Sources, dependencies, and reuse

                              Source and reuse

                              Samplinglib parents called

                              Mathlib API called (external library)

                              No direct Mathlib call recorded; see the Samplinglib parents.

                              Mathematical sources

                              Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                              Samplinglib mathematical lesson

                              Transfer a supplied unit-mass identity

                              AutoSamplingTheory.lsiKlFiSqrtDensityNormalizationScalar · theorem · Teaching coverage

                              Read this first

                              Mathematical statement

                              Let densityMass and testMass be real numbers. If testMass=densityMass and densityMass=1, then testMass=1. Their names carry no measure-theoretic meaning unless an application supplies it.

                              \[\text{testMass}=\text{densityMass},\quad\text{densityMass}=1\Longrightarrow\text{testMass}=1.\]
                              Lean statement · lsiKlFiSqrtDensityNormalizationScalar

                              The two inputs are arbitrary real numbers. Equalities connecting them to actual integrals are not part of this theorem.

                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                              theorem lsiKlFiSqrtDensityNormalizationScalar {densityMass testMass : Real}
                                  (htest : testMass = densityMass)
                                  (hdensity : densityMass = 1) :
                                  testMass = 1

                              Exact module and namespace context

                              Proof roadmap

                              1. 1Chain the given equalities

                                Replace testMass by densityMass, and then replace densityMass by one.

                              Full assumptions and notation

                              All objects and hypotheses

                              • densityMass,testMass∈ℝ; the two displayed equalities are supplied.

                              Mathematical proof

                              1. Chain the given equalities

                              Replace testMass by densityMass, and then replace densityMass by one.

                              \[\text{testMass}=\text{densityMass}=1.\]
                              Corresponding Lean step

                              rw [htest,hdensity]

                              Lean verification

                              The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                              Lean proof · lsiKlFiSqrtDensityNormalizationScalar

                              The proof uses transitivity by rewriting; it does not calculate density mass or establish probability normalization.

                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                              Download module (.lean)
                              theorem lsiKlFiSqrtDensityNormalizationScalar {densityMass testMass : Real}
                                  (htest : testMass = densityMass)
                                  (hdensity : densityMass = 1) :
                                  testMass = 1 := by
                                rw [htest, hdensity]

                              Exact module and namespace context

                              Scope and omitted-condition boundaries
                              • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                              • This is an equality handoff, not a normalization theorem for any measure.
                              Sources, dependencies, and reuse

                              Source and reuse

                              Samplinglib parents called

                                Mathlib API called (external library)

                                No direct Mathlib call recorded; see the Samplinglib parents.

                                Mathematical sources

                                Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                Samplinglib mathematical lesson

                                The Radon–Nikodym density has unit nonnegative integral

                                AutoSamplingTheory.lsiKlFiRnDerivLIntegralMassOne · theorem · Teaching coverage

                                Read this first

                                Mathematical statement

                                For probability measures ρ and π on a measurable space with ρ≪π, the nonnegative extended integral of dρ/dπ against π equals one.

                                \[\int_\alpha^{\!-}\frac{d\rho}{d\pi}\,d\pi=\rho(\alpha)=1.\]
                                Lean statement · lsiKlFiRnDerivLIntegralMassOne

                                This is the extended nonnegative integral, not the real Bochner integral; its integrand can take extended values.

                                Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                theorem lsiKlFiRnDerivLIntegralMassOne {α : Type*} [MeasurableSpace α]
                                    (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                    (hrho_pi : rho ≪ pi) :
                                    ∫⁻ x, rho.rnDeriv pi x ∂pi = 1

                                Exact module and namespace context

                                Proof roadmap

                                1. 1Recover the mass from the derivative

                                  The Radon–Nikodym mass identity under absolute continuity identifies the lower integral with the total mass of ρ.

                                2. 2Use probability normalization

                                  The total mass of ρ is one.

                                Full assumptions and notation

                                All objects and hypotheses

                                • α is an arbitrary measurable space; ρ and π are measures on it, both with IsProbabilityMeasure instances.
                                • hrho_pi supplies absolute continuity ρ≪π. Probability assumptions supply the finite/sigma-finite and Lebesgue-decomposition requirements of the imported Radon–Nikodym APIs.
                                • Write R=dρ/dπ for Mathlib's ℝ≥0∞-valued rnDeriv representative and r=R.toReal for its real-valued conversion; r≥0 everywhere.

                                Notation and interpretation

                                Integrability and Bochner integrals

                                L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                Mathematical proof

                                1. Recover the mass from the derivative

                                The Radon–Nikodym mass identity under absolute continuity identifies the lower integral with the total mass of ρ.

                                \[\int^{\!-}R\,d\pi=\rho(\alpha).\]
                                Corresponding Lean step

                                Measure.lintegral_rnDeriv hrho_pi

                                2. Use probability normalization

                                The total mass of ρ is one.

                                \[\rho(\alpha)=1.\]
                                Corresponding Lean step

                                simp

                                Lean verification

                                The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                Lean proof · lsiKlFiRnDerivLIntegralMassOne

                                The first rewrite uses the existing Radon–Nikodym theorem. Probability normalization simplifies the remaining total mass.

                                Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                Download module (.lean)
                                theorem lsiKlFiRnDerivLIntegralMassOne {α : Type*} [MeasurableSpace α]
                                    (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                    (hrho_pi : rho ≪ pi) :
                                    ∫⁻ x, rho.rnDeriv pi x ∂pi = 1 := by
                                  rw [Measure.lintegral_rnDeriv hrho_pi]
                                  simp

                                Exact module and namespace context

                                Scope and omitted-condition boundaries
                                • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                • No differentiability or admissible square-root test follows from unit mass.
                                Sources, dependencies, and reuse

                                Source and reuse

                                Samplinglib parents called

                                  Mathlib API called (external library)

                                  • MeasureTheory.Measure.lintegral_rnDeriv
                                  • MeasureTheory.IsProbabilityMeasure.measure_univ

                                  Mathematical sources

                                  Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                  Samplinglib mathematical lesson

                                  The real Radon–Nikodym density also has unit integral

                                  AutoSamplingTheory.lsiKlFiRnDerivDensityMassOne · theorem · Teaching coverage

                                  Read this first

                                  Mathematical statement

                                  For absolutely continuous probability measures ρ≪π, the real-valued function r=(dρ/dπ).toReal has real integral one against π.

                                  \[\int_\alpha r(x)\,d\pi(x)=1,\qquad r=(d\rho/d\pi)_{\mathrm{toReal}}.\]
                                  Lean statement · lsiKlFiRnDerivDensityMassOne

                                  The integrand is a particular real conversion of the extended Radon–Nikodym derivative, not an unspecified density symbol.

                                  Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                  theorem lsiKlFiRnDerivDensityMassOne {α : Type*} [MeasurableSpace α]
                                      (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                      (hrho_pi : rho ≪ pi) :
                                      ∫ x, (rho.rnDeriv pi x).toReal ∂pi = 1

                                  Exact module and namespace context

                                  Proof roadmap

                                  1. 1Apply real Radon–Nikodym mass transport

                                    The imported theorem expresses the integral of the real conversion as the real total mass of ρ. Sigma-finiteness is available from the probability instances.

                                  2. 2Simplify the total mass

                                    The real conversion of probability mass one is one.

                                  Full assumptions and notation

                                  All objects and hypotheses

                                  • α is an arbitrary measurable space; ρ and π are measures on it, both with IsProbabilityMeasure instances.
                                  • hrho_pi supplies absolute continuity ρ≪π. Probability assumptions supply the finite/sigma-finite and Lebesgue-decomposition requirements of the imported Radon–Nikodym APIs.
                                  • Write R=dρ/dπ for Mathlib's ℝ≥0∞-valued rnDeriv representative and r=R.toReal for its real-valued conversion; r≥0 everywhere.

                                  Notation and interpretation

                                  Integrability and Bochner integrals

                                  L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                  \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                  Mathematical proof

                                  1. Apply real Radon–Nikodym mass transport

                                  The imported theorem expresses the integral of the real conversion as the real total mass of ρ. Sigma-finiteness is available from the probability instances.

                                  \[\int R_{\mathrm{toReal}}\,d\pi=\rho.\mathrm{real}(\alpha).\]
                                  Corresponding Lean step

                                  Measure.integral_toReal_rnDeriv hrho_pi

                                  2. Simplify the total mass

                                  The real conversion of probability mass one is one.

                                  \[\rho.\mathrm{real}(\alpha)=1.\]
                                  Corresponding Lean step

                                  simp

                                  Lean verification

                                  The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                  Lean proof · lsiKlFiRnDerivDensityMassOne

                                  The proof reuses the real mass theorem and simplifies probability mass; it does not establish a smooth density.

                                  Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                  Download module (.lean)
                                  theorem lsiKlFiRnDerivDensityMassOne {α : Type*} [MeasurableSpace α]
                                      (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                      (hrho_pi : rho ≪ pi) :
                                      ∫ x, (rho.rnDeriv pi x).toReal ∂pi = 1 := by
                                    rw [Measure.integral_toReal_rnDeriv hrho_pi]
                                    simp

                                  Exact module and namespace context

                                  Scope and omitted-condition boundaries
                                  • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                  • The chosen real density r is (rnDeriv ρ π).toReal, with ENNReal.toReal(∞)=0. Do not replace this with an arbitrary pointwise density version; absolute continuity and probability measures justify the a.e. density interpretation.
                                  Sources, dependencies, and reuse

                                  Source and reuse

                                  Samplinglib parents called

                                    Mathlib API called (external library)

                                    • MeasureTheory.Measure.integral_toReal_rnDeriv

                                    Mathematical sources

                                    Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                    Samplinglib mathematical lesson

                                    The squared square-root Radon–Nikodym test has unit mass

                                    AutoSamplingTheory.lsiKlFiSqrtRnDerivTestMassOne · theorem · Teaching coverage

                                    Read this first

                                    Mathematical statement

                                    For probability measures ρ≪π and r=(dρ/dπ).toReal, the real integral of (√r)² against π is one.

                                    \[\int_\alpha(\sqrt{r(x)})^2\,d\pi(x)=1.\]
                                    Lean statement · lsiKlFiSqrtRnDerivTestMassOne

                                    The measure assumptions give density mass. Nonnegativity of the real conversion supplies the pointwise square identity.

                                    Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                    theorem lsiKlFiSqrtRnDerivTestMassOne {α : Type*} [MeasurableSpace α]
                                        (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                        (hrho_pi : rho ≪ pi) :
                                        ∫ x, (Real.sqrt ((rho.rnDeriv pi x).toReal)) ^ 2 ∂pi = 1

                                    Exact module and namespace context

                                    Proof roadmap

                                    1. 1Replace the target one by the density's known mass

                                      The preceding real-density theorem gives ∫r dπ=1, reducing the claim to equality of two integrals.

                                    2. 2Compare the integrands pointwise

                                      The real conversion r is nonnegative everywhere, so its square root squares to r at every x, and therefore π-a.e.

                                    3. 3Transfer a.e. equality through integration

                                      A.e.-equal integrands have equal totalized real integrals.

                                    Full assumptions and notation

                                    All objects and hypotheses

                                    • α is an arbitrary measurable space; ρ and π are measures on it, both with IsProbabilityMeasure instances.
                                    • hrho_pi supplies absolute continuity ρ≪π. Probability assumptions supply the finite/sigma-finite and Lebesgue-decomposition requirements of the imported Radon–Nikodym APIs.
                                    • Write R=dρ/dπ for Mathlib's ℝ≥0∞-valued rnDeriv representative and r=R.toReal for its real-valued conversion; r≥0 everywhere.

                                    Notation and interpretation

                                    Integrability and Bochner integrals

                                    L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                    \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                    Mathematical proof

                                    1. Replace the target one by the density's known mass

                                    The preceding real-density theorem gives ∫r dπ=1, reducing the claim to equality of two integrals.

                                    \[1=\int r\,d\pi.\]
                                    Corresponding Lean step

                                    rw [← lsiKlFiRnDerivDensityMassOne rho pi hrho_pi]

                                    2. Compare the integrands pointwise

                                    The real conversion r is nonnegative everywhere, so its square root squares to r at every x, and therefore π-a.e.

                                    \[(\sqrt{r(x)})^2=r(x)\quad\forall x.\]
                                    Corresponding Lean step

                                    Real.sq_sqrt ENNReal.toReal_nonneg

                                    3. Transfer a.e. equality through integration

                                    A.e.-equal integrands have equal totalized real integrals.

                                    \[\int(\sqrt r)^2\,d\pi=\int r\,d\pi=1.\]
                                    Corresponding Lean step

                                    integral_congr_ae

                                    Lean verification

                                    The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                    Lean proof · lsiKlFiSqrtRnDerivTestMassOne

                                    The proof first imports normalization, then applies integral congruence to a pointwise square-root equality. It supplies no differentiability of the square root.

                                    Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                    Download module (.lean)
                                    theorem lsiKlFiSqrtRnDerivTestMassOne {α : Type*} [MeasurableSpace α]
                                        (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                        (hrho_pi : rho ≪ pi) :
                                        ∫ x, (Real.sqrt ((rho.rnDeriv pi x).toReal)) ^ 2 ∂pi = 1 := by
                                      rw [← lsiKlFiRnDerivDensityMassOne rho pi hrho_pi]
                                      refine integral_congr_ae ?_
                                      filter_upwards with x
                                      exact Real.sq_sqrt ENNReal.toReal_nonneg

                                    Exact module and namespace context

                                    Scope and omitted-condition boundaries
                                    • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                    • The chosen real density r is (rnDeriv ρ π).toReal, with ENNReal.toReal(∞)=0. Do not replace this with an arbitrary pointwise density version; absolute continuity and probability measures justify the a.e. density interpretation.
                                    Sources, dependencies, and reuse

                                    Source and reuse

                                    Samplinglib parents called

                                    Mathlib API called (external library)

                                    • MeasureTheory.integral_congr_ae
                                    • Real.sq_sqrt
                                    • ENNReal.toReal_nonneg

                                    Mathematical sources

                                    Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                    Samplinglib mathematical lesson

                                    Transport the density entropy integral to the log-likelihood measure

                                    AutoSamplingTheory.lsiKlFiRnDerivEntropyIntegral · theorem · Teaching coverage

                                    Read this first

                                    Mathematical statement

                                    For probability measures ρ≪π, with r=(dρ/dπ).toReal and ℓρ,π=log r, the real integral ∫r log r dπ equals ∫ℓρ,π dρ. This is equality of Mathlib's totalized real integrals; it does not assert their integrability or finiteness as entropy quantities.

                                    \[\int_\alpha r(x)\log r(x)\,d\pi(x)=\int_\alpha\ell_{\rho,\pi}(x)\,d\rho(x).\]
                                    Lean statement · lsiKlFiRnDerivEntropyIntegral

                                    No integrability assumption appears in this theorem. The right side is the real log-likelihood integral, not an assertion that extended KL is finite.

                                    Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                    theorem lsiKlFiRnDerivEntropyIntegral {α : Type*} [MeasurableSpace α]
                                        (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                        (hrho_pi : rho ≪ pi) :
                                        ∫ x, (rho.rnDeriv pi x).toReal * Real.log (rho.rnDeriv pi x).toReal ∂pi =
                                          ∫ x, llr rho pi x ∂rho

                                    Exact module and namespace context

                                    Proof roadmap

                                    1. 1Use the log-likelihood Radon–Nikodym transport identity

                                      The imported identity changes the reference measure from π weighted by its density r to ρ. Its sigma-finite/decomposition requirements are supplied by the probability assumptions.

                                    Full assumptions and notation

                                    All objects and hypotheses

                                    • α is an arbitrary measurable space; ρ and π are measures on it, both with IsProbabilityMeasure instances.
                                    • hrho_pi supplies absolute continuity ρ≪π. Probability assumptions supply the finite/sigma-finite and Lebesgue-decomposition requirements of the imported Radon–Nikodym APIs.
                                    • Write R=dρ/dπ for Mathlib's ℝ≥0∞-valued rnDeriv representative and r=R.toReal for its real-valued conversion; r≥0 everywhere.

                                    Notation and interpretation

                                    Integrability and Bochner integrals

                                    L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                    \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                    Mathematical proof

                                    1. Use the log-likelihood Radon–Nikodym transport identity

                                    The imported identity changes the reference measure from π weighted by its density r to ρ. Its sigma-finite/decomposition requirements are supplied by the probability assumptions.

                                    \[\int r\log r\,d\pi=\int\log r\,d\rho.\]
                                    Corresponding Lean step

                                    integral_rnDeriv_mul_log hrho_pi

                                    Lean verification

                                    The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                    Lean proof · lsiKlFiRnDerivEntropyIntegral

                                    This is direct reuse of the log-likelihood-ratio change-of-measure theorem. Its general integral convention allows the equality even when the analytic entropy integral is not finite.

                                    Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                    Download module (.lean)
                                    theorem lsiKlFiRnDerivEntropyIntegral {α : Type*} [MeasurableSpace α]
                                        (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                        (hrho_pi : rho ≪ pi) :
                                        ∫ x, (rho.rnDeriv pi x).toReal * Real.log (rho.rnDeriv pi x).toReal ∂pi =
                                          ∫ x, llr rho pi x ∂rho := by
                                      exact integral_rnDeriv_mul_log hrho_pi

                                    Exact module and namespace context

                                    Scope and omitted-condition boundaries
                                    • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                                    • The chosen real density r is (rnDeriv ρ π).toReal, with ENNReal.toReal(∞)=0. Do not replace this with an arbitrary pointwise density version; absolute continuity and probability measures justify the a.e. density interpretation.
                                    • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                    • Do not identify this equality alone with a finite KL formula; downstream hypotheses must control the log-likelihood integral.
                                    Sources, dependencies, and reuse

                                    Source and reuse

                                    Samplinglib parents called

                                      Mathlib API called (external library)

                                      • MeasureTheory.integral_rnDeriv_mul_log
                                      • MeasureTheory.llr

                                      Mathematical sources

                                      Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                      Samplinglib mathematical lesson

                                      Rewrite the square-root test entropy as a log-likelihood integral

                                      AutoSamplingTheory.lsiKlFiSqrtRnDerivEntropyIntegral · theorem · Teaching coverage

                                      Read this first

                                      Mathematical statement

                                      For probability measures ρ≪π and r=(dρ/dπ).toReal, the real integral of (√r)² log((√r)²) under π equals the integral of llr(ρ,π) under ρ. No finite-entropy or test-admissibility claim is made.

                                      \[\int(\sqrt r)^2\log((\sqrt r)^2)\,d\pi=\int\ell_{\rho,\pi}\,d\rho.\]
                                      Lean statement · lsiKlFiSqrtRnDerivEntropyIntegral

                                      This substitutes a particular square-root density into an integrand. It does not certify that this function belongs to an LSI's admissible class.

                                      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                      theorem lsiKlFiSqrtRnDerivEntropyIntegral {α : Type*} [MeasurableSpace α]
                                          (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                          (hrho_pi : rho ≪ pi) :
                                          ∫ x, (Real.sqrt ((rho.rnDeriv pi x).toReal)) ^ 2 *
                                              Real.log ((Real.sqrt ((rho.rnDeriv pi x).toReal)) ^ 2) ∂pi =
                                            ∫ x, llr rho pi x ∂rho

                                      Exact module and namespace context

                                      Proof roadmap

                                      1. 1Use the established density-entropy transport

                                        Replace the log-likelihood integral by ∫r log r dπ.

                                      2. 2Rewrite each nonnegative density value

                                        At every x, nonnegativity of r(x) gives the scalar square-root entropy identity.

                                      3. 3Integrate the a.e. equality

                                        Pointwise equality supplies the a.e. congruence required for equal real integrals.

                                      Full assumptions and notation

                                      All objects and hypotheses

                                      • α is an arbitrary measurable space; ρ and π are measures on it, both with IsProbabilityMeasure instances.
                                      • hrho_pi supplies absolute continuity ρ≪π. Probability assumptions supply the finite/sigma-finite and Lebesgue-decomposition requirements of the imported Radon–Nikodym APIs.
                                      • Write R=dρ/dπ for Mathlib's ℝ≥0∞-valued rnDeriv representative and r=R.toReal for its real-valued conversion; r≥0 everywhere.

                                      Notation and interpretation

                                      Integrability and Bochner integrals

                                      L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                      \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                      Mathematical proof

                                      1. Use the established density-entropy transport

                                      Replace the log-likelihood integral by ∫r log r dπ.

                                      \[\int\ell_{\rho,\pi}\,d\rho=\int r\log r\,d\pi.\]
                                      Corresponding Lean step

                                      rw [← lsiKlFiRnDerivEntropyIntegral rho pi hrho_pi]

                                      2. Rewrite each nonnegative density value

                                      At every x, nonnegativity of r(x) gives the scalar square-root entropy identity.

                                      \[(\sqrt{r(x)})^2\log((\sqrt{r(x)})^2)=r(x)\log r(x).\]
                                      Corresponding Lean step

                                      lsiKlFiSqrtDensityEntropyIntegrandScalar ENNReal.toReal_nonneg

                                      3. Integrate the a.e. equality

                                      Pointwise equality supplies the a.e. congruence required for equal real integrals.

                                      \[\int(\sqrt r)^2\log((\sqrt r)^2)\,d\pi=\int r\log r\,d\pi.\]
                                      Corresponding Lean step

                                      integral_congr_ae

                                      Lean verification

                                      The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                      Lean proof · lsiKlFiSqrtRnDerivEntropyIntegral

                                      The proof combines one previously established measure-transport identity with a pointwise algebraic rewrite and integral congruence.

                                      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                      Download module (.lean)
                                      theorem lsiKlFiSqrtRnDerivEntropyIntegral {α : Type*} [MeasurableSpace α]
                                          (rho pi : Measure α) [IsProbabilityMeasure rho] [IsProbabilityMeasure pi]
                                          (hrho_pi : rho ≪ pi) :
                                          ∫ x, (Real.sqrt ((rho.rnDeriv pi x).toReal)) ^ 2 *
                                              Real.log ((Real.sqrt ((rho.rnDeriv pi x).toReal)) ^ 2) ∂pi =
                                            ∫ x, llr rho pi x ∂rho := by
                                        rw [← lsiKlFiRnDerivEntropyIntegral rho pi hrho_pi]
                                        refine integral_congr_ae ?_
                                        filter_upwards with x
                                        exact lsiKlFiSqrtDensityEntropyIntegrandScalar ENNReal.toReal_nonneg

                                      Exact module and namespace context

                                      Scope and omitted-condition boundaries
                                      • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                                      • The chosen real density r is (rnDeriv ρ π).toReal, with ENNReal.toReal(∞)=0. Do not replace this with an arbitrary pointwise density version; absolute continuity and probability measures justify the a.e. density interpretation.
                                      • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                      Sources, dependencies, and reuse

                                      Source and reuse

                                      Samplinglib parents called

                                      Mathlib API called (external library)

                                      • MeasureTheory.integral_congr_ae
                                      • ENNReal.toReal_nonneg

                                      Mathematical sources

                                      Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                      Samplinglib mathematical lesson

                                      The scalar square-root/logarithm coefficients give a factor of one quarter

                                      AutoSamplingTheory.lsiKlFiSqrtDensityFisherChainScalar · theorem · Teaching coverage

                                      Read this first

                                      Mathematical statement

                                      For any positive real r and any real dr, the squared expression dr/(2√r) equals one quarter of r times (dr/r)². The symbols are numbers, not derivatives whose existence is established here.

                                      \[r>0\Longrightarrow\left(\frac{dr}{2\sqrt r}\right)^2=\frac14\,r\left(\frac{dr}{r}\right)^2.\]
                                      Lean statement · lsiKlFiSqrtDensityFisherChainScalar

                                      dr is any real number. The theorem identifies a coefficient pattern used by a future derivative calculation, not a derivative of a function.

                                      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                      theorem lsiKlFiSqrtDensityFisherChainScalar {r dr : Real} (hr : 0 < r) :
                                          ((1 / (2 * Real.sqrt r)) * dr) ^ 2 =
                                            (1 / 4) * (r * (dr / r) ^ 2)

                                      Exact module and namespace context

                                      Proof roadmap

                                      1. 1Record the square-root and nonzero facts

                                        Positivity gives (√r)²=r and both r≠0 and √r≠0.

                                      2. 2Clear the nonzero denominators

                                        Cross-multiplication reduces the rational equality to polynomial arithmetic; the two sides agree after replacing (√r)² by r.

                                      Full assumptions and notation

                                      All objects and hypotheses

                                      • r,dr∈ℝ; hr asserts r>0. Strict positivity, not mere nonnegativity, permits clearing both denominators.

                                      Mathematical proof

                                      1. Record the square-root and nonzero facts

                                      Positivity gives (√r)²=r and both r≠0 and √r≠0.

                                      \[(\sqrt r)^2=r,\qquad r\ne0,\qquad\sqrt r\ne0.\]
                                      Corresponding Lean step

                                      Real.sq_sqrt; Real.sqrt_pos; hsqrt_sq, hsqrt_ne, hr_ne

                                      2. Clear the nonzero denominators

                                      Cross-multiplication reduces the rational equality to polynomial arithmetic; the two sides agree after replacing (√r)² by r.

                                      \[\frac{dr^2}{4(\sqrt r)^2}=\frac{dr^2}{4r}=\frac14\,r\,\frac{dr^2}{r^2}.\]
                                      Corresponding Lean step

                                      field_simp [hsqrt_ne,hr_ne]; nlinarith [hsqrt_sq]

                                      Lean verification

                                      The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                      Lean proof · lsiKlFiSqrtDensityFisherChainScalar

                                      The proof first establishes that the denominators are nonzero, then reduces the equation to polynomial arithmetic with the square-root identity.

                                      Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                      Download module (.lean)
                                      theorem lsiKlFiSqrtDensityFisherChainScalar {r dr : Real} (hr : 0 < r) :
                                          ((1 / (2 * Real.sqrt r)) * dr) ^ 2 =
                                            (1 / 4) * (r * (dr / r) ^ 2) := by
                                        have hsqrt_sq : (Real.sqrt r) ^ 2 = r := Real.sq_sqrt (le_of_lt hr)
                                        have hsqrt_ne : Real.sqrt r ≠ 0 := ne_of_gt (Real.sqrt_pos.2 hr)
                                        have hr_ne : r ≠ 0 := ne_of_gt hr
                                        field_simp [hsqrt_ne, hr_ne]
                                        nlinarith [hsqrt_sq]

                                      Exact module and namespace context

                                      Scope and omitted-condition boundaries
                                      • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                      • The r=0 case is excluded; no zero-density extension or vector-norm identity is proved.
                                      Sources, dependencies, and reuse

                                      Source and reuse

                                      Samplinglib parents called

                                        Mathlib API called (external library)

                                        • Real.sq_sqrt
                                        • Real.sqrt_pos

                                        Mathematical sources

                                        • Exact existing ASTIS declaration and body — Directly read local source; not a new proof or source-fidelity verdict.
                                        • Real.sq_sqrt — Directly inspected pinned Mathlib theorem/API. Reuse is distinguished from a new ASTIS proof.
                                        • Real.sqrt_pos — Directly inspected pinned Mathlib theorem/API. Reuse is distinguished from a new ASTIS proof.

                                        Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                        Samplinglib mathematical lesson

                                        Apply the scalar coefficient identity to supplied derivative values

                                        AutoSamplingTheory.lsiKlFiSqrtDensityFisherChainOfDerivativesScalar · theorem · Teaching coverage

                                        Read this first

                                        Mathematical statement

                                        Let r>0 and dr,dSqrt,dLog be real numbers. If dSqrt=dr/(2√r) and dLog=dr/r, then dSqrt²=(1/4)r dLog². The named derivative identities are explicit assumptions.

                                        \[d_{\sqrt{\ }}=\frac{dr}{2\sqrt r},\quad d_{\log}=\frac{dr}{r}\Longrightarrow d_{\sqrt{\ }}^2=\tfrac14\,r\,d_{\log}^2.\]
                                        Lean statement · lsiKlFiSqrtDensityFisherChainOfDerivativesScalar

                                        This handoff takes values called derivatives plus formulas for them. It does not prove a chain rule for any underlying function.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        theorem lsiKlFiSqrtDensityFisherChainOfDerivativesScalar
                                            {r dr dSqrt dLog : Real}
                                            (hr : 0 < r)
                                            (hdSqrt : dSqrt = (1 / (2 * Real.sqrt r)) * dr)
                                            (hdLog : dLog = dr / r) :
                                            dSqrt ^ 2 = (1 / 4) * (r * dLog ^ 2)

                                        Exact module and namespace context

                                        Proof roadmap

                                        1. 1Substitute the supplied identities

                                          Replace each named derivative value by its explicit scalar coefficient expression.

                                        2. 2Reuse the scalar algebra theorem

                                          The previous positive-r identity supplies the required factor one quarter.

                                        Full assumptions and notation

                                        All objects and hypotheses

                                        • r,dr,dSqrt,dLog∈ℝ with r>0.
                                        • The two coefficient identities for dSqrt and dLog are supplied; no functions or differentiability hypotheses are inferred from their names.

                                        Mathematical proof

                                        1. Substitute the supplied identities

                                        Replace each named derivative value by its explicit scalar coefficient expression.

                                        \[d_{\sqrt{\ }}^2=\left(\frac{dr}{2\sqrt r}\right)^2,\quad r\,d_{\log}^2=r\left(\frac{dr}{r}\right)^2.\]
                                        Corresponding Lean step

                                        rw [hdSqrt,hdLog]

                                        2. Reuse the scalar algebra theorem

                                        The previous positive-r identity supplies the required factor one quarter.

                                        \[\left(\frac{dr}{2\sqrt r}\right)^2=\tfrac14r\left(\frac{dr}{r}\right)^2.\]
                                        Corresponding Lean step

                                        lsiKlFiSqrtDensityFisherChainScalar hr

                                        Lean verification

                                        The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                        Lean proof · lsiKlFiSqrtDensityFisherChainOfDerivativesScalar

                                        After substituting the two premises, the goal is exactly the preceding scalar theorem.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        Download module (.lean)
                                        theorem lsiKlFiSqrtDensityFisherChainOfDerivativesScalar
                                            {r dr dSqrt dLog : Real}
                                            (hr : 0 < r)
                                            (hdSqrt : dSqrt = (1 / (2 * Real.sqrt r)) * dr)
                                            (hdLog : dLog = dr / r) :
                                            dSqrt ^ 2 = (1 / 4) * (r * dLog ^ 2) := by
                                          rw [hdSqrt, hdLog]
                                          exact lsiKlFiSqrtDensityFisherChainScalar hr

                                        Exact module and namespace context

                                        Scope and omitted-condition boundaries
                                        • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                        Sources, dependencies, and reuse

                                        Source and reuse

                                        Samplinglib parents called

                                        Mathlib API called (external library)

                                        No direct Mathlib call recorded; see the Samplinglib parents.

                                        Mathematical sources

                                        Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                        Samplinglib mathematical lesson

                                        Sum the scalar Fisher-chain factor over finitely many coordinates

                                        AutoSamplingTheory.lsiKlFiSqrtDensityFisherChainFiniteSumScalar · theorem · Teaching coverage

                                        Read this first

                                        Mathematical statement

                                        Let I be a finite index type, r>0 a real number, and dr,dSqrt,dLog:I→ℝ. If at every i the values satisfy dSqrt_i=dr_i/(2√r) and dLog_i=dr_i/r, then the sum of dSqrt_i² is (1/4)r times the sum of dLog_i². The empty finite index type is allowed.

                                        \[\sum_{i\in I}d_{\sqrt{\ },i}^2=\frac14\,r\sum_{i\in I}d_{\log,i}^2.\]
                                        Lean statement · lsiKlFiSqrtDensityFisherChainFiniteSumScalar

                                        Finiteness concerns the coordinate index only. All coordinate derivative formulas are premises, and no inner product or norm is part of the statement.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        theorem lsiKlFiSqrtDensityFisherChainFiniteSumScalar
                                            {ι : Type*} [Fintype ι] {r : Real} {dr dSqrt dLog : ι → Real}
                                            (hr : 0 < r)
                                            (hdSqrt : ∀ i, dSqrt i = (1 / (2 * Real.sqrt r)) * dr i)
                                            (hdLog : ∀ i, dLog i = dr i / r) :
                                            (∑ i, dSqrt i ^ 2) = (1 / 4) * (r * ∑ i, dLog i ^ 2)

                                        Exact module and namespace context

                                        Proof roadmap

                                        1. 1Prove the identity in each coordinate

                                          Substitute the two supplied formulas at i and apply the scalar theorem.

                                        2. 2Sum equal terms

                                          Equality at each index gives equality of the two finite sums.

                                        3. 3Factor out the common coefficient

                                          Reassociate products, distribute the constant across the finite sum, and reassociate again.

                                        Full assumptions and notation

                                        All objects and hypotheses

                                        • I is a type with Fintype; r∈ℝ is strictly positive.
                                        • dr,dSqrt,dLog:I→ℝ and the two derivative-coefficient equalities hold for every i.

                                        Mathematical proof

                                        1. Prove the identity in each coordinate

                                        Substitute the two supplied formulas at i and apply the scalar theorem.

                                        \[d_{\sqrt{\ },i}^2=\tfrac14\,r\,d_{\log,i}^2\quad\forall i.\]
                                        Corresponding Lean step

                                        Finset.sum_congr; rw [hdSqrt i,hdLog i]; lsiKlFiSqrtDensityFisherChainScalar hr

                                        2. Sum equal terms

                                        Equality at each index gives equality of the two finite sums.

                                        \[\sum_i d_{\sqrt{\ },i}^2=\sum_i\tfrac14(r\,d_{\log,i}^2).\]
                                        Corresponding Lean step

                                        first calc equality

                                        3. Factor out the common coefficient

                                        Reassociate products, distribute the constant across the finite sum, and reassociate again.

                                        \[\sum_i\tfrac14(r\,d_{\log,i}^2)=(\tfrac14r)\sum_i d_{\log,i}^2=\tfrac14\left(r\sum_i d_{\log,i}^2\right).\]
                                        Corresponding Lean step

                                        ring; Finset.mul_sum; ring

                                        Lean verification

                                        The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                        Lean proof · lsiKlFiSqrtDensityFisherChainFiniteSumScalar

                                        The proof checks one summand, replaces the entire finite sum termwise, and pulls out the same scalar coefficient.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        Download module (.lean)
                                        theorem lsiKlFiSqrtDensityFisherChainFiniteSumScalar
                                            {ι : Type*} [Fintype ι] {r : Real} {dr dSqrt dLog : ι → Real}
                                            (hr : 0 < r)
                                            (hdSqrt : ∀ i, dSqrt i = (1 / (2 * Real.sqrt r)) * dr i)
                                            (hdLog : ∀ i, dLog i = dr i / r) :
                                            (∑ i, dSqrt i ^ 2) = (1 / 4) * (r * ∑ i, dLog i ^ 2) := by
                                          calc
                                            (∑ i, dSqrt i ^ 2) = ∑ i, (1 / 4) * (r * dLog i ^ 2) := by
                                              refine Finset.sum_congr rfl ?_
                                              intro i _hi
                                              rw [hdSqrt i, hdLog i]
                                              exact lsiKlFiSqrtDensityFisherChainScalar hr
                                            _ = ∑ i, ((1 / 4) * r) * dLog i ^ 2 := by
                                              refine Finset.sum_congr rfl ?_
                                              intro i _hi
                                              ring
                                            _ = ((1 / 4) * r) * ∑ i, dLog i ^ 2 := by
                                              rw [Finset.mul_sum]
                                            _ = (1 / 4) * (r * ∑ i, dLog i ^ 2) := by
                                              ring

                                        Exact module and namespace context

                                        Scope and omitted-condition boundaries
                                        • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                        • A coordinate-square sum is not automatically the squared norm of a gradient; an application must justify that identification.
                                        Sources, dependencies, and reuse

                                        Source and reuse

                                        Samplinglib parents called

                                        Mathlib API called (external library)

                                        • Finset.sum_congr
                                        • Finset.mul_sum

                                        Mathematical sources

                                        Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                        Samplinglib mathematical lesson

                                        Name the finite-coordinate Dirichlet and Fisher expressions

                                        AutoSamplingTheory.lsiKlFiSqrtDensityFisherChainFiniteSumHandoffScalar · theorem · Teaching coverage

                                        Read this first

                                        Mathematical statement

                                        Let I be finite, r>0, and dr,dSqrt,dLog:I→ℝ satisfy the coefficient identities at every coordinate. If real numbers D and J are supplied to equal ∑dSqrt_i² and r∑dLog_i² respectively, then D=J/4.

                                        \[D=\sum_i d_{\sqrt{\ },i}^2,\quad J=r\sum_i d_{\log,i}^2\Longrightarrow D=\tfrac14J.\]
                                        Lean statement · lsiKlFiSqrtDensityFisherChainFiniteSumHandoffScalar

                                        D and J are real values with supplied representations. Their names do not turn them into analytic Dirichlet energy or Fisher information automatically.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        theorem lsiKlFiSqrtDensityFisherChainFiniteSumHandoffScalar
                                            {ι : Type*} [Fintype ι] {r dirichlet fisher : Real}
                                            {dr dSqrt dLog : ι → Real}
                                            (hr : 0 < r)
                                            (hdirichlet : dirichlet = ∑ i, dSqrt i ^ 2)
                                            (hfisher : fisher = r * ∑ i, dLog i ^ 2)
                                            (hdSqrt : ∀ i, dSqrt i = (1 / (2 * Real.sqrt r)) * dr i)
                                            (hdLog : ∀ i, dLog i = dr i / r) :
                                            dirichlet = (1 / 4) * fisher

                                        Exact module and namespace context

                                        Proof roadmap

                                        1. 1Replace the named quantities by their sums

                                          Use the two representation hypotheses to expose the finite-coordinate expressions.

                                        2. 2Reuse the finite-sum identity

                                          The earlier finite-coordinate algebra theorem identifies these expressions.

                                        Full assumptions and notation

                                        All objects and hypotheses

                                        • I has Fintype; r,D,J∈ℝ with r>0; dr,dSqrt,dLog:I→ℝ.
                                        • D and J have the displayed finite-sum representations, and dSqrt_i=dr_i/(2√r), dLog_i=dr_i/r for every i.

                                        Mathematical proof

                                        1. Replace the named quantities by their sums

                                        Use the two representation hypotheses to expose the finite-coordinate expressions.

                                        \[D=\sum_i d_{\sqrt{\ },i}^2,\quad\tfrac14J=\tfrac14\left(r\sum_i d_{\log,i}^2\right).\]
                                        Corresponding Lean step

                                        rw [hdirichlet,hfisher]

                                        2. Reuse the finite-sum identity

                                        The earlier finite-coordinate algebra theorem identifies these expressions.

                                        \[\sum_i d_{\sqrt{\ },i}^2=\tfrac14\left(r\sum_i d_{\log,i}^2\right).\]
                                        Corresponding Lean step

                                        lsiKlFiSqrtDensityFisherChainFiniteSumScalar hr hdSqrt hdLog

                                        Lean verification

                                        The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                        Lean proof · lsiKlFiSqrtDensityFisherChainFiniteSumHandoffScalar

                                        Only substitution and the existing finite-sum result are used. No derivative identity or norm representation is established.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        Download module (.lean)
                                        theorem lsiKlFiSqrtDensityFisherChainFiniteSumHandoffScalar
                                            {ι : Type*} [Fintype ι] {r dirichlet fisher : Real}
                                            {dr dSqrt dLog : ι → Real}
                                            (hr : 0 < r)
                                            (hdirichlet : dirichlet = ∑ i, dSqrt i ^ 2)
                                            (hfisher : fisher = r * ∑ i, dLog i ^ 2)
                                            (hdSqrt : ∀ i, dSqrt i = (1 / (2 * Real.sqrt r)) * dr i)
                                            (hdLog : ∀ i, dLog i = dr i / r) :
                                            dirichlet = (1 / 4) * fisher := by
                                          rw [hdirichlet, hfisher]
                                          exact lsiKlFiSqrtDensityFisherChainFiniteSumScalar hr hdSqrt hdLog

                                        Exact module and namespace context

                                        Scope and omitted-condition boundaries
                                        • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                        • Named scalar handoff, not integration or geometric identification.
                                        Sources, dependencies, and reuse

                                        Source and reuse

                                        Samplinglib parents called

                                        Mathlib API called (external library)

                                        No direct Mathlib call recorded; see the Samplinglib parents.

                                        Mathematical sources

                                        Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                        Samplinglib mathematical lesson

                                        Integrate the a.e. finite-coordinate Fisher-chain identity

                                        AutoSamplingTheory.lsiKlFiSqrtDensityFisherChainIntegralFiniteSum · theorem · Teaching coverage

                                        Read this first

                                        Mathematical statement

                                        Under the finite-coordinate hypotheses below, suppose positivity of r and both families of derivative-coefficient identities hold μ-a.e. Then the real integral of ∑dSqrt_i² equals the real integral of (1/4)r∑dLog_i². This is a congruence identity for totalized integrals, with no integrability premise.

                                        \[\int\sum_i d_{\sqrt{\ },i}(x)^2\,d\mu(x)=\int\frac14\left(r(x)\sum_i d_{\log,i}(x)^2\right)\,d\mu(x).\]
                                        Lean statement · lsiKlFiSqrtDensityFisherChainIntegralFiniteSum

                                        The a.e. assumptions quantify over x first and every coordinate second. They are not a theorem proving those derivative identities.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        theorem lsiKlFiSqrtDensityFisherChainIntegralFiniteSum
                                            {α ι : Type*} [MeasurableSpace α] [Fintype ι] (mu : Measure α)
                                            {r : α → Real} {dr dSqrt dLog : ι → α → Real}
                                            (hr : ∀ᵐ x ∂mu, 0 < r x)
                                            (hdSqrt : ∀ᵐ x ∂mu,
                                              ∀ i, dSqrt i x = (1 / (2 * Real.sqrt (r x))) * dr i x)
                                            (hdLog : ∀ᵐ x ∂mu, ∀ i, dLog i x = dr i x / r x) :
                                            ∫ x, (∑ i, dSqrt i x ^ 2) ∂mu =
                                              ∫ x, (1 / 4) * (r x * ∑ i, dLog i x ^ 2) ∂mu

                                        Exact module and namespace context

                                        Proof roadmap

                                        1. 1Combine the three a.e. hypotheses

                                          Intersect the full-measure sets for positivity and the two uniform coordinate identities. At every remaining x all scalar hypotheses hold together.

                                        2. 2Apply the finite-sum theorem at that x

                                          Treat r(x) and the coordinate values as scalar data for the previous theorem.

                                        3. 3Use integral congruence

                                          A.e. equality suffices for equality of the real integrals under Mathlib's totalized convention.

                                        Full assumptions and notation

                                        All objects and hypotheses

                                        • α is measurable, I has Fintype, and μ is any measure on α; no finiteness or probability hypothesis.
                                        • r:α→ℝ and dr,dSqrt,dLog:I→α→ℝ are arbitrary functions.
                                        • For μ-almost every x, r(x)>0.
                                        • For μ-almost every x, simultaneously for every i, dSqrt_i(x)=dr_i(x)/(2√r(x)); separately, for μ-almost every x, simultaneously for every i, dLog_i(x)=dr_i(x)/r(x).
                                        • No measurability or integrability of these functions is assumed by this congruence statement.

                                        Notation and interpretation

                                        A.e. and strong measurability

                                        A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                                        \[f=g\quad\mu\text{-a.e.}\]
                                        Integrability and Bochner integrals

                                        L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                        \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                        Mathematical proof

                                        1. Combine the three a.e. hypotheses

                                        Intersect the full-measure sets for positivity and the two uniform coordinate identities. At every remaining x all scalar hypotheses hold together.

                                        \[r(x)>0,\ d_{\sqrt{\ },i}(x)=dr_i(x)/(2\sqrt{r(x)}),\ d_{\log,i}(x)=dr_i(x)/r(x)\quad\forall i.\]
                                        Corresponding Lean step

                                        filter_upwards [hr,hdSqrt,hdLog]

                                        2. Apply the finite-sum theorem at that x

                                        Treat r(x) and the coordinate values as scalar data for the previous theorem.

                                        \[\sum_i d_{\sqrt{\ },i}(x)^2=\tfrac14r(x)\sum_i d_{\log,i}(x)^2\quad\mu\text{-a.e.}\]
                                        Corresponding Lean step

                                        lsiKlFiSqrtDensityFisherChainFiniteSumScalar hx hSqrt hLog

                                        3. Use integral congruence

                                        A.e. equality suffices for equality of the real integrals under Mathlib's totalized convention.

                                        \[\int A\,d\mu=\int B\,d\mu\quad\text{if }A=B\ \mu\text{-a.e.}\]
                                        Corresponding Lean step

                                        integral_congr_ae

                                        Lean verification

                                        The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                        Lean proof · lsiKlFiSqrtDensityFisherChainIntegralFiniteSum

                                        The proof intersects the a.e. events, invokes the scalar finite-sum identity pointwise, then integrates that equality.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        Download module (.lean)
                                        theorem lsiKlFiSqrtDensityFisherChainIntegralFiniteSum
                                            {α ι : Type*} [MeasurableSpace α] [Fintype ι] (mu : Measure α)
                                            {r : α → Real} {dr dSqrt dLog : ι → α → Real}
                                            (hr : ∀ᵐ x ∂mu, 0 < r x)
                                            (hdSqrt : ∀ᵐ x ∂mu,
                                              ∀ i, dSqrt i x = (1 / (2 * Real.sqrt (r x))) * dr i x)
                                            (hdLog : ∀ᵐ x ∂mu, ∀ i, dLog i x = dr i x / r x) :
                                            ∫ x, (∑ i, dSqrt i x ^ 2) ∂mu =
                                              ∫ x, (1 / 4) * (r x * ∑ i, dLog i x ^ 2) ∂mu := by
                                          refine integral_congr_ae ?_
                                          filter_upwards [hr, hdSqrt, hdLog] with x hx hSqrt hLog
                                          exact lsiKlFiSqrtDensityFisherChainFiniteSumScalar hx hSqrt hLog

                                        Exact module and namespace context

                                        Scope and omitted-condition boundaries
                                        • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                                        • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                        • Does not assert finite Dirichlet/Fisher integrals or justify exchanging coordinate sums and integrals. No such interchange is used.
                                        Sources, dependencies, and reuse

                                        Source and reuse

                                        Samplinglib parents called

                                        Mathlib API called (external library)

                                        • MeasureTheory.integral_congr_ae

                                        Mathematical sources

                                        Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                        Samplinglib mathematical lesson

                                        Extract the one-quarter factor from supplied integral representations

                                        AutoSamplingTheory.lsiKlFiSqrtDensityFisherChainIntegralHandoffScalar · theorem · Teaching coverage

                                        Read this first

                                        Mathematical statement

                                        In the same arbitrary-measure finite-coordinate setting, suppose D and J are real numbers represented by ∫∑dSqrt_i²dμ and ∫r∑dLog_i²dμ. With the a.e. positivity and coordinate derivative identities listed below, D=J/4. No integrability is added by this representation handoff.

                                        \[D=\int\sum_i d_{\sqrt{\ },i}^2\,d\mu,\quad J=\int r\sum_i d_{\log,i}^2\,d\mu \Longrightarrow D=\tfrac14J.\]
                                        Lean statement · lsiKlFiSqrtDensityFisherChainIntegralHandoffScalar

                                        D and J are named real numbers tied to displayed integral formulas; the theorem does not itself establish that those formulas are the paper's geometric energies.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        theorem lsiKlFiSqrtDensityFisherChainIntegralHandoffScalar
                                            {α ι : Type*} [MeasurableSpace α] [Fintype ι] (mu : Measure α)
                                            {r : α → Real} {dirichlet fisher : Real} {dr dSqrt dLog : ι → α → Real}
                                            (hdirichlet : dirichlet = ∫ x, (∑ i, dSqrt i x ^ 2) ∂mu)
                                            (hfisher : fisher = ∫ x, (r x * ∑ i, dLog i x ^ 2) ∂mu)
                                            (hr : ∀ᵐ x ∂mu, 0 < r x)
                                            (hdSqrt : ∀ᵐ x ∂mu,
                                              ∀ i, dSqrt i x = (1 / (2 * Real.sqrt (r x))) * dr i x)
                                            (hdLog : ∀ᵐ x ∂mu, ∀ i, dLog i x = dr i x / r x) :
                                            dirichlet = (1 / 4) * fisher

                                        Exact module and namespace context

                                        Proof roadmap

                                        1. 1Use the supplied integral representations

                                          Substitute the definitions supplied for D and J.

                                        2. 2Move the scalar factor into the real integral

                                          The constant-multiplication identity rewrites one quarter of the integral as the integral of one quarter times its integrand.

                                        3. 3Reuse a.e. integral congruence

                                          The preceding integrated finite-coordinate theorem now gives the exact equality.

                                        Full assumptions and notation

                                        All objects and hypotheses

                                        • α is measurable, I has Fintype, and μ is any measure on α; no finiteness or probability hypothesis.
                                        • r:α→ℝ and dr,dSqrt,dLog:I→α→ℝ are arbitrary functions.
                                        • For μ-almost every x, r(x)>0.
                                        • For μ-almost every x, simultaneously for every i, dSqrt_i(x)=dr_i(x)/(2√r(x)); separately, for μ-almost every x, simultaneously for every i, dLog_i(x)=dr_i(x)/r(x).
                                        • No measurability or integrability of these functions is assumed by this congruence statement.
                                        • D,J∈ℝ with the two displayed integral-representation equalities.

                                        Notation and interpretation

                                        A.e. and strong measurability

                                        A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                                        \[f=g\quad\mu\text{-a.e.}\]
                                        Integrability and Bochner integrals

                                        L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                        \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                        Mathematical proof

                                        1. Use the supplied integral representations

                                        Substitute the definitions supplied for D and J.

                                        \[D=\int\sum_i d_{\sqrt{\ },i}^2\,d\mu,\quad \tfrac14J=\tfrac14\int r\sum_i d_{\log,i}^2\,d\mu.\]
                                        Corresponding Lean step

                                        rw [hdirichlet,hfisher]

                                        2. Move the scalar factor into the real integral

                                        The constant-multiplication identity rewrites one quarter of the integral as the integral of one quarter times its integrand.

                                        \[\tfrac14\int B\,d\mu=\int\tfrac14 B\,d\mu.\]
                                        Corresponding Lean step

                                        rw [← integral_const_mul]

                                        3. Reuse a.e. integral congruence

                                        The preceding integrated finite-coordinate theorem now gives the exact equality.

                                        \[\int\sum_i d_{\sqrt{\ },i}^2\,d\mu=\int\tfrac14r\sum_i d_{\log,i}^2\,d\mu.\]
                                        Corresponding Lean step

                                        lsiKlFiSqrtDensityFisherChainIntegralFiniteSum mu hr hdSqrt hdLog

                                        Lean verification

                                        The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                        Lean proof · lsiKlFiSqrtDensityFisherChainIntegralHandoffScalar

                                        After substituting the representations and moving a constant into the integral, the goal is the earlier a.e. finite-sum integral identity.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        Download module (.lean)
                                        theorem lsiKlFiSqrtDensityFisherChainIntegralHandoffScalar
                                            {α ι : Type*} [MeasurableSpace α] [Fintype ι] (mu : Measure α)
                                            {r : α → Real} {dirichlet fisher : Real} {dr dSqrt dLog : ι → α → Real}
                                            (hdirichlet : dirichlet = ∫ x, (∑ i, dSqrt i x ^ 2) ∂mu)
                                            (hfisher : fisher = ∫ x, (r x * ∑ i, dLog i x ^ 2) ∂mu)
                                            (hr : ∀ᵐ x ∂mu, 0 < r x)
                                            (hdSqrt : ∀ᵐ x ∂mu,
                                              ∀ i, dSqrt i x = (1 / (2 * Real.sqrt (r x))) * dr i x)
                                            (hdLog : ∀ᵐ x ∂mu, ∀ i, dLog i x = dr i x / r x) :
                                            dirichlet = (1 / 4) * fisher := by
                                          rw [hdirichlet, hfisher]
                                          rw [← integral_const_mul]
                                          exact lsiKlFiSqrtDensityFisherChainIntegralFiniteSum mu hr hdSqrt hdLog

                                        Exact module and namespace context

                                        Scope and omitted-condition boundaries
                                        • ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.
                                        • These are scalar, density-integral or supplied-derivative handoffs. They do not prove an LSI, the admissibility of its square-root-density test, the vector/Sobolev chain rule or the full KL–Fisher comparison.
                                        • No integral finiteness, vector-gradient identification, or LSI test admissibility is concluded.
                                        Sources, dependencies, and reuse

                                        Source and reuse

                                        Samplinglib parents called

                                        Mathlib API called (external library)

                                        • MeasureTheory.integral_const_mul

                                        Mathematical sources

                                        Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                        Samplinglib mathematical lesson

                                        Rearrange a supplied variational upper bound

                                        AutoSamplingTheory.dvVariationalOneSidedConsequenceScalar · theorem · Teaching coverage

                                        Read this first

                                        Mathematical statement

                                        For arbitrary real numbers k,e,L, if e−L≤k, then e≤k+L. The names KL, expectation and log-mgf used in the Lean declaration are labels for these real inputs, not analytic definitions.

                                        \[e-L\le k\Longrightarrow e\le k+L.\]
                                        Lean statement · dvVariationalOneSidedConsequenceScalar

                                        This theorem has no measures or integrals. Its only premise is a real inequality supplied by another argument.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        theorem dvVariationalOneSidedConsequenceScalar {kl expectation logMgf : Real}
                                            (hvar : expectation - logMgf ≤ kl) :
                                            expectation ≤ kl + logMgf

                                        Exact module and namespace context

                                        Proof roadmap

                                        1. 1Add the same real number to both sides

                                          The ordered-field subtraction equivalence moves −L from the left to +L on the right.

                                        Full assumptions and notation

                                        All objects and hypotheses

                                        • kl, expectation and logMgf are arbitrary real numbers; hvar supplies expectation−logMgf≤kl.

                                        Mathematical proof

                                        1. Add the same real number to both sides

                                        The ordered-field subtraction equivalence moves −L from the left to +L on the right.

                                        \[e-L\le k\iff e\le k+L.\]
                                        Corresponding Lean step

                                        sub_le_iff_le_add.mp hvar

                                        Lean verification

                                        The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                        Lean proof · dvVariationalOneSidedConsequenceScalar

                                        The proof applies a basic ordered-additive equivalence. It neither proves entropy duality nor checks an admissible test.

                                        Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                        Download module (.lean)
                                        theorem dvVariationalOneSidedConsequenceScalar {kl expectation logMgf : Real}
                                            (hvar : expectation - logMgf ≤ kl) :
                                            expectation ≤ kl + logMgf := by
                                          exact sub_le_iff_le_add.mp hvar

                                        Exact module and namespace context

                                        Scope and omitted-condition boundaries
                                        • Only a one-sided bound for a selected admissible test is established. The full Donsker–Varadhan/Boucheron variational supremum equality remains separate; no source-fidelity verdict is made.
                                        • Pure scalar rearrangement; analytic meanings must be supplied downstream.
                                        Sources, dependencies, and reuse

                                        Source and reuse

                                        Samplinglib parents called

                                          Mathlib API called (external library)

                                          • sub_le_iff_le_add

                                          Mathematical sources

                                          Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                          Samplinglib mathematical lesson

                                          Extract one admissible scalar value from a known supremum

                                          AutoSamplingTheory.dvVariationalOneSidedFromSupremumScalar · theorem · Teaching coverage

                                          Read this first

                                          Mathematical statement

                                          Let A⊆ℝ be bounded above, let v∈A, and suppose sup A=k and v=e−L for real k,e,L,v. Then e≤k+L. Membership supplies nonemptiness; the supremum identity and the selected test's representation are assumptions.

                                          \[v\in A,\quad A\text{ bounded above},\quad\sup A=k,\quad v=e-L \Longrightarrow e\le k+L.\]
                                          Lean statement · dvVariationalOneSidedFromSupremumScalar

                                          The set consists of scalar values. This theorem does not define admissible random variables or prove that its supremum is KL.

                                          Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                          theorem dvVariationalOneSidedFromSupremumScalar {admissibleValues : Set Real}
                                              {kl expectation logMgf testValue : Real}
                                              (hbounded : BddAbove admissibleValues)
                                              (hmem : testValue ∈ admissibleValues)
                                              (hsup : sSup admissibleValues = kl)
                                              (htest : testValue = expectation - logMgf) :
                                              expectation ≤ kl + logMgf

                                          Exact module and namespace context

                                          Proof roadmap

                                          1. 1Bound the selected value by the supremum

                                            For a bounded-above real set, every member is at most its supremum. The member v makes an additional nonemptiness assumption unnecessary.

                                          2. 2Substitute the supplied meanings

                                            Replace v by e−L and sup A by k to obtain a variational upper bound.

                                          3. 3Apply scalar rearrangement

                                            The previously established subtraction lemma gives the one-sided sum form.

                                          Full assumptions and notation

                                          All objects and hypotheses

                                          • admissibleValues=A is a set of real numbers; hbounded says A is bounded above.
                                          • testValue=v belongs to A; kl=k, expectation=e and logMgf=L are real.
                                          • hsup gives sSup A=k and htest gives v=e−L.

                                          Mathematical proof

                                          1. Bound the selected value by the supremum

                                          For a bounded-above real set, every member is at most its supremum. The member v makes an additional nonemptiness assumption unnecessary.

                                          \[v\le\sup A.\]
                                          Corresponding Lean step

                                          le_csSup hbounded hmem

                                          2. Substitute the supplied meanings

                                          Replace v by e−L and sup A by k to obtain a variational upper bound.

                                          \[e-L\le k.\]
                                          Corresponding Lean step

                                          rw [← htest,← hsup]; htest_le_sup

                                          3. Apply scalar rearrangement

                                          The previously established subtraction lemma gives the one-sided sum form.

                                          \[e\le k+L.\]
                                          Corresponding Lean step

                                          dvVariationalOneSidedConsequenceScalar hvar

                                          Lean verification

                                          The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                          Lean proof · dvVariationalOneSidedFromSupremumScalar

                                          The proof uses the real supremum order theorem, rewrites the two assumed identities, and reuses the scalar consequence.

                                          Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                          Download module (.lean)
                                          theorem dvVariationalOneSidedFromSupremumScalar {admissibleValues : Set Real}
                                              {kl expectation logMgf testValue : Real}
                                              (hbounded : BddAbove admissibleValues)
                                              (hmem : testValue ∈ admissibleValues)
                                              (hsup : sSup admissibleValues = kl)
                                              (htest : testValue = expectation - logMgf) :
                                              expectation ≤ kl + logMgf := by
                                            have htest_le_sup : testValue ≤ sSup admissibleValues := le_csSup hbounded hmem
                                            have hvar : expectation - logMgf ≤ kl := by
                                              rw [← htest, ← hsup]
                                              exact htest_le_sup
                                            exact dvVariationalOneSidedConsequenceScalar hvar

                                          Exact module and namespace context

                                          Scope and omitted-condition boundaries
                                          • Only a one-sided bound for a selected admissible test is established. The full Donsker–Varadhan/Boucheron variational supremum equality remains separate; no source-fidelity verdict is made.
                                          • The entropy supremum equality and admissible-test membership are not established here.
                                          Sources, dependencies, and reuse

                                          Source and reuse

                                          Samplinglib parents called

                                          Mathlib API called (external library)

                                          • le_csSup

                                          Mathematical sources

                                          Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                          Samplinglib mathematical lesson

                                          An integrable exponential moment remains integrable at a smaller nonnegative scale

                                          AutoSamplingTheory.dvFiniteLogMgfOfLeAlpha · theorem · Teaching coverage

                                          Read this first

                                          Mathematical statement

                                          Let μ be a finite measure on measurable Ω and q:Ω→ℝ any function. If exp(α₀q) is μ-integrable and 0≤α≤α₀, then exp(αq) is μ-integrable. No nonnegativity of q, probability normalization, or separate measurability premise for q is assumed.

                                          \[e^{\alpha_0q}\in L^1(\mu),\quad0\le\alpha\le\alpha_0 \Longrightarrow e^{\alpha q}\in L^1(\mu).\]
                                          Lean statement · dvFiniteLogMgfOfLeAlpha

                                          The actual conclusion is integrability of an exponential. The theorem's name does not additionally assert a positive logarithm normalizer when μ is zero.

                                          Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                          theorem dvFiniteLogMgfOfLeAlpha {Ω : Type*} [MeasurableSpace Ω]
                                              {mu : Measure Ω} [IsFiniteMeasure mu]
                                              {q : Ω → Real} {alpha alpha0 : Real}
                                              (hAlpha0 : Integrable (fun x ↦ Real.exp (alpha0 * q x)) mu)
                                              (hAlpha_nonneg : 0 ≤ alpha) (hAlpha_le : alpha ≤ alpha0) :
                                              Integrable (fun x ↦ Real.exp (alpha * q x)) mu

                                          Exact module and namespace context

                                          Proof roadmap

                                          1. 1Use the zero-scale endpoint

                                            For a finite measure the constant exponential at scale zero is integrable.

                                          2. 2Control all intermediate scales

                                            The imported interval theorem bounds exp(αq) by 1+exp(α₀q): use the upper endpoint where q≥0 and the zero endpoint where q≤0. Its proof also derives the needed a.e. measurability from the endpoint hypotheses, treating the zero-length interval separately.

                                          3. 3Reuse the packaged moment theorem

                                            Specialize the imported nonnegative-scale monotonicity result to q, upper scale α₀ and selected scale α.

                                          Full assumptions and notation

                                          All objects and hypotheses

                                          • Ω is measurable and μ is finite, possibly zero or unnormalized.
                                          • q:Ω→ℝ and α,α₀∈ℝ; the exponential at α₀ is integrable, and 0≤α≤α₀.

                                          Notation and interpretation

                                          A.e. and strong measurability

                                          A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                                          \[f=g\quad\mu\text{-a.e.}\]
                                          Integrability and Bochner integrals

                                          L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                          \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                          Mathematical proof

                                          1. Use the zero-scale endpoint

                                          For a finite measure the constant exponential at scale zero is integrable.

                                          \[e^{0q}=1\in L^1(\mu).\]
                                          Corresponding Lean step

                                          zero endpoint supplied inside integrable_exp_mul_of_nonneg_of_le

                                          2. Control all intermediate scales

                                          The imported interval theorem bounds exp(αq) by 1+exp(α₀q): use the upper endpoint where q≥0 and the zero endpoint where q≤0. Its proof also derives the needed a.e. measurability from the endpoint hypotheses, treating the zero-length interval separately.

                                          \[e^{\alpha q(\omega)}\le1+e^{\alpha_0q(\omega)}\qquad(0\le\alpha\le\alpha_0).\]
                                          Corresponding Lean step

                                          ProbabilityTheory.integrable_exp_mul_of_le_of_le: inspected proof background

                                          3. Reuse the packaged moment theorem

                                          Specialize the imported nonnegative-scale monotonicity result to q, upper scale α₀ and selected scale α.

                                          \[e^{\alpha q}\in L^1(\mu).\]
                                          Corresponding Lean step

                                          ProbabilityTheory.integrable_exp_mul_of_nonneg_of_le hAlpha0 hAlpha_nonneg hAlpha_le

                                          Lean verification

                                          The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                          Lean proof · dvFiniteLogMgfOfLeAlpha

                                          The ASTIS body directly calls the imported moment theorem; the endpoint and domination steps explain its mathematical mechanism rather than a new local proof.

                                          Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                          Download module (.lean)
                                          theorem dvFiniteLogMgfOfLeAlpha {Ω : Type*} [MeasurableSpace Ω]
                                              {mu : Measure Ω} [IsFiniteMeasure mu]
                                              {q : Ω → Real} {alpha alpha0 : Real}
                                              (hAlpha0 : Integrable (fun x ↦ Real.exp (alpha0 * q x)) mu)
                                              (hAlpha_nonneg : 0 ≤ alpha) (hAlpha_le : alpha ≤ alpha0) :
                                              Integrable (fun x ↦ Real.exp (alpha * q x)) mu := by
                                            exact ProbabilityTheory.integrable_exp_mul_of_nonneg_of_le (X := q) (u := alpha0)
                                              (t := alpha) hAlpha0 hAlpha_nonneg hAlpha_le

                                          Exact module and namespace context

                                          Scope and omitted-condition boundaries
                                          • This result establishes exponential integrability at an intermediate nonnegative scale, not a Donsker–Varadhan inequality or a variational supremum formula. Its later use in a selected-test bound is a separate consumer; no source-fidelity verdict is made.
                                          • For a probability target this supports a finite, positive exponential normalizer. For the allowed zero measure, the normalizer is zero, so do not read the title as an unqualified ordinary log-mgf statement.
                                          Sources, dependencies, and reuse

                                          Source and reuse

                                          Samplinglib parents called

                                            Mathlib API called (external library)

                                            • ProbabilityTheory.integrable_exp_mul_of_nonneg_of_le

                                            Mathematical sources

                                            Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                            Samplinglib mathematical lesson

                                            Prove the selected-test entropy bound by exponential tilting

                                            AutoSamplingTheory.dvVariationalOneSidedOfTiltedRight · theorem · Teaching coverage

                                            Read this first

                                            Mathematical statement

                                            For probability measures ν≪μ on a common measurable space, retain the explicit sigma-finiteness hypotheses and assume Z∈L¹(ν), exp Z∈L¹(μ), and llr(ν,μ)∈L¹(ν). Then ∫Z dν−log∫exp Z dμ≤(klDiv ν μ).toReal. These assumptions keep the selected normalizer positive and finite and put KL in its finite branch.

                                            \[\int Z\,d\nu-\log\int e^Z\,d\mu\le K,\qquad K=(\mathrm{klDiv}(\nu,\mu))_{\mathrm{toReal}}.\]
                                            Lean statement · dvVariationalOneSidedOfTiltedRight

                                            The target is a real inequality using toReal of the extended KL divergence. The test and likelihood integrability assumptions are essential analytic hypotheses, not metadata.

                                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                            theorem dvVariationalOneSidedOfTiltedRight {α : Type*} [MeasurableSpace α]
                                                (nu mu : Measure α) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                [SigmaFinite mu] [SigmaFinite nu]
                                                (Z : α → Real)
                                                (hnu_mu : nu ≪ mu)
                                                (hZ_nu : Integrable Z nu)
                                                (hexp_mu : Integrable (fun x ↦ Real.exp (Z x)) mu)
                                                (hllr : Integrable (llr nu mu) nu) :
                                                (∫ x, Z x ∂nu) - Real.log (∫ x, Real.exp (Z x) ∂mu) ≤
                                                  (klDiv nu mu).toReal

                                            Exact module and namespace context

                                            Proof roadmap

                                            1. 1Build a genuine tilted probability measure

                                              Define μ_Z by density exp Z/M_Z against μ. Because μ is nonzero and exp Z is integrable and strictly positive, its normalizer is positive and finite, and Mathlib proves μ_Z is a probability measure.

                                            2. 2Transfer absolute continuity to the tilted target

                                              The positive exponential tilt dominates μ in the absolute-continuity sense; combine μ≪μ_Z with ν≪μ.

                                            3. 3Check integrability and use entropy nonnegativity

                                              The original test and log-likelihood integrability imply llr(ν,μ_Z) is ν-integrable. Gibbs' inequality includes total-mass correction terms; they cancel because ν and μ_Z are both probability measures.

                                            4. 4Rewrite the tilted log-likelihood integral

                                              The imported tilt identity subtracts the test expectation and adds the logarithm of its normalizer to the original log-likelihood integral.

                                            5. 5Rearrange the nonnegative expression

                                              The previous two lines imply the test's variational value is at most the original log-likelihood integral.

                                            6. 6Identify the real KL value

                                              Absolute continuity and equal total masses give the toReal KL identity; substitute it into the bound. The explicit integrability hypotheses prevent this application from concealing infinite KL behind toReal(∞)=0.

                                            Full assumptions and notation

                                            All objects and hypotheses

                                            • α (or Ω) is an arbitrary measurable space; ν and μ are probability measures on that same space.
                                            • Both SigmaFinite μ and SigmaFinite ν are explicitly present in the Lean signature; probability already supplies them, but they are not omitted here.
                                            • ν≪μ; the chosen real test Z is ν-integrable; exp Z is μ-integrable; llr(ν,μ) is ν-integrable.
                                            • Notation: ℓ=llr(ν,μ)=log((dν/dμ).toReal), M_Z=∫exp Z dμ, and K=(InformationTheory.klDiv ν μ).toReal.
                                            • Z is an arbitrary real-valued function on the common space; no pointwise boundedness or smoothness is assumed.

                                            Notation and interpretation

                                            A.e. and strong measurability

                                            A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                                            \[f=g\quad\mu\text{-a.e.}\]
                                            Integrability and Bochner integrals

                                            L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                            \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                            Mathematical proof

                                            1. Build a genuine tilted probability measure

                                            Define μ_Z by density exp Z/M_Z against μ. Because μ is nonzero and exp Z is integrable and strictly positive, its normalizer is positive and finite, and Mathlib proves μ_Z is a probability measure.

                                            \[d\mu_Z=M_Z^{-1}e^Z\,d\mu,\qquad0<M_Z<\infty,\qquad\mu_Z(\alpha)=1.\]
                                            Corresponding Lean step

                                            isProbabilityMeasure_tilted hexp_mu

                                            2. Transfer absolute continuity to the tilted target

                                            The positive exponential tilt dominates μ in the absolute-continuity sense; combine μ≪μ_Z with ν≪μ.

                                            \[\nu\ll\mu\ll\mu_Z\Longrightarrow\nu\ll\mu_Z.\]
                                            Corresponding Lean step

                                            absolutelyContinuous_tilted hexp_mu; hnu_mu.trans hmu_tilted

                                            3. Check integrability and use entropy nonnegativity

                                            The original test and log-likelihood integrability imply llr(ν,μ_Z) is ν-integrable. Gibbs' inequality includes total-mass correction terms; they cancel because ν and μ_Z are both probability measures.

                                            \[0\le\int\ell_{\nu,\mu_Z}\,d\nu+\mu_Z(\alpha)-\nu(\alpha)=\int\ell_{\nu,\mu_Z}\,d\nu.\]
                                            Corresponding Lean step

                                            integrable_llr_tilted_right; integral_llr_add_sub_measure_univ_nonneg; simpa

                                            4. Rewrite the tilted log-likelihood integral

                                            The imported tilt identity subtracts the test expectation and adds the logarithm of its normalizer to the original log-likelihood integral.

                                            \[\int\ell_{\nu,\mu_Z}\,d\nu=\int\ell_{\nu,\mu}\,d\nu-\int Z\,d\nu+\log M_Z.\]
                                            Corresponding Lean step

                                            integral_llr_tilted_right hnu_mu hZ_nu hexp_mu hllr

                                            5. Rearrange the nonnegative expression

                                            The previous two lines imply the test's variational value is at most the original log-likelihood integral.

                                            \[\int Z\,d\nu-\log M_Z\le\int\ell_{\nu,\mu}\,d\nu.\]
                                            Corresponding Lean step

                                            hnonneg_rewrite; linarith

                                            6. Identify the real KL value

                                            Absolute continuity and equal total masses give the toReal KL identity; substitute it into the bound. The explicit integrability hypotheses prevent this application from concealing infinite KL behind toReal(∞)=0.

                                            \[K=\int\ell_{\nu,\mu}\,d\nu,\qquad\int Z\,d\nu-\log M_Z\le K.\]
                                            Corresponding Lean step

                                            toReal_klDiv_of_measure_eq hnu_mu (by simp); simpa [hkl] using hineq

                                            Lean verification

                                            The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                            Lean proof · dvVariationalOneSidedOfTiltedRight

                                            The proof introduces the tilted probability instance, proves absolute continuity to it, applies nonnegativity of the tilted log-likelihood integral, expands that integral, and rearranges before identifying KL.

                                            Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                            Download module (.lean)
                                            theorem dvVariationalOneSidedOfTiltedRight {α : Type*} [MeasurableSpace α]
                                                (nu mu : Measure α) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                [SigmaFinite mu] [SigmaFinite nu]
                                                (Z : α → Real)
                                                (hnu_mu : nu ≪ mu)
                                                (hZ_nu : Integrable Z nu)
                                                (hexp_mu : Integrable (fun x ↦ Real.exp (Z x)) mu)
                                                (hllr : Integrable (llr nu mu) nu) :
                                                (∫ x, Z x ∂nu) - Real.log (∫ x, Real.exp (Z x) ∂mu) ≤
                                                  (klDiv nu mu).toReal := by
                                              let : IsProbabilityMeasure (mu.tilted Z) := isProbabilityMeasure_tilted hexp_mu
                                              have hmu_tilted : mu ≪ mu.tilted Z := absolutelyContinuous_tilted hexp_mu
                                              have hnu_tilted : nu ≪ mu.tilted Z := hnu_mu.trans hmu_tilted
                                              have hllr_tilted : Integrable (llr nu (mu.tilted Z)) nu :=
                                                integrable_llr_tilted_right (μ := nu) (ν := mu) (f := Z) hnu_mu hZ_nu hllr
                                                  hexp_mu
                                              have hnonneg := integral_llr_add_sub_measure_univ_nonneg (μ := nu) (ν := mu.tilted Z)
                                                hnu_tilted hllr_tilted
                                              have hnonneg_llr : 0 ≤ ∫ x, llr nu (mu.tilted Z) x ∂nu := by
                                                simpa using hnonneg
                                              have htilted :=
                                                integral_llr_tilted_right (μ := nu) (ν := mu) (f := Z) hnu_mu hZ_nu hexp_mu
                                                  hllr
                                              have hnonneg_rewrite :
                                                  0 ≤ (∫ x, llr nu mu x ∂nu) - (∫ x, Z x ∂nu) +
                                                    Real.log (∫ x, Real.exp (Z x) ∂mu) := by
                                                simpa [htilted] using hnonneg_llr
                                              have hineq :
                                                  (∫ x, Z x ∂nu) - Real.log (∫ x, Real.exp (Z x) ∂mu) ≤
                                                    ∫ x, llr nu mu x ∂nu := by
                                                linarith
                                              have hkl : (klDiv nu mu).toReal = ∫ x, llr nu mu x ∂nu := by
                                                simpa using toReal_klDiv_of_measure_eq (μ := nu) (ν := mu) hnu_mu (by simp)
                                              simpa [hkl] using hineq

                                            Exact module and namespace context

                                            Scope and omitted-condition boundaries
                                            • Only a one-sided bound for a selected admissible test is established. The full Donsker–Varadhan/Boucheron variational supremum equality remains separate; no source-fidelity verdict is made.
                                            • No supremum equality, optimizer characterization or equality case is proved. The assumptions are not replaceable by merely finite-looking totalized integrals.
                                            Sources, dependencies, and reuse

                                            Source and reuse

                                            Samplinglib parents called

                                              Mathlib API called (external library)

                                              • MeasureTheory.isProbabilityMeasure_tilted
                                              • MeasureTheory.absolutelyContinuous_tilted
                                              • MeasureTheory.Measure.AbsolutelyContinuous.trans
                                              • MeasureTheory.integrable_llr_tilted_right
                                              • InformationTheory.integral_llr_add_sub_measure_univ_nonneg
                                              • MeasureTheory.integral_llr_tilted_right
                                              • InformationTheory.toReal_klDiv_of_measure_eq

                                              Mathematical sources

                                              Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                              Samplinglib mathematical lesson

                                              Use an upper-scale exponential moment for the selected scaled test

                                              AutoSamplingTheory.dvVariationalOneSidedOfScaledTest · theorem · Teaching coverage

                                              Read this first

                                              Mathematical statement

                                              For the probability measures and hypotheses below, including integrability of the selected test αq under ν and an exponential moment at α₀ with 0≤α≤α₀, the selected-test DV bound holds at scale α. No positivity of q or strict positivity of α is needed.

                                              \[\int\alpha q\,d\nu-\log\int e^{\alpha q}\,d\mu\le K.\]
                                              Lean statement · dvVariationalOneSidedOfScaledTest

                                              Integrability is assumed for αq itself, not for q. The scale may be zero, so those are genuinely different hypotheses.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              theorem dvVariationalOneSidedOfScaledTest {Ω : Type*} [MeasurableSpace Ω]
                                                  (nu mu : Measure Ω) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                  [SigmaFinite mu] [SigmaFinite nu]
                                                  (q : Ω → Real) {alpha alpha0 : Real}
                                                  (hAlpha_nonneg : 0 ≤ alpha) (hAlpha_le : alpha ≤ alpha0)
                                                  (hnu_mu : nu ≪ mu)
                                                  (hZ_nu : Integrable (fun x ↦ alpha * q x) nu)
                                                  (hexp_alpha0_mu : Integrable (fun x ↦ Real.exp (alpha0 * q x)) mu)
                                                  (hllr : Integrable (llr nu mu) nu) :
                                                  (∫ x, alpha * q x ∂nu) - Real.log (∫ x, Real.exp (alpha * q x) ∂mu) ≤
                                                    (klDiv nu mu).toReal

                                              Exact module and namespace context

                                              Proof roadmap

                                              1. 1Supply the selected exponential moment

                                                The finite-measure moment theorem reduces the scale from α₀ to α.

                                              2. 2Apply the tilted selected-test theorem

                                                Use Z=αq with the explicitly supplied absolute continuity, selected-test integrability and likelihood integrability.

                                              Full assumptions and notation

                                              All objects and hypotheses

                                              • Ω is measurable; ν and μ are probability measures with explicit SigmaFinite μ and SigmaFinite ν instances.
                                              • q:Ω→ℝ and α,α₀∈ℝ satisfy 0≤α≤α₀; ν≪μ.
                                              • The selected test αq is ν-integrable, exp(α₀q) is μ-integrable, and llr(ν,μ) is ν-integrable.
                                              • Write K=(klDiv ν μ).toReal and L_α=log∫exp(αq)dμ.

                                              Notation and interpretation

                                              A.e. and strong measurability

                                              A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                                              \[f=g\quad\mu\text{-a.e.}\]
                                              Integrability and Bochner integrals

                                              L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                              \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                              Mathematical proof

                                              1. Supply the selected exponential moment

                                              The finite-measure moment theorem reduces the scale from α₀ to α.

                                              \[e^{\alpha_0q}\in L^1(\mu)\Longrightarrow e^{\alpha q}\in L^1(\mu).\]
                                              Corresponding Lean step

                                              dvFiniteLogMgfOfLeAlpha hexp_alpha0_mu hAlpha_nonneg hAlpha_le

                                              2. Apply the tilted selected-test theorem

                                              Use Z=αq with the explicitly supplied absolute continuity, selected-test integrability and likelihood integrability.

                                              \[\mathbb E_\nu[\alpha q]-L_\alpha\le K.\]
                                              Corresponding Lean step

                                              dvVariationalOneSidedOfTiltedRight ... (Z := fun x ↦ alpha*q x)

                                              Lean verification

                                              The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                              Lean proof · dvVariationalOneSidedOfScaledTest

                                              One reused theorem supplies the missing selected exponential moment and the other proves the one-sided inequality for that particular test.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              Download module (.lean)
                                              theorem dvVariationalOneSidedOfScaledTest {Ω : Type*} [MeasurableSpace Ω]
                                                  (nu mu : Measure Ω) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                  [SigmaFinite mu] [SigmaFinite nu]
                                                  (q : Ω → Real) {alpha alpha0 : Real}
                                                  (hAlpha_nonneg : 0 ≤ alpha) (hAlpha_le : alpha ≤ alpha0)
                                                  (hnu_mu : nu ≪ mu)
                                                  (hZ_nu : Integrable (fun x ↦ alpha * q x) nu)
                                                  (hexp_alpha0_mu : Integrable (fun x ↦ Real.exp (alpha0 * q x)) mu)
                                                  (hllr : Integrable (llr nu mu) nu) :
                                                  (∫ x, alpha * q x ∂nu) - Real.log (∫ x, Real.exp (alpha * q x) ∂mu) ≤
                                                    (klDiv nu mu).toReal := by
                                                have hexp_mu : Integrable (fun x ↦ Real.exp (alpha * q x)) mu :=
                                                  dvFiniteLogMgfOfLeAlpha (mu := mu) (q := q) hexp_alpha0_mu hAlpha_nonneg
                                                    hAlpha_le
                                                exact dvVariationalOneSidedOfTiltedRight (nu := nu) (mu := mu)
                                                  (Z := fun x ↦ alpha * q x) hnu_mu hZ_nu hexp_mu hllr

                                              Exact module and namespace context

                                              Scope and omitted-condition boundaries
                                              • Only a one-sided bound for a selected admissible test is established. The full Donsker–Varadhan/Boucheron variational supremum equality remains separate; no source-fidelity verdict is made.
                                              • No q≥0 or α>0 hypothesis is added. No arbitrary-test supremum is taken.
                                              Sources, dependencies, and reuse

                                              Source and reuse

                                              Samplinglib parents called

                                              Mathlib API called (external library)

                                              No direct Mathlib call recorded; see the Samplinglib parents.

                                              Mathematical sources

                                              Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                              Samplinglib mathematical lesson

                                              Divide the scaled entropy bound by its positive scale

                                              AutoSamplingTheory.dvVariationalScaledTestEnergyBound · theorem · Teaching coverage

                                              Read this first

                                              Mathematical statement

                                              Under the probability, absolute-continuity and integrability assumptions below, let 0<α≤α₀ and let e_α=α⁻¹log∫exp(αq)dμ. Then ∫q dν≤α⁻¹(klDiv ν μ).toReal+e_α. Although q may represent an energy in an application, this theorem does not require q≥0.

                                              \[\int q\,d\nu\le\alpha^{-1}K+e_\alpha,\qquad e_\alpha=\alpha^{-1}\log\int e^{\alpha q}\,d\mu.\]
                                              Lean statement · dvVariationalScaledTestEnergyBound

                                              Strict positivity of α distinguishes this division theorem from the preceding α≥0 result. The value e_α is a real parameter tied to the log-mgf by an explicit equality.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              theorem dvVariationalScaledTestEnergyBound {Ω : Type*} [MeasurableSpace Ω]
                                                  (nu mu : Measure Ω) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                  [SigmaFinite mu] [SigmaFinite nu]
                                                  (q : Ω → Real) {alpha alpha0 eAlpha : Real}
                                                  (hAlpha_pos : 0 < alpha) (hAlpha_le : alpha ≤ alpha0)
                                                  (hnu_mu : nu ≪ mu)
                                                  (hq_nu : Integrable q nu)
                                                  (hexp_alpha0_mu : Integrable (fun x ↦ Real.exp (alpha0 * q x)) mu)
                                                  (hllr : Integrable (llr nu mu) nu)
                                                  (heAlpha : eAlpha =
                                                    alpha⁻¹ * Real.log (∫ x, Real.exp (alpha * q x) ∂mu)) :
                                                  (∫ x, q x ∂nu) ≤ alpha⁻¹ * (klDiv nu mu).toReal + eAlpha

                                              Exact module and namespace context

                                              Proof roadmap

                                              1. 1Make the scaled test integrable

                                                A constant multiple of the ν-integrable q is integrable, so αq satisfies the selected-test input.

                                              2. 2Apply the selected scaled-test bound

                                                The preceding theorem gives the variational inequality for αq, using the upper-scale exponential moment.

                                              3. 3Move the constant and rearrange

                                                Pull α out of the integral and move the log-mgf to the right.

                                              4. 4Multiply by the positive inverse

                                                Since α>0, its inverse is nonnegative, so multiplication preserves the inequality and α⁻¹α cancels.

                                              5. 5Identify the named log-mgf contribution

                                                Distribute the inverse and replace its log-mgf term by the supplied e_α.

                                              Full assumptions and notation

                                              All objects and hypotheses

                                              • Ω is measurable; ν and μ are probability measures with explicit SigmaFinite μ and SigmaFinite ν instances.
                                              • q:Ω→ℝ is ν-integrable; α,α₀,e_α∈ℝ with 0<α≤α₀; ν≪μ.
                                              • exp(α₀q) is μ-integrable and llr(ν,μ) is ν-integrable.
                                              • The supplied named value e_α equals α⁻¹ log∫exp(αq)dμ. Write K=(klDiv ν μ).toReal.

                                              Notation and interpretation

                                              A.e. and strong measurability

                                              A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                                              \[f=g\quad\mu\text{-a.e.}\]
                                              Integrability and Bochner integrals

                                              L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                              \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                              Mathematical proof

                                              1. Make the scaled test integrable

                                              A constant multiple of the ν-integrable q is integrable, so αq satisfies the selected-test input.

                                              \[q\in L^1(\nu)\Longrightarrow\alpha q\in L^1(\nu).\]
                                              Corresponding Lean step

                                              hq_nu.const_mul alpha; hZ_nu

                                              2. Apply the selected scaled-test bound

                                              The preceding theorem gives the variational inequality for αq, using the upper-scale exponential moment.

                                              \[\int\alpha q\,d\nu-L_\alpha\le K.\]
                                              Corresponding Lean step

                                              dvVariationalOneSidedOfScaledTest

                                              3. Move the constant and rearrange

                                              Pull α out of the integral and move the log-mgf to the right.

                                              \[\alpha\int q\,d\nu\le K+L_\alpha.\]
                                              Corresponding Lean step

                                              integral_const_mul; sub_le_iff_le_add.mp

                                              4. Multiply by the positive inverse

                                              Since α>0, its inverse is nonnegative, so multiplication preserves the inequality and α⁻¹α cancels.

                                              \[\int q\,d\nu=\alpha^{-1}\alpha\int q\,d\nu\le\alpha^{-1}(K+L_\alpha).\]
                                              Corresponding Lean step

                                              mul_le_mul_of_nonneg_left; inv_nonneg; field_simp [ne_of_gt hAlpha_pos]

                                              5. Identify the named log-mgf contribution

                                              Distribute the inverse and replace its log-mgf term by the supplied e_α.

                                              \[\alpha^{-1}(K+L_\alpha)=\alpha^{-1}K+e_\alpha.\]
                                              Corresponding Lean step

                                              rw [heAlpha]; ring

                                              Lean verification

                                              The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                              Lean proof · dvVariationalScaledTestEnergyBound

                                              The proof obtains the selected-test bound, uses linearity for one constant, divides by a verified positive scale, and rewrites the named complexity term.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              Download module (.lean)
                                              theorem dvVariationalScaledTestEnergyBound {Ω : Type*} [MeasurableSpace Ω]
                                                  (nu mu : Measure Ω) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                  [SigmaFinite mu] [SigmaFinite nu]
                                                  (q : Ω → Real) {alpha alpha0 eAlpha : Real}
                                                  (hAlpha_pos : 0 < alpha) (hAlpha_le : alpha ≤ alpha0)
                                                  (hnu_mu : nu ≪ mu)
                                                  (hq_nu : Integrable q nu)
                                                  (hexp_alpha0_mu : Integrable (fun x ↦ Real.exp (alpha0 * q x)) mu)
                                                  (hllr : Integrable (llr nu mu) nu)
                                                  (heAlpha : eAlpha =
                                                    alpha⁻¹ * Real.log (∫ x, Real.exp (alpha * q x) ∂mu)) :
                                                  (∫ x, q x ∂nu) ≤ alpha⁻¹ * (klDiv nu mu).toReal + eAlpha := by
                                                have hZ_nu : Integrable (fun x ↦ alpha * q x) nu := by
                                                  simpa [smul_eq_mul] using hq_nu.const_mul alpha
                                                have hdv := dvVariationalOneSidedOfScaledTest (nu := nu) (mu := mu)
                                                  (q := q) hAlpha_pos.le hAlpha_le hnu_mu hZ_nu hexp_alpha0_mu hllr
                                                have hscaledIntegral :
                                                    (∫ x, alpha * q x ∂nu) = alpha * ∫ x, q x ∂nu := by
                                                  rw [integral_const_mul]
                                                have hscaled :
                                                    alpha * (∫ x, q x ∂nu) ≤
                                                      (klDiv nu mu).toReal + Real.log (∫ x, Real.exp (alpha * q x) ∂mu) := by
                                                  have hvar :
                                                      alpha * (∫ x, q x ∂nu) -
                                                          Real.log (∫ x, Real.exp (alpha * q x) ∂mu) ≤
                                                        (klDiv nu mu).toReal := by
                                                    simpa [hscaledIntegral] using hdv
                                                  exact sub_le_iff_le_add.mp hvar
                                                have hdiv :
                                                    alpha⁻¹ * (alpha * (∫ x, q x ∂nu)) ≤
                                                      alpha⁻¹ * ((klDiv nu mu).toReal +
                                                        Real.log (∫ x, Real.exp (alpha * q x) ∂mu)) := by
                                                  exact mul_le_mul_of_nonneg_left hscaled (inv_nonneg.mpr hAlpha_pos.le)
                                                calc
                                                  (∫ x, q x ∂nu) = alpha⁻¹ * (alpha * (∫ x, q x ∂nu)) := by
                                                    field_simp [ne_of_gt hAlpha_pos]
                                                  _ ≤ alpha⁻¹ * ((klDiv nu mu).toReal +
                                                        Real.log (∫ x, Real.exp (alpha * q x) ∂mu)) := hdiv
                                                  _ = alpha⁻¹ * (klDiv nu mu).toReal + eAlpha := by
                                                    rw [heAlpha]
                                                    ring

                                              Exact module and namespace context

                                              Scope and omitted-condition boundaries
                                              • Only a one-sided bound for a selected admissible test is established. The full Donsker–Varadhan/Boucheron variational supremum equality remains separate; no source-fidelity verdict is made.
                                              • No nonnegativity of q is required. It does not construct a complexity bound or prove a later Grönwall estimate.
                                              Sources, dependencies, and reuse

                                              Source and reuse

                                              Samplinglib parents called

                                              Mathlib API called (external library)

                                              • MeasureTheory.Integrable.const_mul
                                              • MeasureTheory.integral_const_mul
                                              • sub_le_iff_le_add
                                              • mul_le_mul_of_nonneg_left
                                              • inv_nonneg

                                              Mathematical sources

                                              Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                              Samplinglib mathematical lesson

                                              Preserve an external nonnegative coefficient in the energy bound

                                              AutoSamplingTheory.dvVariationalScaledTestEnergyBoundWithCoeff · theorem · Teaching coverage

                                              Read this first

                                              Mathematical statement

                                              Under the complete scaled-energy assumptions below, let c≥0 be any real coefficient. Then c∫q dν≤(cα⁻¹)(klDiv ν μ).toReal+c e_α. The coefficient may be zero and is independent of the integration variable.

                                              \[c\int q\,d\nu\le(c\alpha^{-1})K+c\,e_\alpha\qquad(c\ge0).\]
                                              Lean statement · dvVariationalScaledTestEnergyBoundWithCoeff

                                              The new coefficient is a real number with an explicit nonnegative sign proof. No inverse of c is used, so c=0 is allowed.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              theorem dvVariationalScaledTestEnergyBoundWithCoeff {Ω : Type*} [MeasurableSpace Ω]
                                                  (nu mu : Measure Ω) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                  [SigmaFinite mu] [SigmaFinite nu]
                                                  (q : Ω → Real) {alpha alpha0 eAlpha coeff : Real}
                                                  (hAlpha_pos : 0 < alpha) (hAlpha_le : alpha ≤ alpha0)
                                                  (hcoeff : 0 ≤ coeff)
                                                  (hnu_mu : nu ≪ mu)
                                                  (hq_nu : Integrable q nu)
                                                  (hexp_alpha0_mu : Integrable (fun x ↦ Real.exp (alpha0 * q x)) mu)
                                                  (hllr : Integrable (llr nu mu) nu)
                                                  (heAlpha : eAlpha =
                                                    alpha⁻¹ * Real.log (∫ x, Real.exp (alpha * q x) ∂mu)) :
                                                  coeff * (∫ x, q x ∂nu) ≤
                                                    (coeff * alpha⁻¹) * (klDiv nu mu).toReal + coeff * eAlpha

                                              Exact module and namespace context

                                              Proof roadmap

                                              1. 1Reuse the unweighted energy inequality

                                                All measure-theoretic hypotheses are passed unchanged to the existing positive-scale result.

                                              2. 2Multiply by a nonnegative scalar

                                                The sign assumption on c ensures multiplication preserves the order.

                                              3. 3Distribute while keeping the coefficient visible

                                                Associativity and distributivity give the desired coefficient grouping.

                                              Full assumptions and notation

                                              All objects and hypotheses

                                              • Ω is measurable; ν and μ are probability measures with explicit SigmaFinite μ and SigmaFinite ν instances.
                                              • q:Ω→ℝ is ν-integrable; α,α₀,e_α∈ℝ with 0<α≤α₀; ν≪μ.
                                              • exp(α₀q) is μ-integrable and llr(ν,μ) is ν-integrable.
                                              • The supplied named value e_α equals α⁻¹ log∫exp(αq)dμ. Write K=(klDiv ν μ).toReal.
                                              • c=coeff is a real scalar with hcoeff:0≤c.

                                              Notation and interpretation

                                              A.e. and strong measurability

                                              A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                                              \[f=g\quad\mu\text{-a.e.}\]
                                              Integrability and Bochner integrals

                                              L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                              \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                              Mathematical proof

                                              1. Reuse the unweighted energy inequality

                                              All measure-theoretic hypotheses are passed unchanged to the existing positive-scale result.

                                              \[\int q\,d\nu\le\alpha^{-1}K+e_\alpha.\]
                                              Corresponding Lean step

                                              dvVariationalScaledTestEnergyBound ...

                                              2. Multiply by a nonnegative scalar

                                              The sign assumption on c ensures multiplication preserves the order.

                                              \[c\int q\,d\nu\le c(\alpha^{-1}K+e_\alpha).\]
                                              Corresponding Lean step

                                              mul_le_mul_of_nonneg_left hbase hcoeff

                                              3. Distribute while keeping the coefficient visible

                                              Associativity and distributivity give the desired coefficient grouping.

                                              \[c(\alpha^{-1}K+e_\alpha)=(c\alpha^{-1})K+ce_\alpha.\]
                                              Corresponding Lean step

                                              ring

                                              Lean verification

                                              The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                              Lean proof · dvVariationalScaledTestEnergyBoundWithCoeff

                                              The proof invokes the already proved energy bound, multiplies its two sides, then normalizes the algebraic grouping.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              Download module (.lean)
                                              theorem dvVariationalScaledTestEnergyBoundWithCoeff {Ω : Type*} [MeasurableSpace Ω]
                                                  (nu mu : Measure Ω) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                  [SigmaFinite mu] [SigmaFinite nu]
                                                  (q : Ω → Real) {alpha alpha0 eAlpha coeff : Real}
                                                  (hAlpha_pos : 0 < alpha) (hAlpha_le : alpha ≤ alpha0)
                                                  (hcoeff : 0 ≤ coeff)
                                                  (hnu_mu : nu ≪ mu)
                                                  (hq_nu : Integrable q nu)
                                                  (hexp_alpha0_mu : Integrable (fun x ↦ Real.exp (alpha0 * q x)) mu)
                                                  (hllr : Integrable (llr nu mu) nu)
                                                  (heAlpha : eAlpha =
                                                    alpha⁻¹ * Real.log (∫ x, Real.exp (alpha * q x) ∂mu)) :
                                                  coeff * (∫ x, q x ∂nu) ≤
                                                    (coeff * alpha⁻¹) * (klDiv nu mu).toReal + coeff * eAlpha := by
                                                have hbase := dvVariationalScaledTestEnergyBound (nu := nu) (mu := mu)
                                                  (q := q) hAlpha_pos hAlpha_le hnu_mu hq_nu hexp_alpha0_mu hllr heAlpha
                                                have hmul :
                                                    coeff * (∫ x, q x ∂nu) ≤
                                                      coeff * (alpha⁻¹ * (klDiv nu mu).toReal + eAlpha) := by
                                                  exact mul_le_mul_of_nonneg_left hbase hcoeff
                                                calc
                                                  coeff * (∫ x, q x ∂nu) ≤
                                                      coeff * (alpha⁻¹ * (klDiv nu mu).toReal + eAlpha) := hmul
                                                  _ = (coeff * alpha⁻¹) * (klDiv nu mu).toReal + coeff * eAlpha := by
                                                    ring

                                              Exact module and namespace context

                                              Scope and omitted-condition boundaries
                                              • Only a one-sided bound for a selected admissible test is established. The full Donsker–Varadhan/Boucheron variational supremum equality remains separate; no source-fidelity verdict is made.
                                              • A scalar coefficient such as a time-change factor must have its sign established by the caller. No Grönwall, convergence or time-change theorem is proved here.
                                              Sources, dependencies, and reuse

                                              Source and reuse

                                              Samplinglib parents called

                                              Mathlib API called (external library)

                                              • mul_le_mul_of_nonneg_left

                                              Mathematical sources

                                              Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                              Samplinglib mathematical lesson

                                              Write the tilted-backend test bound in additive form

                                              AutoSamplingTheory.dvVariationalTiltedRightOneSidedConsequence · theorem · Teaching coverage

                                              Read this first

                                              Mathematical statement

                                              For probability measures ν≪μ with the explicit sigma-finiteness hypotheses, if Z is ν-integrable, exp Z is μ-integrable and llr(ν,μ) is ν-integrable, then ∫Z dν≤(klDiv ν μ).toReal+log∫exp Z dμ. This is the additive form of the already proved selected-test inequality.

                                              \[\int Z\,d\nu\le K+\log\int e^Z\,d\mu.\]
                                              Lean statement · dvVariationalTiltedRightOneSidedConsequence

                                              The measure-theoretic assumptions are unchanged. Only the placement of the logarithmic term differs from the earlier theorem.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              theorem dvVariationalTiltedRightOneSidedConsequence {α : Type*} [MeasurableSpace α]
                                                  (nu mu : Measure α) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                  [SigmaFinite mu] [SigmaFinite nu]
                                                  (Z : α → Real)
                                                  (hnu_mu : nu ≪ mu)
                                                  (hZ_nu : Integrable Z nu)
                                                  (hexp_mu : Integrable (fun x ↦ Real.exp (Z x)) mu)
                                                  (hllr : Integrable (llr nu mu) nu) :
                                                  (∫ x, Z x ∂nu) ≤
                                                    (klDiv nu mu).toReal + Real.log (∫ x, Real.exp (Z x) ∂mu)

                                              Exact module and namespace context

                                              Proof roadmap

                                              1. 1Reuse the analytic one-sided bound

                                                Apply the exponential-tilt theorem with exactly the selected-test hypotheses.

                                              2. 2Rearrange in real order

                                                Move the log-mgf from the left to the right using the existing scalar wrapper.

                                              Full assumptions and notation

                                              All objects and hypotheses

                                              • α (or Ω) is an arbitrary measurable space; ν and μ are probability measures on that same space.
                                              • Both SigmaFinite μ and SigmaFinite ν are explicitly present in the Lean signature; probability already supplies them, but they are not omitted here.
                                              • ν≪μ; the chosen real test Z is ν-integrable; exp Z is μ-integrable; llr(ν,μ) is ν-integrable.
                                              • Notation: ℓ=llr(ν,μ)=log((dν/dμ).toReal), M_Z=∫exp Z dμ, and K=(InformationTheory.klDiv ν μ).toReal.

                                              Notation and interpretation

                                              A.e. and strong measurability

                                              A.e. means outside a μ-null set. AEMeasurable means equality a.e. to a measurable map; AEStronglyMeasurable (abbreviated AESM) means equality a.e. to a strongly measurable function, which is approximable by simple functions.

                                              \[f=g\quad\mu\text{-a.e.}\]
                                              Integrability and Bochner integrals

                                              L¹ in the teaching formulas means Integrable, not a newly defined quotient-space element. ∫ denotes Mathlib's totalized Bochner integral: it is zero for nonintegrable functions, and also for a codomain lacking completeness. Do not infer integrability or a genuine finite expectation from an unqualified integral equality. Real-valued integrals have a complete codomain; missing integrability still matters.

                                              \[f\in L^1(\mu)\quad\Longleftrightarrow\quad f\text{ is a.e. strongly measurable and }\int^{\!-}\|f\|\,d\mu<\infty\]

                                              Mathematical proof

                                              1. Reuse the analytic one-sided bound

                                              Apply the exponential-tilt theorem with exactly the selected-test hypotheses.

                                              \[\int Z\,d\nu-\log M_Z\le K.\]
                                              Corresponding Lean step

                                              dvVariationalOneSidedOfTiltedRight hnu_mu hZ_nu hexp_mu hllr

                                              2. Rearrange in real order

                                              Move the log-mgf from the left to the right using the existing scalar wrapper.

                                              \[\int Z\,d\nu\le K+\log M_Z.\]
                                              Corresponding Lean step

                                              dvVariationalOneSidedConsequenceScalar

                                              Lean verification

                                              The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                              Lean proof · dvVariationalTiltedRightOneSidedConsequence

                                              The proof nests the selected-test theorem inside the scalar rearrangement theorem. It supplies no independent DV proof or supremum statement.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              Download module (.lean)
                                              theorem dvVariationalTiltedRightOneSidedConsequence {α : Type*} [MeasurableSpace α]
                                                  (nu mu : Measure α) [IsProbabilityMeasure nu] [IsProbabilityMeasure mu]
                                                  [SigmaFinite mu] [SigmaFinite nu]
                                                  (Z : α → Real)
                                                  (hnu_mu : nu ≪ mu)
                                                  (hZ_nu : Integrable Z nu)
                                                  (hexp_mu : Integrable (fun x ↦ Real.exp (Z x)) mu)
                                                  (hllr : Integrable (llr nu mu) nu) :
                                                  (∫ x, Z x ∂nu) ≤
                                                    (klDiv nu mu).toReal + Real.log (∫ x, Real.exp (Z x) ∂mu) := by
                                                exact dvVariationalOneSidedConsequenceScalar
                                                  (dvVariationalOneSidedOfTiltedRight (nu := nu) (mu := mu) (Z := Z)
                                                    hnu_mu hZ_nu hexp_mu hllr)

                                              Exact module and namespace context

                                              Scope and omitted-condition boundaries
                                              • Only a one-sided bound for a selected admissible test is established. The full Donsker–Varadhan/Boucheron variational supremum equality remains separate; no source-fidelity verdict is made.
                                              • Additive-form reuse wrapper, not a new variational principle.
                                              Sources, dependencies, and reuse

                                              Source and reuse

                                              Samplinglib parents called

                                              Mathlib API called (external library)

                                              No direct Mathlib call recorded; see the Samplinglib parents.

                                              Mathematical sources

                                              Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

                                              Samplinglib mathematical lesson

                                              Record the remaining LSI-to-KL/Fisher proof target

                                              AutoSamplingTheory.lsiToKlFiObligation · def · Teaching coverage

                                              Read this first

                                              Mathematical statement

                                              Given any source anchor, construct the proof-obligation record named probability.lsi_to_kl_fi with the text that an LSI constant c_LSI should imply KL(ρ‖π)≤FI(ρ‖π)/(2c_LSI). The record has obligation status. It does not prove the inequality or supply its missing analytic hypotheses.

                                              \[\text{recorded target: }\mathrm{KL}(\rho\|\pi)\le\frac{\mathrm{FI}(\rho\|\pi)}{2c_{\mathrm{LSI}}},\qquad\operatorname{status}=\texttt{obligation}.\]
                                              Lean statement · lsiToKlFiObligation

                                              The displayed inequality occurs inside a string field. The return type is a record for unproved work, not the inequality proposition.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              def lsiToKlFiObligation (source : SourceAnchor) : ProofObligation

                                              Exact module and namespace context

                                              Proof roadmap

                                              1. 1Write the requested target and provenance

                                                Populate the fixed id, written inequality, supplied source and explicit obligation label.

                                              2. 2Interpret the result only as a workflow object

                                                The constructor returns data that can track unfinished work. It provides no witness of the stored functional inequality.

                                              Full assumptions and notation

                                              All objects and hypotheses

                                              • source:SourceAnchor is the sole input. No positive constant, measures, LSI witness, density regularity or admissible-test proof is passed.
                                              • The returned ProofObligation uses its default empty dependency list and empty note.

                                              Notation and interpretation

                                              Analytic values versus metadata

                                              Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.

                                              \[\texttt{ProofObligation}\ne\text{proof of its statement string}\]

                                              Construction and meaning

                                              1. Write the requested target and provenance

                                              Populate the fixed id, written inequality, supplied source and explicit obligation label.

                                              \[\text{source}\mapsto(\texttt{probability.lsi\_to\_kl\_fi},\text{target text},\text{source},\texttt{obligation}).\]
                                              Corresponding Lean step

                                              record fields id, statement, source, status

                                              2. Interpret the result only as a workflow object

                                              The constructor returns data that can track unfinished work. It provides no witness of the stored functional inequality.

                                              \[\texttt{ProofObligation}\not\Rightarrow\mathrm{KL}\le\mathrm{FI}/(2c_{\mathrm{LSI}}).\]
                                              Corresponding Lean step

                                              return type ProofObligation

                                              Lean verification

                                              The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

                                              Lean construction · lsiToKlFiObligation

                                              No proof tactics or analytic theorem are used. The function constructs the stated data record with an obligation status.

                                              Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

                                              Download module (.lean)
                                              def lsiToKlFiObligation (source : SourceAnchor) : ProofObligation where
                                                id := "probability.lsi_to_kl_fi"
                                                statement := "If pi satisfies LSI with constant c_LSI, then KL(rho || pi) <= FI(rho || pi)/(2*c_LSI)."
                                                source := source
                                                status := ProofStatus.obligation
                                              
                                              end AutoSamplingTheory

                                              Exact module and namespace context

                                              Scope and omitted-condition boundaries
                                              • Contracts and obligation/interface constructors store strings and status labels. They are not propositions asserting the written mathematics and supply no Lean proof of it.
                                              • No LSI-to-KL/FI conclusion may be inferred from compiling or displaying this record.
                                              Sources, dependencies, and reuse

                                              Source and reuse

                                              Samplinglib parents called

                                              Mathlib API called (external library)

                                              No direct Mathlib call recorded; see the Samplinglib parents.

                                              Mathematical sources

                                              Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.