Skip to content

feat(ProbabilityTheory): Conditional Jensen's Inequality #27188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

CoolRmal
Copy link

@CoolRmal CoolRmal commented Jul 16, 2025

This PR adds conditional Jensen's inequality.


Open in Gitpod

@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Jul 16, 2025
Copy link

github-actions bot commented Jul 16, 2025

PR summary e2292a327e

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Analysis.NormedSpace.HahnBanach.Separation 1854 1857 +3 (+0.16%)
Import changes for all files
Files Import difference
56 files Mathlib.Analysis.BoundedVariation Mathlib.Analysis.Calculus.BumpFunction.Normed Mathlib.Analysis.Calculus.Monotone Mathlib.Analysis.Fourier.FourierTransform Mathlib.Analysis.SumIntegralComparisons Mathlib.Dynamics.Ergodic.Action.OfMinimal Mathlib.Dynamics.Ergodic.AddCircleAdd Mathlib.Dynamics.Ergodic.AddCircle Mathlib.Dynamics.Ergodic.Extreme Mathlib.Dynamics.Ergodic.RadonNikodym Mathlib.MeasureTheory.Covering.BesicovitchVectorSpace Mathlib.MeasureTheory.Covering.Besicovitch Mathlib.MeasureTheory.Covering.DensityTheorem Mathlib.MeasureTheory.Covering.Differentiation Mathlib.MeasureTheory.Covering.LiminfLimsup Mathlib.MeasureTheory.Covering.OneDim Mathlib.MeasureTheory.Function.Intersectivity Mathlib.MeasureTheory.Function.JacobianOneDim Mathlib.MeasureTheory.Function.Jacobian Mathlib.MeasureTheory.Function.L2Space Mathlib.MeasureTheory.Group.AddCircle Mathlib.MeasureTheory.Group.IntegralConvolution Mathlib.MeasureTheory.Group.ModularCharacter Mathlib.MeasureTheory.Integral.Asymptotics Mathlib.MeasureTheory.Integral.Average Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap Mathlib.MeasureTheory.Integral.DivergenceTheorem Mathlib.MeasureTheory.Integral.DominatedConvergence Mathlib.MeasureTheory.Integral.IntervalAverage Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic Mathlib.MeasureTheory.Integral.IntervalIntegral.Periodic Mathlib.MeasureTheory.Integral.Layercake Mathlib.MeasureTheory.Integral.Periodic Mathlib.MeasureTheory.Integral.Pi Mathlib.MeasureTheory.Integral.Prod Mathlib.MeasureTheory.Integral.SetIntegral Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym Mathlib.MeasureTheory.Measure.DiracProba Mathlib.MeasureTheory.Measure.FiniteMeasureProd Mathlib.MeasureTheory.Measure.FiniteMeasure Mathlib.MeasureTheory.Measure.Haar.Disintegration Mathlib.MeasureTheory.Measure.Haar.DistribChar Mathlib.MeasureTheory.Measure.Haar.Quotient Mathlib.MeasureTheory.Measure.Haar.Unique Mathlib.MeasureTheory.Measure.Lebesgue.Integral Mathlib.MeasureTheory.Measure.LevyProkhorovMetric Mathlib.MeasureTheory.Measure.LogLikelihoodRatio Mathlib.MeasureTheory.Measure.Portmanteau Mathlib.MeasureTheory.Measure.ProbabilityMeasure Mathlib.MeasureTheory.Measure.Tilted Mathlib.MeasureTheory.Order.UpperLower Mathlib.NumberTheory.WellApproximable Mathlib.Probability.Density Mathlib.Probability.Kernel.Composition.IntegralCompProd Mathlib.Probability.Kernel.MeasurableIntegral Mathlib.Probability.Kernel.WithDensity
1
Mathlib.Analysis.LocallyConvex.WeakOperatorTopology Mathlib.Analysis.NormedSpace.HahnBanach.SeparatingDual 2
4 files Mathlib.Analysis.Convex.Cone.Dual Mathlib.Analysis.Convex.KreinMilman Mathlib.Analysis.LocallyConvex.WeakSpace Mathlib.Analysis.NormedSpace.HahnBanach.Separation
3
Mathlib.MeasureTheory.Function.ConditionalExpectation.CondJensen (new file) 2185

Declarations diff

