Mathlib.Probability.Kernel

Kernel-measure probability helpers: graph-map product identities and composition-product assembly lemmas for conditional-law arguments.

Comp­Prod­Assembly 2 core · 1 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.

theorem compProd_eq_of_inner_ae_kernel reviewed
Causalean.Mathlib.CompProdAssembly

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
κ :
fL fR :
Kernel (α × γ) β
hL :
∀ a, KL a = (fL.sectR a) ∘ₘ κ a
hR :
∀ a, KR a = (fR.sectR a) ∘ₘ κ a
hae :
∀ᵐ p ∂(ν ⊗ₘ κ), fL p = fR p
ν ⊗ₘ KL = ν ⊗ₘ KR
Proof (Lean source)
theorem compProd_eq_of_inner_ae_kernel {α γ β : Type*} [MeasurableSpace α] [MeasurableSpace γ] [MeasurableSpace β] (ν : Measure α) [IsFiniteMeasure ν] (κ : Kernel α γ) [IsSFiniteKernel κ] (KL KR : Kernel α β) [IsFiniteKernel KL] [IsSFiniteKernel KR] (fL fR : Kernel (α × γ) β) (hL : ∀ a, KL a = (fL.sectR a) ∘ₘ κ a) (hR : ∀ a, KR a = (fR.sectR a) ∘ₘ κ a) (hae : ∀ᵐ p ∂(ν ⊗ₘ κ), fL p = fR p) : ν ⊗ₘ KL = ν ⊗ₘ KR := by refine MeasureTheory.Measure.ext_prod (fun {A B} hA hB => ?_) rw [MeasureTheory.Measure.compProd_apply_prod hA hB, MeasureTheory.Measure.compProd_apply_prod hA hB] have hInnerL : ∀ a, (KL a) B = ∫⁻ c, (fL (a, c)) B ∂(κ a) := by intro a rw [hL a, MeasureTheory.Measure.bind_apply hB (ProbabilityTheory.Kernel.aemeasurable _)] simp only [ProbabilityTheory.Kernel.sectR_apply] have hInnerR : ∀ a, (KR a) B = ∫⁻ c, (fR (a, c)) B ∂(κ a) := by intro a rw [hR a, MeasureTheory.Measure.bind_apply hB (ProbabilityTheory.Kernel.aemeasurable _)] simp only [ProbabilityTheory.Kernel.sectR_apply] simp only [hInnerL, hInnerR] have hae' := MeasureTheory.Measure.ae_ae_of_ae_compProd hae have hInnerAE : ∀ᵐ a ∂ν, (∫⁻ c, (fL (a, c)) B ∂(κ a)) = ∫⁻ c, (fR (a, c)) B ∂(κ a) := by filter_upwards [hae'] with a ha refine MeasureTheory.lintegral_congr_ae ?_ filter_upwards [ha] with c hc rw [hc] exact MeasureTheory.lintegral_congr_ae (MeasureTheory.ae_restrict_of_ae hInnerAE)
Causalean.Mathlib.CompProdAssembly.compProd_eq_of_inner_ae_kernel · Causalean/Mathlib/Probability/Kernel/CompProdAssembly.lean:33
theorem compProd_eq_of_inner_ae reviewed
Causalean.Mathlib.CompProdAssembly

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
μ :
fL fR :
Kernel (α × γ) β
hL :
∀ a, KL a = (fL.sectR a) ∘ₘ μ
hR :
∀ a, KR a = (fR.sectR a) ∘ₘ μ
hae :
∀ᵐ p ∂(ν ⊗ₘ Kernel.const α μ), fL p = fR p
ν ⊗ₘ KL = ν ⊗ₘ KR
Proof (Lean source)
theorem compProd_eq_of_inner_ae {α γ β : Type*} [MeasurableSpace α] [MeasurableSpace γ] [MeasurableSpace β] (ν : Measure α) [IsFiniteMeasure ν] (μ : Measure γ) [SFinite μ] (KL KR : Kernel α β) [IsFiniteKernel KL] [IsSFiniteKernel KR] (fL fR : Kernel (α × γ) β) (hL : ∀ a, KL a = (fL.sectR a) ∘ₘ μ) (hR : ∀ a, KR a = (fR.sectR a) ∘ₘ μ) (hae : ∀ᵐ p ∂(ν ⊗ₘ Kernel.const α μ), fL p = fR p) : ν ⊗ₘ KL = ν ⊗ₘ KR := by refine compProd_eq_of_inner_ae_kernel ν (Kernel.const α μ) KL KR fL fR ?_ ?_ hae · simpa only [Kernel.const_apply] using hL · simpa only [Kernel.const_apply] using hR
Causalean.Mathlib.CompProdAssembly.compProd_eq_of_inner_ae · Causalean/Mathlib/Probability/Kernel/CompProdAssembly.lean:77
1 supporting declaration (lemmas, instances)
Graph­Map­Prod 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 κ.

def mechanismKernel reviewed
Causalean.Mathlib.GraphMapProd

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.

Definition (Lean source)
β :
Type u_1
shared
γ :
Type u_2
shared
δ :
Type u_3
shared
νₗ :
Φ :
β × γ → δ
mechanismKernel νₗ Φ :
Kernel β δ
((ProbabilityTheory.Kernel.id : Kernel β β).prod (const β νₗ)).map Φ
Causalean.Mathlib.GraphMapProd.mechanismKernel · Causalean/Mathlib/Probability/Kernel/GraphMapProd.lean:34
theorem map_graph_prod_eq_compProd reviewed
Causalean.Mathlib.GraphMapProd

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
β :
Type u_1
shared
γ :
Type u_2
shared
δ :
Type u_3
shared
α :
νₗ :
Φ :
β × γ → δ
:
Measure.map (fun p : β × γ => (p.1, Φ p)) (α.prod νₗ) = α.compProd (mechanismKernel νₗ Φ)
Proof (Lean source)
theorem map_graph_prod_eq_compProd (α : Measure β) [SFinite α] (νₗ : Measure γ) [SFinite νₗ] {Φ : β × γ → δ} (hΦ : Measurable Φ) : Measure.map (fun p : β × γ => (p.1, Φ p)) (α.prod νₗ) = α.compProd (mechanismKernel νₗ Φ) := by -- `mechanismKernel = η.map Φ` with `η = Kernel.id ×ₖ Kernel.const β νₗ`. set η : Kernel β (β × γ) := (ProbabilityTheory.Kernel.id : Kernel β β).prod (const β νₗ) with hη have hΦ' : Measurable (fun p : β × γ => (p.1, Φ p)) := by fun_prop -- Step 1: `α.compProd (η.map Φ) = map (map id Φ) (α.compProd η)`. have h1 : α.compProd (mechanismKernel νₗ Φ) = Measure.map (map id Φ) (α.compProd η) := by unfold mechanismKernel rw [← hη] exact MeasureTheory.Measure.compProd_map (μ := α) (κ := η) hΦ -- Step 2: `α.compProd η = map (fun o => (o, (o, ·)))`-style; concretely -- `α.compProd (id ×ₖ const νₗ) = map (fun p => (p.1, (p.1, p.2))) (α.prod νₗ)`. have h2 : α.compProd η = Measure.map (fun p : β × γ => (p.1, (p.1, p.2))) (α.prod νₗ) := by ext s hs rw [MeasureTheory.Measure.compProd_apply hs, MeasureTheory.Measure.map_apply ((measurable_fst.prodMk (measurable_fst.prodMk measurable_snd))) hs] rw [MeasureTheory.Measure.prod_apply (measurable_fst.prodMk (measurable_fst.prodMk measurable_snd) hs)] apply MeasureTheory.lintegral_congr intro o rw [hη, ProbabilityTheory.Kernel.prod_apply, ProbabilityTheory.Kernel.id_apply, ProbabilityTheory.Kernel.const_apply, MeasureTheory.Measure.dirac_prod] rw [MeasureTheory.Measure.map_apply measurable_prodMk_left (measurable_prodMk_left hs)] congr 1 -- Step 3: combine. `(map id Φ) ∘ (fun p => (p.1, p.1, p.2)) = fun p => (p.1, Φ p)`. rw [h1, h2, MeasureTheory.Measure.map_map (by fun_prop) (by fun_prop)] rfl
Causalean.Mathlib.GraphMapProd.map_graph_prod_eq_compProd · Causalean/Mathlib/Probability/Kernel/GraphMapProd.lean:72 · uses mechanismKernel
2 supporting declarations (lemmas, instances)
Parameterized­Kernel­Quantile­Realization 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.

def SupportedOnUnitInterval reviewed
Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization

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)
S :
Type u_1
shared
κ :
Kernel S ℝ
s :
SupportedOnUnitInterval κ :
Prop
κ s (Icc (0 : ℝ) 1) = 1
Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.SupportedOnUnitInterval · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:27
def kernelUnitQuantile reviewed
Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization

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)
S :
Type u_1
shared
κ :
Kernel S ℝ
s :
S
kernelUnitQuantile κ s u :
sSup {x : unitInterval | (κ s).real (Icc (0 : ℝ) x) < u}
Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.kernelUnitQuantile · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:36
def quantileRealization reviewed
Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization

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)
S :
Type u_1
shared
κ :
Kernel S ℝ
p :
S × ℝ
quantileRealization κ p :
kernelUnitQuantile κ p.1 (projIcc (0 : ℝ) 1 zero_le_one p.2)
Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.quantileRealization · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:48
theorem map_quantileRealization reviewed
Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization

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
S :
Type u_1
shared
κ :
s :
S
Measure.map (fun u : ℝ => quantileRealization κ (s, u)) (volume.restrict (Icc (0 : ℝ) 1))
= κ s
Proof (Lean source)
theorem map_quantileRealization (κ : Kernel S ℝ) [IsMarkovKernel κ] (hκ : SupportedOnUnitInterval κ) (s : S) : Measure.map (fun u : ℝ => quantileRealization κ (s, u)) (volume.restrict (Icc (0 : ℝ) 1)) = κ s := by rw [← unitInterval.measurePreserving_coe.map_eq, Measure.map_map (measurable_quantileRealization_section κ s) measurable_subtype_coe] rw [show (fun u : ℝ => quantileRealization κ (s, u)) ∘ val = fun u : unitInterval => (kernelUnitQuantile κ s u : ℝ) by funext u simp only [Function.comp_apply, quantileRealization] rw [Set.projIcc_of_mem zero_le_one u.property]] exact map_kernelUnitQuantile κ hκ s
Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.map_quantileRealization · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:233 · uses SupportedOnUnitInterval , quantileRealization
6 supporting declarations (lemmas, instances)
  • quantileRealization_mem_unitInterval theorem — For a real-valued Markov kernel and a parameter--randomization pair, the corresponding realization value belongs to the closed unit interval.
    S :
    Type u_1
    shared
    κ :
    Kernel S ℝ
    p :
    S × ℝ
    quantileRealization κ p ∈ Icc (0 : ℝ) 1
    Proof (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
    Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.quantileRealization_mem_unitInterval · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:58
  • measurable_kernelUnitQuantile theorem — For a real-valued Markov kernel that is Markov, the unit-interval generalized inverse is jointly measurable in the kernel parameter and uniform level.
    S :
    Type u_1
    shared
    κ :
    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
    Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.measurable_kernelUnitQuantile · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:66
  • measurable_quantileRealization theorem — For a real-valued Markov kernel, the real-valued quantile realization is jointly measurable in its parameter and real randomization input.
    S :
    Type u_1
    shared
    κ :
    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)
    Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.measurable_quantileRealization · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:106
  • measurable_quantileRealization_section theorem — For a real-valued Markov kernel and a fixed parameter value, the resulting real-valued function of the randomization input is measurable.
    S :
    Type u_1
    shared
    κ :
    s :
    S
    Measurable (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)
    Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.measurable_quantileRealization_section · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:120
  • map_kernelUnitQuantile theorem — 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.
    S :
    Type u_1
    shared
    κ :
    s :
    S
    Measure.map (fun u : unitInterval => (kernelUnitQuantile κ s u : ℝ)) volume = κ s
    Proof (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]
    Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.map_kernelUnitQuantile · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:130
  • ae_quantileRealization_mem_unitInterval theorem — 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.
    S :
    Type u_1
    shared
    κ :
    Kernel S ℝ
    s :
    S
    ∀ᵐ u ∂(volume.restrict (Icc (0 : ℝ) 1)), quantileRealization κ (s, u) ∈ Icc (0 : ℝ) 1
    Proof (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)
    Causalean.Mathlib.Probability.Kernel.ParameterizedKernelQuantileRealization.ae_quantileRealization_mem_unitInterval · Causalean/Mathlib/Probability/Kernel/ParameterizedKernelQuantileRealization.lean:252
Product­Cond­Distrib 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 κ η).

