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

Restricted-Gaussian fiber log ratio and exact relative score

Yin Tat Lee, Ruoqi Shen and Kevin Tian; used by Fan Chen, Sinho Chewi, Jianfeng Lu and Matthew S. Zhang. ASTIS expanded representative-level proof; no author endorsement implied.

arXiv:2010.03106v4 · Lemma 2 proof, equation (11), used by SPHMC arXiv:2609.06906v1 Lemma 4.17 · faithful paraphrase

Complete source statement (Samplinglib restatement)

For normalized restricted-Gaussian fibers, the canonical log-likelihood ratio agrees almost everywhere under the left fiber with the explicit normalized quadratic exponent difference. For eta>0 the displayed smooth representative has the constant spatial gradient eta^{-1}(y-y'). This is the score calculation in the cited contraction proof, not the contraction itself.

  • The canonical llr identity uses a sigma-finite common base, a measurable left exponent and integrability of both exponential weights.
  • The source fiber uses eta>0; the reusable calculus theorem only requires eta nonzero.
  • Almost-everywhere value equality is not converted into differentiability of the canonical measurable representative.

canonical a.e. representative

\[\operatorname{llr}(R_{\eta,y},R_{\eta,y'})(x)=q_{\eta,y}(x)-\log Z_y-q_{\eta,y'}(x)+\log Z_{y'}\quad R_{\eta,y}\text{-a.e.}\]

equation (11) score

\[\nabla r_{y,y'}(x)=\eta^{-1}(y-y')\]

Read the formalized proofs

Each statement and proof below has its own closed Lean disclosure. Samplinglib parents, Mathlib calls and external mathematical sources are distinguished in each proof.

Samplinglib mathematical lesson

Canonical llr equals the explicit normalized tilt ratio a.e.

AutoSamplingTheory.TechnicalLemmas.InformationTheory.TiltedLogRatio.llr_tilted_tilted_ae · theorem · Teaching coverage

Read this first

Mathematical statement

For a σ-finite base μ and two integrable exponential tilts, Mathlib's canonical log-likelihood ratio of the f-tilt against the g-tilt agrees almost everywhere under the left tilted law with f−log Z_f−g+log Z_g.

\[\operatorname{llr}(\mu_f,\mu_g)(x)=f(x)-\log Z_f-g(x)+\log Z_g\quad\mu_f\text{-a.e.}\]
Lean statement · llr_tilted_tilted_ae

The right-hand side is written explicitly in the public theorem, so no hidden selected representative occurs in its interface.

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 llr_tilted_tilted_ae
    (mu : Measure X) [SigmaFinite mu] (f g : X → ℝ)
    (hf : Measurable f)
    (hfi : Integrable (fun x => Real.exp (f x)) mu)
    (hgi : Integrable (fun x => Real.exp (g x)) mu) :
    MeasureTheory.llr (mu.tilted f) (mu.tilted g) =ᵐ[mu.tilted f]
      fun x => f x - Real.log (∫ z, Real.exp (f z) ∂mu) - g x +
        Real.log (∫ z, Real.exp (g z) ∂mu)

Exact module and namespace context

Proof roadmap

  1. 1Expand the left tilt

    Mathlib's left-tilt identity contributes f−log Z_f and leaves a base-to-right-tilt llr.

  2. 2Expand the right tilt

    The right-tilt identity contributes −g+log Z_g, while the self log ratio is zero.

  3. 3Transfer the null set

    The equality is first assembled μ-a.e. and then transported to μ_f because every tilted measure is absolutely continuous with respect to its base.

Full assumptions and notation

All objects and hypotheses

  • The common base μ is σ-finite.
  • f is measurable and both exp f and exp g are μ-integrable.
  • The equality is under the left tilt μ_f, which is the law used by relative Fisher information.

Mathematical proof

1. Expand the left tilt

Mathlib's left-tilt identity contributes f−log Z_f and leaves a base-to-right-tilt llr.

\[\operatorname{llr}(\mu_f,\mu_g)=f-\log Z_f+\operatorname{llr}(\mu,\mu_g).\]
Corresponding Lean step

MeasureTheory.llr_tilted_left

2. Expand the right tilt

The right-tilt identity contributes −g+log Z_g, while the self log ratio is zero.

\[\operatorname{llr}(\mu,\mu_g)=-g+\log Z_g.\]
Corresponding Lean step

MeasureTheory.llr_tilted_right; MeasureTheory.llr_self

3. Transfer the null set

The equality is first assembled μ-a.e. and then transported to μ_f because every tilted measure is absolutely continuous with respect to its base.

\[\mu_f\ll\mu.\]
Corresponding Lean step

MeasureTheory.tilted_absolutelyContinuous

Lean verification

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

Lean proof · llr_tilted_tilted_ae

The proof combines the three canonical Mathlib llr identities pointwise on a full-measure set and uses absolute continuity to change the a.e. 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.

Download module (.lean)
theorem llr_tilted_tilted_ae
    (mu : Measure X) [SigmaFinite mu] (f g : X → ℝ)
    (hf : Measurable f)
    (hfi : Integrable (fun x => Real.exp (f x)) mu)
    (hgi : Integrable (fun x => Real.exp (g x)) mu) :
    MeasureTheory.llr (mu.tilted f) (mu.tilted g) =ᵐ[mu.tilted f]
      fun x => f x - Real.log (∫ z, Real.exp (f z) ∂mu) - g x +
        Real.log (∫ z, Real.exp (g z) ∂mu) := by
  have hbase :
      MeasureTheory.llr (mu.tilted f) (mu.tilted g) =ᵐ[mu]
        representative mu f g := by
    filter_upwards [
      MeasureTheory.llr_tilted_left
        (μ := mu) (ν := mu.tilted g) (f := f)
        (absolutelyContinuous_tilted hgi) hfi hf.aemeasurable,
      MeasureTheory.llr_tilted_right
        (μ := mu) (ν := mu) (f := g)
        Measure.AbsolutelyContinuous.rfl hgi,
      MeasureTheory.llr_self mu] with x hleft hright hself
    rw [hleft, hright, hself]
    simp [representative]
    ring
  exact (tilted_absolutelyContinuous mu f).ae_eq hbase

section Quadratic

variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
  [CompleteSpace E]
  [MeasurableSpace E] [BorelSpace E]

Exact module and namespace context

Source assumptions versus formal assumptions

SourceActual LeanDifference kindWhy it matters
The two normalized restricted-Gaussian laws are manipulated without an explicit RN representative domain.Sigma-finite common base, measurable left exponent and integrability of both exponential weights.source-implicitThese conditions justify the normalized tilts and Mathlib's canonical llr identities.
The score is used under the left fiber.Equality is explicitly almost everywhere under the left tilted law.sameThis is the measure required by FI(left||right).

A.e. value identification under the left tilt only; no classical gradient equality for the canonical llr.

Encoder–denoiser: accepted · equivalent-after-elaboration

Detected semantic differences

  • assumptions: The formal statement exposes the canonical RN representative and the analytic hypotheses implicit in the normalized-density manipulation. — Independent source review classification: explicit-elaboration; nonblocking.
  • domains: The reusable identity allows general sigma-finite common-base tilts and the vacuous zero-base case beyond the nondegenerate fiber application. — Independent source review classification: documented-generalization; nonblocking.

A generalization is not a source correction. Proposed missing conditions require separate independent repair review. No proposed repair silently changes the original theorem.

Scope and omitted-condition boundaries
  • Almost-everywhere equality of values does not identify classical gradients of arbitrary representatives.
  • No Fisher-information, log-Sobolev, Talagrand or Wasserstein conclusion is included.
Sources, dependencies, and reuse

Source and reuse

Samplinglib parents called

    Mathlib API called (external library)

    • MeasureTheory.llr_tilted_left
    • MeasureTheory.llr_tilted_right
    • MeasureTheory.llr_self
    • MeasureTheory.tilted_absolutelyContinuous

    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 restricted-Gaussian relative score is constant

    AutoSamplingTheory.TechnicalLemmas.InformationTheory.TiltedLogRatio.gradient_quadratic_representative · theorem · Teaching coverage

    Read this first

    Mathematical statement

    For η≠0, the explicit normalized log-ratio representative of the quadratic fiber centered at y against the one centered at y′ has the constant gradient η⁻¹(y−y′). The paper consumer specializes to η>0.

    \[\nabla_x\!\left[-\frac{\|x-y\|^2}{2\eta}-\log Z_y+\frac{\|x-y'\|^2}{2\eta}+\log Z_{y'}\right]=\eta^{-1}(y-y').\]
    Lean statement · gradient_quadratic_representative

    The base measure is arbitrary because only the x-independence of its two normalizers is used. No normalization or integrability premise is smuggled into this calculus 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 gradient_quadratic_representative
        (mu : Measure E) {eta : ℝ} (heta : eta ≠ 0) (y y' x : E) :
        gradient
            (fun t =>
              -(‖t - y‖ ^ 2 / (2 * eta)) -
                Real.log (∫ z, Real.exp (-(‖z - y‖ ^ 2 / (2 * eta))) ∂mu) -
              (-(‖t - y'‖ ^ 2 / (2 * eta))) +
                Real.log (∫ z, Real.exp (-(‖z - y'‖ ^ 2 / (2 * eta))) ∂mu)) x =
          eta⁻¹ • (y - y')

    Exact module and namespace context

    Proof roadmap

    1. 1Differentiate the two quadratics

      The genuine Fréchet gradients are −η⁻¹(x−y) and −η⁻¹(x−y′).

    2. 2Discard only spatial constants

      The two log normalizers may depend on μ, η and the centers, but not on x, so their derivatives vanish.

    3. 3Cancel x

      Subtracting the two quadratic scores cancels x and leaves the center displacement with the source sign.

    Full assumptions and notation

    All objects and hypotheses

    • E is a complete real inner-product space.
    • η is nonzero; SPHMC and the cited restricted-Gaussian theorem use η>0.
    • The differentiated function is displayed explicitly and is not Mathlib's arbitrary canonical measurable llr representative.

    Mathematical proof

    1. Differentiate the two quadratics

    The genuine Fréchet gradients are −η⁻¹(x−y) and −η⁻¹(x−y′).

    \[\nabla q_{\eta,y}(x)=-\eta^{-1}(x-y).\]
    Corresponding Lean step

    HasFDerivAt.norm_sq; InnerProductSpace.toDual

    2. Discard only spatial constants

    The two log normalizers may depend on μ, η and the centers, but not on x, so their derivatives vanish.

    \[\nabla_x\log Z_y=\nabla_x\log Z_{y'}=0.\]
    Corresponding Lean step

    HasFDerivAt.sub_const; HasFDerivAt.add_const

    3. Cancel x

    Subtracting the two quadratic scores cancels x and leaves the center displacement with the source sign.

    \[-\eta^{-1}(x-y)+\eta^{-1}(x-y')=\eta^{-1}(y-y').\]
    Corresponding Lean step

    module; map_sub

    Lean verification

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

    Lean proof · gradient_quadratic_representative

    A private helper derives the genuine gradient of each quadratic from the norm-square derivative and the Hilbert duality map. The public proof removes constant normalizers and performs the linear cancellation.

    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 gradient_quadratic_representative
        (mu : Measure E) {eta : ℝ} (heta : eta ≠ 0) (y y' x : E) :
        gradient
            (fun t =>
              -(‖t - y‖ ^ 2 / (2 * eta)) -
                Real.log (∫ z, Real.exp (-(‖z - y‖ ^ 2 / (2 * eta))) ∂mu) -
              (-(‖t - y'‖ ^ 2 / (2 * eta))) +
                Real.log (∫ z, Real.exp (-(‖z - y'‖ ^ 2 / (2 * eta))) ∂mu)) x =
          eta⁻¹ • (y - y') := by
      have hy := hasGradientAt_quadraticExponent heta y x
      have hy' := hasGradientAt_quadraticExponent heta y' x
      apply HasGradientAt.gradient
      rw [hasGradientAt_iff_hasFDerivAt]
      change HasFDerivAt
        (fun t => quadraticExponent eta y t -
          Real.log (∫ z, Real.exp (quadraticExponent eta y z) ∂mu) -
          quadraticExponent eta y' t +
          Real.log (∫ z, Real.exp (quadraticExponent eta y' z) ∂mu))
        (InnerProductSpace.toDual ℝ E (eta⁻¹ • (y - y'))) x
      let c := Real.log (∫ z, Real.exp (quadraticExponent eta y z) ∂mu)
      let c' := Real.log (∫ z, Real.exp (quadraticExponent eta y' z) ∂mu)
      have hderiv : HasFDerivAt
          (fun t => quadraticExponent eta y t - c - quadraticExponent eta y' t + c')
          ((InnerProductSpace.toDual ℝ E (-eta⁻¹ • (x - y))) -
            InnerProductSpace.toDual ℝ E (-eta⁻¹ • (x - y'))) x :=
        ((hy.hasFDerivAt.sub_const c).sub hy'.hasFDerivAt).add_const c'
      have hvec :
          (-eta⁻¹ • (x - y)) - (-eta⁻¹ • (x - y')) =
            eta⁻¹ • (y - y') := by
        module
      rw [← hvec, map_sub]
      simpa only [c, c'] using hderiv
    
    end Quadratic
    
    end
    
    end TiltedLogRatio
    end InformationTheory
    end TechnicalLemmas
    end AutoSamplingTheory

    Exact module and namespace context

    Source assumptions versus formal assumptions

    SourceActual LeanDifference kindWhy it matters
    eta>0 in Euclidean space.eta!=0 in a complete real inner-product space.generalizationThe derivative calculation only divides by eta; the source consumer specializes to eta>0.
    The paper differentiates the displayed log-density ratio.Only the explicitly displayed smooth representative is differentiated.mathematically-necessaryAn arbitrary canonical measurable RN representative may change on a null set, so a.e. equality of values does not determine a classical derivative.

    Exact equation (11) gradient for the explicit smooth representative only. Canonical-Fisher identification, LSI, T2 and W2 contraction remain open.

    Encoder–denoiser: accepted · equivalent-after-elaboration

    Detected semantic differences

    • domains: The calculus theorem extends positive eta in Euclidean space to nonzero eta in a complete real inner-product space. — Independent source review classification: documented-generalization; nonblocking.
    • assumptions: The standalone derivative identity permits arbitrary base measures and total real integral/log constants, while its normalized-density interpretation remains restricted to admissible fibers. — Independent source review classification: documented-generalization; nonblocking.

    A generalization is not a source correction. Proposed missing conditions require separate independent repair review. No proposed repair silently changes the original theorem.

    Scope and omitted-condition boundaries
    • The theorem does not differentiate the canonical measurable llr.
    • A representative-to-canonical-Fisher adapter, the strong-convex Gibbs LSI/T₂ backend and the W₂ contraction all remain separate red nodes.
    Sources, dependencies, and reuse

    Source and reuse

    Samplinglib parents called

      Mathlib API called (external library)

      • HasFDerivAt.norm_sq
      • InnerProductSpace.toDual
      • HasGradientAt.gradient

      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.

      Which proof obligations and prerequisites are covered?

      • TODO — not closed by these contributions Identify the explicit normalized tilt ratio a.e. with the canonical llr
      • TODO — not closed by these contributions Prove the exact constant gradient of the displayed smooth representative