+ ConvexOn.convex_RCLike_epigraph
+ ConvexOn.iSup_affine_eq_of_separableSpace
+ LowerSemicontinuous.isClosed_RCLike_epigraph
+ Measurable.codRestrict
+ condExpL1_comp_affine
+ condExpL1_comp_continuousLinearMap
+ conditional_jensen
+ conditional_jensen_of_separableSpace
+ iInter_nat_halfSpaces_eq
+ iInter_nat_halfSpaces_eq_of_prod

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@hanwenzhu hanwenzhu added the t-measure-probability Measure theory / Probability theory label Jul 16, 2025
@CoolRmal CoolRmal marked this pull request as ready for review July 17, 2025 07:04
Copy link
Contributor

@RemyDegenne RemyDegenne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR! Here are a first few general comments. I did not review the proofs of the lemmas yet.

I think that the file should be placed in the folder MeasureTheory/Function/ConditionalExpectation.

@@ -65,7 +65,7 @@
"type": "git",
"subDir": null,
"scope": "leanprover-community",
"rev": "3cabaef23886b82ba46f07018f2786d9496477d6",
"rev": "82fd0cf6aaa1e2580aa17b3b1e5b9140e6e6a5e5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert that change. A PR should not change anything in lake-manifest.json.

/-!
# Conditional Jensen's Inequality

This file contains the proof of the conditional Jensen's inequality.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add an explanation of what the inequality is.

countably many half spaces in a separable space. -/
theorem iInter_halfSpaces_eq_of_separableSpace {𝕜 E : Type*} {s : Set E}
[RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace ℝ E]
[SeparableSpace E] [Module 𝕜 E] [ContinuousSMul 𝕜 E]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docstring of TopologicalSpace.SeparableSpace, you should instead use SecondCountableTopology here.


/-- Lemma 1.2.10 in [Hytonen_VanNeerven_Veraar_Wies_2016]: a convex lower-semicontinuous function
is the supremum of a sequence of affine functions in a separable space. -/
theorem ConvexOn.iSup_affine_eq_of_separableSpace {𝕜 E : Type*}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That lemma is about convex functions in general and not specifically about conditional expectations, so it should be moved to a file about convex functions.

All the auxiliary lemmas of this file should be moved to other more appropriate files.

Comment on lines 160 to 161
/-- Lemma 1.2.10 in [Hytonen_VanNeerven_Veraar_Wies_2016]: a convex lower-semicontinuous function
is the supremum of a sequence of affine functions in a separable space. -/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put the description of the lemma first. The reference is not as important to a person reading the docstring while coding.

Suggested change
/-- Lemma 1.2.10 in [Hytonen_VanNeerven_Veraar_Wies_2016]: a convex lower-semicontinuous function
is the supremum of a sequence of affine functions in a separable space. -/
/-- A convex lower-semicontinuous function is the supremum of a sequence of affine functions
in a separable space.
Lemma 1.2.10 in [Hytonen_VanNeerven_Veraar_Wies_2016]. -/

apply (hLc j).2; exact hxs
exact this

/-- Lemma 1.2.9 for product spaces. -/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That docstring does not explain what the lemma does, and refers to a lemma from an unknown source.

/-- Conditional Jensen's inequality. -/
theorem conditional_jensen {α X : Type*}
[NormedAddCommGroup X] [NormedSpace ℝ X] [CompleteSpace X]
{m mα : MeasurableSpace α} (hm : m ≤ mα) {μ : Measure α} [IsFiniteMeasure μ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a TODO in the file docstring to say that this should possibly be generalized to sigma-finite measures?

[SeparableSpace E] [Module 𝕜 E] [ContinuousSMul 𝕜 E]
(hs₁ : Convex ℝ s) (hs₂ : IsClosed s) (hs₃ : s.Nonempty) :
∃ (L : ℕ → E →L[𝕜] 𝕜) (c : ℕ → ℝ),
⋂ (i : ℕ), {x | re ((L i) x) - c i ≥ 0} = s ∧
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Mathlib, for uniformity and to avoid duplication of some lemmas, we state all inequalities with , not . Can you change that everywhere in your code?

Suggested change
⋂ (i : ℕ), {x | re ((L i) x) - c i0} = s ∧
⋂ (i : ℕ), {x | 0re ((L i) x) - c i} = s ∧

Also, why not {x | c i ≤ re ((L i) x)}?

@RemyDegenne RemyDegenne added the awaiting-author A reviewer has asked the author a question or requested changes. label Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author A reviewer has asked the author a question or requested changes. new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-measure-probability Measure theory / Probability theory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants