Stat.Minimax.Mixture
This file defines finite mixtures of measures with nonnegative extended-real weights.
Mixture 4 core · 7 supporting This file defines finite mixtures of measures with nonnegative extended-real weights. ★ mixtureReal_le★ kernel_comp_priorPredictive
Finite Mixtures of Measures
This file defines finite mixtures of measures with nonnegative extended-real weights. It proves evaluation, probability-measure, and domination facts used to transfer componentwise bounds to mixtures in minimax arguments.
Given a sample space equipped with a σ-algebra, a finite index set, nonnegative extended-real weights indexed by that set, and a measure for each index, the finite mixture measure is the sum of the component measures, each scaled by its corresponding weight.
Definition (Lean source)
Domination. If the mixture weights w sum to 1, each component measure P i is a probability measure, and every component assigns .real-mass at most B to the set A, then the mixture measure also assigns .real-mass at most B to A.
Formal statement
Proof (Lean source)
Given a prior measure and a measurable experiment kernel, the prior-predictive law first draws a parameter from the prior and then draws an observation from the experiment at that parameter.
Given a probability prior, an experiment Markov kernel, and a common post-processing Markov kernel, mixing the composed experiment equals post-processing the prior-predictive mixture.
Formal statement
Proof (Lean source)
7 supporting declarations (lemmas, instances)
-
mixture_applytheorem — Evaluation: the mixture's mass on a set is the weighted sum of the parts' masses.hypothesesconclusionmixture w P A = ∑ i, w i * P i AProof (Lean source)
theorem mixture_apply (w : ι → ℝ≥0∞) (P : ι → Measure Ω) (A : Set Ω) : mixture w P A = ∑ i, w i * P i A := by simp only [mixture, Measure.coe_finsetSum, Finset.sum_apply, Measure.smul_apply, smul_eq_mul] -
mixture_isProbabilityMeasuretheorem — If the weights sum to 1 and each part is a probability measure, the mixture is one.hypothesesconclusionIsProbabilityMeasure (mixture w P)Proof (Lean source)
theorem mixture_isProbabilityMeasure (w : ι → ℝ≥0∞) (hw : ∑ i, w i = 1) (P : ι → Measure Ω) [∀ i, IsProbabilityMeasure (P i)] : IsProbabilityMeasure (mixture w P) := by refine ⟨?_⟩ rw [mixture_apply] simp only [measure_univ, mul_one] exact hw -
exists_real_ge_mixturetheorem — Witness extraction. Some component carries at least the mixture's .real-mass: since the mixture is a weighted average (weights summing to 1), its mass on A is at most the maximal component mass, attained over the finite index.hypothesesι :sharedType u_2Nonempty ιw :ι → ℝ≥0∞hw :∑ i, w i = 1P :ι → Measure Ω∀ i, IsProbabilityMeasure (P i)A :Set ΩProof (Lean source)
theorem exists_real_ge_mixture [Nonempty ι] (w : ι → ℝ≥0∞) (hw : ∑ i, w i = 1) (P : ι → Measure Ω) [∀ i, IsProbabilityMeasure (P i)] (A : Set Ω) : ∃ i, (mixture w P).real A ≤ (P i).real A := by obtain ⟨i, _, hmax⟩ := Finset.exists_max_image (Finset.univ : Finset ι) (fun i => (P i).real A) univ_nonempty exact ⟨i, mixtureReal_le w hw P A ((P i).real A) (fun j => hmax j (Finset.mem_univ j))⟩ -
priorPredictive_isProbabilitytheorem — Mixing probability experiment laws from a measurable kernel against a probability prior produces a probability law on observations.hypothesesΘ :sharedType u_1X :sharedType u_2π :Measure ΘK :Kernel Θ XhK :∀ θ, IsProbabilityMeasure (K θ)conclusionProof (Lean source)
theorem priorPredictive_isProbability (π : Measure Θ) (K : Kernel Θ X) [IsProbabilityMeasure π] (hK : ∀ θ, IsProbabilityMeasure (K θ)) : IsProbabilityMeasure (priorPredictive π K) := by rw [priorPredictive] apply isProbabilityMeasure_iff.mpr rw [Measure.bind_apply MeasurableSet.univ K.aemeasurable] simp_rw [isProbabilityMeasure_iff.mp (hK _)] simp -
priorPredictive_applytheorem — The mass that a prior and experiment kernel assign to a measurable observation event equals the prior average of its conditional event probabilities.hypothesesconclusionpriorPredictive π K A = ∫⁻ θ, K θ A ∂πProof (Lean source)
theorem priorPredictive_apply (π : Measure Θ) (K : Kernel Θ X) {A : Set X} (hA : MeasurableSet A) : priorPredictive π K A = ∫⁻ θ, K θ A ∂π := by exact Measure.bind_apply hA K.aemeasurable -
lintegral_priorPredictivetheorem — The lower integral of a nonnegative measurable statistic under the mixture from a prior and experiment kernel equals the iterated prior-then-experiment lower integral.hypothesesconclusion∫⁻ x, f x ∂priorPredictive π K = ∫⁻ θ, ∫⁻ x, f x ∂K θ ∂πProof (Lean source)
theorem lintegral_priorPredictive (π : Measure Θ) (K : Kernel Θ X) (f : X → ℝ≥0∞) (hf : Measurable f) : ∫⁻ x, f x ∂priorPredictive π K = ∫⁻ θ, ∫⁻ x, f x ∂K θ ∂π := by exact Measure.lintegral_bind K.aemeasurable hf.aemeasurable -
integral_priorPredictivetheorem — The expectation of an integrable real-valued statistic under the mixture from a prior and experiment kernel equals the prior average of its conditional expectations.hypothesesΘ :sharedType u_1X :sharedType u_2π :Measure ΘK :Kernel Θ Xf :X → ℝhf :Integrable f (priorPredictive π K)conclusion∫ x, f x ∂priorPredictive π K = ∫ θ, ∫ x, f x ∂K θ ∂πProof (Lean source)
theorem integral_priorPredictive (π : Measure Θ) (K : Kernel Θ X) (f : X → ℝ) (hf : Integrable f (priorPredictive π K)) : ∫ x, f x ∂priorPredictive π K = ∫ θ, ∫ x, f x ∂K θ ∂π := by exact integral_bind K.measurable hf
Iid 3 core · 11 supporting This module proves the Radon--Nikodym density formula for finite iid product laws, expands uniform finite-mixture chi-squared second moments into pairwise overlaps, and identifies iid overlaps as powers of their one-samp ★ one_add_chiSqDiv_uniformMixture_iid★ product_pair_overlap
Iid second moments of uniform finite mixtures
This module proves the Radon--Nikodym density formula for finite iid product laws, expands uniform finite-mixture chi-squared second moments into pairwise overlaps, and identifies iid overlaps as powers of their one-sample versions.
Given a finite nonempty family of measures, the uniform finite mixture assigns equal mass to every component.
Given a finite nonempty family of probability laws, a reference probability law, componentwise domination, integrable pairwise one-observation density products, and a sample size, one plus the chi-squared divergence, from the iid product of the reference law, of the uniform mixture of the components' iid product laws equals the average over all ordered pairs of components of the one-observation overlap raised to the sample size, where the overlap of two components is the reference-law integral of the product of their densities.
Formal statement
Proof (Lean source)
Given the first channel sample space, the second channel sample space, the first channel's reference and component laws, the second channel's reference and component laws, and domination in both channels, the overlap of the two product component laws, meaning the integral under the product reference law of the product of their densities, is the product of the two channels' separate overlaps.
Formal statement
Proof (Lean source)
11 supporting declarations (lemmas, instances)
-
iidRnDeriv_eq_prodtheorem — Given two probability laws on a measurable sample space, the second law is dominated by the first, and a sample size, the Radon--Nikodym density of the iid product law is almost everywhere the product of the one-observation densities.hypothesesΩ :Type*P Q :hQ :Q ≪ Pn :ℕProof (Lean source)
theorem iidRnDeriv_eq_prod {Ω : Type*} [MeasurableSpace Ω] (P Q : Measure Ω) [IsProbabilityMeasure P] [IsProbabilityMeasure Q] (hQ : Q ≪ P) (n : ℕ) : (Measure.pi (fun _ : Fin n => Q)).rnDeriv (Measure.pi (fun _ : Fin n => P)) =ᵐ[Measure.pi (fun _ : Fin n => P)] (fun x => ∏ i : Fin n, Q.rnDeriv P (x i)) := by induction n with | zero => have heq : Measure.pi (fun _ : Fin 0 => Q) = Measure.pi (fun _ : Fin 0 => P) := by rw [Measure.pi_of_empty, Measure.pi_of_empty] rw [heq] simpa using (Measure.rnDeriv_self (Measure.pi (fun _ : Fin 0 => P))) | succ n ih => let e := piFinSuccAbove (fun _ : Fin (n + 1) => Ω) 0 have hQmap := measurePreserving_piFinSuccAbove (fun _ : Fin (n + 1) => Q) 0 have hPmap := measurePreserving_piFinSuccAbove (fun _ : Fin (n + 1) => P) 0 have htail : Measure.pi (fun _ : Fin n => Q) ≪ Measure.pi (fun _ : Fin n => P) := pi_iid_absolutelyContinuous Q P hQ n have hb := rnDeriv_prod_eq Q P (Measure.pi (fun _ : Fin n => Q)) (Measure.pi (fun _ : Fin n => P)) hQ htail have hitail := (Measure.quasiMeasurePreserving_snd (μ := P) (ν := Measure.pi (fun _ : Fin n => P))).ae_eq_comp ih have hprod : (Q.prod (Measure.pi (fun _ : Fin n => Q))).rnDeriv (P.prod (Measure.pi (fun _ : Fin n => P))) =ᵐ[ P.prod (Measure.pi (fun _ : Fin n => P))] fun z => Q.rnDeriv P z.1 * ∏ i, Q.rnDeriv P (z.2 i) := by filter_upwards [hb, hitail] with z hz ht simp only [Function.comp_apply] at ht rw [hz, ht] have hpull := hPmap.quasiMeasurePreserving.ae_eq_comp hprod have hmap := e.measurableEmbedding.rnDeriv_map (Measure.pi (fun _ : Fin (n + 1) => Q)) (Measure.pi (fun _ : Fin (n + 1) => P)) filter_upwards [hmap, hpull] with x hm hp simp only [Function.comp_apply] at hp rw [← hm, hQmap.map_eq, hPmap.map_eq, hp, Fin.prod_univ_succ] congr 1 -
iidRnDeriv_toReal_eq_prodtheorem — Given two probability laws on a measurable sample space, the second law is dominated by the first, and a sample size, the real-valued Radon--Nikodym density of the iid product law is almost everywhere the product of the real-valued one-observation densities.hypothesesΩ :Type*P Q :hQ :Q ≪ Pn :ℕProof (Lean source)
theorem iidRnDeriv_toReal_eq_prod {Ω : Type*} [MeasurableSpace Ω] (P Q : Measure Ω) [IsProbabilityMeasure P] [IsProbabilityMeasure Q] (hQ : Q ≪ P) (n : ℕ) : (fun x => ((Measure.pi (fun _ : Fin n => Q)).rnDeriv (Measure.pi (fun _ : Fin n => P)) x).toReal) =ᵐ[ Measure.pi (fun _ : Fin n => P)] (fun x => ∏ i : Fin n, (Q.rnDeriv P (x i)).toReal) := by filter_upwards [iidRnDeriv_eq_prod P Q hQ n] with x hx simpa only [hx, ENNReal.toReal_prod] -
uniformMixture_isProbabilitytheorem — Given a finite nonempty family of probability measures, its uniform mixture is a probability measure.hypothesesΩ S :Q :S → Measure Ω∀ s, IsProbabilityMeasure (Q s)conclusionIsProbabilityMeasure (uniformMixture Q)Proof (Lean source)
theorem uniformMixture_isProbability {Ω S : Type*} [MeasurableSpace Ω] [Fintype S] [Nonempty S] (Q : S → Measure Ω) [∀ s, IsProbabilityMeasure (Q s)] : IsProbabilityMeasure (uniformMixture Q) := by apply Causalean.Stat.mixture_isProbabilityMeasure have hc : (Fintype.card S : ℝ≥0∞) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero rw [Finset.sum_const, nsmul_eq_mul] exact ENNReal.mul_inv_cancel hc (by simp) -
uniformMixture_absolutelyContinuoustheorem — Given a finite nonempty family of measures, a reference measure, and componentwise domination by that reference, the uniform mixture is also dominated by the reference measure.hypothesesconclusionuniformMixture Q ≪ PProof (Lean source)
theorem uniformMixture_absolutelyContinuous {Ω S : Type*} [MeasurableSpace Ω] [Fintype S] [Nonempty S] (Q : S → Measure Ω) (P : Measure Ω) (hac : ∀ s, Q s ≪ P) : uniformMixture Q ≪ P := by unfold uniformMixture mixture have h (t : Finset S) : t.sum (fun s => (Fintype.card S : ℝ≥0∞)⁻¹ • Q s) ≪ P := by classical induction t using Finset.induction_on with | empty => simp | @insert s t hs ih => simpa [Finset.sum_insert hs] using Measure.AbsolutelyContinuous.add_left ((hac s).smul_left ((Fintype.card S : ℝ≥0∞)⁻¹)) ih exact h univ -
uniformMixture_rnDerivtheorem — Given a finite nonempty family of probability laws and a reference probability law, the real-valued density of the uniform mixture is almost everywhere the average of the component densities.hypothesesProof (Lean source)
theorem uniformMixture_rnDeriv {Ω S : Type*} [MeasurableSpace Ω] [Fintype S] [Nonempty S] (Q : S → Measure Ω) (P : Measure Ω) [IsProbabilityMeasure P] [∀ s, IsProbabilityMeasure (Q s)] : (fun x => ((uniformMixture Q).rnDeriv P x).toReal) =ᵐ[P] (fun x => (∑ s, ((Q s).rnDeriv P x).toReal) / (Fintype.card S : ℝ)) := by classical let w : ℝ≥0∞ := (Fintype.card S : ℝ≥0∞)⁻¹ have hw : w ≠ ⊤ := by simp [w] haveI (s : S) : IsFiniteMeasure (w • Q s) := (Q s).smul_finite hw have hrn (t : Finset S) : (t.sum (fun s => w • Q s)).rnDeriv P =ᵐ[P] fun x => t.sum (fun s => w * (Q s).rnDeriv P x) := by induction t using Finset.induction_on with | empty => filter_upwards [Measure.rnDeriv_zero P] with x hx simpa using hx | @insert s t hs ih => haveI : IsFiniteMeasure (t.sum (fun s => w • Q s)) := inferInstance have hadd := Measure.rnDeriv_add (w • Q s) (t.sum (fun s => w • Q s)) P have hsmul := Measure.rnDeriv_smul_left_of_ne_top (Q s) P hw filter_upwards [hadd, hsmul, ih] with x hx ha hb simpa [Finset.sum_insert hs, Pi.add_apply, Pi.smul_apply, smul_eq_mul, ha, hb] using hx have hfinite : ∀ᵐ x ∂P, ∀ s : S, (Q s).rnDeriv P x ≠ ⊤ := by rw [Filter.eventually_all] intro s exact (Measure.rnDeriv_lt_top (Q s) P).mono (fun x hx => ne_of_lt hx) filter_upwards [hrn univ, hfinite] with x hx hfx change ((Finset.univ.sum (fun s => w • Q s)).rnDeriv P x).toReal = (∑ s, ((Q s).rnDeriv P x).toReal) / (Fintype.card S : ℝ) rw [hx, ENNReal.toReal_sum (fun s _ => ENNReal.mul_ne_top hw (hfx s))] simp_rw [ENNReal.toReal_mul] simp [w, ENNReal.toReal_inv, ENNReal.toReal_natCast, div_eq_mul_inv, Finset.mul_sum, mul_comm] -
one_add_chiSqDiv_uniformMixturetheorem — Given a finite nonempty family of probability laws, a reference probability law, componentwise domination, and integrable pairwise density products, one plus the chi-squared divergence of the uniform mixture is the average of all pairwise Radon--Nikodym overlaps.hypothesesProof (Lean source)
theorem one_add_chiSqDiv_uniformMixture {Ω S : Type*} [MeasurableSpace Ω] [Fintype S] [Nonempty S] (Q : S → Measure Ω) (P : Measure Ω) [IsProbabilityMeasure P] [∀ s, IsProbabilityMeasure (Q s)] (hac : ∀ s, Q s ≪ P) (hpair : ∀ s t, Integrable (fun x => ((Q s).rnDeriv P x).toReal * ((Q t).rnDeriv P x).toReal) P) : 1 + chiSqDiv (uniformMixture Q) P = (∑ s : S, ∑ t : S, ∫ x, ((Q s).rnDeriv P x).toReal * ((Q t).rnDeriv P x).toReal ∂P) / (Fintype.card S : ℝ) ^ 2 := by classical haveI : IsProbabilityMeasure (uniformMixture Q) := uniformMixture_isProbability Q let d (s : S) (x : Ω) : ℝ := ((Q s).rnDeriv P x).toReal let p (x : Ω) : ℝ := ((uniformMixture Q).rnDeriv P x).toReal let n : ℝ := Fintype.card S have hdouble : Integrable (fun x => ∑ s : S, ∑ t : S, d s x * d t x) P := by apply integrable_finsetSum Finset.univ intro s _ apply integrable_finsetSum Finset.univ intro t _ exact hpair s t have hpoint : ∀ᵐ x ∂P, p x ^ 2 = (∑ s : S, ∑ t : S, d s x * d t x) / n ^ 2 := by filter_upwards [uniformMixture_rnDeriv Q P] with x hx change p x = (∑ s : S, d s x) / n at hx rw [hx, div_pow, sq, Finset.sum_mul_sum] have hsq : Integrable (fun x => p x ^ 2) P := by exact (hdouble.div_const (n ^ 2)).congr (hpoint.mono fun x hx => hx.symm) have hp : Integrable p P := Measure.integrable_toReal_rnDeriv have hdev : Integrable (fun x => (p x - 1) ^ 2) P := by have heq : (fun x => (p x - 1) ^ 2) = (fun x => p x ^ 2 - 2 * p x + 1) := by funext x; ring rw [heq] exact (hsq.sub (hp.const_mul 2)).add (integrable_const 1) have hint : (∫ x, p x ^ 2 ∂P) = (∑ s : S, ∑ t : S, ∫ x, d s x * d t x ∂P) / n ^ 2 := by calc (∫ x, p x ^ 2 ∂P) = ∫ x, (∑ s : S, ∑ t : S, d s x * d t x) / n ^ 2 ∂P := integral_congr_ae hpoint _ = (∫ x, ∑ s : S, ∑ t : S, d s x * d t x ∂P) / n ^ 2 := integral_div _ _ _ = (∑ s : S, ∑ t : S, ∫ x, d s x * d t x ∂P) / n ^ 2 := by rw [integral_finsetSum] · congr 1 apply Finset.sum_congr rfl intro s _ rw [integral_finsetSum] intro t _ exact hpair s t · intro s _ apply integrable_finsetSum Finset.univ intro t _ exact hpair s t have hchi := chiSqDiv_eq (uniformMixture_absolutelyContinuous Q P hac) hdev change chiSqDiv (uniformMixture Q) P = (∫ x, p x ^ 2 ∂P) - 1 at hchi rw [hchi, hint] ring -
iidPairIntegrabletheorem — Given a reference probability law and two dominated probability laws, domination of the two laws, an integrable one-observation density product, and a sample size, the product of their iid sample densities is integrable.hypothesesΩ :Type*hQ :Q ≪ PhR :R ≪ Phint :n :ℕProof (Lean source)
theorem iidPairIntegrable {Ω : Type*} [MeasurableSpace Ω] (P Q R : Measure Ω) [IsProbabilityMeasure P] [IsProbabilityMeasure Q] [IsProbabilityMeasure R] (hQ : Q ≪ P) (hR : R ≪ P) (hint : Integrable (fun x => (Q.rnDeriv P x).toReal * (R.rnDeriv P x).toReal) P) (n : ℕ) : Integrable (fun x => (((Measure.pi (fun _ : Fin n => Q)).rnDeriv (Measure.pi (fun _ : Fin n => P)) x).toReal) * (((Measure.pi (fun _ : Fin n => R)).rnDeriv (Measure.pi (fun _ : Fin n => P)) x).toReal)) (Measure.pi (fun _ : Fin n => P)) := by have hprod : Integrable (fun x : Fin n → Ω => ∏ i : Fin n, (Q.rnDeriv P (x i)).toReal * (R.rnDeriv P (x i)).toReal) (Measure.pi (fun _ : Fin n => P)) := Integrable.fin_nat_prod (fun _ => hint) have heq : (fun x => (((Measure.pi (fun _ : Fin n => Q)).rnDeriv (Measure.pi (fun _ : Fin n => P)) x).toReal) * (((Measure.pi (fun _ : Fin n => R)).rnDeriv (Measure.pi (fun _ : Fin n => P)) x).toReal)) =ᵐ[ Measure.pi (fun _ : Fin n => P)] (fun x => ∏ i : Fin n, (Q.rnDeriv P (x i)).toReal * (R.rnDeriv P (x i)).toReal) := by filter_upwards [iidRnDeriv_toReal_eq_prod P Q hQ n, iidRnDeriv_toReal_eq_prod P R hR n] with x hqx hrx rw [hqx, hrx, ← Finset.prod_mul_distrib] exact hprod.congr heq.symm -
iidPairOverlaptheorem — Given a reference probability law and two dominated probability laws, domination of the two laws, and a sample size, the overlap of their iid sample laws is the corresponding power of the one-observation overlap.hypothesesΩ :Type*hQ :Q ≪ PhR :R ≪ Pn :ℕProof (Lean source)
theorem iidPairOverlap {Ω : Type*} [MeasurableSpace Ω] (P Q R : Measure Ω) [IsProbabilityMeasure P] [IsProbabilityMeasure Q] [IsProbabilityMeasure R] (hQ : Q ≪ P) (hR : R ≪ P) (n : ℕ) : (∫ x, (((Measure.pi (fun _ : Fin n => Q)).rnDeriv (Measure.pi (fun _ : Fin n => P)) x).toReal) * (((Measure.pi (fun _ : Fin n => R)).rnDeriv (Measure.pi (fun _ : Fin n => P)) x).toReal) ∂(Measure.pi (fun _ : Fin n => P))) = (∫ x, (Q.rnDeriv P x).toReal * (R.rnDeriv P x).toReal ∂P) ^ n := by have heq : (fun x => (((Measure.pi (fun _ : Fin n => Q)).rnDeriv (Measure.pi (fun _ : Fin n => P)) x).toReal) * (((Measure.pi (fun _ : Fin n => R)).rnDeriv (Measure.pi (fun _ : Fin n => P)) x).toReal)) =ᵐ[ Measure.pi (fun _ : Fin n => P)] (fun x => ∏ i : Fin n, (Q.rnDeriv P (x i)).toReal * (R.rnDeriv P (x i)).toReal) := by filter_upwards [iidRnDeriv_toReal_eq_prod P Q hQ n, iidRnDeriv_toReal_eq_prod P R hR n] with x hqx hrx rw [hqx, hrx, ← Finset.prod_mul_distrib] rw [integral_congr_ae heq] simpa using (integral_fintype_prod_eq_pow (ι := Fin n) (μ := P) (fun x => (Q.rnDeriv P x).toReal * (R.rnDeriv P x).toReal)) -
iid_absolutelyContinuous_of_likelihoodtheorem — Given a measurable sample space, a reference probability law, an alternative probability law, a likelihood, its likelihood representation, and a sample size, the iid alternative law is dominated by the iid reference law.hypothesesProof (Lean source)
theorem iid_absolutelyContinuous_of_likelihood {Ω : Type*} [MeasurableSpace Ω] (μ Q : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure Q] (L : Ω → ℝ) (hQ : Q = μ.withDensity (fun x => ofReal (L x))) (n : ℕ) : Measure.pi (fun _ : Fin n => Q) ≪ Measure.pi (fun _ : Fin n => μ) := by apply pi_iid_absolutelyContinuous Q μ _ n rw [hQ] exact withDensity_absolutelyContinuous μ _ -
iid_pair_integrable_of_likelihoodtheorem — Given a measurable sample space, a reference probability law and two alternative probability laws, two likelihoods, their measurability, their nonnegativity, their likelihood representations, an integrable one-observation likelihood product, and a sample size, the product of the iid densities is integrable under the iid reference law.hypothesesΩ :Type*L M :Ω → ℝhL :hM :hL0 :∀ x, 0 ≤ L xhM0 :∀ x, 0 ≤ M xhQ :Q = μ.withDensity (fun x => ofReal (L x))hR :R = μ.withDensity (fun x => ofReal (M x))hpairInt :Integrable (fun x => L x * M x) μn :ℕProof (Lean source)
theorem iid_pair_integrable_of_likelihood {Ω : Type*} [MeasurableSpace Ω] (μ Q R : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure Q] [IsProbabilityMeasure R] (L M : Ω → ℝ) (hL : Measurable L) (hM : Measurable M) (hL0 : ∀ x, 0 ≤ L x) (hM0 : ∀ x, 0 ≤ M x) (hQ : Q = μ.withDensity (fun x => ofReal (L x))) (hR : R = μ.withDensity (fun x => ofReal (M x))) (hpairInt : Integrable (fun x => L x * M x) μ) (n : ℕ) : Integrable (fun x => (((Measure.pi (fun _ : Fin n => Q)).rnDeriv (Measure.pi (fun _ : Fin n => μ)) x).toReal) * (((Measure.pi (fun _ : Fin n => R)).rnDeriv (Measure.pi (fun _ : Fin n => μ)) x).toReal)) (Measure.pi (fun _ : Fin n => μ)) := by have hLeq : (fun x => (Q.rnDeriv μ x).toReal) =ᵐ[μ] L := by rw [hQ] filter_upwards [Measure.rnDeriv_withDensity μ hL.ennreal_ofReal] with x hx simp [hx, ENNReal.toReal_ofReal (hL0 x)] have hMeq : (fun x => (R.rnDeriv μ x).toReal) =ᵐ[μ] M := by rw [hR] filter_upwards [Measure.rnDeriv_withDensity μ hM.ennreal_ofReal] with x hx simp [hx, ENNReal.toReal_ofReal (hM0 x)] have hprod : (fun x => (Q.rnDeriv μ x).toReal * (R.rnDeriv μ x).toReal) =ᵐ[μ] (fun x => L x * M x) := by filter_upwards [hLeq, hMeq] with x hx hy simp [hx, hy] have hacQ : Q ≪ μ := by rw [hQ] exact withDensity_absolutelyContinuous μ _ have hacR : R ≪ μ := by rw [hR] exact withDensity_absolutelyContinuous μ _ have hint : Integrable (fun x => (Q.rnDeriv μ x).toReal * (R.rnDeriv μ x).toReal) μ := hpairInt.congr hprod.symm exact iidPairIntegrable μ Q R hacQ hacR hint n -
product_pair_integrabletheorem — Given the first channel sample space, the second channel sample space, the first channel's reference and component laws, the second channel's reference and component laws, domination in both channels, and integrable component-density products in both channels, the product joint-density product is integrable under the product reference law.hypothesesΩ₁ Ω₂ :P₁ Q₁ R₁ :Measure Ω₁P₂ Q₂ R₂ :Measure Ω₂hQ₁ :Q₁ ≪ P₁hR₁ :R₁ ≪ P₁hQ₂ :Q₂ ≪ P₂hR₂ :R₂ ≪ P₂hInt₁ :hInt₂ :conclusionIntegrable (fun z => ((Q₁.prod Q₂).rnDeriv (P₁.prod P₂) z).toReal * ((R₁.prod R₂).rnDeriv (P₁.prod P₂) z).toReal) (P₁.prod P₂)Proof (Lean source)
theorem product_pair_integrable {Ω₁ Ω₂ : Type*} [MeasurableSpace Ω₁] [MeasurableSpace Ω₂] (P₁ Q₁ R₁ : Measure Ω₁) (P₂ Q₂ R₂ : Measure Ω₂) [IsProbabilityMeasure P₁] [IsProbabilityMeasure Q₁] [IsProbabilityMeasure R₁] [IsProbabilityMeasure P₂] [IsProbabilityMeasure Q₂] [IsProbabilityMeasure R₂] (hQ₁ : Q₁ ≪ P₁) (hR₁ : R₁ ≪ P₁) (hQ₂ : Q₂ ≪ P₂) (hR₂ : R₂ ≪ P₂) (hInt₁ : Integrable (fun x => (Q₁.rnDeriv P₁ x).toReal * (R₁.rnDeriv P₁ x).toReal) P₁) (hInt₂ : Integrable (fun x => (Q₂.rnDeriv P₂ x).toReal * (R₂.rnDeriv P₂ x).toReal) P₂) : Integrable (fun z => ((Q₁.prod Q₂).rnDeriv (P₁.prod P₂) z).toReal * ((R₁.prod R₂).rnDeriv (P₁.prod P₂) z).toReal) (P₁.prod P₂) := by have hQ := Causalean.Mathlib.Probability.ProductAbsolutelyContinuous.rnDeriv_prod_eq Q₁ P₁ Q₂ P₂ hQ₁ hQ₂ have hR := Causalean.Mathlib.Probability.ProductAbsolutelyContinuous.rnDeriv_prod_eq R₁ P₁ R₂ P₂ hR₁ hR₂ have hEq : (fun z => ((Q₁.prod Q₂).rnDeriv (P₁.prod P₂) z).toReal * ((R₁.prod R₂).rnDeriv (P₁.prod P₂) z).toReal) =ᵐ[P₁.prod P₂] (fun z => ((Q₁.rnDeriv P₁ z.1).toReal * (R₁.rnDeriv P₁ z.1).toReal) * ((Q₂.rnDeriv P₂ z.2).toReal * (R₂.rnDeriv P₂ z.2).toReal)) := by filter_upwards [hQ, hR] with z hzQ hzR simp only [hzQ, hzR, ENNReal.toReal_mul] ring exact (Integrable.mul_prod hInt₁ hInt₂).congr hEq.symm
SignOverlap 2 core · 2 supporting When two hypotheses are drawn independently and uniformly from the 2^K sign vectors in {−1, +1}^K, the chi-square (second-moment) computation for the resulting mixture reduces to an average of powers of 1 + ρ ⟨s, t⟩ / K ★ uniform_sign_twoPower_le_exp
Exponential bounds for averages over pairs of sign vectors
When two hypotheses are drawn independently and uniformly from the 2^K sign vectors in
{−1, +1}^K, the chi-square (second-moment) computation for the resulting mixture reduces to an
average of powers of 1 + ρ ⟨s, t⟩ / K over all pairs (s, t). This module bounds such averages:
for two sample sizes n₁, n₂ and overlap coefficients ρ₁, ρ₂ with nonnegative bases,
average over (s, t) of (1 + ρ₁⟨s,t⟩/K)^n₁ (1 + ρ₂⟨s,t⟩/K)^n₂ ≤ exp((n₁ρ₁ + n₂ρ₂)² / (2K)).
Main definitions and results
* innerSign — the inner product ⟨s, t⟩ of two Boolean vectors read as ±1 signs.
* uniform_innerSign_exp_le — the average of exp(t ⟨s,u⟩ / K) over pairs is at most
exp(t² / (2K)).
* sign_twoPower_pointwise_le_exp — (1 + ρ₁x)^n₁ (1 + ρ₂x)^n₂ ≤ exp((n₁ρ₁ + n₂ρ₂) x).
* uniform_sign_twoPower_le_exp — the displayed two-sample bound.
Given a sign-vector length and two Boolean sign vectors, the inner sign product is given by summing coordinatewise products after interpreting Boolean values as plus or minus one.
Given a positive sign-vector length and two sample sizes, two overlap coefficients, and bases 1 + ρ₁⟨s,t⟩/K and 1 + ρ₂⟨s,t⟩/K that are nonnegative for every pair of sign vectors, where ⟨s,t⟩ is the inner sign product, the average over all pairs of sign vectors of (1 + ρ₁⟨s,t⟩/K)^n₁ · (1 + ρ₂⟨s,t⟩/K)^n₂ is at most exp((n₁ρ₁ + n₂ρ₂)² / (2K)).
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
sign_twoPower_pointwise_le_exptheorem — Given two sample sizes, two overlap coefficients, an overlap coordinate, and nonnegative overlap bases, the product of two overlap powers is bounded by its linearized exponential.hypothesesn₁ n₂ :ℕρ₁ ρ₂ x :ℝhbase₁ :0 ≤ 1 + ρ₁ * xhbase₂ :0 ≤ 1 + ρ₂ * xconclusion(1 + ρ₁ * x) ^ n₁ * (1 + ρ₂ * x) ^ n₂ ≤ exp (((n₁ : ℝ) * ρ₁ + (n₂ : ℝ) * ρ₂) * x)Proof (Lean source)
theorem sign_twoPower_pointwise_le_exp (n₁ n₂ : ℕ) (ρ₁ ρ₂ x : ℝ) (hbase₁ : 0 ≤ 1 + ρ₁ * x) (hbase₂ : 0 ≤ 1 + ρ₂ * x) : (1 + ρ₁ * x) ^ n₁ * (1 + ρ₂ * x) ^ n₂ ≤ exp (((n₁ : ℝ) * ρ₁ + (n₂ : ℝ) * ρ₂) * x) := by have h₁ : (1 + ρ₁ * x) ^ n₁ ≤ (exp (ρ₁ * x)) ^ n₁ := pow_le_pow_left₀ hbase₁ (by simpa [add_comm] using Real.add_one_le_exp (ρ₁ * x)) _ have h₂ : (1 + ρ₂ * x) ^ n₂ ≤ (exp (ρ₂ * x)) ^ n₂ := pow_le_pow_left₀ hbase₂ (by simpa [add_comm] using Real.add_one_le_exp (ρ₂ * x)) _ calc (1 + ρ₁ * x) ^ n₁ * (1 + ρ₂ * x) ^ n₂ ≤ (exp (ρ₁ * x)) ^ n₁ * (exp (ρ₂ * x)) ^ n₂ := mul_le_mul h₁ h₂ (pow_nonneg hbase₂ _) (pow_nonneg (Real.exp_pos _).le _) _ = exp (((n₁ : ℝ) * ρ₁ + (n₂ : ℝ) * ρ₂) * x) := by rw [← Real.exp_nat_mul, ← Real.exp_nat_mul, ← Real.exp_add] congr 1 ring -
uniform_innerSign_exp_letheorem — Given a positive sign-vector length and an exponential coefficient, the uniform double average of the scaled inner-sign exponential is bounded by its Gaussian moment expression.hypothesesK :ℕNeZero Kt :ℝProof (Lean source)
theorem uniform_innerSign_exp_le (K : ℕ) [NeZero K] (t : ℝ) : (∑ s : Fin K → Bool, ∑ u : Fin K → Bool, exp (t * innerSign s u / (K : ℝ))) / (card (Fin K → Bool) : ℝ) ^ 2 ≤ exp (t ^ 2 / (2 * (K : ℝ))) := by classical have hK : (K : ℝ) ≠ 0 := by exact_mod_cast (NeZero.ne K) have hcard : (card (Fin K → Bool) : ℝ) = (2 : ℝ) ^ K := by simp [Fintype.card_bool] have hinner (s : Fin K → Bool) : (∑ u : Fin K → Bool, exp (t * innerSign s u / (K : ℝ))) / (card (Fin K → Bool) : ℝ) ≤ exp (t ^ 2 / (2 * (K : ℝ))) := by have hswap (u : Fin K → Bool) : innerSign s u = ∑ j : Fin K, (if u j then (1 : ℝ) else -1) * (if s j then (1 : ℝ) else -1) := by unfold innerSign apply Finset.sum_congr rfl intro j hj ring have hsquares : (∑ j : Fin K, (if s j then (1 : ℝ) else -1) ^ 2) = (K : ℝ) := by simp have hm := signMGF_le (fun j : Fin K => if s j then (1 : ℝ) else -1) (t / (K : ℝ)) convert hm using 1 · rw [hcard] congr 1 apply Finset.sum_congr rfl intro u hu congr 1 rw [hswap] ring · rw [hsquares] field_simp calc (∑ s : Fin K → Bool, ∑ u : Fin K → Bool, exp (t * innerSign s u / (K : ℝ))) / (card (Fin K → Bool) : ℝ) ^ 2 = (∑ s : Fin K → Bool, (∑ u : Fin K → Bool, exp (t * innerSign s u / (K : ℝ))) / (card (Fin K → Bool) : ℝ)) / (card (Fin K → Bool) : ℝ) := by simp only [Finset.sum_div] apply Finset.sum_congr rfl intro s hs apply Finset.sum_congr rfl intro u hu ring _ ≤ (∑ _s : Fin K → Bool, exp (t ^ 2 / (2 * (K : ℝ)))) / (card (Fin K → Bool) : ℝ) := by apply div_le_div_of_nonneg_right · exact Finset.sum_le_sum fun s _ => hinner s · rw [hcard] positivity _ = exp (t ^ 2 / (2 * (K : ℝ))) := by simp [Fintype.card_bool]
FiniteCells 2 core · 3 supporting This module turns finite observed-cell masses into likelihood representations of measures. ★ eq_withDensity_of_cellSetMass
Finite-cell likelihood assembly
This module turns finite observed-cell masses into likelihood representations
of measures. It covers a finite latent choice assembled by Measure.bind and
an exact event-mass interface suitable for other finite-cell experiments.
Given a covariate sample space, a finite observed-cell space, a covariate law, nonnegative masses for every cell, and an observed event, the finite-cell event mass is given by integrating the masses of event cells.
Definition (Lean source)
Given a covariate sample space, a finite observed-cell space, a covariate law, reference and alternative observed laws, reference and alternative cell masses, a likelihood, measurable reference masses, a measurable likelihood, finite-cell event-mass representations, and each alternative cell mass equal to the reference cell mass times the likelihood at that covariate value and cell, the alternative law is the measure having that likelihood as its density with respect to the reference law.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
isProbability_of_cellSetMasstheorem — Given a covariate sample space, a finite observed-cell space, a probability covariate law, an observed law, cell masses, an exact finite-cell event-mass representation, and cell masses that sum to one at every covariate value, the observed law is a probability measure.hypothesesX C :ν :Q :Measure (X × C)q :X → C → ℝ≥0∞hQ :∀ AifthenQ A = cellSetMass ν q Ahsum :∀ x, ∑ c : C, q x c = 1conclusionProof (Lean source)
theorem isProbability_of_cellSetMass {X C : Type*} [MeasurableSpace X] [MeasurableSpace C] [Fintype C] (ν : Measure X) [IsProbabilityMeasure ν] (Q : Measure (X × C)) (q : X → C → ℝ≥0∞) (hQ : ∀ A, MeasurableSet A → Q A = cellSetMass ν q A) (hsum : ∀ x, ∑ c : C, q x c = 1) : IsProbabilityMeasure Q := by apply isProbabilityMeasure_iff.mpr rw [hQ univ MeasurableSet.univ] simp [cellSetMass, hsum] -
bind_latent_map_cellSetMasstheorem — Given a covariate sample space, a finite observed-cell space, a finite latent-state space, a covariate law, latent-state weights, an observed-cell reporting map, measurable weights, and a measurable reporting map, the bound latent law has the stated finite-cell event masses.hypothesesX C Z :ν :Measure Xw :X → Z → ℝ≥0∞obs :X → Z → Chw :∀ z, Measurable fun x => w x zhobs :∀ z, Measurable fun x => obs x zA :conclusion(ν.bind (fun x => ∑ z : Z, w x z • Measure.dirac (x, obs x z))) A= cellSetMass ν (fun x c => ∑ z : Z, if obs x z = c then w x z else 0) AProof (Lean source)
theorem bind_latent_map_cellSetMass {X C Z : Type*} [MeasurableSpace X] [MeasurableSpace C] [Fintype C] [DecidableEq C] [Fintype Z] (ν : Measure X) (w : X → Z → ℝ≥0∞) (obs : X → Z → C) (hw : ∀ z, Measurable fun x => w x z) (hobs : ∀ z, Measurable fun x => obs x z) : ∀ A, MeasurableSet A → (ν.bind (fun x => ∑ z : Z, w x z • Measure.dirac (x, obs x z))) A = cellSetMass ν (fun x c => ∑ z : Z, if obs x z = c then w x z else 0) A := by intro A hA have hk : Measurable (fun x => ∑ z : Z, w x z • Measure.dirac (x, obs x z)) := by classical refine Measure.measurable_of_measurable_coe _ fun s hs => ?_ simp only [Measure.finsetSum_apply] apply Finset.measurable_fun_sum intro z hz simp only [Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hs] exact (hw z).mul (measurable_one.indicator (hs.preimage (measurable_id.prodMk (hobs z)))) rw [Measure.bind_apply hA hk.aemeasurable] unfold cellSetMass apply lintegral_congr intro x classical simp only [Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hA] calc (∑ z : Z, w x z * A.indicator 1 (x, obs x z)) = ∑ z : Z, if (x, obs x z) ∈ A then w x z else 0 := by apply Finset.sum_congr rfl intro z hz simp [indicator, mul_ite] _ = ∑ z : Z, ∑ c : C, if (x, c) ∈ A then (if obs x z = c then w x z else 0) else 0 := by apply Finset.sum_congr rfl intro z hz calc (if (x, obs x z) ∈ A then w x z else 0) = ∑ c : C, if obs x z = c then (if (x, c) ∈ A then w x z else 0) else 0 := by simp _ = ∑ c : C, if (x, c) ∈ A then (if obs x z = c then w x z else 0) else 0 := by apply Finset.sum_congr rfl intro c hc split_ifs <;> simp_all _ = ∑ c : C, ∑ z : Z, if (x, c) ∈ A then (if obs x z = c then w x z else 0) else 0 := Finset.sum_comm _ = ∑ c : C, if (x, c) ∈ A then (∑ z : Z, if obs x z = c then w x z else 0) else 0 := by apply Finset.sum_congr rfl intro c hc split_ifs <;> simp -
bind_cells_eq_withDensitytheorem — Given a covariate sample space, a finite observed-cell space, a covariate law, reference and alternative cell masses, a likelihood, measurable masses, a measurable likelihood, and the cellwise likelihood ratio identity, the alternative finite-cell bound law is the likelihood tilt of the reference bound law.hypothesesX C :ν :Measure Xp q :X → C → ℝ≥0∞L :X × C → ℝhp :∀ c, Measurable fun x => p x chq :∀ c, Measurable fun x => q x chL :hratio :∀ x c, q x c = p x c * ofReal (L (x, c))conclusionν.bind (fun x => ∑ c : C, q x c • Measure.dirac (x, c))= (ν.bind (fun x => ∑ c : C, p x c • Measure.dirac (x, c))).withDensity (fun z => ofReal (L z))Proof (Lean source)
theorem bind_cells_eq_withDensity {X C : Type*} [MeasurableSpace X] [MeasurableSpace C] [Fintype C] (ν : Measure X) (p q : X → C → ℝ≥0∞) (L : X × C → ℝ) (hp : ∀ c, Measurable fun x => p x c) (hq : ∀ c, Measurable fun x => q x c) (hL : Measurable L) (hratio : ∀ x c, q x c = p x c * ofReal (L (x, c))) : ν.bind (fun x => ∑ c : C, q x c • Measure.dirac (x, c)) = (ν.bind (fun x => ∑ c : C, p x c • Measure.dirac (x, c))).withDensity (fun z => ofReal (L z)) := by classical apply eq_withDensity_of_cellSetMass ν _ _ p q L hp hL · intro A hA rw [bind_latent_map_cellSetMass ν p (fun _ c => c) hp (fun _ => measurable_const) A hA] unfold cellSetMass apply lintegral_congr intro x apply Finset.sum_congr rfl intro c hc simp · intro A hA rw [bind_latent_map_cellSetMass ν q (fun _ c => c) hq (fun _ => measurable_const) A hA] unfold cellSetMass apply lintegral_congr intro x apply Finset.sum_congr rfl intro c hc simp · exact hratio
TwoChannel 1 core · 4 supporting This module turns explicit likelihoods and one-observation overlap identities into iid and independent two-channel overlaps. ★ one_add_chiSqDiv_uniformMixture_twoChannel_sign_le_exp
Two-channel iid sign mixtures
This module turns explicit likelihoods and one-observation overlap identities into iid and independent two-channel overlaps. Its uniform-mixture result feeds the finite-sign Gaussian moment bound without application-specific constants.
Given a positive sign-vector length and two sample sizes, two measurable sample spaces, two reference laws, two sign-indexed families of probability laws, two likelihood families, their measurability, their nonnegativity, their likelihood representations, integrable pair products, two overlap coefficients, and pairwise overlap identities stating that in each channel the reference-law mean of the product of the likelihoods at sign vectors s and t is 1 + ρ⟨s,t⟩/K, with ⟨s,t⟩ the inner sign product, one plus the chi-squared divergence of the uniform mixture over sign vectors of the two-channel iid product laws, relative to the product of the iid reference laws, is at most exp((n₁ρ₁ + n₂ρ₂)² / (2K)).
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
integral_likelihood_eq_onetheorem — Given a measurable sample space, a reference probability law, an alternative probability law, a likelihood, its measurability and nonnegativity, and its likelihood representation, the likelihood integrates to one under the reference law.hypothesesconclusion∫ x, L x ∂μ = 1Proof (Lean source)
theorem integral_likelihood_eq_one {Ω : Type*} [MeasurableSpace Ω] (μ Q : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure Q] (L : Ω → ℝ) (hL : Measurable L) (hL0 : ∀ x, 0 ≤ L x) (hQ : Q = μ.withDensity (fun x => ofReal (L x))) : ∫ x, L x ∂μ = 1 := by have hLeq : (fun x => (Q.rnDeriv μ x).toReal) =ᵐ[μ] L := by rw [hQ] filter_upwards [Measure.rnDeriv_withDensity μ hL.ennreal_ofReal] with x hx simp [hx, ENNReal.toReal_ofReal (hL0 x)] have hac : Q ≪ μ := by rw [hQ] exact withDensity_absolutelyContinuous μ _ calc ∫ x, L x ∂μ = ∫ x, (Q.rnDeriv μ x).toReal ∂μ := integral_congr_ae hLeq.symm _ = 1 := by simpa using (Measure.integral_toReal_rnDeriv hac) -
iid_pair_overlap_of_likelihoodtheorem — Given a measurable sample space, a reference probability law and two alternative probability laws, two likelihoods, their measurability, their nonnegativity, their likelihood representations, an integrable one-observation likelihood product, and a sample size, the iid pair overlap is the corresponding power of the one-observation overlap.hypothesesΩ :Type*L M :Ω → ℝhL :hM :hL0 :∀ x, 0 ≤ L xhM0 :∀ x, 0 ≤ M xhQ :Q = μ.withDensity (fun x => ofReal (L x))hR :R = μ.withDensity (fun x => ofReal (M x))hpairInt :Integrable (fun x => L x * M x) μn :ℕProof (Lean source)
theorem iid_pair_overlap_of_likelihood {Ω : Type*} [MeasurableSpace Ω] (μ Q R : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure Q] [IsProbabilityMeasure R] (L M : Ω → ℝ) (hL : Measurable L) (hM : Measurable M) (hL0 : ∀ x, 0 ≤ L x) (hM0 : ∀ x, 0 ≤ M x) (hQ : Q = μ.withDensity (fun x => ofReal (L x))) (hR : R = μ.withDensity (fun x => ofReal (M x))) (hpairInt : Integrable (fun x => L x * M x) μ) (n : ℕ) : (∫ x, (((Measure.pi (fun _ : Fin n => Q)).rnDeriv (Measure.pi (fun _ : Fin n => μ)) x).toReal) * (((Measure.pi (fun _ : Fin n => R)).rnDeriv (Measure.pi (fun _ : Fin n => μ)) x).toReal) ∂(Measure.pi (fun _ : Fin n => μ))) = (∫ x, L x * M x ∂μ) ^ n := by have hLeq : (fun x => (Q.rnDeriv μ x).toReal) =ᵐ[μ] L := by rw [hQ] filter_upwards [Measure.rnDeriv_withDensity μ hL.ennreal_ofReal] with x hx simp [hx, ENNReal.toReal_ofReal (hL0 x)] have hMeq : (fun x => (R.rnDeriv μ x).toReal) =ᵐ[μ] M := by rw [hR] filter_upwards [Measure.rnDeriv_withDensity μ hM.ennreal_ofReal] with x hx simp [hx, ENNReal.toReal_ofReal (hM0 x)] have hprod : (fun x => (Q.rnDeriv μ x).toReal * (R.rnDeriv μ x).toReal) =ᵐ[μ] (fun x => L x * M x) := by filter_upwards [hLeq, hMeq] with x hx hy simp [hx, hy] have hacQ : Q ≪ μ := by rw [hQ] exact withDensity_absolutelyContinuous μ _ have hacR : R ≪ μ := by rw [hR] exact withDensity_absolutelyContinuous μ _ have hint : Integrable (fun x => (Q.rnDeriv μ x).toReal * (R.rnDeriv μ x).toReal) μ := hpairInt.congr hprod.symm rw [iidPairOverlap μ Q R hacQ hacR n] congr 1 exact integral_congr_ae hprod -
two_channel_pair_overlaptheorem — Given two measurable sample spaces, two reference laws, two pairs of alternative laws, two pairs of likelihoods, their measurability, their nonnegativity, their likelihood representations, integrable one-observation likelihood products, and two sample sizes, the independent iid pair overlap is the product of the two channel powers.hypothesesΩ₁ Ω₂ :μ₁ :Measure Ω₁μ₂ :Measure Ω₂Q₁ R₁ :Measure Ω₁Q₂ R₂ :Measure Ω₂L₁ M₁ :Ω₁ → ℝL₂ M₂ :Ω₂ → ℝhL₁ :Measurable L₁hM₁ :Measurable M₁hL₂ :Measurable L₂hM₂ :Measurable M₂hL₁0 :∀ x, 0 ≤ L₁ xhM₁0 :∀ x, 0 ≤ M₁ xhL₂0 :∀ x, 0 ≤ L₂ xhM₂0 :∀ x, 0 ≤ M₂ xhQ₁ :Q₁ = μ₁.withDensity (fun x => ofReal (L₁ x))hR₁ :R₁ = μ₁.withDensity (fun x => ofReal (M₁ x))hQ₂ :Q₂ = μ₂.withDensity (fun x => ofReal (L₂ x))hR₂ :R₂ = μ₂.withDensity (fun x => ofReal (M₂ x))hInt₁ :Integrable (fun x => L₁ x * M₁ x) μ₁hInt₂ :Integrable (fun x => L₂ x * M₂ x) μ₂n₁ n₂ :ℕconclusion(∫ x, ((((Measure.pi (fun _ : Fin n₁ => Q₁)).prod (Measure.pi (fun _ : Fin n₂ => Q₂))).rnDeriv ((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))) x).toReal) * ((((Measure.pi (fun _ : Fin n₁ => R₁)).prod (Measure.pi (fun _ : Fin n₂ => R₂))).rnDeriv ((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))) x).toReal) ∂((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))))= (∫ x, L₁ x * M₁ x ∂μ₁) ^ n₁ * (∫ x, L₂ x * M₂ x ∂μ₂) ^ n₂Proof (Lean source)
theorem two_channel_pair_overlap {Ω₁ Ω₂ : Type*} [MeasurableSpace Ω₁] [MeasurableSpace Ω₂] (μ₁ : Measure Ω₁) (μ₂ : Measure Ω₂) (Q₁ R₁ : Measure Ω₁) (Q₂ R₂ : Measure Ω₂) [IsProbabilityMeasure μ₁] [IsProbabilityMeasure μ₂] [IsProbabilityMeasure Q₁] [IsProbabilityMeasure R₁] [IsProbabilityMeasure Q₂] [IsProbabilityMeasure R₂] (L₁ M₁ : Ω₁ → ℝ) (L₂ M₂ : Ω₂ → ℝ) (hL₁ : Measurable L₁) (hM₁ : Measurable M₁) (hL₂ : Measurable L₂) (hM₂ : Measurable M₂) (hL₁0 : ∀ x, 0 ≤ L₁ x) (hM₁0 : ∀ x, 0 ≤ M₁ x) (hL₂0 : ∀ x, 0 ≤ L₂ x) (hM₂0 : ∀ x, 0 ≤ M₂ x) (hQ₁ : Q₁ = μ₁.withDensity (fun x => ofReal (L₁ x))) (hR₁ : R₁ = μ₁.withDensity (fun x => ofReal (M₁ x))) (hQ₂ : Q₂ = μ₂.withDensity (fun x => ofReal (L₂ x))) (hR₂ : R₂ = μ₂.withDensity (fun x => ofReal (M₂ x))) (hInt₁ : Integrable (fun x => L₁ x * M₁ x) μ₁) (hInt₂ : Integrable (fun x => L₂ x * M₂ x) μ₂) (n₁ n₂ : ℕ) : (∫ x, ((((Measure.pi (fun _ : Fin n₁ => Q₁)).prod (Measure.pi (fun _ : Fin n₂ => Q₂))).rnDeriv ((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))) x).toReal) * ((((Measure.pi (fun _ : Fin n₁ => R₁)).prod (Measure.pi (fun _ : Fin n₂ => R₂))).rnDeriv ((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))) x).toReal) ∂((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂)))) = (∫ x, L₁ x * M₁ x ∂μ₁) ^ n₁ * (∫ x, L₂ x * M₂ x ∂μ₂) ^ n₂ := by have hQ₁' := iid_absolutelyContinuous_of_likelihood μ₁ Q₁ L₁ hQ₁ n₁ have hR₁' := iid_absolutelyContinuous_of_likelihood μ₁ R₁ M₁ hR₁ n₁ have hQ₂' := iid_absolutelyContinuous_of_likelihood μ₂ Q₂ L₂ hQ₂ n₂ have hR₂' := iid_absolutelyContinuous_of_likelihood μ₂ R₂ M₂ hR₂ n₂ have hInt₁' := iid_pair_integrable_of_likelihood μ₁ Q₁ R₁ L₁ M₁ hL₁ hM₁ hL₁0 hM₁0 hQ₁ hR₁ hInt₁ n₁ have hInt₂' := iid_pair_integrable_of_likelihood μ₂ Q₂ R₂ L₂ M₂ hL₂ hM₂ hL₂0 hM₂0 hQ₂ hR₂ hInt₂ n₂ rw [product_pair_overlap (Measure.pi (fun _ : Fin n₁ => μ₁)) (Measure.pi (fun _ : Fin n₁ => Q₁)) (Measure.pi (fun _ : Fin n₁ => R₁)) (Measure.pi (fun _ : Fin n₂ => μ₂)) (Measure.pi (fun _ : Fin n₂ => Q₂)) (Measure.pi (fun _ : Fin n₂ => R₂)) hQ₁' hR₁' hQ₂' hR₂', iid_pair_overlap_of_likelihood μ₁ Q₁ R₁ L₁ M₁ hL₁ hM₁ hL₁0 hM₁0 hQ₁ hR₁ hInt₁ n₁, iid_pair_overlap_of_likelihood μ₂ Q₂ R₂ L₂ M₂ hL₂ hM₂ hL₂0 hM₂0 hQ₂ hR₂ hInt₂ n₂] -
one_add_chiSqDiv_uniformMixture_twoChannel_signtheorem — Given a positive sign-vector length and two sample sizes, two measurable sample spaces, two reference laws, two sign-indexed families of probability laws, two likelihood families, their measurability, their nonnegativity, their likelihood representations, integrable pair products, two overlap coefficients, and their pairwise overlap identities, one plus the chi-squared divergence of the uniform two-channel iid mixture is the uniform double average of its sign-overlap factors.hypothesesΩ₁ Ω₂ :K n₁ n₂ :ℕNeZero Kμ₁ :Measure Ω₁μ₂ :Measure Ω₂∀ s, IsProbabilityMeasure (Q₁ s)∀ s, IsProbabilityMeasure (Q₂ s)hL₁ :∀ s, Measurable (L₁ s)hL₂ :∀ s, Measurable (L₂ s)hL₁0 :∀ s x, 0 ≤ L₁ s xhL₂0 :∀ s x, 0 ≤ L₂ s xhQ₁ :∀ s, Q₁ s = μ₁.withDensity (fun x => ofReal (L₁ s x))hQ₂ :∀ s, Q₂ s = μ₂.withDensity (fun x => ofReal (L₂ s x))hInt₁ :∀ s t, Integrable (fun x => L₁ s x * L₁ t x) μ₁hInt₂ :∀ s t, Integrable (fun x => L₂ s x * L₂ t x) μ₂ρ₁ ρ₂ :ℝhPair₁ :∀ s t, (∫ x, L₁ s x * L₁ t x ∂μ₁) = 1 + ρ₁ * innerSign s t / (K : ℝ)hPair₂ :∀ s t, (∫ x, L₂ s x * L₂ t x ∂μ₂) = 1 + ρ₂ * innerSign s t / (K : ℝ)Proof (Lean source)
theorem one_add_chiSqDiv_uniformMixture_twoChannel_sign {Ω₁ Ω₂ : Type*} [MeasurableSpace Ω₁] [MeasurableSpace Ω₂] (K n₁ n₂ : ℕ) [NeZero K] (μ₁ : Measure Ω₁) (μ₂ : Measure Ω₂) (Q₁ : (Fin K → Bool) → Measure Ω₁) (Q₂ : (Fin K → Bool) → Measure Ω₂) [IsProbabilityMeasure μ₁] [IsProbabilityMeasure μ₂] [∀ s, IsProbabilityMeasure (Q₁ s)] [∀ s, IsProbabilityMeasure (Q₂ s)] (L₁ : (Fin K → Bool) → Ω₁ → ℝ) (L₂ : (Fin K → Bool) → Ω₂ → ℝ) (hL₁ : ∀ s, Measurable (L₁ s)) (hL₂ : ∀ s, Measurable (L₂ s)) (hL₁0 : ∀ s x, 0 ≤ L₁ s x) (hL₂0 : ∀ s x, 0 ≤ L₂ s x) (hQ₁ : ∀ s, Q₁ s = μ₁.withDensity (fun x => ofReal (L₁ s x))) (hQ₂ : ∀ s, Q₂ s = μ₂.withDensity (fun x => ofReal (L₂ s x))) (hInt₁ : ∀ s t, Integrable (fun x => L₁ s x * L₁ t x) μ₁) (hInt₂ : ∀ s t, Integrable (fun x => L₂ s x * L₂ t x) μ₂) (ρ₁ ρ₂ : ℝ) (hPair₁ : ∀ s t, (∫ x, L₁ s x * L₁ t x ∂μ₁) = 1 + ρ₁ * innerSign s t / (K : ℝ)) (hPair₂ : ∀ s t, (∫ x, L₂ s x * L₂ t x ∂μ₂) = 1 + ρ₂ * innerSign s t / (K : ℝ)) : 1 + chiSqDiv (uniformMixture (fun s => (Measure.pi (fun _ : Fin n₁ => Q₁ s)).prod (Measure.pi (fun _ : Fin n₂ => Q₂ s)))) ((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))) = (∑ s : Fin K → Bool, ∑ t : Fin K → Bool, (1 + ρ₁ * innerSign s t / (K : ℝ)) ^ n₁ * (1 + ρ₂ * innerSign s t / (K : ℝ)) ^ n₂) / (card (Fin K → Bool) : ℝ) ^ 2 := by classical have hac (s : Fin K → Bool) : (Measure.pi (fun _ : Fin n₁ => Q₁ s)).prod (Measure.pi (fun _ : Fin n₂ => Q₂ s)) ≪ (Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂)) := (iid_absolutelyContinuous_of_likelihood μ₁ (Q₁ s) (L₁ s) (hQ₁ s) n₁).prod (iid_absolutelyContinuous_of_likelihood μ₂ (Q₂ s) (L₂ s) (hQ₂ s) n₂) have hpair (s t : Fin K → Bool) : Integrable (fun x => (((Measure.pi (fun _ : Fin n₁ => Q₁ s)).prod (Measure.pi (fun _ : Fin n₂ => Q₂ s))).rnDeriv ((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))) x).toReal * (((Measure.pi (fun _ : Fin n₁ => Q₁ t)).prod (Measure.pi (fun _ : Fin n₂ => Q₂ t))).rnDeriv ((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))) x).toReal) ((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))) := by exact product_pair_integrable (Measure.pi (fun _ : Fin n₁ => μ₁)) (Measure.pi (fun _ : Fin n₁ => Q₁ s)) (Measure.pi (fun _ : Fin n₁ => Q₁ t)) (Measure.pi (fun _ : Fin n₂ => μ₂)) (Measure.pi (fun _ : Fin n₂ => Q₂ s)) (Measure.pi (fun _ : Fin n₂ => Q₂ t)) (iid_absolutelyContinuous_of_likelihood μ₁ (Q₁ s) (L₁ s) (hQ₁ s) n₁) (iid_absolutelyContinuous_of_likelihood μ₁ (Q₁ t) (L₁ t) (hQ₁ t) n₁) (iid_absolutelyContinuous_of_likelihood μ₂ (Q₂ s) (L₂ s) (hQ₂ s) n₂) (iid_absolutelyContinuous_of_likelihood μ₂ (Q₂ t) (L₂ t) (hQ₂ t) n₂) (iid_pair_integrable_of_likelihood μ₁ (Q₁ s) (Q₁ t) (L₁ s) (L₁ t) (hL₁ s) (hL₁ t) (hL₁0 s) (hL₁0 t) (hQ₁ s) (hQ₁ t) (hInt₁ s t) n₁) (iid_pair_integrable_of_likelihood μ₂ (Q₂ s) (Q₂ t) (L₂ s) (L₂ t) (hL₂ s) (hL₂ t) (hL₂0 s) (hL₂0 t) (hQ₂ s) (hQ₂ t) (hInt₂ s t) n₂) rw [one_add_chiSqDiv_uniformMixture (fun s => (Measure.pi (fun _ : Fin n₁ => Q₁ s)).prod (Measure.pi (fun _ : Fin n₂ => Q₂ s))) ((Measure.pi (fun _ : Fin n₁ => μ₁)).prod (Measure.pi (fun _ : Fin n₂ => μ₂))) hac hpair] congr 1 apply Finset.sum_congr rfl intro s _ apply Finset.sum_congr rfl intro t _ rw [two_channel_pair_overlap μ₁ μ₂ (Q₁ s) (Q₁ t) (Q₂ s) (Q₂ t) (L₁ s) (L₁ t) (L₂ s) (L₂ t) (hL₁ s) (hL₁ t) (hL₂ s) (hL₂ t) (hL₁0 s) (hL₁0 t) (hL₂0 s) (hL₂0 t) (hQ₁ s) (hQ₁ t) (hQ₂ s) (hQ₂ t) (hInt₁ s t) (hInt₂ s t) n₁ n₂, hPair₁ s t, hPair₂ s t]