theorem condDistrib_fst_of_compProd_prod reviewed
Causalean.Mathlib.ProbabilityTheory.ProductCondDistrib

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
α :
Type u_1
shared
β :
Type u_2
shared
γ :
Type u_3
shared
Nonempty β
κ :
Kernel α β
η :
Kernel α γ
(condDistrib (Y := fun z : α × (β × γ) => z.2.1) (X := fun z : α × (β × γ) => z.1) (μ := Measure.compProd ρ (prod κ η)))
=ᵐ[ρ] κ
Proof (Lean source)
theorem condDistrib_fst_of_compProd_prod [StandardBorelSpace β] [Nonempty β] {ρ : Measure α} [IsFiniteMeasure ρ] (κ : Kernel α β) (η : Kernel α γ) [IsMarkovKernel κ] [IsMarkovKernel η] : (condDistrib (Y := fun z : α × (β × γ) => z.2.1) (X := fun z : α × (β × γ) => z.1) (μ := Measure.compProd ρ (prod κ η))) =ᵐ[ρ] κ := by have hX : Measurable (fun z : α × (β × γ) => z.1) := measurable_fst have hY : Measurable (fun z : α × (β × γ) => z.2.1) := by fun_prop have hbase : (Measure.compProd ρ (prod κ η)).map (fun z : α × (β × γ) => z.1) = ρ := by simpa [Measure.fst] using (Measure.fst_compProd ρ (prod κ η)) have hfst : (prod κ η).map fst = κ := by simpa [ProbabilityTheory.Kernel.fst_eq] using (ProbabilityTheory.Kernel.fst_prod κ η) have hjoint : (Measure.compProd ρ (prod κ η)).map (fun z : α × (β × γ) => (z.1, z.2.1)) = Measure.compProd ρ κ := by calc (Measure.compProd ρ (prod κ η)).map (fun z : α × (β × γ) => (z.1, z.2.1)) = (Measure.compProd ρ (prod κ η)).map (map id fst) := by rfl _ = Measure.compProd ρ ((prod κ η).map fst) := by rw [← Measure.compProd_map (μ := ρ) (κ := prod κ η) measurable_fst] _ = Measure.compProd ρ κ := by rw [hfst] have h := ProbabilityTheory.condDistrib_ae_eq_of_measure_eq_compProd_of_measurable (μ := Measure.compProd ρ (prod κ η)) hX hY (κ := κ) (by simpa [hbase] using hjoint) rwa [hbase] at h
Causalean.Mathlib.ProbabilityTheory.ProductCondDistrib.condDistrib_fst_of_compProd_prod · Causalean/Mathlib/Probability/Kernel/ProductCondDistrib.lean:31
theorem condDistrib_snd_of_compProd_prod reviewed
Causalean.Mathlib.ProbabilityTheory.ProductCondDistrib

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
α :
Type u_1
shared
β :
Type u_2
shared
γ :
Type u_3
Nonempty γ
shared
κ :
Kernel α β
η :
Kernel α γ
(condDistrib (Y := fun z : α × (β × γ) => z.2.2) (X := fun z : α × (β × γ) => z.1) (μ := Measure.compProd ρ (prod κ η)))
=ᵐ[ρ] η
Proof (Lean source)
theorem condDistrib_snd_of_compProd_prod [StandardBorelSpace γ] [Nonempty γ] {ρ : Measure α} [IsFiniteMeasure ρ] (κ : Kernel α β) (η : Kernel α γ) [IsMarkovKernel κ] [IsMarkovKernel η] : (condDistrib (Y := fun z : α × (β × γ) => z.2.2) (X := fun z : α × (β × γ) => z.1) (μ := Measure.compProd ρ (prod κ η))) =ᵐ[ρ] η := by have hX : Measurable (fun z : α × (β × γ) => z.1) := measurable_fst have hY : Measurable (fun z : α × (β × γ) => z.2.2) := by fun_prop have hbase : (Measure.compProd ρ (prod κ η)).map (fun z : α × (β × γ) => z.1) = ρ := by simpa [Measure.fst] using (Measure.fst_compProd ρ (prod κ η)) have hsnd : (prod κ η).map snd = η := by simpa [ProbabilityTheory.Kernel.snd_eq] using (ProbabilityTheory.Kernel.snd_prod κ η) have hjoint : (Measure.compProd ρ (prod κ η)).map (fun z : α × (β × γ) => (z.1, z.2.2)) = Measure.compProd ρ η := by calc (Measure.compProd ρ (prod κ η)).map (fun z : α × (β × γ) => (z.1, z.2.2)) = (Measure.compProd ρ (prod κ η)).map (map id snd) := by rfl _ = Measure.compProd ρ ((prod κ η).map snd) := by rw [← Measure.compProd_map (μ := ρ) (κ := prod κ η) measurable_snd] _ = Measure.compProd ρ η := by rw [hsnd] have h := ProbabilityTheory.condDistrib_ae_eq_of_measure_eq_compProd_of_measurable (μ := Measure.compProd ρ (prod κ η)) hX hY (κ := η) (by simpa [hbase] using hjoint) rwa [hbase] at h
Causalean.Mathlib.ProbabilityTheory.ProductCondDistrib.condDistrib_snd_of_compProd_prod · Causalean/Mathlib/Probability/Kernel/ProductCondDistrib.lean:73