Mathlib.Probability.Kernel
Kernel-measure probability helpers: graph-map product identities and composition-product assembly lemmas for conditional-law arguments.
Kernel 1 core · 0 supporting Probability-kernel constructions for conditional distributions, product composition, graph-based maps, Bernoulli marks, and quantile realizations. ★ kernel_apply_univ
Probability-kernel constructions for conditional distributions, product composition, graph-based maps, Bernoulli marks, and quantile realizations. These tools build and compare stochastic mechanisms with explicit conditioning structure.
For measurable spaces, a Markov kernel κ, and a source point a, the kernel slice has total mass one.
Formal statement
Proof (Lean source)
BernoulliMark 6 core · 9 supporting This file constructs a measurable Boolean Bernoulli mark over a base space and proves the measure identities behind reciprocal-probability tilting. ★ bernoulliMarkedLaw_restrict_true_map_fst★ bernoulliMarkedLaw_restrict_false_map_fst★ bernoulliMarkedLaw_condExp_mark
Reciprocal tilts with Bernoulli marks
This file constructs a measurable Boolean Bernoulli mark over a base space and proves the measure identities behind reciprocal-probability tilting. The first marginal is the tilted base law, the success and failure restrictions recover their density formulas, the mark has the prescribed conditional mean, and measurable pushforwards of the success restriction are transported back to the original base law.
Given a real-valued weight on a measurable space, the Boolean Bernoulli-mark kernel has success weight max(h(a), 0) and failure weight max(1-h(a), 0) at a. For measurable unit-interval weights its fibers are Bernoulli probability measures.
For a base measure and a real-valued weight, the reciprocal tilt weights each base point by max(1/h, 0).
Definition (Lean source)
For a base measure and a real-valued mark probability, the reciprocally tilted Bernoulli-marked law first draws from the reciprocal tilt and then draws the Boolean mark with success weight h.
Definition (Lean source)
For a finite base measure, a measurable success weight, and strict positivity almost everywhere, restricting the marked law to successful marks and then forgetting the mark recovers the base measure.
Formal statement
Proof (Lean source)
For a finite base measure, a measurable success weight, and a positive success weight bounded above by one almost everywhere, restricting the marked law to failed marks and then forgetting the mark gives the base measure tilted by the failure odds (1-h)/h.
Formal statement
Proof (Lean source)
For a finite base measure, a measurable success weight, a positive success weight bounded above by one almost everywhere, and unit total mass of the reciprocal tilt, the conditional mean of the Boolean mark given the base coordinate equals the success weight at that coordinate.
Formal statement
Proof (Lean source)
9 supporting declarations (lemmas, instances)
-
instSFiniteinstance — The reciprocal tilt of an s-finite base measure by any real-valued weight is s-finite. -
bernoulliMarkKernel_applytheorem — For a measurable weight, the Bernoulli-mark kernel fiber at a base point is the Boolean Bernoulli measure with that point's weight.hypothesesconclusionbernoulliMarkKernel h a = bernoulliBool (h a)Proof (Lean source)
theorem bernoulliMarkKernel_apply {α : Type*} [MeasurableSpace α] (h : α → ℝ) (hh : Measurable h) (a : α) : bernoulliMarkKernel h a = bernoulliBool (h a) := by rw [bernoulliMarkKernel, Kernel.withDensity_apply] · rw [Kernel.const_apply] rw [withDensity_add_measure, dirac_withDensity, dirac_withDensity] simp [bernoulliBool] · exact Measurable.ite (measurable_snd (measurableSet_singleton true)) (ENNReal.measurable_ofReal.comp (hh.comp measurable_fst)) (ENNReal.measurable_ofReal.comp (measurable_const.sub (hh.comp measurable_fst))) -
instIsSFiniteKernelinstance — The Bernoulli-mark kernel built from a weight is s-finite.parametersα :Type*h :α → ℝinstancegiven byby unfold bernoulliMarkKernel apply Kernel.IsSFiniteKernel.withDensity intro a z split_ifs <;> exact ENNReal.ofReal_ne_top -
bernoulliMarkKernel_apply_truetheorem — For a measurable weight and a base point, the success singleton has kernel mass max(h(a),0).hypothesesconclusionProof (Lean source)
theorem bernoulliMarkKernel_apply_true {α : Type*} [MeasurableSpace α] (h : α → ℝ) (hh : Measurable h) (a : α) : bernoulliMarkKernel h a {true} = ofReal (h a) := by rw [bernoulliMarkKernel_apply h hh a] simp [bernoulliBool] -
bernoulliMarkKernel_apply_falsetheorem — For a measurable weight and a base point, the failure singleton has kernel mass max(1-h(a),0).hypothesesconclusionProof (Lean source)
theorem bernoulliMarkKernel_apply_false {α : Type*} [MeasurableSpace α] (h : α → ℝ) (hh : Measurable h) (a : α) : bernoulliMarkKernel h a {false} = ofReal (1 - h a) := by rw [bernoulliMarkKernel_apply h hh a] simp [bernoulliBool] -
ae_bernoulliMarkKernel_apply_univ_eq_onetheorem — If a measurable weight lies strictly above zero and at most one almost everywhere under a measure, then the corresponding Bernoulli-mark fibers have total mass one almost everywhere.hypothesesconclusion∀ᵐ a ∂μ, bernoulliMarkKernel h a univ = 1Proof (Lean source)
theorem ae_bernoulliMarkKernel_apply_univ_eq_one {α : Type*} [MeasurableSpace α] (μ : Measure α) (h : α → ℝ) (hh : Measurable h) (hpos : ∀ᵐ a ∂μ, 0 < h a) (hle : ∀ᵐ a ∂μ, h a ≤ 1) : ∀ᵐ a ∂μ, bernoulliMarkKernel h a univ = 1 := by filter_upwards [hpos, hle] with a ha h'a rw [bernoulliMarkKernel_apply h hh a] exact @IsProbabilityMeasure.measure_univ Bool _ _ (bernoulliBool_isProbabilityMeasure ha.le h'a) -
bernoulliMarkedLaw_map_fsttheorem — For a finite base measure, a measurable success weight, and a positive success weight bounded above by one almost everywhere, the first-coordinate pushforward of the reciprocal-tilt Bernoulli law is the reciprocal tilt.hypothesesα :Type*ν₁ :h :α → ℝhh :hpos :∀ᵐ a ∂ν₁, 0 < h ahle :∀ᵐ a ∂ν₁, h a ≤ 1conclusionProof (Lean source)
theorem bernoulliMarkedLaw_map_fst {α : Type*} [MeasurableSpace α] (ν₁ : Measure α) [IsFiniteMeasure ν₁] (h : α → ℝ) (hh : Measurable h) (hpos : ∀ᵐ a ∂ν₁, 0 < h a) (hle : ∀ᵐ a ∂ν₁, h a ≤ 1) : (bernoulliMarkedLaw ν₁ h).map fst = reciprocalTilt ν₁ h := by have hac : reciprocalTilt ν₁ h ≪ ν₁ := withDensity_absolutelyContinuous ν₁ (fun a => ofReal (1 / h a)) have hmass : ∀ᵐ a ∂reciprocalTilt ν₁ h, bernoulliMarkKernel h a univ = 1 := ae_bernoulliMarkKernel_apply_univ_eq_one (reciprocalTilt ν₁ h) h hh (hac.ae_le hpos) (hac.ae_le hle) ext s hs rw [Measure.map_apply measurable_fst hs] rw [bernoulliMarkedLaw, show fst ⁻¹' s = s ×ˢ univ by ext p; simp] rw [Measure.compProd_apply_prod hs MeasurableSet.univ] calc (∫⁻ a in s, bernoulliMarkKernel h a univ ∂reciprocalTilt ν₁ h) = ∫⁻ _a in s, (1 : ENNReal) ∂reciprocalTilt ν₁ h := by apply setLIntegral_congr_fun_ae hs filter_upwards [hmass] with a ha _ exact ha _ = reciprocalTilt ν₁ h s := setLIntegral_one s -
bernoulliMarkedLaw_isProbabilityMeasuretheorem — For a finite base measure, a measurable success weight, a positive success weight bounded above by one almost everywhere, and unit total mass of the reciprocal tilt, the reciprocal-tilt Bernoulli-marked law is a probability measure.hypothesesα :Type*ν₁ :h :α → ℝhh :hpos :∀ᵐ a ∂ν₁, 0 < h ahle :∀ᵐ a ∂ν₁, h a ≤ 1hcal :reciprocalTilt ν₁ h univ = 1conclusionProof (Lean source)
theorem bernoulliMarkedLaw_isProbabilityMeasure {α : Type*} [MeasurableSpace α] (ν₁ : Measure α) [IsFiniteMeasure ν₁] (h : α → ℝ) (hh : Measurable h) (hpos : ∀ᵐ a ∂ν₁, 0 < h a) (hle : ∀ᵐ a ∂ν₁, h a ≤ 1) (hcal : reciprocalTilt ν₁ h univ = 1) : IsProbabilityMeasure (bernoulliMarkedLaw ν₁ h) := by rw [isProbabilityMeasure_iff] calc bernoulliMarkedLaw ν₁ h univ = (bernoulliMarkedLaw ν₁ h).map fst univ := by rw [Measure.map_apply measurable_fst MeasurableSet.univ] simp _ = reciprocalTilt ν₁ h univ := by rw [bernoulliMarkedLaw_map_fst ν₁ h hh hpos hle] _ = 1 := hcal -
bernoulliMarkedLaw_map_restrict_truetheorem — For a finite base measure, a measurable success weight that is strictly positive almost everywhere, and a measurable statistic of a marked point, the statistic's law on successful marks is the pushforward of the base measure by evaluating that statistic at a successful mark.hypothesesconclusion= ν₁.map (fun a => g (a, true))Proof (Lean source)
theorem bernoulliMarkedLaw_map_restrict_true {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] (ν₁ : Measure α) [IsFiniteMeasure ν₁] (h : α → ℝ) (hh : Measurable h) (hpos : ∀ᵐ a ∂ν₁, 0 < h a) (g : α × Bool → β) (hg : Measurable g) : ((bernoulliMarkedLaw ν₁ h).restrict (univ ×ˢ {true})).map g = ν₁.map (fun a => g (a, true)) := by have hsection : Measurable (fun a => g (a, true)) := by fun_prop have hcancel := withDensity_one_div_ofReal_cancel ν₁ h hh hpos ext s hs rw [Measure.map_apply hg hs, Measure.map_apply hsection hs] rw [Measure.restrict_apply (hs.preimage hg)] rw [show g ⁻¹' s ∩ univ ×ˢ {true} = ((fun a => g (a, true)) ⁻¹' s) ×ˢ {true} by ext ⟨a, z⟩ cases z <;> simp] rw [bernoulliMarkedLaw, Measure.compProd_apply_prod (hs.preimage hsection) (measurableSet_singleton true)] simp_rw [bernoulliMarkKernel_apply_true h hh] rw [← withDensity_apply _ (hs.preimage hsection)] change ((ν₁.withDensity fun a => ofReal (1 / h a)).withDensity (fun a => ofReal (h a))) ((fun a => g (a, true)) ⁻¹' s) = ν₁ ((fun a => g (a, true)) ⁻¹' s) rw [hcancel]
CompProdAssembly 2 core · 2 supporting This file packages recurring measure-kernel assembly steps for composition products. ★ compProd_eq_of_inner_ae_kernel★ compProd_eq_of_inner_ae
Composition-product assembly lemmas
This file packages recurring measure-kernel assembly steps for composition products. The main lemmas turn an almost-everywhere equality of inner kernels on a product space into equality of the resulting outer composition products:
* compProd_eq_of_inner_ae: the inner kernels are mixed against a fixed s-finite measure;
* compProd_eq_of_inner_ae_kernel: the inner kernels are mixed against an indexed s-finite
kernel;
* compProd_map_snd_apply: the second-coordinate marginal of a kernel composition product
is the bind of the section of the inner kernel against the outer kernel value.
These results isolate the Fubini-style steps that otherwise require repeating
Measure.ext_prod, compProd_apply_prod, ae_ae_of_ae_compProd, and
lintegral_congr_ae.
CompProd assembly from an a.e. inner equality, indexed-integrator form. Consider two Markov-style kernels KL, KR from a base space to an outer space, each built by mixing the section at a base point of an inner kernel — fL, respectively fR, on the product of the base space and an intermediate space — against a fixed intermediate kernel κ evaluated at that point: KL a equals the section fL(a,·) composed with κ a and KR a equals the section fR(a,·) composed with κ a. If the inner kernels fL and fR agree almost everywhere with respect to the composition product of the base measure ν and κ, then the composition products ν ⊗ₘ KL and ν ⊗ₘ KR are equal.
Formal statement
Proof (Lean source)
CompProd assembly from an a.e. inner equality. Consider two Markov-style kernels KL, KR from a base space to an outer space, each built by mixing the section at a base point of an inner kernel — fL, respectively fR, on the product of the base space and an intermediate space — against a fixed intermediate measure μ: KL a equals the section fL(a,·) composed with μ and KR a equals the section fR(a,·) composed with μ. If the inner kernels fL and fR agree almost everywhere with respect to the composition product of the base measure ν with the constant-μ kernel, then the composition products ν ⊗ₘ KL and ν ⊗ₘ KR are equal.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
compProd_map_snd_applytheorem — Snd-marginal of a composition product, pointwise (disintegration backbone).Proof (Lean source)
theorem compProd_map_snd_apply {α β γ : Type*} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ] (κ₁ : Kernel α β) (κ₂ : Kernel (α × β) γ) [IsSFiniteKernel κ₁] [IsSFiniteKernel κ₂] (a : α) : ((κ₁ ⊗ₖ κ₂).map snd) a = (κ₂.sectR a) ∘ₘ (κ₁ a) := by rw [Kernel.map_apply _ measurable_snd, Kernel.compProd_apply_eq_compProd_sectR, ← Measure.snd, Measure.snd_compProd] -
compProd_deterministic_applylemma — For measurable spaces, an s-finite kernel κ, a function f, its measurability, and a base point a, composition with the deterministic kernel equals the paired pushforward.hypothesesconclusion(κ ⊗ₖ deterministic f hf) a = (κ a).map (fun b => (b, f (a, b)))Proof (Lean source)
lemma compProd_deterministic_apply {α β γ : Type*} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ] (κ : Kernel α β) [IsSFiniteKernel κ] {f : α × β → γ} (hf : Measurable f) (a : α) : (κ ⊗ₖ deterministic f hf) a = (κ a).map (fun b => (b, f (a, b))) := by have hpair : Measurable (fun b : β => (b, f (a, b))) := prodMk measurable_id (hf.comp (prodMk measurable_const measurable_id)) refine MeasureTheory.Measure.ext fun A hA => ?_ rw [ProbabilityTheory.Kernel.compProd_apply hA, MeasureTheory.Measure.map_apply hpair hA] simp only [ProbabilityTheory.Kernel.deterministic_apply] trans (∫⁻ b, indicator ((fun b => (b, f (a, b))) ⁻¹' A) (fun _ => (1 : ENNReal)) b ∂(κ a)) · apply MeasureTheory.lintegral_congr intro b have hSlice : MeasurableSet (Prod.mk b ⁻¹' A) := measurable_prodMk_left hA rw [MeasureTheory.Measure.dirac_apply' _ hSlice] simp only [indicator, Set.mem_preimage, Pi.one_apply] rfl · exact MeasureTheory.lintegral_indicator_one (hpair hA)
CondDistrib 2 core · 2 supporting This file proves general-purpose lemmas for conditional distributions under measurable equivalences and disintegration through bind form. ★ map_compProd_prodMap_left_eq_compProd_comap★ measure_eq_bind_marginal_condDistrib
Conditional-Distribution Transport Lemmas
This file proves general-purpose lemmas for conditional distributions under measurable equivalences and disintegration through bind form. The statements are independent of the causal-model infrastructure and serve as Mathlib-adjacent measure-theoretic support for identification proofs.
The exported results are map_compProd_prodMap_left_eq_compProd_comap,
condDistrib_comp_right_measurableEquiv, and
measure_eq_bind_marginal_condDistrib. Together
they move regular conditional distributions across measurable equivalences and
package finite-measure disintegration as a bind identity.
Pushforward of compProd through a measurable equivalence on the first coordinate. For a measurable equivalence e between the first-coordinate spaces, an s-finite measure ν on the source first coordinate, and an s-finite kernel κ from that coordinate to a second space, pushing the composed-product measure of ν and κ forward through e on the first coordinate (identity on the second) equals the composed-product measure of the pushed-forward ν and κ transported back along e's inverse.
Formal statement
Proof (Lean source)
Measure-theoretic chain rule / disintegration (Mathlib gap). For a finite measure μ on a product space, μ equals the composition obtained by first drawing the second coordinate from its marginal distribution and then drawing the first coordinate from its regular conditional distribution given that second coordinate.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
condDistrib_eq_of_map_prod_eqtheorem — For measurable source spaces, measurable target spaces, random elements X, Y, X', and Y', finite measures μ and ν, and equal joint laws, the conditional distributions are equal.hypothesesh :μ.map (fun a => (X a, Y a)) = ν.map (fun a => (X' a, Y' a))conclusioncondDistrib Y X μ = condDistrib Y' X' νProof (Lean source)
theorem condDistrib_eq_of_map_prod_eq {α α' β γ : Type*} [MeasurableSpace α] [MeasurableSpace α'] [MeasurableSpace β] [MeasurableSpace γ] [StandardBorelSpace β] [Nonempty β] {X : α → γ} {Y : α → β} {X' : α' → γ} {Y' : α' → β} {μ : Measure α} {ν : Measure α'} [IsFiniteMeasure μ] [IsFiniteMeasure ν] (h : μ.map (fun a => (X a, Y a)) = ν.map (fun a => (X' a, Y' a))) : condDistrib Y X μ = condDistrib Y' X' ν := by rw [condDistrib, condDistrib] congr 1 -
condDistrib_comp_right_measurableEquivtheorem — Push-forward invariance of condDistrib under a measurable equivalence of the conditioning variable.hypothesesα β Ω γ :Type*Nonempty Ωμ :Y :γ → ΩX :γ → αe :α ≃ᵐ βhY :hX :conclusion∀ᵐ x ∂(μ.map X), condDistrib Y (e ∘ X) μ (e x)= condDistrib Y X μ xProof (Lean source)
theorem condDistrib_comp_right_measurableEquiv {α β Ω γ : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] [Nonempty Ω] {mγ : MeasurableSpace γ} (μ : Measure γ) [IsFiniteMeasure μ] {Y : γ → Ω} {X : γ → α} (e : α ≃ᵐ β) (hY : Measurable Y) (hX : Measurable X) : ∀ᵐ x ∂(μ.map X), ProbabilityTheory.condDistrib Y (e ∘ X) μ (e x) = ProbabilityTheory.condDistrib Y X μ x := by classical set κ : Kernel α Ω := ProbabilityTheory.condDistrib Y X μ with hκ_def set κ' : Kernel β Ω := κ.comap e.symm e.symm.measurable with hκ'_def -- (1) Pushforward of the joint `(X, Y)` map under `(e × id)`. have hpush : map (fun a => ((e ∘ X) a, Y a)) μ = map (map e (id : Ω → Ω)) (map (fun a => (X a, Y a)) μ) := by rw [MeasureTheory.Measure.map_map (e.measurable.prodMap measurable_id) (hX.prodMk hY)] rfl -- (2) Compose with `compProd_map_condDistrib` and the pushforward lemma -- `map_compProd_prodMap_left_eq_compProd_comap` to express the -- `(e ∘ X, Y)`-pushforward as a compProd against `κ'`. have hcompProd_eX : map (fun a => ((e ∘ X) a, Y a)) μ = (map (e ∘ X) μ).compProd κ' := by rw [hpush, ← ProbabilityTheory.compProd_map_condDistrib (X := X) hY.aemeasurable, map_compProd_prodMap_left_eq_compProd_comap (map X μ) e κ] congr 1 exact MeasureTheory.Measure.map_map e.measurable hX -- (3) Uniqueness of disintegration gives ae-equality of `κ'` with -- `condDistrib Y (e ∘ X) μ` under `μ.map (e ∘ X)`. have hae : (fun b => ProbabilityTheory.condDistrib Y (e ∘ X) μ b) =ᵐ[map (e ∘ X) μ] κ' := ProbabilityTheory.condDistrib_ae_eq_of_measure_eq_compProd (e ∘ X) hY.aemeasurable hcompProd_eX -- (4) Transport the ae-equality through `e`. Since -- `μ.map (e ∘ X) = (μ.map X).map e`, an a.e. statement on the former -- becomes an a.e. statement on `μ.map X` after precomposing with `e`. have hmap : map (e ∘ X) μ = map e (map X μ) := (MeasureTheory.Measure.map_map e.measurable hX).symm rw [hmap] at hae have hae' : ∀ᵐ x ∂(map X μ), ProbabilityTheory.condDistrib Y (e ∘ X) μ (e x) = κ' (e x) := MeasureTheory.ae_of_ae_map (μ := map X μ) (f := e) e.measurable.aemeasurable hae -- (5) Finally, `κ' (e x) = κ (e.symm (e x)) = κ x`. filter_upwards [hae'] with x hx rw [hx, hκ'_def, ProbabilityTheory.Kernel.comap_apply, e.symm_apply_apply]
CondDistribFiber 1 core · 3 supporting This module localizes a joint law to a measurable conditioning fiber. ★ condDistrib_congr_on_conditioning_fiber
Conditional-distribution congruence on a conditioning fiber
This module localizes a joint law to a measurable conditioning fiber. It turns almost-everywhere equality of two outcomes on that fiber into equality of their conditional distributions there. The proof packages the restricted joint-law, composition-product restriction, and localized kernel-uniqueness steps for use in general finite-measure arguments.
Given a finite sampling measure μ, a measurable covariate map Xv, a measurable treatment map Av, two measurable outcome maps Yv and Zv, and a selected treatment value a, if the outcomes agree almost everywhere whenever treatment has that value, then their conditional distributions given covariates and treatment agree almost everywhere on the corresponding conditioning fiber.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
map_prod_restrict_eq_of_ae_eq_on_preimagetheorem — Given a measure μ, a measurable conditioning variable T, two measurable outcome variables Yv and Zv, and a measurable conditioning set s, if the outcomes agree almost everywhere on the preimage of that set, then their joint laws agree after restriction to that conditioning set.hypothesesΩ B Y :μ :Measure ΩT :Ω → BYv Zv :Ω → YhT :hY :Measurable YvhZ :Measurable Zvs :Set Bhs :h :∀ᵐ ω ∂μ, T ω ∈ s → Yv ω = Zv ωProof (Lean source)
theorem map_prod_restrict_eq_of_ae_eq_on_preimage {Ω B Y : Type*} [MeasurableSpace Ω] [MeasurableSpace B] [MeasurableSpace Y] (μ : Measure Ω) (T : Ω → B) (Yv Zv : Ω → Y) (hT : Measurable T) (hY : Measurable Yv) (hZ : Measurable Zv) {s : Set B} (hs : MeasurableSet s) (h : ∀ᵐ ω ∂μ, T ω ∈ s → Yv ω = Zv ω) : (μ.map (fun ω => (T ω, Yv ω))).restrict (s ×ˢ univ) = (μ.map (fun ω => (T ω, Zv ω))).restrict (s ×ˢ univ) := by have hYprod : Measurable (fun ω => (T ω, Yv ω)) := hT.prodMk hY have hZprod : Measurable (fun ω => (T ω, Zv ω)) := hT.prodMk hZ have hYpre : (fun ω => (T ω, Yv ω)) ⁻¹' (s ×ˢ univ) = T ⁻¹' s := by ext ω simp have hZpre : (fun ω => (T ω, Zv ω)) ⁻¹' (s ×ˢ univ) = T ⁻¹' s := by ext ω simp rw [Measure.restrict_map hYprod (hs.prod MeasurableSet.univ), Measure.restrict_map hZprod (hs.prod MeasurableSet.univ), hYpre, hZpre] apply Measure.map_congr apply (ae_restrict_iff' (hT hs)).2 filter_upwards [h] with ω hω hωs exact congrArg (fun y => (T ω, y)) (hω hωs) -
compProd_restrict_lefttheorem — Given an s-finite base measure ν, an s-finite kernel κ, and a measurable base set s, restricting their composition product to that set in the first coordinate gives the composition product formed from the restricted base measure.Proof (Lean source)
theorem compProd_restrict_left {B Y : Type*} [MeasurableSpace B] [MeasurableSpace Y] (ν : Measure B) [SFinite ν] (κ : Kernel B Y) [IsSFiniteKernel κ] {s : Set B} (hs : MeasurableSet s) : (ν ⊗ₘ κ).restrict (s ×ˢ univ) = (ν.restrict s) ⊗ₘ κ := by ext t ht rw [Measure.restrict_apply' (hs.prod MeasurableSet.univ), Measure.compProd_apply (ht.inter (hs.prod MeasurableSet.univ)), Measure.compProd_apply ht, ← lintegral_indicator hs] congr 1 ext b by_cases hb : b ∈ s <;> simp [hb] -
ae_eq_on_of_compProd_restrict_eqtheorem — Given a finite base measure ν, two finite kernels κ and η, and a measurable base set s, if their composition products agree after restriction to that set, then the kernels agree almost everywhere on the selected set.Proof (Lean source)
theorem ae_eq_on_of_compProd_restrict_eq {B Y : Type*} [MeasurableSpace B] [MeasurableSpace Y] [StandardBorelSpace Y] [Nonempty Y] (ν : Measure B) [IsFiniteMeasure ν] (κ η : Kernel B Y) [IsFiniteKernel κ] [IsFiniteKernel η] {s : Set B} (hs : MeasurableSet s) (h : (ν ⊗ₘ κ).restrict (s ×ˢ univ) = (ν ⊗ₘ η).restrict (s ×ˢ univ)) : ∀ᵐ b ∂ν, b ∈ s → κ b = η b := by rw [compProd_restrict_left ν κ hs, compProd_restrict_left ν η hs] at h exact ae_imp_of_ae_restrict (Kernel.ae_eq_of_compProd_eq h)
CondDistribWitness 3 core · 2 supporting This file states the measure-theoretic core of a backdoor or Rule-2 argument purely in terms of Mathlib's conditional distributions, with no SCM machinery. ★ condDistrib_map_of_condDistrib_fst_eq★ condDistrib_map_of_funext
Witness-kernel form of conditional distributions
This file states the measure-theoretic core of a backdoor or Rule-2 argument purely in terms of Mathlib's conditional distributions, with no SCM machinery. When an outcome is a measurable function of the conditioning variable and a residual coordinate, its conditional law is the pushforward of the residual coordinate's conditional law by that function.
The main construction is witnessKernel, a Markov kernel sending a treatment-
covariate pair to the residual conditional law pushed through a structural
response. The theorem condDistrib_map_of_condDistrib_fst_eq proves this
witness-kernel form under a conditional-independence hypothesis, while
condDistrib_map_of_funext gives the no-treatment specialization where the
conditioning variable already contains the full non-residual information.
Given a sample space equipped with a σ-algebra, a treatment space equipped with a σ-algebra, a covariate space equipped with a σ-algebra, a nonempty standard Borel residual-coordinate space, and an outcome space equipped with a σ-algebra, let the sampling measure be finite, the covariate map and the residual-coordinate map map sample points to their respective spaces, and let the structural response map map a treatment, covariate, and residual coordinate to an outcome. If this structural response is jointly measurable, then the witness kernel assigns to each treatment--covariate pair the distribution of the structural response after drawing the residual coordinate from its conditional distribution given the covariate.
Definition (Lean source)
Witness-kernel form of a conditional distribution under conditional independence. For measurable maps X, Z, and C and a jointly measurable structural-response function h, if the conditional distribution of C given the pair (X,Z) agrees almost everywhere with the conditional distribution of C given Z alone — conditional independence of C from X given Z, then the conditional distribution of the outcome h(X,Z,C) given (X,Z) agrees almost everywhere with the pushforward, by the map h x z, of the conditional distribution of C given Z.
Formal statement
Proof (Lean source)
No-treatment witness-kernel form of a conditional distribution. For measurable maps Z and C and a jointly measurable response function H, the conditional distribution of the outcome H(Z,C) given Z agrees almost everywhere with the pushforward, by the map H z, of the conditional distribution of C given Z.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
witnessKernel_applylemma — Evaluating the witness kernel at a conditioning pair gives the residual conditional law pushed through the corresponding structural slice.hypothesesΩ :sharedType u_1𝒳 :sharedType u_2𝒵 :sharedType u_3𝒞 :sharedType u_4𝒴 :sharedType u_5μ :Z :Ω → 𝒵C :Ω → 𝒞h :𝒳 → 𝒵 → 𝒞 → 𝒴hh :Measurable (fun p : (𝒳 × 𝒵) × 𝒞 => h p.1.1 p.1.2 p.2)p :𝒳 × 𝒵conclusionProof (Lean source)
@[simp] lemma witnessKernel_apply (μ : Measure Ω) [IsFiniteMeasure μ] (Z : Ω → 𝒵) (C : Ω → 𝒞) {h : 𝒳 → 𝒵 → 𝒞 → 𝒴} (hh : Measurable (fun p : (𝒳 × 𝒵) × 𝒞 => h p.1.1 p.1.2 p.2)) (p : 𝒳 × 𝒵) : witnessKernel μ (Z := Z) (C := C) hh p = (condDistrib C Z μ p.2).map (h p.1 p.2) := rfl -
instIsMarkovKernel_witnessKernelinstance — For every sample space, treatment space, covariate space, nonempty standard Borel residual-coordinate space, and outcome space, each equipped with the stated measurable structure, finite sampling measure, covariate map, residual-coordinate map, structural response map, and joint measurability of that response map, the witness kernel is a Markov kernel.parametersΩ :sharedType u_1𝒳 :sharedType u_2𝒵 :sharedType u_3𝒞 :sharedType u_4𝒴 :sharedType u_5μ :Z :Ω → 𝒵C :Ω → 𝒞h :𝒳 → 𝒵 → 𝒞 → 𝒴hh :Measurable (fun p : (𝒳 × 𝒵) × 𝒞 => h p.1.1 p.1.2 p.2)instancegiven byby constructor intro p rw [witnessKernel_apply] have hhp : Measurable (h p.1 p.2) := hh.comp (measurable_const.prodMk measurable_id) have : IsMarkovKernel (condDistrib C Z μ) := inferInstance exact Measure.isProbabilityMeasure_map hhp.aemeasurable
FiniteAtomic 1 core · 3 supporting This module evaluates Bochner integrals against finite mixtures of Dirac measures and disintegrates set integrals along a measurable base coordinate. ★ setIntegral_finiteAtomicKernel
Bochner disintegration of finite atomic kernels
This module evaluates Bochner integrals against finite mixtures of Dirac measures and disintegrates set integrals along a measurable base coordinate. It applies to a continuous base measure with finitely many, possibly distinct, atoms above each base point.
An s-finite base measure and s-finite finite atomic kernel with nonnegative weights, together with a measurable projection that recovers the base point from every atom, a measurable base set, and an outcome integrable under the law obtained by drawing a base point and then an atom, give that the integral of the outcome under that law, over the points whose recovered base point lies in the set, equals the base-measure integral over the set of the weighted sum of the outcome values at the atoms above each base point.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
integral_finiteAtomicKerneltheorem — A finite atomic kernel, described by its atom locations and nonnegative weights through a pointwise Dirac decomposition, has the finite weighted integral of an integrable real-valued outcome at the specified base point as its Bochner integral.hypothesesX :sharedType u_1Y :sharedType u_2I :sharedType u_3κ :Kernel X Yatom :X → I → Yweight :X → I → ℝhweight :∀ x i, 0 ≤ weight x ihκ :∀ x, κ x = ∑ i : I, ofReal (weight x i) • Measure.dirac (atom x i)f :Y → ℝx :Xhf :Integrable f (κ x)conclusion∫ y, f y ∂κ x = ∑ i : I, weight x i * f (atom x i)Proof (Lean source)
theorem integral_finiteAtomicKernel (κ : Kernel X Y) (atom : X → I → Y) (weight : X → I → ℝ) (hweight : ∀ x i, 0 ≤ weight x i) (hκ : ∀ x, κ x = ∑ i : I, ofReal (weight x i) • Measure.dirac (atom x i)) (f : Y → ℝ) (x : X) (hf : Integrable f (κ x)) : ∫ y, f y ∂κ x = ∑ i : I, weight x i * f (atom x i) := by rw [hκ x] have hi : ∀ i ∈ (Finset.univ : Finset I), Integrable f (ofReal (weight x i) • Measure.dirac (atom x i)) := (integrable_finsetSum_measure.mp (by simpa using (hκ x ▸ hf))) rw [integral_finsetSum_measure hi] simp only [integral_smul_measure, integral_dirac, ENNReal.toReal_ofReal (hweight x _), smul_eq_mul] -
setIntegral_finiteAtomicKernel_of_pointwisetheorem — An s-finite base measure, finite atomic kernel with nonnegative weights, measurable base-recovering projection, measurable base set, and integrable outcome, with a pointwise-equal candidate mean, make the selected outcome integral equal the set integral of that mean.hypothesesX :sharedType u_1Y :sharedType u_2I :sharedType u_3κ :Kernel X Yatom :X → I → Yweight :X → I → ℝhweight :∀ x i, 0 ≤ weight x ihκ :∀ x, κ x = ∑ i : I, ofReal (weight x i) • Measure.dirac (atom x i)base :Y → Xhbase_meas :Measurable basehbase :∀ x i, base (atom x i) = xB :Set XhB :f :Y → ℝhf :Integrable f (κ ∘ₘ μ)q :X → ℝhq :∀ x, (∑ i : I, weight x i * f (atom x i)) = q xconclusion∫ y in {y | base y ∈ B}, f y ∂(κ ∘ₘ μ) = ∫ x in B, q x ∂μProof (Lean source)
theorem setIntegral_finiteAtomicKernel_of_pointwise (μ : Measure X) [SFinite μ] (κ : Kernel X Y) [IsSFiniteKernel κ] (atom : X → I → Y) (weight : X → I → ℝ) (hweight : ∀ x i, 0 ≤ weight x i) (hκ : ∀ x, κ x = ∑ i : I, ofReal (weight x i) • Measure.dirac (atom x i)) (base : Y → X) (hbase_meas : Measurable base) (hbase : ∀ x i, base (atom x i) = x) (B : Set X) (hB : MeasurableSet B) (f : Y → ℝ) (hf : Integrable f (κ ∘ₘ μ)) (q : X → ℝ) (hq : ∀ x, (∑ i : I, weight x i * f (atom x i)) = q x) : ∫ y in {y | base y ∈ B}, f y ∂(κ ∘ₘ μ) = ∫ x in B, q x ∂μ := by rw [setIntegral_finiteAtomicKernel μ κ atom weight hweight hκ base hbase_meas hbase B hB f hf] simp_rw [hq] -
setIntegral_twoAtomicKerneltheorem — An s-finite base measure and two-atom s-finite kernel with nonnegative weights, a measurable base set, and an integrable paired outcome give the selected integral as the weighted average of the two atom values over that base set.hypothesesX :sharedType u_1MeasurableSingletonClass (X × Fin 2)κ :weight :X → Fin 2 → ℝhweight :∀ x i, 0 ≤ weight x iB :Set XhB :f :X × Fin 2 → ℝhf :Integrable f (κ ∘ₘ μ)conclusion∫ y in {y | y.1 ∈ B}, f y ∂(κ ∘ₘ μ) = ∫ x in B, (∑ i : Fin 2, weight x i * f (x, i)) ∂μProof (Lean source)
theorem setIntegral_twoAtomicKernel (μ : Measure X) [SFinite μ] [MeasurableSingletonClass (X × Fin 2)] (κ : Kernel X (X × Fin 2)) [IsSFiniteKernel κ] (weight : X → Fin 2 → ℝ) (hweight : ∀ x i, 0 ≤ weight x i) (hκ : ∀ x, κ x = ∑ i : Fin 2, ofReal (weight x i) • Measure.dirac (x, i)) (B : Set X) (hB : MeasurableSet B) (f : X × Fin 2 → ℝ) (hf : Integrable f (κ ∘ₘ μ)) : ∫ y in {y | y.1 ∈ B}, f y ∂(κ ∘ₘ μ) = ∫ x in B, (∑ i : Fin 2, weight x i * f (x, i)) ∂μ := by exact setIntegral_finiteAtomicKernel μ κ (fun x i => (x, i)) weight hweight hκ fst measurable_fst (by intros; rfl) B hB f hf
GraphMapProd 2 core · 2 supporting If νₗ is an s-finite measure on γ and Φ : β × γ → δ is measurable, then pushing a product measure α ⊗ νₗ forward along the *graph map* (o, l) ↦ (o, Φ (o, l)) produces a composition product α.compProd κ, where the disinte ★ map_graph_prod_eq_compProd
The graph push-forward of a product measure is a composition product
If νₗ is an s-finite measure on γ and Φ : β × γ → δ is measurable, then
pushing a product measure α ⊗ νₗ forward along the graph map
(o, l) ↦ (o, Φ (o, l)) produces a composition product α.compProd κ, where the
disintegration kernel κ o = νₗ.map (fun l => Φ (o, l)) reads the first
coordinate as a parameter and pushes the γ-marginal through the slice of Φ.
This is the abstract measure-theoretic core of "exogenous noise plus a structural
mechanism gives an environment-invariant conditional law": the predictor marginal
is α, the exogenous-noise law is νₗ, the mechanism is Φ, and the resulting
conditional law of the response given the predictor is the kernel κ.
For three measurable spaces serving respectively as predictor, exogenous-noise, and response spaces, a measure on the exogenous-noise space, and a mechanism mapping a predictor--noise pair to a response, the structural-mechanism kernel assigns to each predictor value the push-forward of the noise measure through the corresponding slice of the mechanism.
Graph push-forward of a product measure is a composition product. For an s-finite measure α on a first factor, an s-finite measure νₗ on a second factor, and a measurable mechanism map Φ combining the two factors into a third space, pushing the product measure α.prod νₗ forward along the graph map (o, l) ↦ (o, Φ (o, l)) equals the composition product of α with the mechanism kernel that sends each value o of the first coordinate to the pushforward of νₗ through the slice l ↦ Φ (o, l).
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
mechanismKernel_applytheorem — Pointwise value of mechanismKernel: κ o = νₗ.map (fun l => Φ (o, l)).hypothesesβ :sharedType u_1γ :sharedType u_2δ :sharedType u_3Φ :β × γ → δhΦ :o :βconclusionmechanismKernel νₗ Φ o = νₗ.map (fun l => Φ (o, l))Proof (Lean source)
theorem mechanismKernel_apply (νₗ : Measure γ) [SFinite νₗ] {Φ : β × γ → δ} (hΦ : Measurable Φ) (o : β) : mechanismKernel νₗ Φ o = νₗ.map (fun l => Φ (o, l)) := by unfold mechanismKernel rw [ProbabilityTheory.Kernel.map_apply _ hΦ, ProbabilityTheory.Kernel.prod_apply, ProbabilityTheory.Kernel.id_apply, ProbabilityTheory.Kernel.const_apply, MeasureTheory.Measure.dirac_prod, MeasureTheory.Measure.map_map hΦ measurable_prodMk_left] rfl -
instIsMarkovKernelMechanismKerneltheorem — The mechanism kernel is Markov when the exogenous-noise law is a probability measure and the mechanism is measurable.hypothesesβ :sharedType u_1γ :sharedType u_2δ :sharedType u_3νₗ :Φ :β × γ → δhΦ :conclusionIsMarkovKernel (mechanismKernel νₗ Φ)Proof (Lean source)
theorem instIsMarkovKernelMechanismKernel (νₗ : Measure γ) [IsProbabilityMeasure νₗ] {Φ : β × γ → δ} (hΦ : Measurable Φ) : IsMarkovKernel (mechanismKernel νₗ Φ) := by unfold mechanismKernel exact ProbabilityTheory.Kernel.IsMarkovKernel.map _ hΦ
ParameterizedKernelQuantileRealization 4 core · 6 supporting This file constructs a jointly measurable realization of a real-valued Markov kernel supported on the closed unit interval by one uniform variable. ★ map_quantileRealization
Parameterized quantile realization of real Markov kernels
This file constructs a jointly measurable realization of a real-valued Markov kernel supported on the closed unit interval by one uniform variable. The construction is the generalized inverse of each fiber's distribution function, valued first in the unit interval and then extended to real randomization inputs by clamping them to that interval. It proves both the exact fiberwise pushforward law and the pointwise range guarantee needed by parameterized coupling and conditional law constructions.
For a real-valued kernel, the unit-interval support property says that each parameter-specific fiber measure assigns mass one to the closed interval from zero to one. The kernel is not required to be Markov here; for a Markov kernel, as in the realization theorems, this says each fiber is a probability distribution supported on that interval.
Definition (Lean source)
For a real-valued kernel, a parameter value, and a uniform level in the closed unit interval, the unit-interval-valued parameterized quantile is the supremum of the points x of the unit interval whose fiber mass on the closed interval from zero to x is strictly smaller than the supplied level. The kernel is not required to be Markov here; the quantile interpretation holds for Markov kernels, as assumed by the realization theorems.
Definition (Lean source)
For a real-valued kernel and a parameter--randomization pair, the real-valued quantile realization evaluates the unit-interval quantile after clamping the randomization coordinate to the closed unit interval.
Definition (Lean source)
Given a real-valued Markov kernel, the condition that each fiber is supported on the closed unit interval, and a parameter value, pushing Lebesgue measure restricted to the closed unit interval through the real quantile section exactly recovers that kernel fiber.
Formal statement
Proof (Lean source)
6 supporting declarations (lemmas, instances)
-
quantileRealization_mem_unitIntervaltheorem — For a real-valued Markov kernel and a parameter--randomization pair, the corresponding realization value belongs to the closed unit interval.hypothesesconclusionquantileRealization κ p ∈ Icc (0 : ℝ) 1Proof (Lean source)
theorem quantileRealization_mem_unitInterval (κ : Kernel S ℝ) (p : S × ℝ) : quantileRealization κ p ∈ Icc (0 : ℝ) 1 := by exact (kernelUnitQuantile κ p.1 (projIcc (0 : ℝ) 1 zero_le_one p.2)).property -
measurable_kernelUnitQuantiletheorem — For a real-valued Markov kernel that is Markov, the unit-interval generalized inverse is jointly measurable in the kernel parameter and uniform level.Proof (Lean source)
theorem measurable_kernelUnitQuantile (κ : Kernel S ℝ) [IsMarkovKernel κ] : Measurable (uncurry (kernelUnitQuantile κ)) := by refine measurable_of_Ioi fun a ↦ ?_ simp only [preimage, uncurry, mem_Ioi] have h_monotone s : Monotone (fun x : unitInterval ↦ (κ s).real (Icc (0 : ℝ) x)) := fun x y hxy ↦ measureReal_mono (by gcongr) have sSup_eq_iUnion_rat : {x : S × unitInterval | a < kernelUnitQuantile κ x.1 x.2} = ⋃ (q : ℚ) (hqI : (↑q : ℝ) ∈ unitInterval) (_ : a < (q : ℝ)), {e | (κ e.1).real (Icc (0 : ℝ) ((⟨(q : ℝ), hqI⟩ : unitInterval) : ℝ)) < e.2} := by ext e simp_all only [lt_sSup_iff, mem_ofPred_eq, Subtype.exists, mem_Icc, Rat.cast_nonneg, mem_iUnion, exists_prop, exists_and_left, kernelUnitQuantile] constructor · rintro ⟨y, y_mem, hyI, (hy : a.1 < y)⟩ obtain ⟨q, hqa, hqy⟩ := exists_rat_btwn hy have hq0 : 0 ≤ q := by exact (Rat.cast_nonneg (K := ℝ)).mp (a.2.1.trans hqa.le) have hqI : (q : ℝ) ∈ unitInterval := ⟨a.2.1.trans hqa.le, hqy.le.trans hyI.2⟩ refine ⟨q, ⟨hq0, hqI.2⟩, hqa, lt_of_lt_of_le' y_mem ?_⟩ exact h_monotone e.1 (a := ⟨(q : ℝ), hqI⟩) (b := ⟨y, hyI⟩) hqy.le · intro he obtain ⟨q, hqI, hqa, h⟩ := he exact ⟨q, h, ⟨by simp [hqI.1], hqI.2⟩, hqa⟩ rw [sSup_eq_iUnion_rat] refine MeasurableSet.iUnion (fun b ↦ MeasurableSet.iUnion (fun bI ↦ MeasurableSet.iUnion (fun _ ↦ ?_))) refine measurableSet_lt ?_ measurable_snd.subtype_val simp_rw [measureReal_def] have hκ := κ.measurable_coe (s := Icc (0 : ℝ) ((⟨(b : ℝ), bI⟩ : unitInterval) : ℝ)) measurableSet_Icc fun_prop -
measurable_quantileRealizationtheorem — For a real-valued Markov kernel, the real-valued quantile realization is jointly measurable in its parameter and real randomization input.Proof (Lean source)
theorem measurable_quantileRealization (κ : Kernel S ℝ) [IsMarkovKernel κ] : Measurable (quantileRealization κ) := by change Measurable (fun p : S × ℝ ↦ ((kernelUnitQuantile κ p.1 (projIcc (0 : ℝ) 1 zero_le_one p.2) : unitInterval) : ℝ)) exact measurable_subtype_coe.comp <| (measurable_kernelUnitQuantile κ).comp <| measurable_fst.prodMk ((continuous_projIcc (a := (0 : ℝ)) (b := 1) (h := zero_le_one)).measurable.comp measurable_snd) -
measurable_quantileRealization_sectiontheorem — For a real-valued Markov kernel and a fixed parameter value, the resulting real-valued function of the randomization input is measurable.hypothesesconclusionMeasurable (fun u : ℝ => quantileRealization κ (s, u))Proof (Lean source)
@[fun_prop] theorem measurable_quantileRealization_section (κ : Kernel S ℝ) [IsMarkovKernel κ] (s : S) : Measurable (fun u : ℝ => quantileRealization κ (s, u)) := by exact (measurable_quantileRealization κ).comp (measurable_const.prodMk measurable_id) -
map_kernelUnitQuantiletheorem — Given a real-valued Markov kernel, the condition that each fiber is supported on the closed unit interval, and a parameter value, pushing canonical uniform unit-interval volume through the fiber's quantile map exactly recovers that kernel fiber.hypothesesconclusionMeasure.map (fun u : unitInterval => (kernelUnitQuantile κ s u : ℝ)) volume = κ sProof (Lean source)
theorem map_kernelUnitQuantile (κ : Kernel S ℝ) [IsMarkovKernel κ] (hκ : SupportedOnUnitInterval κ) (s : S) : Measure.map (fun u : unitInterval => (kernelUnitQuantile κ s u : ℝ)) volume = κ s := by let f := fun u : unitInterval => (kernelUnitQuantile κ s u : ℝ) have hf : Measurable f := measurable_subtype_coe.comp (measurable_kernelUnitQuantile κ).of_uncurry_left have hκ_compl : κ s (Icc (0 : ℝ) 1)ᶜ = 0 := by rw [measure_compl measurableSet_Icc (measure_ne_top (κ s) _), hκ s, measure_univ] simp have hκ_ae : ∀ᵐ y ∂κ s, y ∈ Icc (0 : ℝ) 1 := by rw [ae_iff] exact hκ_compl have hκ_Iic (z : unitInterval) : κ s (Iic (z : ℝ)) = κ s (Icc 0 (z : ℝ)) := by apply measure_congr refine hκ_ae.mono ?_ intro y hy apply propext exact ⟨fun h ↦ ⟨hy.1, h⟩, And.right⟩ refine (Measure.map f volume).ext_of_Iic (κ s) fun x ↦ ?_ rw [Measure.map_apply hf measurableSet_Iic] change volume {u : unitInterval | (kernelUnitQuantile κ s u : ℝ) ≤ x} = κ s (Iic x) by_cases hx0 : x < 0 · have hpre : {u : unitInterval | (kernelUnitQuantile κ s u : ℝ) ≤ x} = ∅ := by ext u simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false] exact not_le.mpr (hx0.trans_le (kernelUnitQuantile κ s u).property.1) have hnull : κ s (Iic x) = 0 := by refine measure_mono_null ?_ hκ_compl intro y hy simp only [mem_Iic] at hy simp only [mem_compl_iff, mem_Icc, not_and_or] exact inl (not_le.mpr (hy.trans_lt hx0)) rw [hpre, measure_empty, hnull] · have hx0' : 0 ≤ x := le_of_not_gt hx0 by_cases hx1 : x ≤ 1 · let xI : unitInterval := ⟨x, hx0', hx1⟩ have hIic : κ s (Iic x) = κ s (Icc 0 x) := hκ_Iic xI have κ_in_I : ((κ s).real (Icc (0 : ℝ) x)) ∈ unitInterval := ⟨measureReal_nonneg, measureReal_le_one⟩ rw [hIic, ← ofReal_measureReal (measure_ne_top (κ s) _), ← unitInterval.volume_Iic ⟨_, κ_in_I⟩] congr with ξ constructor · intro (hξ : kernelUnitQuantile κ s ξ ≤ xI) change ξ ≤ (κ s).real (Icc (0 : ℝ) x) by_cases hx : xI = 1 · have hx' : x = 1 := congrArg val hx rw [hx', measureReal_def, hκ s] simpa using ξ.2.2 let g := fun y : unitInterval ↦ (κ s).real (Icc (0 : ℝ) y) let nebot : NeBot (𝓝[>] xI) := by refine nhdsGT_neBot_of_exists_gt ?_ use 1 exact lt_of_le_of_ne xI.2.2 hx refine le_of_tendsto_of_tendsto (b := 𝓝[>] xI) (g := g) continuousWithinAt_const ?_ ?_ · let h := cdf (κ s) have h_continuousWithinAt := continuousWithinAt_Ioi_iff_Ici.mpr (h.right_continuous (xI : ℝ)) have hreal (y : unitInterval) : (κ s).real (Icc (0 : ℝ) (y : ℝ)) = h (y : ℝ) := by change (κ s).real (Icc (0 : ℝ) (y : ℝ)) = cdf (κ s) (y : ℝ) rw [ProbabilityTheory.cdf_eq_real, measureReal_def, measureReal_def, hκ_Iic y] simp_rw [g, hreal] rw [hreal xI] exact h_continuousWithinAt.comp (Continuous.continuousWithinAt (by fun_prop)) (fun y hy ↦ hy) · refine eventually_nhdsWithin_of_forall fun y hy ↦ ?_ by_contra! h simp only [sSup_le_iff, kernelUnitQuantile] at hξ specialize hξ y h grind · intro (hξ : ξ ≤ (κ s).real (Icc (0 : ℝ) x)) change kernelUnitQuantile κ s ξ ≤ xI simp only [sSup_le_iff, kernelUnitQuantile] intro c hc by_contra! h have h_lt : ¬(κ s).real (Icc (0 : ℝ) x) ≤ (κ s).real (Icc (0 : ℝ) c) := not_le.mpr (lt_of_le_of_lt' hξ hc) refine h_lt ?_ refine measureReal_mono ?_ intro z hz exact ⟨hz.1, hz.2.trans (by exact_mod_cast h.le)⟩ · have hx1' : 1 < x := lt_of_not_ge hx1 have hpre : {u : unitInterval | (kernelUnitQuantile κ s u : ℝ) ≤ x} = univ := by ext u simp only [mem_ofPred_eq, mem_univ, iff_true] exact (kernelUnitQuantile κ s u).property.2.trans hx1'.le have hfull : κ s (Iic x) = 1 := by calc κ s (Iic x) = κ s univ := by apply measure_congr refine hκ_ae.mono ?_ intro y hy exact propext ⟨fun _ ↦ mem_univ y, fun _ ↦ hy.2.trans hx1'.le⟩ _ = 1 := measure_univ rw [hpre, measure_univ, hfull] -
ae_quantileRealization_mem_unitIntervaltheorem — For a real-valued Markov kernel and a parameter value, the realization section lies in the closed unit interval almost everywhere under the uniform law.hypothesesconclusion∀ᵐ u ∂(volume.restrict (Icc (0 : ℝ) 1)), quantileRealization κ (s, u) ∈ Icc (0 : ℝ) 1Proof (Lean source)
theorem ae_quantileRealization_mem_unitInterval (κ : Kernel S ℝ) (s : S) : ∀ᵐ u ∂(volume.restrict (Icc (0 : ℝ) 1)), quantileRealization κ (s, u) ∈ Icc (0 : ℝ) 1 := by exact Filter.Eventually.of_forall fun u => quantileRealization_mem_unitInterval κ (s, u)
ProductCondDistrib 2 core · 0 supporting Let ρ be a finite base measure on α, and let κ : Kernel α β and η : Kernel α γ be Markov kernels. ★ condDistrib_fst_of_compProd_prod★ condDistrib_snd_of_compProd_prod
Conditional distributions for product kernels
Let ρ be a finite base measure on α, and let κ : Kernel α β and
η : Kernel α γ be Markov kernels. After sampling (B, C) from the product kernel
Kernel.prod κ η over the base coordinate, the conditional distribution of B given the
base coordinate is κ, and the conditional distribution of C given the base coordinate
is η.
The public theorems condDistrib_fst_of_compProd_prod and
condDistrib_snd_of_compProd_prod record these two coordinate conditionals for
Measure.compProd ρ (Kernel.prod κ η).
For the joint law formed by combining a finite base measure ρ with the product of two Markov kernels κ and η, the conditional distribution of the first product-kernel coordinate given the base coordinate equals κ, for ρ-almost every base point.
Formal statement
Proof (Lean source)
For the joint law formed by combining a finite base measure ρ with the product of two Markov kernels κ and η, the conditional distribution of the second product-kernel coordinate given the base coordinate equals η, for ρ-almost every base point.
Formal statement
Proof (Lean source)
TwoStateMarkov 4 core · 2 supporting This file develops transitionMatrix, stationaryProjection, transitionMatrix_pow_eq_spectral, the pointwise and compact-uniform spectral gap bounds, and transitionMatrix_pow_tendsto_stationary_uniform for a two-state Mark ★ transitionMatrix_pow_eq_spectral★ transitionMatrix_pow_tendsto_stationary_uniform
Two-State Markov Chains
This file develops transitionMatrix, stationaryProjection,
transitionMatrix_pow_eq_spectral, the pointwise and compact-uniform spectral
gap bounds, and transitionMatrix_pow_tendsto_stationary_uniform for a
two-state Markov chain with transition probabilities in the open unit square.
For two transition parameters in an arbitrary field, the two-state transition matrix is the matrix whose first row is and whose second row is .
For two transition parameters in an arbitrary field, the stationary projection matrix is the matrix whose two rows both equal .
For parameters a, b in a field with a + b nonzero, the k-th power of the two-state transition matrix transitionMatrix a b decomposes as the stationary projection stationaryProjection a b plus (1 - a - b)^k times its complement, for every k.
Formal statement
Proof (Lean source)
For a set K of transition-parameter pairs (a,b) that is compact and contained in the open unit square, the k-th power of the transition matrix converges to the stationary projection entrywise, uniformly over K: for every ε > 0 there is a threshold N such that every entry of (transitionMatrix a b)^k - stationaryProjection a b has absolute value at most ε once k ≥ N, for every (a,b) in K.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
one_minus_a_b_abs_lt_onetheorem — Pointwise spectral gap: |1 - a - b| < 1 when a + b lies strictly between zero and two.hypothesesconclusion|1 - a - b| < 1Proof (Lean source)
theorem one_minus_a_b_abs_lt_one {K : Type*} [CommRing K] [LinearOrder K] [IsStrictOrderedRing K] {a b : K} (hs_pos : 0 < a + b) (hs_lt_two : a + b < 2) : |1 - a - b| < 1 := by by_cases hle : a + b ≤ 1 · rw [abs_of_nonneg (by linarith)] linarith · have hgt : 1 < a + b := lt_of_not_ge hle rw [abs_of_neg (by linarith)] linarith -
one_minus_a_b_uniform_gap_on_compacttheorem — Uniform spectral gap on compact subsets of the open strip: the continuous function (a,b) ↦ |1 - a - b| attains its supremum when 0 < a + b < 2 at some point of K, and that supremum is strictly less than 1 by the pointwise bound.hypothesesconclusion∃ ρ : ℝ,ρ < 1conclusion 1p ∈ K :|1 - p.1 - p.2| ≤ ρProof (Lean source)
theorem one_minus_a_b_uniform_gap_on_compact (K : Set (ℝ × ℝ)) (hK_compact : IsCompact K) (hK_open : K ⊆ {p : ℝ × ℝ | 0 < p.1 + p.2 ∧ p.1 + p.2 < 2}) : ∃ ρ : ℝ, ρ < 1 ∧ ∀ p ∈ K, |1 - p.1 - p.2| ≤ ρ := by by_cases hne : K.Nonempty · let f : ℝ × ℝ → ℝ := fun p => |1 - p.1 - p.2| have hf : ContinuousOn f K := by dsimp [f] fun_prop rcases hK_compact.exists_isMaxOn hne hf with ⟨pstar, hpstar, hpmax⟩ have hopen := hK_open hpstar have hmax_lt : f pstar < 1 := by dsimp [f] exact one_minus_a_b_abs_lt_one hopen.1 hopen.2 refine ⟨(f pstar + 1) / 2, ?_, ?_⟩ · linarith · intro p hp have hle : f p ≤ f pstar := isMaxOn_iff.mp hpmax p hp dsimp [f] at hle ⊢ linarith · refine ⟨0, by norm_num, ?_⟩ intro p hp exact False.elim (hne ⟨p, hp⟩)