Stat.Concentration.ConditionalBernstein
This module provides finite-family Bernstein bounds for outcome-bin counts conditional on an IID design vector.
Basic 8 core · 8 supporting The design partition is represented by a key map with measurable fibres. ★ jointCount_sub_conditionalMean
Finite design-cell and outcome-bin histogram statistics
The design partition is represented by a key map with measurable fibres. Outcome bins are an arbitrary finite measurable family: disjointness is unnecessary for concentration. Counts are natural numbers; conditional means and deviations are real numbers. All statistics include the empty sample and empty cells, with no division by cell counts.
The cell indicator of the cell selected by a key map and a cell label at a design point is the real number one when the key of the point equals the label, and zero otherwise.
Definition (Lean source)
The real bin indicator for an outcome set at an outcome is the real number one when the outcome lies in the set, and zero otherwise.
Definition (Lean source)
The cell count counts coordinates of a design vector in the cell specified by the key.
Definition (Lean source)
The joint count is the number of sample coordinates whose entry of the design vector lies in the design cell given by the key map and cell label and whose entry of the outcome vector lies in the bin.
The bin probability is the real probability of an outcome bin under the conditional outcome kernel at a design point.
The conditional joint-count mean sums the kernel bin probabilities over coordinates of the design vector in the chosen cell.
Definition (Lean source)
The centered count summand at a coordinate of the design and outcome vectors is the indicator that the design entry lies in the selected design cell, multiplied by the indicator that the outcome entry lies in the bin minus the kernel probability of the bin at that design entry.
Definition (Lean source)
For any key map, outcome kernel, bin, cell label, design vector and outcome vector, the joint count minus the conditional joint-count mean equals the sum over sample coordinates of the centered count summands.
Formal statement
Proof (Lean source)
8 supporting declarations (lemmas, instances)
-
measurable_cellIndicatortheorem — A measurable cell fibre has a measurable real indicator.hypothesesconclusionMeasurable (cellIndicator key c)Proof (Lean source)
@[fun_prop] theorem measurable_cellIndicator {key : D → C} {c : C} (hcell : MeasurableSet {d | key d = c}) : Measurable (cellIndicator key c) := by classical exact measurable_const.ite hcell measurable_const -
measurable_binIndicatortheorem — A measurable outcome bin has a measurable real indicator.Proof (Lean source)
@[fun_prop] theorem measurable_binIndicator {bin : Set Y} (hbin : MeasurableSet bin) : Measurable (binIndicator bin) := measurable_const.indicator hbin -
measurable_binProbabilitytheorem — A measurable bin has a measurable conditional probability under the outcome kernel.hypothesesconclusionMeasurable (binProbability K bin)Proof (Lean source)
@[fun_prop] theorem measurable_binProbability (K : Kernel D Y) {bin : Set Y} (hbin : MeasurableSet bin) : Measurable (binProbability K bin) := by exact (K.measurable_coe hbin).ennreal_toReal -
cellCount_casttheorem — Casting the cell count to the reals gives the sum of real cell indicators.hypothesesconclusion(cellCount key c x : ℝ) = ∑ i, cellIndicator key c (x i)Proof (Lean source)
theorem cellCount_cast (key : D → C) (c : C) (x : Fin n → D) : (cellCount key c x : ℝ) = ∑ i, cellIndicator key c (x i) := by classical simp [cellCount, cellIndicator] -
jointCount_casttheorem — Casting the joint count to the reals gives the sum of products of its cell and bin indicators.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :D → Cbin :Set Yc :Cx :Fin n → Dy :Fin n → Yconclusion(jointCount key bin c x y : ℝ) = ∑ i, cellIndicator key c (x i) * binIndicator bin (y i)Proof (Lean source)
theorem jointCount_cast (key : D → C) (bin : Set Y) (c : C) (x : Fin n → D) (y : Fin n → Y) : (jointCount key bin c x y : ℝ) = ∑ i, cellIndicator key c (x i) * binIndicator bin (y i) := by classical simp only [jointCount, Nat.cast_sum] apply Finset.sum_congr rfl intro i _ by_cases hc : key (x i) = c <;> by_cases hy : y i ∈ bin <;> simp [cellIndicator, binIndicator, hc, hy] -
measurable_cellCount_realtheorem — A measurable cell fibre gives a measurable real cell count.hypothesesD :sharedType u_1C :sharedType u_3n :sharedℕkey :D → Cc :Chcell :MeasurableSet {d | key d = c}conclusionMeasurable (fun x : Fin n → D => (cellCount key c x : ℝ))Proof (Lean source)
@[fun_prop] theorem measurable_cellCount_real {key : D → C} {c : C} (hcell : MeasurableSet {d | key d = c}) : Measurable (fun x : Fin n → D => (cellCount key c x : ℝ)) := by simp_rw [cellCount_cast] exact Finset.measurable_sum _ (fun i _ => (measurable_cellIndicator hcell).comp (measurable_pi_apply i)) -
measurable_jointCount_realtheorem — A measurable cell fibre and bin give a jointly measurable real joint count.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :D → Cc :Cbin :Set Yhcell :MeasurableSet {d | key d = c}hbin :MeasurableSet binconclusionProof (Lean source)
@[fun_prop] theorem measurable_jointCount_real {key : D → C} {c : C} {bin : Set Y} (hcell : MeasurableSet {d | key d = c}) (hbin : MeasurableSet bin) : Measurable (fun p : (Fin n → D) × (Fin n → Y) => (jointCount key bin c p.1 p.2 : ℝ)) := by simp_rw [jointCount_cast] exact Finset.measurable_sum _ (fun i _ => ((measurable_cellIndicator hcell).comp ((measurable_pi_apply i).comp measurable_fst)).mul ((measurable_binIndicator hbin).comp ((measurable_pi_apply i).comp measurable_snd))) -
measurable_conditionalMeantheorem — A measurable cell fibre and bin under an outcome kernel give a measurable conditional count mean.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕK :Kernel D Ykey :D → Cc :Cbin :Set Yhcell :MeasurableSet {d | key d = c}hbin :MeasurableSet binconclusionMeasurable (conditionalMean (n := n) key K bin c)Proof (Lean source)
@[fun_prop] theorem measurable_conditionalMean (K : Kernel D Y) {key : D → C} {c : C} {bin : Set Y} (hcell : MeasurableSet {d | key d = c}) (hbin : MeasurableSet bin) : Measurable (conditionalMean (n := n) key K bin c) := by exact Finset.measurable_sum _ (fun i _ => ((measurable_cellIndicator hcell).comp (measurable_pi_apply i)).mul ((measurable_binProbability K hbin).comp (measurable_pi_apply i)))
TotalVariance 2 core · 2 supporting The existing bernstein_sum_ge uses a common variance proxy for all coordinates. ★ bernstein_sum_totalVariance_abs_gt
Bernstein tails with a total second-moment budget
The existing bernstein_sum_ge uses a common variance proxy for all coordinates.
Here the budget is the sum of the individual second moments, so inactive histogram
coordinates contribute zero instead of inflating the budget to the full sample size.
Reference: Boucheron, Lugosi, and Bousquet, Concentration Inequalities, Theorem 3
(pp. 218–219), https://web.majunjielab.cn/usr/uploads/2024/07/1972749276.pdf.
The fetched authors' notes give the denominator 2 * (totalVariance + t / 3).
We use the convenient, slightly larger inverted radius sqrt (2 * v * u) + u.
The Bernstein radius for a total variance budget v and an exponential-tail parameter u is √(2 v u) + u.
Definition (Lean source)
Independent measurable centered summands, integrable with integrable squares, bounded in absolute value by one, and having total second moment at most a nonnegative budget v, satisfy, at a nonnegative tail parameter u, the two-sided Bernstein bound: the probability that the absolute value of their sum strictly exceeds √(2 v u) + u is at most 2 exp(−u).
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
bernsteinRadius_nonnegtheorem — The Bernstein radius is nonnegative at any nonnegative tail parameter.Proof (Lean source)
theorem bernsteinRadius_nonneg (v : ℝ) {u : ℝ} (hu : 0 ≤ u) : 0 ≤ bernsteinRadius v u := add_nonneg (Real.sqrt_nonneg _) hu -
bernstein_sum_totalVariance_getheorem — Independent measurable centered summands, integrable with integrable squares and bounded above by one, whose total second moment is at most a positive budget, satisfy the upper Bernstein tail at any nonnegative threshold.hypothesesΩ :n :ℕFin n → Ω → ℝv t :ℝhv :0 < vht :0 ≤ thindep :iIndepFun X μhmeas :∀ i, Measurable (X i)hint :∀ i, Integrable (X i) μhsqint :∀ i, Integrable (fun ω => X i ω ^ 2) μhmean :∀ i, ∫ ω, X i ω ∂μ = 0hupper :∀ i, ∀ᵐ ω ∂μ, X i ω ≤ 1hsecond :(∑ i, ∫ ω, X i ω ^ 2 ∂μ) ≤ vconclusionμ.real {ω | t ≤ ∑ i, X i ω} ≤ exp (-t ^ 2 / (2 * (v + t / 3)))Proof (Lean source)
theorem bernstein_sum_totalVariance_ge {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {n : ℕ} {X : Fin n → Ω → ℝ} {v t : ℝ} (hv : 0 < v) (ht : 0 ≤ t) (hindep : iIndepFun X μ) (hmeas : ∀ i, Measurable (X i)) (hint : ∀ i, Integrable (X i) μ) (hsqint : ∀ i, Integrable (fun ω => X i ω ^ 2) μ) (hmean : ∀ i, ∫ ω, X i ω ∂μ = 0) (hupper : ∀ i, ∀ᵐ ω ∂μ, X i ω ≤ 1) (hsecond : (∑ i, ∫ ω, X i ω ^ 2 ∂μ) ≤ v) : μ.real {ω | t ≤ ∑ i, X i ω} ≤ exp (-t ^ 2 / (2 * (v + t / 3))) := by classical by_cases htzero : t = 0 · subst t calc _ ≤ μ.real univ := measureReal_mono (Set.subset_univ _) _ = _ := by simp by_cases hn : n = 0 · subst n have htpos : 0 < t := lt_of_le_of_ne ht (Ne.symm htzero) have hempty : {ω | t ≤ ∑ i : Fin 0, X i ω} = ∅ := by ext ω simp [not_le.mpr htpos] rw [hempty] simp only [measureReal_empty] exact (Real.exp_pos _).le set d : ℝ := v + t / 3 with hd have hdpos : 0 < d := by dsimp [d]; positivity set lam : ℝ := t / d with hlam have hlam0 : 0 ≤ lam := div_nonneg ht hdpos.le have hlam3 : lam * 1 < 3 := by rw [mul_one, hlam, div_lt_iff₀ hdpos] dsimp [d] linarith have hexp (i : Fin n) : Integrable (fun ω => exp (lam * X i ω)) μ := by refine Integrable.mono' (integrable_const (exp lam)) ((Real.measurable_exp.comp ((hmeas i).const_mul lam)).aestronglyMeasurable) ?_ filter_upwards [hupper i] with ω hω rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] exact Real.exp_le_exp.mpr (by nlinarith) have hmgfi (i : Fin n) : mgf (X i) μ lam ≤ exp (lam ^ 2 * (∫ ω, X i ω ^ 2 ∂μ) / (2 * (1 - lam / 3))) := by simpa using centered_bounded_mgf_le (b := 1) (by norm_num) hlam0 hlam3 (hmeas i).aemeasurable (hint i) (hsqint i) (hmean i) (hupper i) le_rfl have hden : 0 < 2 * (1 - lam / 3) := by linarith have hmgfsum : mgf (fun ω => ∑ i, X i ω) μ lam ≤ exp (lam ^ 2 * v / (2 * (1 - lam / 3))) := by simp only [← Finset.sum_apply] rw [hindep.mgf_sum hmeas univ] calc ∏ i, mgf (X i) μ lam ≤ ∏ i, exp (lam ^ 2 * (∫ ω, X i ω ^ 2 ∂μ) / (2 * (1 - lam / 3))) := by apply Finset.prod_le_prod · intro i _ exact mgf_nonneg · intro i _ exact hmgfi i _ = exp (lam ^ 2 * (∑ i, ∫ ω, X i ω ^ 2 ∂μ) / (2 * (1 - lam / 3))) := by rw [← Real.exp_sum] congr 1 rw [← Finset.sum_div, ← Finset.mul_sum] _ ≤ _ := by apply Real.exp_le_exp.mpr exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hsecond (sq_nonneg lam)) hden.le have hsumint : Integrable (fun ω => exp (lam * (∑ i, X i ω))) μ := by simp only [← Finset.sum_apply] exact hindep.integrable_exp_mul_sum hmeas (s := univ) (fun i _ => hexp i) calc μ.real {ω | t ≤ ∑ i, X i ω} ≤ exp (-lam * t) * mgf (fun ω => ∑ i, X i ω) μ lam := measure_ge_le_exp_mul_mgf t hlam0 hsumint _ ≤ exp (-lam * t) * exp (lam ^ 2 * v / (2 * (1 - lam / 3))) := mul_le_mul_of_nonneg_left hmgfsum (Real.exp_pos _).le _ = exp (-lam * t + lam ^ 2 * v / (2 * (1 - lam / 3))) := by rw [← Real.exp_add] _ ≤ _ := by apply Real.exp_le_exp.mpr rw [hlam, hd] field_simp [ne_of_gt hv] nlinarith
Simultaneous 2 core · 2 supporting The failure event is a union over all design-cell and outcome-bin pairs. ★ fibre_simultaneous_tail_le
Simultaneous finite-family conditional histogram tails
The failure event is a union over all design-cell and outcome-bin pairs. Outside it,
every count deviation is at most sqrt (2 * pMax * N_c * u) + u without division.
Finite union bounds require no independence or disjointness between different pairs.
The histogram failure event is the set of design and outcome vectors for which, for some design cell of the key map and some outcome bin of the family, the joint count differs from its conditional mean under the outcome kernel by strictly more than √(2 · pMax · N_c · u) + u, where N_c is the number of design entries in the cell and pMax and u are the probability envelope and tail parameter.
Definition (Lean source)
Fix a complete design vector, finitely many design cells and finitely many measurable outcome bins, and draw the outcomes independently across coordinates from a Markov outcome kernel at the design entries. Suppose the kernel probability of every bin is at most a nonnegative number pMax at every design entry and the tail parameter u is nonnegative. Then the probability that, for some cell and some bin, the joint count differs from its conditional mean by strictly more than √(2 · pMax · N_c · u) + u, where N_c is the number of design entries in the cell, is at most 2 · (number of cells) · (number of bins) · exp(−u).
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
measurableSet_histogramBadEventtheorem — With finite cell and bin families, measurable cell fibres and bins, the histogram failure event is measurable.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3B :sharedType u_4n :sharedℕFinite CFinite Bkey :D → CK :Kernel D Ybins :B → Set Yhcell :∀ c, MeasurableSet {d | key d = c}hbins :∀ b, MeasurableSet (bins b)pMax u :ℝconclusionMeasurableSet (histogramBadEvent (n := n) key K bins pMax u)Proof (Lean source)
theorem measurableSet_histogramBadEvent [Finite C] [Finite B] (key : D → C) (K : Kernel D Y) (bins : B → Set Y) (hcell : ∀ c, MeasurableSet {d | key d = c}) (hbins : ∀ b, MeasurableSet (bins b)) (pMax u : ℝ) : MeasurableSet (histogramBadEvent (n := n) key K bins pMax u) := by simp only [histogramBadEvent, Set.ofPred_exists] refine MeasurableSet.iUnion (fun c => MeasurableSet.iUnion (fun b => ?_)) have hcount : Measurable (fun p : (Fin n → D) × (Fin n → Y) => (cellCount key c p.1 : ℝ)) := (measurable_cellCount_real (n := n) (hcell c)).comp measurable_fst have hmean : Measurable (fun p : (Fin n → D) × (Fin n → Y) => conditionalMean key K (bins b) c p.1) := (measurable_conditionalMean (n := n) K (hcell c) (hbins b)).comp measurable_fst exact measurableSet_lt ((((hcount.const_mul pMax).const_mul 2).mul_const u).sqrt.add_const u) ((measurable_jointCount_real (n := n) (hcell c) (hbins b)).sub hmean).abs -
simultaneous_deviation_of_not_mem_badEventtheorem — Outside the histogram failure event, all cell/bin deviations obey their Bernstein radii.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3B :sharedType u_4n :sharedℕkey :D → CK :Kernel D Ybins :B → Set YpMax u :ℝhgood :p ∉ histogramBadEvent key K bins pMax uc b :conclusion|(jointCount key (bins b) c p.1 p.2 : ℝ) - conditionalMean key K (bins b) c p.1|≤ bernsteinRadius (pMax * (cellCount key c p.1 : ℝ)) uProof (Lean source)
theorem simultaneous_deviation_of_not_mem_badEvent {key : D → C} {K : Kernel D Y} {bins : B → Set Y} {pMax u : ℝ} {p : (Fin n → D) × (Fin n → Y)} (hgood : p ∉ histogramBadEvent key K bins pMax u) : ∀ c b, |(jointCount key (bins b) c p.1 p.2 : ℝ) - conditionalMean key K (bins b) c p.1| ≤ bernsteinRadius (pMax * (cellCount key c p.1 : ℝ)) u := by intro c b exact le_of_not_gt (fun h => hgood ⟨c, b, h⟩)
Bernoulli 1 core · 5 supporting These one-coordinate facts supply the Bernoulli means, second moments, and bounds used on each conditional design fibre. ★ integral_sq_centered_bin
Centered measurable-bin indicators
These one-coordinate facts supply the Bernoulli means, second moments, and bounds used on each conditional design fibre. No density or regularity of the outcome law is assumed.
For a measurable bin with probability p under a probability law, the expected square of the bin indicator minus p equals p (1 − p).
Formal statement
Proof (Lean source)
5 supporting declarations (lemmas, instances)
-
integrable_centered_bintheorem — The indicator of a measurable bin, centered by its probability under the law, is integrable.hypothesesconclusionIntegrable (fun y => binIndicator bin y - μ.real bin) μProof (Lean source)
theorem integrable_centered_bin (hbin : MeasurableSet bin) : Integrable (fun y => binIndicator bin y - μ.real bin) μ := by exact ((integrable_const (1 : ℝ)).indicator hbin).sub (integrable_const (μ.real bin)) -
integrable_sq_centered_bintheorem — The squared centered indicator of a measurable bin under the law is integrable.hypothesesconclusionIntegrable (fun y => (binIndicator bin y - μ.real bin) ^ 2) μProof (Lean source)
theorem integrable_sq_centered_bin (hbin : MeasurableSet bin) : Integrable (fun y => (binIndicator bin y - μ.real bin) ^ 2) μ := by have hi : Integrable (binIndicator bin) μ := (integrable_const (1 : ℝ)).indicator hbin refine ((hi.const_mul (1 - 2 * μ.real bin)).add (integrable_const (μ.real bin ^ 2))).congr ?_ filter_upwards [] with y by_cases hy : y ∈ bin · simp [binIndicator, hy] ring · simp [binIndicator, hy] -
integral_centered_bintheorem — Centering the indicator of a measurable bin by its probability under the law gives mean zero.hypothesesconclusion(∫ y, (binIndicator bin y - μ.real bin) ∂μ) = 0Proof (Lean source)
theorem integral_centered_bin (hbin : MeasurableSet bin) : (∫ y, (binIndicator bin y - μ.real bin) ∂μ) = 0 := by have hi : Integrable (binIndicator bin) μ := (integrable_const (1 : ℝ)).indicator hbin rw [integral_sub hi (integrable_const (μ.real bin))] simp [binIndicator, integral_indicator_const, hbin] -
abs_centered_bin_le_onetheorem — A bin indicator centered by its probability under the law is pointwise bounded in absolute value by one.hypothesesconclusion|binIndicator bin y - μ.real bin| ≤ 1Proof (Lean source)
theorem abs_centered_bin_le_one (y : Y) : |binIndicator bin y - μ.real bin| ≤ 1 := by rcases binProbability_mem_Icc μ (bin := bin) with ⟨hp0, hp1⟩ by_cases hy : y ∈ bin · simp only [binIndicator, Set.indicator_of_mem hy] rw [abs_of_nonneg (sub_nonneg.mpr hp1)] linarith · simp only [binIndicator, Set.indicator_of_notMem hy, zero_sub, abs_neg] rwa [abs_of_nonneg hp0]
Disintegration 1 core · 1 supporting This module exposes the generic kernel-law tensorization pattern used by RandomDesignWeightedHoeffding.product_observation_law_map_design_outcome. ★ iid_joint_map_split
Design-fibre disintegration for arbitrary outcome spaces
This module exposes the generic kernel-law tensorization pattern used by
RandomDesignWeightedHoeffding.product_observation_law_map_design_outcome.
Unlike that conditional-distribution adapter, this kernel-native formulation accepts
arbitrary measurable outcome spaces and needs no standard-Borel hypothesis. A second
lemma integrates an almost-everywhere fibre event bound over a probability design law.
Sampling IID design/outcome pairs from an attached kernel law and separating the complete design and outcome vectors yields the design-product law attached to the coordinatewise product outcome kernel.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
compProd_real_le_of_fibre_real_letheorem — A measurable joint event with fibre probability at most a nonnegative constant almost everywhere under a probability base and Markov kernel has attached-law probability at most that same constant.hypothesesD Y :Q :K :Kernel D YE :Set (D × Y)hE :A :ℝhA :0 ≤ Ahfibre :∀ᵐ d ∂Q, (K d).real (Prod.mk d ⁻¹' E) ≤ Aconclusion(Q ⊗ₘ K).real E ≤ AProof (Lean source)
theorem compProd_real_le_of_fibre_real_le {D Y : Type*} [MeasurableSpace D] [MeasurableSpace Y] (Q : Measure D) [IsProbabilityMeasure Q] (K : Kernel D Y) [IsMarkovKernel K] {E : Set (D × Y)} (hE : MeasurableSet E) {A : ℝ} (hA : 0 ≤ A) (hfibre : ∀ᵐ d ∂Q, (K d).real (Prod.mk d ⁻¹' E) ≤ A) : (Q ⊗ₘ K).real E ≤ A := by have hfibreENN : ∀ᵐ d ∂Q, K d (Prod.mk d ⁻¹' E) ≤ ofReal A := by filter_upwards [hfibre] with d hd exact (ENNReal.le_ofReal_iff_toReal_le (measure_ne_top (K d) _) hA).2 hd apply ENNReal.toReal_le_of_le_ofReal hA rw [Measure.compProd_apply hE] calc (∫⁻ d, K d (Prod.mk d ⁻¹' E) ∂Q) ≤ ∫⁻ _ : D, ofReal A ∂Q := lintegral_mono_ae hfibreENN _ = ofReal A := by simp
Fibre 1 core · 8 supporting Fixing the complete design vector makes the outcome coordinates independent under the finite product kernel. ★ fibre_pair_tail_le
Conditional Bernstein bounds on a complete design fibre
Fixing the complete design vector makes the outcome coordinates independent under the
finite product kernel. This module derives the centered Bernoulli summand data, bounds
the sum of second moments by pMax * cellCount, and proves the two-sided count tail.
No positive-count condition is imposed; zero-count cells have identically zero deviation.
Fix a complete design vector, and draw the outcomes independently across coordinates, each from a Markov outcome kernel at its design entry. For a design cell and measurable bin, suppose the kernel probability of the bin is at most a nonnegative number pMax at every design entry in the cell and the tail parameter u is nonnegative. Then the probability that the joint count differs from its conditional mean by strictly more than √(2 · pMax · N · u) + u, where N is the number of design entries in the cell, is at most 2 exp(−u).
Formal statement
Proof (Lean source)
8 supporting declarations (lemmas, instances)
-
iIndepFun_centeredSummandtheorem — The centered bin-count summands for a fixed complete design vector, cell, and measurable bin under a Markov outcome kernel are independent on that design fibre.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :sharedD → Cc :sharedChbin :MeasurableSet binconclusioniIndepFun (centeredSummand key K bin c x) (finProductKernel n K x)Proof (Lean source)
theorem iIndepFun_centeredSummand (hbin : MeasurableSet bin) : iIndepFun (centeredSummand key K bin c x) (finProductKernel n K x) := by rw [finProductKernel_apply] exact iIndepFun_pi (fun i => (((measurable_binIndicator hbin).sub measurable_const).const_mul (cellIndicator key c (x i))).aemeasurable) -
measurable_centeredSummandtheorem — Each centered count summand for the design vector, cell, kernel, and measurable bin is measurable as a function of the outcome vector.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :sharedD → Cc :sharedChbin :MeasurableSet bini :Fin nconclusionMeasurable (centeredSummand key K bin c x i)Proof (Lean source)
@[fun_prop] theorem measurable_centeredSummand (hbin : MeasurableSet bin) (i : Fin n) : Measurable (centeredSummand key K bin c x i) := by exact (((measurable_binIndicator hbin).comp (measurable_pi_apply i)).sub measurable_const).const_mul _ -
abs_centeredSummand_le_onetheorem — Each centered bin-count summand for the cell and design vector under a Markov outcome kernel is bounded in absolute value by one.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :sharedD → Cc :sharedCi :Fin ny :Fin n → Yconclusion|centeredSummand key K bin c x i y| ≤ 1Proof (Lean source)
theorem abs_centeredSummand_le_one (i : Fin n) (y : Fin n → Y) : |centeredSummand key K bin c x i y| ≤ 1 := by classical by_cases hc : key (x i) = c · simpa [centeredSummand, cellIndicator, binProbability, hc] using abs_centered_bin_le_one (K (x i)) (bin := bin) (y i) · simp [centeredSummand, cellIndicator, hc] -
integrable_centeredSummandtheorem — Each centered count summand for the design vector, cell, kernel, and measurable bin is integrable on its design fibre.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :sharedD → Cc :sharedChbin :MeasurableSet bini :Fin nconclusionProof (Lean source)
theorem integrable_centeredSummand (hbin : MeasurableSet bin) (i : Fin n) : Integrable (centeredSummand key K bin c x i) (finProductKernel n K x) := by rw [finProductKernel_apply] exact (integrable_comp_eval (μ := fun j : Fin n => K (x j)) (integrable_centered_bin (K (x i)) hbin)).const_mul (cellIndicator key c (x i)) -
integrable_sq_centeredSummandtheorem — Each squared centered count summand for the design vector, cell, kernel, and measurable bin is integrable on its design fibre.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :sharedD → Cc :sharedChbin :MeasurableSet bini :Fin nconclusionProof (Lean source)
theorem integrable_sq_centeredSummand (hbin : MeasurableSet bin) (i : Fin n) : Integrable (fun y => centeredSummand key K bin c x i y ^ 2) (finProductKernel n K x) := by rw [finProductKernel_apply] simpa only [centeredSummand, binProbability, mul_pow] using (integrable_comp_eval (μ := fun j : Fin n => K (x j)) (integrable_sq_centered_bin (K (x i)) hbin)).const_mul (cellIndicator key c (x i) ^ 2) -
integral_centeredSummandtheorem — Each centered count summand for the design vector, cell, kernel, and measurable bin has zero conditional mean.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :sharedD → Cc :sharedChbin :MeasurableSet bini :Fin nconclusion(∫ y, centeredSummand key K bin c x i y ∂Causalean.Stat.finProductKernel n K x) = 0Proof (Lean source)
theorem integral_centeredSummand (hbin : MeasurableSet bin) (i : Fin n) : (∫ y, centeredSummand key K bin c x i y ∂Causalean.Stat.finProductKernel n K x) = 0 := by rw [finProductKernel_apply] change (∫ y, cellIndicator key c (x i) * (binIndicator bin (y i) - (K (x i)).real bin) ∂Measure.pi (fun j : Fin n => K (x j))) = 0 rw [integral_const_mul, integral_comp_eval (μ := fun j : Fin n => K (x j)) (i := i) (integrable_centered_bin (K (x i)) hbin).aestronglyMeasurable, integral_centered_bin (K (x i)) hbin, mul_zero] -
integral_sq_centeredSummandtheorem — A centered count summand for the design vector, cell, kernel, and measurable bin has the cell indicator times the conditional Bernoulli variance as its second moment.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :sharedD → Cc :sharedChbin :MeasurableSet bini :Fin nconclusion(∫ y, centeredSummand key K bin c x i y ^ 2 ∂Causalean.Stat.finProductKernel n K x)= cellIndicator key c (x i) * binProbability K bin (x i) * (1 - binProbability K bin (x i))Proof (Lean source)
theorem integral_sq_centeredSummand (hbin : MeasurableSet bin) (i : Fin n) : (∫ y, centeredSummand key K bin c x i y ^ 2 ∂Causalean.Stat.finProductKernel n K x) = cellIndicator key c (x i) * binProbability K bin (x i) * (1 - binProbability K bin (x i)) := by classical rw [finProductKernel_apply] simp only [centeredSummand, binProbability, mul_pow] rw [integral_const_mul, integral_comp_eval (μ := fun j : Fin n => K (x j)) (i := i) (integrable_sq_centered_bin (K (x i)) hbin).aestronglyMeasurable, integral_sq_centered_bin (K (x i)) hbin] by_cases hc : key (x i) = c <;> simp [cellIndicator, hc] -
sum_second_moments_letheorem — If conditional bin probabilities obey a cell envelope, then the centered summands have total second moment at most the envelope times the realized cell count.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :sharedD → Cc :sharedChbin :MeasurableSet binpMax :ℝhprob :∀ iifkey (x i) = cthenbinProbability K bin (x i) ≤ pMaxconclusion(∑ i, ∫ y, centeredSummand key K bin c x i y ^ 2 ∂Causalean.Stat.finProductKernel n K x)≤ pMax * (cellCount key c x : ℝ)Proof (Lean source)
theorem sum_second_moments_le (hbin : MeasurableSet bin) {pMax : ℝ} (hprob : ∀ i, key (x i) = c → binProbability K bin (x i) ≤ pMax) : (∑ i, ∫ y, centeredSummand key K bin c x i y ^ 2 ∂Causalean.Stat.finProductKernel n K x) ≤ pMax * (cellCount key c x : ℝ) := by classical simp_rw [integral_sq_centeredSummand key K c x hbin] rw [cellCount_cast, Finset.mul_sum] apply Finset.sum_le_sum intro i _ by_cases hc : key (x i) = c · simp only [cellIndicator, if_pos hc, one_mul] have hp0 : 0 ≤ binProbability K bin (x i) := measureReal_nonneg have hp := hprob i hc nlinarith [sq_nonneg (binProbability K bin (x i))] · simp [cellIndicator, hc]
Integrated 1 core · 3 supporting The headline theorem bounds simultaneous cell/bin count deviations under the IID product of a design marginal attached to a measurable conditional outcome kernel. ★ iid_joint_simultaneous_tail_le
IID joint-law finite-partition conditional Bernstein histogram tails
The headline theorem bounds simultaneous cell/bin count deviations under the IID product of a design marginal attached to a measurable conditional outcome kernel. It first proves the conditional bound given the entire design vector, integrates that bound, and transports back to the IID law. The probability envelope need only hold almost everywhere under the design marginal. There is no lower-count hypothesis.
For all pairs, the radius is sqrt (2 * pMax * N_c * u) + u, and the total failure
probability is at most 2 * card C * card B * exp (-u). A deterministic adapter permits
division by the cell count only when a separate positive-count hypothesis is available.
Draw an IID sample of design/outcome pairs, each design from a probability law and each outcome from a Markov kernel at its design, and fix finitely many measurable design cells and finitely many measurable outcome bins. Suppose the kernel probability of every bin is at most a nonnegative number pMax at almost every design point and the tail parameter u is nonnegative. Then the probability that, for some cell and some bin, the joint count differs from its conditional mean given the designs by strictly more than √(2 · pMax · N_c · u) + u, where N_c is the number of sampled designs in the cell, is at most 2 · (number of cells) · (number of bins) · exp(−u).
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
ae_design_vector_envelopetheorem — An almost-everywhere conditional bin envelope under a design marginal also holds simultaneously at every coordinate of almost every IID design vector.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3B :sharedType u_4n :sharedℕQ :K :Kernel D Ykey :D → Cbins :B → Set YpMax :ℝhenvelope :∀ᵐ d ∂Q, ∀ c b, key d = c → binProbability K (bins b) d ≤ pMaxconclusion∀ᵐ x ∂Measure.pi (fun _ : Fin n => Q), ∀ c b i, key (x i)= c → binProbability K (bins b) (x i) ≤ pMaxProof (Lean source)
theorem ae_design_vector_envelope (Q : Measure D) [IsProbabilityMeasure Q] (K : Kernel D Y) (key : D → C) (bins : B → Set Y) (pMax : ℝ) (henvelope : ∀ᵐ d ∂Q, ∀ c b, key d = c → binProbability K (bins b) d ≤ pMax) : ∀ᵐ x ∂Measure.pi (fun _ : Fin n => Q), ∀ c b i, key (x i) = c → binProbability K (bins b) (x i) ≤ pMax := by have hcoord (i : Fin n) : ∀ᵐ x ∂Measure.pi (fun _ : Fin n => Q), ∀ c b, key (x i) = c → binProbability K (bins b) (x i) ≤ pMax := (Measure.tendsto_eval_ae_ae (μ := fun _ : Fin n => Q) (i := i)).eventually henvelope filter_upwards [(ae_all_iff).mpr hcoord] with x hx exact fun c b i => hx i c b -
attached_simultaneous_tail_letheorem — Under a probability design marginal and Markov outcome kernel, finite measurable cells and bins with an almost-everywhere nonnegative conditional bin envelope satisfy the simultaneous two-sided count bound under the retained-design law at nonnegative tail parameter.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3B :sharedType u_4n :sharedℕFintype CFintype BQ :K :Kernel D Ykey :D → Cbins :B → Set Yhcell :∀ c, MeasurableSet {d | key d = c}hbins :∀ b, MeasurableSet (bins b)pMax u :ℝhpMax :0 ≤ pMaxhu :0 ≤ uhenvelope :∀ᵐ d ∂Q, ∀ c b, key d = c → binProbability K (bins b) d ≤ pMaxconclusion(Measure.pi (fun _ : Fin n => Q) ⊗ₘ finProductKernel n K).real (histogramBadEvent key K bins pMax u)≤ 2 * (Fintype.card C : ℝ) * (Fintype.card B : ℝ) * exp (-u)Proof (Lean source)
theorem attached_simultaneous_tail_le [Fintype C] [Fintype B] (Q : Measure D) [IsProbabilityMeasure Q] (K : Kernel D Y) [IsMarkovKernel K] (key : D → C) (bins : B → Set Y) (hcell : ∀ c, MeasurableSet {d | key d = c}) (hbins : ∀ b, MeasurableSet (bins b)) {pMax u : ℝ} (hpMax : 0 ≤ pMax) (hu : 0 ≤ u) (henvelope : ∀ᵐ d ∂Q, ∀ c b, key d = c → binProbability K (bins b) d ≤ pMax) : (Measure.pi (fun _ : Fin n => Q) ⊗ₘ finProductKernel n K).real (histogramBadEvent key K bins pMax u) ≤ 2 * (Fintype.card C : ℝ) * (Fintype.card B : ℝ) * exp (-u) := by refine compProd_real_le_of_fibre_real_le (Measure.pi (fun _ : Fin n => Q)) (finProductKernel n K) (measurableSet_histogramBadEvent key K bins hcell hbins pMax u) (by positivity) ?_ filter_upwards [ae_design_vector_envelope Q K key bins pMax henvelope] with x hx exact fibre_simultaneous_tail_le key K bins hbins x hpMax hu hx -
normalized_deviation_letheorem — A count deviation bounded by its Bernstein radius in a cell of positive count gives the corresponding bound for the empirical bin proportion minus the conditional mean divided by that count.hypothesesD :sharedType u_1Y :sharedType u_2C :sharedType u_3n :sharedℕkey :D → CK :Kernel D Ybin :Set Yc :Cx :Fin n → Dy :Fin n → YpMax u :ℝhcount :0 < cellCount key c xhdev :|(jointCount key bin c x y : ℝ) - conditionalMean key K bin c x|≤ bernsteinRadius (pMax * (cellCount key c x : ℝ)) uconclusion|(jointCount key bin c x y : ℝ) / (cellCount key c x : ℝ)- conditionalMean key K bin c x / (cellCount key c x : ℝ)|≤ bernsteinRadius (pMax * (cellCount key c x : ℝ)) u / (cellCount key c x : ℝ)Proof (Lean source)
theorem normalized_deviation_le (key : D → C) (K : Kernel D Y) (bin : Set Y) (c : C) (x : Fin n → D) (y : Fin n → Y) (pMax u : ℝ) (hcount : 0 < cellCount key c x) (hdev : |(jointCount key bin c x y : ℝ) - conditionalMean key K bin c x| ≤ bernsteinRadius (pMax * (cellCount key c x : ℝ)) u) : |(jointCount key bin c x y : ℝ) / (cellCount key c x : ℝ) - conditionalMean key K bin c x / (cellCount key c x : ℝ)| ≤ bernsteinRadius (pMax * (cellCount key c x : ℝ)) u / (cellCount key c x : ℝ) := by have hpos : (0 : ℝ) < cellCount key c x := by exact_mod_cast hcount rw [← sub_div, abs_div, abs_of_pos hpos] exact div_le_div_of_nonneg_right hdev hpos.le