Repository navigation
feat: integrals and conditional expectations against a conditional distribution - #297
Conversation
…stribution Characterize HasCondDistrib by the lintegral identity, add its Bochner form, the conditional expectation of g (X, Y) given X without a standard Borel assumption, the gluing of conditional distributions under μ ⊗ₘ κ and the transport of a conditional distribution to the law of a map. Co-Authored-By: Claude Code <noreply@github.com>
|
Do check what the conflict actually is before resolving it mechanically. If |
…b-integrals-condexp-essakine2026tight-reinforcementlearning # Conflicts: # LMLExplore/Probability/HasCondDistrib.lean
There was a problem hiding this comment.
✅ scope — now passing on 5db0008.
There was a problem hiding this comment.
Agreed: Layer 7.6 is already on main, so it was the wrong target. Commit 5db0008 leaves the code unchanged in scope, and the PR description now names ReinforcementLearning Layer 7.7 "Episodes as rounds" (statesEnv M H μ / episodeEnv M H μ, not on main: grep -rn 'statesEnv\|episodeEnv' LMLExplore finds nothing), and through it Layer 14.2 "Visits and stream models". The path from each lemma:
- 7.7 is about the joint law of the
Hsteps of an episode:statesEnvis thestationaryEnvof the kernel fromH-step policies to the law of the episode's state sequence, plus the comparisons "forgetting rewards mapsepisodeEnvepisode laws tostatesEnvones" and "a stochastic Markov policy has the episode law of the randomH-step policy". That law is built step by step, where the next state has conditional distributionP_h(s, a)given the earlier steps.hasCondDistrib_compProd_of_forall_sectRglues the per-step conditional distributions over the composition-productμ ⊗ₘ κthat forms the episode law.HasCondDistrib.of_comp_hasLawtransports the conditional distribution of theM.augmentedtrajectory to the episode law, which is the law of the state-sequence map.hasCondDistrib_iff_forall_lintegral_eqproves both of these and the comparison of episode laws. (Source:hasCondDistrib_shiftRounds_stepLaw, paper item R6.) - 14.2: the stream representation in
statesEnv(the next state of each visit of(h, s, a)has lawP_h(s, a)given the past) takes integrals and conditional expectations of functions of (visit, next state) against these conditional distributions, with no standard Borel structure available:HasCondDistrib.integral_comp_prodMk_eq_integral_integralandHasCondDistrib.condExp_prod_ae_eq_integral. (Source:integral_mul_obs_succ_stepLaw(R6),Visits.lean/VisitConcentration.lean(R11).)
The Roadmap: ReinforcementLearning line is unchanged.
There was a problem hiding this comment.
🟡 proof-quality — request_changes claude/claude-opus-5-5
The proofs are short and robust, but the same integrability step is proved twice in a row by unfolding Measure.compProd into the kernel compProd and closing with simpa, instead of through one shared measure-level lemma.
LMLExplore/Probability/HasCondDistrib.lean:137—hg'(integrability ofx ↦ ∫ y, g (x, y) ∂κ xunderP.map X) is proved byrw [Measure.compProd] at hg; simpa using hg.integral_compProd. This unfolds the measurecompProdinto the kernelκ ⊗ₖ ηform and depends onsimpremoving theprodMkLeft/constwrappers. The same two lines are repeated verbatim at line 249 incondExp_prod_ae_eq_integral. Fix: Add a reusable lemmaMeasureTheory.Integrable.integral_measure_compProd [SFinite μ] [IsSFiniteKernel κ] (hf : Integrable f (μ ⊗ₘ κ)) : Integrable (fun x ↦ ∫ y, f (x, y) ∂κ x) μinLMLExplore/Probability/Kernel/Composition/IntegralCompProd.lean. Prove it once, e.g. like Mathlib'sMeasure.integrable_compProd_iffviasimp_rw [Measure.compProd, ...], and use it at both sites.
Reply in this thread to contest a finding; that re-runs only this rubric and posts an answer here. (To fix it, just push a commit — that re-reviews on its own. To contest again after an answer, post a NEW reply rather than editing an old one.)
claude/claude-opus-5-5 · 36s · 73.6k in (68.8k cache read, 4.8k cache write) / 2.2k out tokens · reviewing this diff · rubric
AI review — approvedEach rubric is judged independently by multiple review agents; the PR merges only once every rubric is green — any rubric that is not green (changes requested, blocked, errored, stale, or not yet run) blocks the merge. See the rubrics.
♻️ = approved on an earlier commit, re-run before merge. Reviewing this diff at head |
Use `HasLaw.integral_comp` and `HasLaw.integrable_comp` for the joint law of a conditional distribution, and add `MeasureTheory.Integrable.integral_measure_compProd`, the measure form of `Integrable.integral_compProd`, used by both HasCondDistrib integral lemmas. Co-Authored-By: Claude Code <noreply@github.com>
This PR adds to
LMLExplore/Probability/HasCondDistrib.leanthe integrals and conditional expectations against a given conditional distributionHasCondDistrib Y X κ P, together with two constructions of conditional distributions. Episodic Markov arguments need these, on spaces where Mathlib'scondDistrib(standard Borel) does not apply:hasCondDistrib_iff_forall_lintegral_eq:κis the conditional distribution ofYgivenXiff∫⁻ g(X, Y) dP = ∫⁻ ∫⁻ g(X, y) dκ(X) dPfor every measurableg ≥ 0. The forward direction is the existinglintegral_comp_prodMk_eq_lintegral_lintegral;HasCondDistrib.integral_comp_prodMk_eq_integral_integral: the Bochner form, forgintegrable forP.map X ⊗ₘ κ, valued in any real normed space;HasCondDistrib.condExp_prod_ae_eq_integral:P[g(X, Y) | σ(X)] =ᵐ ∫ g(X, y) dκ(X)for integrablegvalued in a Banach space. Unlike Mathlib'scondExp_prod_ae_eq_integral_condDistrib'and LML'sHasCondDistrib.condExp_comp_ae_eq, it needs no standard Borel assumption, and it allows functions of(X, Y)(not only ofY);hasCondDistrib_compProd_of_forall_sectR: ifYhas conditional distributionη (a, ·)givenXunder everyκ a, then underμ ⊗ₘ κit has conditional distributionηgiven(fst, X ∘ snd). It is proved through the new characterization;HasCondDistrib.of_comp_hasLaw: the converse of LML'sHasCondDistrib.comp_hasLaw. A conditional distribution ofY ∘ fgivenX ∘ funderPis one ofYgivenXunder the law off.Target: ReinforcementLearning, Layer 7.7 "Episodes as rounds" (
statesEnv M H μandepisodeEnv M H μ, not yet onmain), and through it Layer 14.2 "Visits and stream models". This PR supplies prerequisites of both; it adds none of their statements. The path from each lemma:statesEnv(andepisodeEnv) as thestationaryEnvof the kernel fromH-step policies to the law of the state sequence (and rewards) of an episode, and proves that forgetting the rewards maps one episode law to the other and that a stochastic Markov policy has the episode law of a randomH-step policy. These are statements about the joint law of theHsteps of an episode, built step by step: the next state has conditional distributionP_h(s, a)given the steps so far.hasCondDistrib_compProd_of_forall_sectRglues these per-step conditional distributions over the composition-productμ ⊗ₘ κthat forms the episode law;HasCondDistrib.of_comp_hasLawtransports the conditional distribution of the trajectory ofM.augmented(a run ofM.env) to the episode law, the law of the state-sequence map;hasCondDistrib_iff_forall_lintegral_eqis how both the gluing and the comparison of episode laws are proved. In the source paper project this ishasCondDistrib_shiftRounds_stepLaw(MarkovDecisionProcess/Episodic/StepLaw.lean, the paper's item R6).statesEnv: the next state of each visit of(h, s, a)is a draw of lawP_h(s, a)given the past. Its proofs compute integrals and conditional expectations of functions of (visit, next state) against these conditional distributions, on the finite but not otherwise structured spaces ofstatesEnv, where Mathlib'scondDistribwould need a standard Borel assumption:HasCondDistrib.integral_comp_prodMk_eq_integral_integralandHasCondDistrib.condExp_prod_ae_eq_integral. In the source these areintegral_mul_obs_succ_stepLaw(R6) andVisits.lean,VisitConcentration.lean(item R11).Layer 7.6 "Episodic values" is already on
main; an earlier version of this description named it as the target by mistake.Generality, relative to the source: the Bochner identity and the conditional expectation take integrability for the joint law instead of strong measurability, a bound, or real values. The characterization takes an s-finite measure instead of a finite one. The gluing takes an s-finite kernel
κinstead of a Markov one. The transport needs only almost-everywhere measurability. The source'sHasCondDistrib.restrict_preimage(also in the item) is not included: PR #288 has already added it to this file onmain. The additions sit at the end of the existing sections and in two new sections at the end of the file. The proofs use Mathlib'sHasLaw.integral_compandHasLaw.integrable_compfor the joint law, and one new lemma,MeasureTheory.Integrable.integral_measure_compProdinLMLExplore/Probability/Kernel/Composition/IntegralCompProd.lean: the measure formIntegrable g (μ ⊗ₘ κ) → Integrable (fun a ↦ ∫ b, g (a, b) ∂κ a) μof Mathlib's kernel-levelIntegrable.integral_compProd, used by both integral lemmas. No public declaration is removed or renamed.Source: adapted from the paper project RemyDegenne/Essakine2026Tight at commit afce796e30222b744d6cef85899b2e81f06e3fc7 (Apache 2.0), files
Essakine2026Tight/ForLMLExplore/Probability/HasCondDistribIntegral.lean,HasCondDistribCondExp.leanandCondDistrib.lean. The module docstring credits it.Roadmap: ReinforcementLearning
Paper: RemyDegenne/Essakine2026Tight
Item: R4
🤖 Prepared with Claude Code