Stat.UStatistic.Localized­Variance

A variance bound for U-statistics whose kernel is concentrated on a small set, as with kernel smoothing.

Basic 8 core · 1 supporting This module fixes the finite product law, unordered pair set, statistic, and the two localization masses used in a variance bound.

Localized unordered order-two U-statistics

This module fixes the finite product law, unordered pair set, statistic, and the two localization masses used in a variance bound. The row mass squares the conditional weight before integrating; the pair mass integrates the weight once over each variable.

structure LocalizedKernel reviewed
Causalean.Stat.UStatistic.LocalizedVariance

A kernel, localization weight, and nonnegative envelope scale form a localized symmetric kernel when both functions are measurable and symmetric, the weight lies between zero and one, and the kernel is bounded by the scaled weight.

Definition (Lean source)
X :
Type u_1
shared
H W :
X → X → ℝ
M :
ℝ
measurable_kernel :
Measurable fun z : X × X => H z.1 z.2
measurable_weight :
Measurable fun z : X × X => W z.1 z.2
symmetric_kernel :
∀ x y, H x y = H y x
symmetric_weight :
∀ x y, W x y = W y x
weight_nonneg :
∀ x y, 0 ≤ W x y
weight_le_one :
∀ x y, W x y ≤ 1
envelope_nonneg :
0 ≤ M
envelope :
∀ x y, |H x y| ≤ M * W x y
Causalean.Stat.UStatistic.LocalizedVariance.LocalizedKernel · Causalean/Stat/UStatistic/LocalizedVariance/Basic.lean:22
def iidLaw reviewed
Causalean.Stat.UStatistic.LocalizedVariance

A probability law and sample size determine the product law of independent observations with that common marginal distribution.

Definition (Lean source)
X :
Type u_1
shared
P :
n :
ℕ
iidLaw P n :
Measure (Fin n → X)
Measure.pi fun _ : Fin n => P
Causalean.Stat.UStatistic.LocalizedVariance.iidLaw · Causalean/Stat/UStatistic/LocalizedVariance/Basic.lean:35
def pairIndices reviewed
Causalean.Stat.UStatistic.LocalizedVariance

A sample size determines its unordered distinct index pairs, represented by the unique orientation whose first index is smaller.

Definition (Lean source)
n :
ℕ
pairIndices n :
Finset (Fin n × Fin n)
Finset.univ.filter fun p => p.1 < p.2
Causalean.Stat.UStatistic.LocalizedVariance.pairIndices · Causalean/Stat/UStatistic/LocalizedVariance/Basic.lean:40
def uStatistic reviewed
Causalean.Stat.UStatistic.LocalizedVariance

A sample size, two-observation kernel, and realized sample determine the unordered order-two U-statistic, the average kernel value over distinct unordered pairs of observations (each pair evaluated with the lower-indexed observation first). With fewer than two observations there are no pairs and the value is zero.

Definition (Lean source)
X :
Type u_1
shared
n :
ℕ
H :
X → X → ℝ
ω :
Fin n → X
uStatistic n H ω :
ℝ
((pairIndices n).card : ℝ)⁻¹ * ∑ p ∈ pairIndices n, H (ω p.1) (ω p.2)
Causalean.Stat.UStatistic.LocalizedVariance.uStatistic · Causalean/Stat/UStatistic/LocalizedVariance/Basic.lean:45
def pairMass reviewed
Causalean.Stat.UStatistic.LocalizedVariance

A probability law and localization weight determine the pair mass, the weight's expectation under two independent draws.

Definition (Lean source)
X :
Type u_1
shared
P :
W :
X → X → ℝ
pairMass P W :
ℝ
∫ x, ∫ y, W x y ∂P ∂P
Causalean.Stat.UStatistic.LocalizedVariance.pairMass · Causalean/Stat/UStatistic/LocalizedVariance/Basic.lean:53
def rowMassSq reviewed
Causalean.Stat.UStatistic.LocalizedVariance

A probability law and localization weight determine the squared row mass, the expectation of the square of its conditional one-draw mass.

Definition (Lean source)
X :
Type u_1
shared
P :
W :
X → X → ℝ
rowMassSq P W :
ℝ
∫ x, (∫ y, W x y ∂P) ^ 2 ∂P
Causalean.Stat.UStatistic.LocalizedVariance.rowMassSq · Causalean/Stat/UStatistic/LocalizedVariance/Basic.lean:58
def SharesIndex reviewed
Causalean.Stat.UStatistic.LocalizedVariance

Two finite index pairs satisfy the shared-index relation when they have at least one endpoint in common.

Definition (Lean source)
n :
ℕ
p q :
Fin n × Fin n
SharesIndex p q :
Prop
p.1 = q.1 ∨ p.1 = q.2 ∨ p.2 = q.1 ∨ p.2 = q.2
Causalean.Stat.UStatistic.LocalizedVariance.SharesIndex · Causalean/Stat/UStatistic/LocalizedVariance/Basic.lean:63
def pairValue reviewed
Causalean.Stat.UStatistic.LocalizedVariance

A two-observation kernel, index pair, and sample realization determine the pair's kernel value.

Definition (Lean source)
X :
Type u_1
shared
n :
ℕ
H :
X → X → ℝ
p :
Fin n × Fin n
ω :
Fin n → X
pairValue H p ω :
ℝ
H (ω p.1) (ω p.2)
Causalean.Stat.UStatistic.LocalizedVariance.pairValue · Causalean/Stat/UStatistic/LocalizedVariance/Basic.lean:73
1 supporting declaration (lemmas, instances)
Bounds 1 core · 9 supporting This module bounds the mean, pair variance, and overlapping pair covariance using the two distinct localization scales. ★ covariance_shared_pairs_le_rowMassSq

Localized covariance bounds

This module bounds the mean, pair variance, and overlapping pair covariance using the two distinct localization scales. Symmetry handles every orientation of a shared index.

theorem covariance_shared_pairs_le_rowMassSq reviewed
Causalean.Stat.UStatistic.LocalizedVariance

Under a probability law and a kernel H localized by a weight W with envelope M, for two unordered pairs of sample indices that are distinct and share an index, the covariance, under independent draws from the law, of the kernel values at the two pairs is at most 2·M² times the squared row mass of W. The squared row mass is the expectation over one draw of the square of the weight's mean over a second independent draw.

Formal statement
X :
Type u_1
shared
P :
shared
H :
X → X → ℝ
shared
W :
X → X → ℝ
shared
M :
ℝ
shared
h :
shared
n :
ℕ
Fin n × Fin n
hp :
p ∈ pairIndices n
hq :
q ∈ pairIndices n
hne :
p ≠ q
hpq :
covariance (pairValue H p) (pairValue H q) (iidLaw P n) ≤ 2 * M ^ 2 * rowMassSq P W
Proof (Lean source)
theorem covariance_shared_pairs_le_rowMassSq {n : ℕ} {p q : Fin n × Fin n} (hp : p ∈ pairIndices n) (hq : q ∈ pairIndices n) (hne : p ≠ q) (hpq : SharesIndex p q) : covariance (pairValue H p) (pairValue H q) (iidLaw P n) ≤ 2 * M ^ 2 * rowMassSq P W := by haveI : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw; infer_instance rw [covariance_eq_sub (pairValue_memLp_two P h p) (pairValue_memLp_two P h q), pairValue_integral_eq_kernel_mean P h hp, pairValue_integral_eq_kernel_mean P h hq] have hb := shared_pairs_product_integral_abs_le_rowMassSq P h hp hq hne hpq have hs : 0 ≤ M ^ 2 * rowMassSq P W := by apply mul_nonneg (sq_nonneg M) unfold rowMassSq exact integral_nonneg (fun x => sq_nonneg _) have hm : 0 ≤ (∫ x, ∫ y, H x y ∂P ∂P) * (∫ x, ∫ y, H x y ∂P ∂P) := mul_self_nonneg _ have hi : (∫ ω, pairValue H p ω * pairValue H q ω ∂iidLaw P n) ≤ M ^ 2 * rowMassSq P W := le_trans (le_abs_self _) hb simp only [Pi.mul_apply] linarith
Causalean.Stat.UStatistic.LocalizedVariance.covariance_shared_pairs_le_rowMassSq · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:362 · uses LocalizedKernel , SharesIndex , iidLaw , pairIndices , pairValue , rowMassSq
9 supporting declarations (lemmas, instances)
  • pairValue_memLp_two theorem — A probability law and localization certificate and sample pair give a pair kernel value with finite second moment under the independent product law.
    X :
    Type u_1
    shared
    P :
    shared
    H :
    X → X → ℝ
    shared
    W :
    X → X → ℝ
    shared
    M :
    ℝ
    shared
    h :
    shared
    n :
    ℕ
    p :
    Fin n × Fin n
    MemLp (pairValue H p) 2 (iidLaw P n)
    Proof (Lean source)
    theorem pairValue_memLp_two {n : ℕ} (p : Fin n × Fin n) : MemLp (pairValue H p) 2 (iidLaw P n) := by have : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw; infer_instance have hm : Measurable (pairValue H p) := by change Measurable (fun ω : Fin n → X => H (ω p.1) (ω p.2)) have hpair : Measurable (fun ω : Fin n → X => (ω p.1, ω p.2)) := by fun_prop exact h.measurable_kernel.comp hpair apply MemLp.of_bound hm.aestronglyMeasurable M filter_upwards [] with ω rw [Real.norm_eq_abs] exact (h.envelope (ω p.1) (ω p.2)).trans (mul_le_of_le_one_right h.envelope_nonneg (h.weight_le_one _ _))
    Causalean.Stat.UStatistic.LocalizedVariance.pairValue_memLp_two · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:25
  • kernel_mean_sq_le_rowMassSq theorem — A probability law and localized-kernel certificate give a population kernel mean whose square is controlled by the squared row mass.
    X :
    Type u_1
    shared
    P :
    shared
    H :
    X → X → ℝ
    shared
    W :
    X → X → ℝ
    shared
    M :
    ℝ
    shared
    h :
    shared
    (∫ x, ∫ y, H x y ∂P ∂P) ^ 2 ≤ M ^ 2 * rowMassSq P W
    Proof (Lean source)
    theorem kernel_mean_sq_le_rowMassSq : (∫ x, ∫ y, H x y ∂P ∂P) ^ 2 ≤ M ^ 2 * rowMassSq P W := by have hH (x : X) : Integrable (H x) P := Integrable.of_bound (h.measurable_kernel.comp (measurable_const.prodMk measurable_id)).aestronglyMeasurable M (Filter.Eventually.of_forall (fun y => by rw [Real.norm_eq_abs] exact (h.envelope x y).trans (mul_le_of_le_one_right h.envelope_nonneg (h.weight_le_one x y)))) have hW (x : X) : Integrable (W x) P := Integrable.of_bound (h.measurable_weight.comp (measurable_const.prodMk measurable_id)).aestronglyMeasurable 1 (Filter.Eventually.of_forall (fun y => by rw [Real.norm_eq_abs, abs_of_nonneg (h.weight_nonneg x y)] exact h.weight_le_one x y)) have hrow (x : X) : |∫ y, H x y ∂P| ≤ M * ∫ y, W x y ∂P := by calc _ ≤ ∫ y, |H x y| ∂P := abs_integral_le_integral_abs _ ≤ ∫ y, M * W x y ∂P := integral_mono (hH x).abs ((hW x).const_mul M) (h.envelope x) _ = _ := by rw [integral_const_mul] have hHprod : Integrable (fun z : X × X => H z.1 z.2) (P.prod P) := Integrable.of_bound h.measurable_kernel.aestronglyMeasurable M (Filter.Eventually.of_forall (fun z => by rw [Real.norm_eq_abs] exact (h.envelope z.1 z.2).trans (mul_le_of_le_one_right h.envelope_nonneg (h.weight_le_one _ _)))) have hWprod : Integrable (fun z : X × X => W z.1 z.2) (P.prod P) := Integrable.of_bound h.measurable_weight.aestronglyMeasurable 1 (Filter.Eventually.of_forall (fun z => by rw [Real.norm_eq_abs, abs_of_nonneg (h.weight_nonneg _ _)] exact h.weight_le_one _ _)) have hHout : Integrable (fun x => ∫ y, H x y ∂P) P := hHprod.integral_prod_left have hWout : Integrable (fun x => ∫ y, W x y ∂P) P := hWprod.integral_prod_left have hWmeas : Measurable (fun x => ∫ y, W x y ∂P) := (h.measurable_weight.stronglyMeasurable.integral_prod_right' (ν := P)).measurable have hWbound (x : X) : |∫ y, W x y ∂P| ≤ 1 := by calc _ ≤ ∫ y, |W x y| ∂P := abs_integral_le_integral_abs _ = ∫ y, W x y ∂P := by congr 1; funext y; rw [abs_of_nonneg (h.weight_nonneg x y)] _ ≤ 1 := by simpa using integral_mono (hW x) (integrable_const (1 : ℝ)) (h.weight_le_one x) have hWsq : Integrable (fun x => (∫ y, W x y ∂P) ^ 2) P := Integrable.of_bound (hWmeas.pow_const 2).aestronglyMeasurable 1 (Filter.Eventually.of_forall (fun x => by rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] nlinarith [mul_nonneg (sub_nonneg.mpr (hWbound x)) (add_nonneg (abs_nonneg (∫ y, W x y ∂P)) (by norm_num : (0 : ℝ) ≤ 1)), sq_abs (∫ y, W x y ∂P)])) have hglobal : |∫ x, ∫ y, H x y ∂P ∂P| ≤ M * ∫ x, ∫ y, W x y ∂P ∂P := by calc _ ≤ ∫ x, |∫ y, H x y ∂P| ∂P := abs_integral_le_integral_abs _ ≤ ∫ x, M * ∫ y, W x y ∂P ∂P := integral_mono hHout.abs (hWout.const_mul M) hrow _ = _ := by rw [integral_const_mul] have hjs : (∫ x, ∫ y, W x y ∂P ∂P) ^ 2 ≤ rowMassSq P W := by have hvar := variance_nonneg (fun x => ∫ y, W x y ∂P) P rw [variance_eq_sub ((memLp_two_iff_integrable_sq hWmeas.aestronglyMeasurable).2 hWsq)] at hvar simp only [Pi.pow_apply] at hvar unfold rowMassSq linarith have hsq : (∫ x, ∫ y, H x y ∂P ∂P) ^ 2 ≤ M ^ 2 * (∫ x, ∫ y, W x y ∂P ∂P) ^ 2 := by have hw : 0 ≤ ∫ x, ∫ y, W x y ∂P ∂P := integral_nonneg (fun x => integral_nonneg (h.weight_nonneg x)) have ha := (sq_le_sq₀ (abs_nonneg (∫ x, ∫ y, H x y ∂P ∂P)) (mul_nonneg h.envelope_nonneg hw)).2 hglobal nlinarith [ha, sq_abs (∫ x, ∫ y, H x y ∂P ∂P)] nlinarith [mul_le_mul_of_nonneg_left hjs (sq_nonneg M)]
    Causalean.Stat.UStatistic.LocalizedVariance.kernel_mean_sq_le_rowMassSq · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:40
  • pairValue_second_moment_le_pairMass theorem — A probability law and localized-kernel certificate and unordered sample pair give a pair-value second moment bounded by the pair mass.
    X :
    Type u_1
    shared
    P :
    shared
    H :
    X → X → ℝ
    shared
    W :
    X → X → ℝ
    shared
    M :
    ℝ
    shared
    h :
    shared
    n :
    ℕ
    Fin n × Fin n
    hp :
    p ∈ pairIndices n
    (∫ ω, (pairValue H p ω) ^ 2 ∂iidLaw P n) ≤ M ^ 2 * pairMass P W
    Proof (Lean source)
    theorem pairValue_second_moment_le_pairMass {n : ℕ} {p : Fin n × Fin n} (hp : p ∈ pairIndices n) : (∫ ω, (pairValue H p ω) ^ 2 ∂iidLaw P n) ≤ M ^ 2 * pairMass P W := by have hij : p.1 ≠ p.2 := ne_of_lt (Finset.mem_filter.mp hp).2 have hsq (x y : X) : H x y ^ 2 ≤ M ^ 2 * W x y := by have hw0 := h.weight_nonneg x y have hw1 := h.weight_le_one x y have he := h.envelope x y have hm := h.envelope_nonneg have ha : H x y ^ 2 ≤ (M * W x y) ^ 2 := by nlinarith [mul_nonneg (sub_nonneg.mpr he) (add_nonneg (abs_nonneg (H x y)) (mul_nonneg hm hw0)), sq_abs (H x y)] have hb : (W x y) ^ 2 ≤ W x y := by nlinarith [mul_nonneg hw0 (sub_nonneg.mpr hw1)] nlinarith [mul_le_mul_of_nonneg_left hb (sq_nonneg M)] have hmeas : Measurable (fun z : X × X => H z.1 z.2 ^ 2) := h.measurable_kernel.pow_const 2 have hbound (x y : X) : |H x y ^ 2| ≤ M ^ 2 := by rw [abs_of_nonneg (sq_nonneg _)] have := hsq x y exact this.trans (mul_le_of_le_one_right (sq_nonneg M) (h.weight_le_one x y)) have hH (x : X) : Integrable (fun y => H x y ^ 2) P := Integrable.of_bound (hmeas.comp (measurable_const.prodMk measurable_id)).aestronglyMeasurable (M ^ 2) (Filter.Eventually.of_forall (fun y => by simpa only [Real.norm_eq_abs] using hbound x y)) have hW (x : X) : Integrable (fun y => M ^ 2 * W x y) P := by have hwm : Measurable (fun y => M ^ 2 * W x y) := (h.measurable_weight.comp (measurable_const.prodMk measurable_id)).const_mul _ exact Integrable.of_bound hwm.aestronglyMeasurable (M ^ 2) (Filter.Eventually.of_forall (fun y => by rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (sq_nonneg _) (h.weight_nonneg _ _))] exact mul_le_of_le_one_right (sq_nonneg _) (h.weight_le_one _ _))) have hinner (x : X) : (∫ y, H x y ^ 2 ∂P) ≤ M ^ 2 * ∫ y, W x y ∂P := by calc _ ≤ ∫ y, M ^ 2 * W x y ∂P := integral_mono (hH x) (hW x) (hsq x) _ = _ := by rw [integral_const_mul] have houtH : Integrable (fun x => ∫ y, H x y ^ 2 ∂P) P := by have hp : Integrable (fun z : X × X => H z.1 z.2 ^ 2) (P.prod P) := Integrable.of_bound hmeas.aestronglyMeasurable (M ^ 2) (Filter.Eventually.of_forall (fun z => by simpa only [Real.norm_eq_abs] using hbound z.1 z.2)) exact hp.integral_prod_left have houtW : Integrable (fun x => M ^ 2 * ∫ y, W x y ∂P) P := by have hw : Integrable (fun z : X × X => W z.1 z.2) (P.prod P) := Integrable.of_bound h.measurable_weight.aestronglyMeasurable 1 (Filter.Eventually.of_forall (fun z => by rw [Real.norm_eq_abs, abs_of_nonneg (h.weight_nonneg _ _)] exact h.weight_le_one _ _)) exact hw.integral_prod_left.const_mul _ calc _ = ∫ x, ∫ y, H x y ^ 2 ∂P ∂P := by change (∫ ω, H (ω p.1) (ω p.2) ^ 2 ∂iidLaw P n) = _ exact integral_two_coordinates P hij (fun x y => H x y ^ 2) hmeas (M ^ 2) hbound _ ≤ ∫ x, M ^ 2 * ∫ y, W x y ∂P ∂P := integral_mono houtH houtW hinner _ = M ^ 2 * pairMass P W := by rw [integral_const_mul]; rfl
    Causalean.Stat.UStatistic.LocalizedVariance.pairValue_second_moment_le_pairMass · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:115
  • pairValue_integral_eq_kernel_mean theorem — A probability law and localized-kernel certificate and unordered sample pair give the independent-pair population mean.
    X :
    Type u_1
    shared
    P :
    shared
    H :
    X → X → ℝ
    shared
    W :
    X → X → ℝ
    shared
    M :
    ℝ
    shared
    h :
    shared
    n :
    ℕ
    Fin n × Fin n
    hp :
    p ∈ pairIndices n
    (∫ ω, pairValue H p ω ∂iidLaw P n) = ∫ x, ∫ y, H x y ∂P ∂P
    Proof (Lean source)
    theorem pairValue_integral_eq_kernel_mean {n : ℕ} {p : Fin n × Fin n} (hp : p ∈ pairIndices n) : (∫ ω, pairValue H p ω ∂iidLaw P n) = ∫ x, ∫ y, H x y ∂P ∂P := by have hij : p.1 ≠ p.2 := ne_of_lt (Finset.mem_filter.mp hp).2 have hbound (x y : X) : |H x y| ≤ M := (h.envelope x y).trans (mul_le_of_le_one_right h.envelope_nonneg (h.weight_le_one x y)) change (∫ ω, H (ω p.1) (ω p.2) ∂iidLaw P n) = _ exact integral_two_coordinates P hij H h.measurable_kernel M hbound
    Causalean.Stat.UStatistic.LocalizedVariance.pairValue_integral_eq_kernel_mean · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:178
  • covariance_disjoint_pairs_eq_zero theorem — A probability law and localized-kernel certificate, two unordered sample pairs, and their disjointness give zero covariance under the finite independent product law.
    X :
    Type u_1
    shared
    P :
    shared
    H :
    X → X → ℝ
    shared
    W :
    X → X → ℝ
    shared
    M :
    ℝ
    shared
    h :
    shared
    n :
    ℕ
    Fin n × Fin n
    hpq :
    covariance (pairValue H p) (pairValue H q) (iidLaw P n) = 0
    Proof (Lean source)
    theorem covariance_disjoint_pairs_eq_zero {n : ℕ} {p q : Fin n × Fin n} (hpq : ¬ SharesIndex p q) : covariance (pairValue H p) (pairValue H q) (iidLaw P n) = 0 := by -- The two coordinate pairs are independent by `iIndepFun_pi` and the four -- cross-inequalities from `¬ SharesIndex`; apply `IndepFun.covariance_eq_zero`. haveI : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw; infer_instance have hcross : p.1 ≠ q.1 ∧ p.1 ≠ q.2 ∧ p.2 ≠ q.1 ∧ p.2 ≠ q.2 := by simp only [SharesIndex, not_or] at hpq exact hpq have hcoord : iIndepFun (fun i : Fin n => fun ω : Fin n → X => ω i) (iidLaw P n) := by unfold iidLaw simpa using (iIndepFun_pi (μ := fun _ : Fin n => P) (X := fun _ : Fin n => id) (fun _ => aemeasurable_id)) have hind : pairValue H p ⟂ᵢ[iidLaw P n] pairValue H q := by have hpairs := hcoord.indepFun_prodMk_prodMk (fun i => measurable_pi_apply i) p.1 p.2 q.1 q.2 hcross.1 hcross.2.1 hcross.2.2.1 hcross.2.2.2 have hc := hpairs.comp h.measurable_kernel h.measurable_kernel change (fun ω => H (ω p.1) (ω p.2)) ⟂ᵢ[iidLaw P n] (fun ω => H (ω q.1) (ω q.2)) simpa only [Function.comp_def, Function.uncurry_apply_pair] using hc exact hind.covariance_eq_zero (pairValue_memLp_two P h p) (pairValue_memLp_two P h q)
    Causalean.Stat.UStatistic.LocalizedVariance.covariance_disjoint_pairs_eq_zero · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:190
  • shared_triple_integral_abs_le_rowMassSq theorem — A probability law and localized-kernel certificate give a shared-first-draw product moment bounded by the squared row mass.
    X :
    Type u_1
    shared
    P :
    shared
    H :
    X → X → ℝ
    shared
    W :
    X → X → ℝ
    shared
    M :
    ℝ
    shared
    h :
    shared
    |∫ x, ∫ y, ∫ z, H x y * H x z ∂P ∂P ∂P| ≤ M ^ 2 * rowMassSq P W
    Proof (Lean source)
    theorem shared_triple_integral_abs_le_rowMassSq : |∫ x, ∫ y, ∫ z, H x y * H x z ∂P ∂P ∂P| ≤ M ^ 2 * rowMassSq P W := by have hH (x : X) : Integrable (H x) P := Integrable.of_bound (h.measurable_kernel.comp (measurable_const.prodMk measurable_id)).aestronglyMeasurable M (Filter.Eventually.of_forall (fun y => by rw [Real.norm_eq_abs] exact (h.envelope x y).trans (mul_le_of_le_one_right h.envelope_nonneg (h.weight_le_one x y)))) have hW (x : X) : Integrable (W x) P := Integrable.of_bound (h.measurable_weight.comp (measurable_const.prodMk measurable_id)).aestronglyMeasurable 1 (Filter.Eventually.of_forall (fun y => by rw [Real.norm_eq_abs, abs_of_nonneg (h.weight_nonneg x y)] exact h.weight_le_one x y)) have hrow (x : X) : |∫ y, H x y ∂P| ≤ M * ∫ y, W x y ∂P := by calc _ ≤ ∫ y, |H x y| ∂P := abs_integral_le_integral_abs _ ≤ ∫ y, M * W x y ∂P := integral_mono (hH x).abs ((hW x).const_mul M) (h.envelope x) _ = _ := by rw [integral_const_mul] have hWrow_nonneg (x : X) : 0 ≤ ∫ y, W x y ∂P := integral_nonneg (h.weight_nonneg x) have hWrow_le_one (x : X) : ∫ y, W x y ∂P ≤ 1 := by simpa using integral_mono (hW x) (integrable_const (1 : ℝ)) (h.weight_le_one x) have hWmeas : Measurable (fun x => ∫ y, W x y ∂P) := (h.measurable_weight.stronglyMeasurable.integral_prod_right' (ν := P)).measurable have hHmeas : Measurable (fun x => ∫ y, H x y ∂P) := (h.measurable_kernel.stronglyMeasurable.integral_prod_right' (ν := P)).measurable have hWsq : Integrable (fun x => (∫ y, W x y ∂P) ^ 2) P := Integrable.of_bound (hWmeas.pow_const 2).aestronglyMeasurable 1 (Filter.Eventually.of_forall (fun x => by rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] nlinarith [hWrow_nonneg x, hWrow_le_one x])) have hHsq : Integrable (fun x => (∫ y, H x y ∂P) ^ 2) P := Integrable.of_bound (hHmeas.pow_const 2).aestronglyMeasurable (M ^ 2) (Filter.Eventually.of_forall (fun x => by rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] have hx : |∫ y, H x y ∂P| ≤ M := (hrow x).trans (mul_le_of_le_one_right h.envelope_nonneg (hWrow_le_one x)) nlinarith [(sq_le_sq₀ (abs_nonneg (∫ y, H x y ∂P)) h.envelope_nonneg).2 hx, sq_abs (∫ y, H x y ∂P)])) have hsq (x : X) : (∫ y, H x y ∂P) ^ 2 ≤ M ^ 2 * (∫ y, W x y ∂P) ^ 2 := by have hx := hrow x have hy := hWrow_nonneg x nlinarith [(sq_le_sq₀ (abs_nonneg (∫ y, H x y ∂P)) (mul_nonneg h.envelope_nonneg hy)).2 hx, sq_abs (∫ y, H x y ∂P)] have hid (x : X) : (∫ y, ∫ z, H x y * H x z ∂P ∂P) = (∫ y, H x y ∂P) ^ 2 := by simp_rw [integral_const_mul, integral_mul_const] ring calc _ = |∫ x, (∫ y, H x y ∂P) ^ 2 ∂P| := by simp_rw [hid] _ = ∫ x, (∫ y, H x y ∂P) ^ 2 ∂P := by rw [abs_of_nonneg (integral_nonneg (fun x => sq_nonneg _))] _ ≤ ∫ x, M ^ 2 * (∫ y, W x y ∂P) ^ 2 ∂P := integral_mono hHsq (hWsq.const_mul _) hsq _ = M ^ 2 * rowMassSq P W := by rw [integral_const_mul]; rfl
    Causalean.Stat.UStatistic.LocalizedVariance.shared_triple_integral_abs_le_rowMassSq · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:217
  • shared_first_coordinate_product_integral_abs_le_rowMassSq theorem — A probability law and localized-kernel certificate and three pairwise distinct sample coordinates give a shared-coordinate product moment bounded by the squared row mass.
    X :
    Type u_1
    shared
    P :
    shared
    H :
    X → X → ℝ
    shared
    W :
    X → X → ℝ
    shared
    M :
    ℝ
    shared
    h :
    shared
    n :
    ℕ
    Fin n
    hij :
    i ≠ j
    hik :
    i ≠ k
    hjk :
    j ≠ k
    |∫ ω, H (ω i) (ω j) * H (ω i) (ω k) ∂iidLaw P n| ≤ M ^ 2 * rowMassSq P W
    Proof (Lean source)
    theorem shared_first_coordinate_product_integral_abs_le_rowMassSq {n : ℕ} {i j k : Fin n} (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : |∫ ω, H (ω i) (ω j) * H (ω i) (ω k) ∂iidLaw P n| ≤ M ^ 2 * rowMassSq P W := by have hmeas : Measurable (fun t : (X × X) × X => H t.1.1 t.1.2 * H t.1.1 t.2) := by have hleft : Measurable (fun t : (X × X) × X => (t.1.1, t.1.2)) := by fun_prop have hright : Measurable (fun t : (X × X) × X => (t.1.1, t.2)) := by fun_prop exact (h.measurable_kernel.comp hleft).mul (h.measurable_kernel.comp hright) have hbound (x y z : X) : |H x y * H x z| ≤ M ^ 2 := by have hxy : |H x y| ≤ M := (h.envelope x y).trans (mul_le_of_le_one_right h.envelope_nonneg (h.weight_le_one x y)) have hxz : |H x z| ≤ M := (h.envelope x z).trans (mul_le_of_le_one_right h.envelope_nonneg (h.weight_le_one x z)) calc |H x y * H x z| = |H x y| * |H x z| := abs_mul _ _ _ ≤ M * M := mul_le_mul hxy hxz (abs_nonneg _) h.envelope_nonneg _ = M ^ 2 := by ring rw [integral_three_coordinates P hij hik hjk (fun x y z => H x y * H x z) hmeas (M ^ 2) hbound] exact shared_triple_integral_abs_le_rowMassSq P h
    Causalean.Stat.UStatistic.LocalizedVariance.shared_first_coordinate_product_integral_abs_le_rowMassSq · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:283
  • shared_pairs_product_integral_abs_le_rowMassSq theorem — A probability law and localized-kernel certificate, two unordered sample pairs, their inequality, and their shared index give an absolute product expectation bounded by the squared row mass.
    X :
    Type u_1
    shared
    P :
    shared
    H :
    X → X → ℝ
    shared
    W :
    X → X → ℝ
    shared
    M :
    ℝ
    shared
    h :
    shared
    n :
    ℕ
    Fin n × Fin n
    hp :
    p ∈ pairIndices n
    hq :
    q ∈ pairIndices n
    hne :
    p ≠ q
    hpq :
    |∫ ω, pairValue H p ω * pairValue H q ω ∂iidLaw P n| ≤ M ^ 2 * rowMassSq P W
    Proof (Lean source)
    theorem shared_pairs_product_integral_abs_le_rowMassSq {n : ℕ} {p q : Fin n × Fin n} (hp : p ∈ pairIndices n) (hq : q ∈ pairIndices n) (hne : p ≠ q) (hpq : SharesIndex p q) : |∫ ω, pairValue H p ω * pairValue H q ω ∂iidLaw P n| ≤ M ^ 2 * rowMassSq P W := by have hpord : p.1 < p.2 := (Finset.mem_filter.mp hp).2 have hqord : q.1 < q.2 := (Finset.mem_filter.mp hq).2 rcases hpq with h11 | h12 | h21 | h22 · have hjk : p.2 ≠ q.2 := by intro e exact hne (Prod.ext h11 e) have hb := shared_first_coordinate_product_integral_abs_le_rowMassSq P h (ne_of_lt hpord) (by omega : p.1 ≠ q.2) hjk convert hb using 1 congr 1 apply integral_congr_ae filter_upwards [] with ω simp only [pairValue, h11] · have hjk : p.2 ≠ q.1 := by omega have hb := shared_first_coordinate_product_integral_abs_le_rowMassSq P h (ne_of_lt hpord) (by omega : p.1 ≠ q.1) hjk convert hb using 1 congr 1 apply integral_congr_ae filter_upwards [] with ω simp only [pairValue] rw [h.symmetric_kernel (ω q.1) (ω q.2), ← h12] · have hjk : p.1 ≠ q.2 := by omega have hb := shared_first_coordinate_product_integral_abs_le_rowMassSq P h (by omega : p.2 ≠ p.1) (by omega : p.2 ≠ q.2) hjk convert hb using 1 congr 1 apply integral_congr_ae filter_upwards [] with ω simp only [pairValue] rw [h.symmetric_kernel (ω p.1) (ω p.2), h21] · have hjk : p.1 ≠ q.1 := by intro e exact hne (Prod.ext e h22) have hb := shared_first_coordinate_product_integral_abs_le_rowMassSq P h (by omega : p.2 ≠ p.1) (by omega : p.2 ≠ q.1) hjk convert hb using 1 congr 1 apply integral_congr_ae filter_upwards [] with ω simp only [pairValue] rw [h.symmetric_kernel (ω p.1) (ω p.2), h.symmetric_kernel (ω q.1) (ω q.2), h22]
    Causalean.Stat.UStatistic.LocalizedVariance.shared_pairs_product_integral_abs_le_rowMassSq · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:310
  • covariance_identical_pair_le_pairMass theorem — A probability law and localized-kernel certificate and unordered sample pair give a self-covariance bounded by the scaled pair mass.
    X :
    Type u_1
    shared
    P :
    shared
    H :
    X → X → ℝ
    shared
    W :
    X → X → ℝ
    shared
    M :
    ℝ
    shared
    h :
    shared
    n :
    ℕ
    Fin n × Fin n
    hp :
    p ∈ pairIndices n
    covariance (pairValue H p) (pairValue H p) (iidLaw P n) ≤ M ^ 2 * pairMass P W
    Proof (Lean source)
    theorem covariance_identical_pair_le_pairMass {n : ℕ} {p : Fin n × Fin n} (hp : p ∈ pairIndices n) : covariance (pairValue H p) (pairValue H p) (iidLaw P n) ≤ M ^ 2 * pairMass P W := by -- Use `variance_le_expectation_sq` or `covariance_self`, then the localized -- second-moment estimate above. haveI : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw; infer_instance have hm := pairValue_memLp_two P h p calc covariance (pairValue H p) (pairValue H p) (iidLaw P n) = variance (pairValue H p) (iidLaw P n) := covariance_self hm.aemeasurable _ ≤ ∫ ω, (pairValue H p ω) ^ 2 ∂iidLaw P n := variance_le_expectation_sq hm.aestronglyMeasurable _ ≤ M ^ 2 * pairMass P W := pairValue_second_moment_le_pairMass P h hp
    Causalean.Stat.UStatistic.LocalizedVariance.covariance_identical_pair_le_pairMass · Causalean/Stat/UStatistic/LocalizedVariance/Bounds.lean:389
Bridge 1 core · 0 supporting The real centered second moment bound for a localized unordered pair average transfers to its extended nonnegative integral. ★ lintegral_centered_second_moment_le

Extended nonnegative localized variance bound

The real centered second moment bound for a localized unordered pair average transfers to its extended nonnegative integral.

theorem lintegral_centered_second_moment_le reviewed
Causalean.Stat.UStatistic.LocalizedVariance

Under a probability law and a kernel H localized by a weight W with envelope M, with at least two observations, the expected squared deviation of the unordered order-two U-statistic of H from its mean under n independent draws, computed as an integral of an extended-nonnegative integrand, is at most 16·M²·(R/n + Q/n²), where R is the squared row mass and Q the pair mass of W.

Formal statement
X :
Type u_1
shared
P :
shared
H :
X → X → ℝ
shared
W :
X → X → ℝ
shared
M :
ℝ
shared
h :
shared
n :
ℕ
hn :
2 ≤ n
(∫⁻ ω, ofReal ((uStatistic n H ω - ∫ z, uStatistic n H z ∂iidLaw P n) ^ 2) ∂iidLaw P n)
≤ ofReal (16 * M ^ 2 * (rowMassSq P W / (n : ℝ) + pairMass P W / (n : ℝ) ^ 2))
Proof (Lean source)
theorem lintegral_centered_second_moment_le {n : ℕ} (hn : 2 ≤ n) : (∫⁻ ω, ofReal ((uStatistic n H ω - ∫ z, uStatistic n H z ∂iidLaw P n) ^ 2) ∂iidLaw P n) ≤ ofReal (16 * M ^ 2 * (rowMassSq P W / (n : ℝ) + pairMass P W / (n : ℝ) ^ 2)) := by have : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw infer_instance calc _ = evariance (uStatistic n H) (iidLaw P n) := (evariance_eq_lintegral_ofReal (uStatistic n H) (iidLaw P n)).symm _ = ofReal (variance (uStatistic n H) (iidLaw P n)) := (ofReal_variance (uStatistic_memLp_two P h)).symm _ ≤ ofReal (16 * M ^ 2 * (rowMassSq P W / (n : ℝ) + pairMass P W / (n : ℝ) ^ 2)) := ENNReal.ofReal_le_ofReal (by rw [variance_eq_integral (uStatistic_memLp_two P h).aemeasurable] exact centered_second_moment_le P h hn)
Causalean.Stat.UStatistic.LocalizedVariance.lintegral_centered_second_moment_le · Causalean/Stat/UStatistic/LocalizedVariance/Bridge.lean:23 · uses LocalizedKernel , iidLaw , pairMass , rowMassSq , uStatistic
Coordinates 1 core · 2 supporting These lemmas identify integrals of functions of two, three, and four distinct sample coordinates with their independent iterated integrals. ★ integral_four_coordinates

Integration over distinct product coordinates

These lemmas identify integrals of functions of two, three, and four distinct sample coordinates with their independent iterated integrals. The bounded measurable form is suited to products of bounded localized kernels and weights.

theorem integral_four_coordinates reviewed
Causalean.Stat.UStatistic.LocalizedVariance

For a probability law, four pairwise distinct coordinates, measurable four-variable function, and uniform bound, the finite-product integral equals the four independent-draw integral.

Formal statement
X :
Type u_1
shared
P :
shared
n :
ℕ
Fin n
hij :
i ≠ j
hik :
i ≠ k
hil :
i ≠ l
hjk :
j ≠ k
hjl :
j ≠ l
hkl :
k ≠ l
f :
X → X → X → X → ℝ
hf :
Measurable fun z : ((X × X) × X) × X => f z.1.1.1 z.1.1.2 z.1.2 z.2
B :
ℝ
hB :
∀ x y z w, |f x y z w| ≤ B
∫ ω, f (ω i) (ω j) (ω k) (ω l) ∂iidLaw P n = ∫ x, ∫ y, ∫ z, ∫ w, f x y z w ∂P ∂P ∂P ∂P
Proof (Lean source)
theorem integral_four_coordinates {n : ℕ} {i j k l : Fin n} (hij : i ≠ j) (hik : i ≠ k) (hil : i ≠ l) (hjk : j ≠ k) (hjl : j ≠ l) (hkl : k ≠ l) (f : X → X → X → X → ℝ) (hf : Measurable fun z : ((X × X) × X) × X => f z.1.1.1 z.1.1.2 z.1.2 z.2) (B : ℝ) (hB : ∀ x y z w, |f x y z w| ≤ B) : ∫ ω, f (ω i) (ω j) (ω k) (ω l) ∂iidLaw P n = ∫ x, ∫ y, ∫ z, ∫ w, f x y z w ∂P ∂P ∂P ∂P := by -- As above for four projections; use the independent coordinate family -- `iIndepFun_pi` and a product-law characterization of the joint map. letI : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw; infer_instance have hcoord : iIndepFun (fun a : Fin n => fun ω : Fin n → X => ω a) (iidLaw P n) := by unfold iidLaw simpa using (iIndepFun_pi (μ := fun _ : Fin n => P) (X := fun _ : Fin n => id) (fun _ => aemeasurable_id)) have hpair₁ : (iidLaw P n).map (fun ω => (ω i, ω j)) = P.prod P := by have hind := hcoord.indepFun hij simpa only [(measurePreserving_eval (fun _ : Fin n => P) i).map_eq, (measurePreserving_eval (fun _ : Fin n => P) j).map_eq, iidLaw] using (hind.map_prod_eq_prod_map_map (measurable_pi_apply i).aemeasurable (measurable_pi_apply j).aemeasurable) have hpair₂ : (iidLaw P n).map (fun ω => (ω k, ω l)) = P.prod P := by have hind := hcoord.indepFun hkl simpa only [(measurePreserving_eval (fun _ : Fin n => P) k).map_eq, (measurePreserving_eval (fun _ : Fin n => P) l).map_eq, iidLaw] using (hind.map_prod_eq_prod_map_map (measurable_pi_apply k).aemeasurable (measurable_pi_apply l).aemeasurable) have hfour : (iidLaw P n).map (fun ω => ((ω i, ω j), (ω k, ω l))) = (P.prod P).prod (P.prod P) := by have hind := hcoord.indepFun_prodMk_prodMk (fun a => measurable_pi_apply a) i j k l hik hil hjk hjl have h := hind.map_prod_eq_prod_map_map ((measurable_pi_apply i).prodMk (measurable_pi_apply j)).aemeasurable ((measurable_pi_apply k).prodMk (measurable_pi_apply l)).aemeasurable rw [hpair₁, hpair₂] at h simpa only using h have hmeas : Measurable (fun z : (X × X) × (X × X) => f z.1.1 z.1.2 z.2.1 z.2.2) := by have hassoc : Measurable (fun z : (X × X) × (X × X) => ((z.1, z.2.1), z.2.2)) := by fun_prop exact hf.comp hassoc have hfi : Integrable (fun z : (X × X) × (X × X) => f z.1.1 z.1.2 z.2.1 z.2.2) ((P.prod P).prod (P.prod P)) := Integrable.of_bound hmeas.aestronglyMeasurable B (Filter.Eventually.of_forall (by intro z simpa only [Real.norm_eq_abs] using hB z.1.1 z.1.2 z.2.1 z.2.2)) have hinner (p : X × X) : Integrable (fun q : X × X => f p.1 p.2 q.1 q.2) (P.prod P) := Integrable.of_bound (hmeas.comp (measurable_const.prodMk measurable_id)).aestronglyMeasurable B (Filter.Eventually.of_forall (by intro q simpa only [Real.norm_eq_abs] using hB p.1 p.2 q.1 q.2)) calc _ = ∫ z : (X × X) × (X × X), f z.1.1 z.1.2 z.2.1 z.2.2 ∂ (iidLaw P n).map (fun ω => ((ω i, ω j), (ω k, ω l))) := by rw [integral_map (by fun_prop) hmeas.aestronglyMeasurable] _ = ∫ z : (X × X) × (X × X), f z.1.1 z.1.2 z.2.1 z.2.2 ∂ ((P.prod P).prod (P.prod P)) := by rw [hfour] _ = ∫ p : X × X, ∫ q : X × X, f p.1 p.2 q.1 q.2 ∂(P.prod P) ∂(P.prod P) := integral_prod _ hfi _ = ∫ p : X × X, ∫ z : X, ∫ w : X, f p.1 p.2 z w ∂P ∂P ∂(P.prod P) := by congr 1 funext p exact integral_prod _ (hinner p) _ = _ := integral_prod _ (by convert hfi.integral_prod_left using 1 funext p exact (integral_prod _ (hinner p)).symm)
Causalean.Stat.UStatistic.LocalizedVariance.integral_four_coordinates · Causalean/Stat/UStatistic/LocalizedVariance/Coordinates.lean:96 · uses iidLaw
2 supporting declarations (lemmas, instances)
  • integral_two_coordinates theorem — For a probability law, two distinct coordinates, measurable two-variable function, and uniform bound, the finite-product integral equals the two independent-draw integral.
    X :
    Type u_1
    shared
    P :
    shared
    n :
    ℕ
    Fin n
    hij :
    i ≠ j
    f :
    X → X → ℝ
    hf :
    Measurable fun z : X × X => f z.1 z.2
    B :
    ℝ
    hB :
    ∀ x y, |f x y| ≤ B
    ∫ ω, f (ω i) (ω j) ∂iidLaw P n = ∫ x, ∫ y, f x y ∂P ∂P
    Proof (Lean source)
    theorem integral_two_coordinates {n : ℕ} {i j : Fin n} (hij : i ≠ j) (f : X → X → ℝ) (hf : Measurable fun z : X × X => f z.1 z.2) (B : ℝ) (hB : ∀ x y, |f x y| ≤ B) : ∫ ω, f (ω i) (ω j) ∂iidLaw P n = ∫ x, ∫ y, f x y ∂P ∂P := by -- Use independence of the two coordinate projections under `Measure.pi` to identify -- their joint law with `P.prod P`; bounded measurability supplies integrability. have hcoord : iIndepFun (fun a : Fin n => fun ω : Fin n → X => ω a) (iidLaw P n) := by unfold iidLaw simpa using (iIndepFun_pi (μ := fun _ : Fin n => P) (X := fun _ : Fin n => id) (fun _ => aemeasurable_id)) have hpair : (iidLaw P n).map (fun ω => (ω i, ω j)) = P.prod P := by letI : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw; infer_instance have hind := hcoord.indepFun hij simpa only [(measurePreserving_eval (fun _ : Fin n => P) i).map_eq, (measurePreserving_eval (fun _ : Fin n => P) j).map_eq, iidLaw] using (hind.map_prod_eq_prod_map_map (measurable_pi_apply i).aemeasurable (measurable_pi_apply j).aemeasurable) have hfi : Integrable (fun z : X × X => f z.1 z.2) (P.prod P) := Integrable.of_bound hf.aestronglyMeasurable B (Filter.Eventually.of_forall (by intro z simpa only [Real.norm_eq_abs] using hB z.1 z.2)) calc _ = ∫ z : X × X, f z.1 z.2 ∂(iidLaw P n).map (fun ω => (ω i, ω j)) := by rw [integral_map (by fun_prop) hf.aestronglyMeasurable] _ = ∫ z : X × X, f z.1 z.2 ∂(P.prod P) := by rw [hpair] _ = _ := integral_prod _ hfi
    Causalean.Stat.UStatistic.LocalizedVariance.integral_two_coordinates · Causalean/Stat/UStatistic/LocalizedVariance/Coordinates.lean:20
  • integral_three_coordinates theorem — For a probability law, three pairwise distinct coordinates, measurable three-variable function, and uniform bound, the finite-product integral equals the three independent-draw integral.
    X :
    Type u_1
    shared
    P :
    shared
    n :
    ℕ
    Fin n
    hij :
    i ≠ j
    hik :
    i ≠ k
    hjk :
    j ≠ k
    f :
    X → X → X → ℝ
    hf :
    Measurable fun z : (X × X) × X => f z.1.1 z.1.2 z.2
    B :
    ℝ
    hB :
    ∀ x y z, |f x y z| ≤ B
    ∫ ω, f (ω i) (ω j) (ω k) ∂iidLaw P n = ∫ x, ∫ y, ∫ z, f x y z ∂P ∂P ∂P
    Proof (Lean source)
    theorem integral_three_coordinates {n : ℕ} {i j k : Fin n} (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) (f : X → X → X → ℝ) (hf : Measurable fun z : (X × X) × X => f z.1.1 z.1.2 z.2) (B : ℝ) (hB : ∀ x y z, |f x y z| ≤ B) : ∫ ω, f (ω i) (ω j) (ω k) ∂iidLaw P n = ∫ x, ∫ y, ∫ z, f x y z ∂P ∂P ∂P := by -- Push the product law along the three distinct coordinate projections, then -- apply Fubini twice. A reusable finite-coordinate map theorem may shorten this. letI : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw; infer_instance have hcoord : iIndepFun (fun a : Fin n => fun ω : Fin n → X => ω a) (iidLaw P n) := by unfold iidLaw simpa using (iIndepFun_pi (μ := fun _ : Fin n => P) (X := fun _ : Fin n => id) (fun _ => aemeasurable_id)) have hpair : (iidLaw P n).map (fun ω => (ω i, ω j)) = P.prod P := by have hind := hcoord.indepFun hij simpa only [(measurePreserving_eval (fun _ : Fin n => P) i).map_eq, (measurePreserving_eval (fun _ : Fin n => P) j).map_eq, iidLaw] using (hind.map_prod_eq_prod_map_map (measurable_pi_apply i).aemeasurable (measurable_pi_apply j).aemeasurable) have htriple : (iidLaw P n).map (fun ω => ((ω i, ω j), ω k)) = (P.prod P).prod P := by have hind := hcoord.indepFun_prodMk (fun a => measurable_pi_apply a) i j k hik hjk have h := hind.map_prod_eq_prod_map_map ((measurable_pi_apply i).prodMk (measurable_pi_apply j)).aemeasurable (measurable_pi_apply k).aemeasurable rw [hpair] at h simpa only [(measurePreserving_eval (fun _ : Fin n => P) k).map_eq, iidLaw] using h have hfi : Integrable (fun z : (X × X) × X => f z.1.1 z.1.2 z.2) ((P.prod P).prod P) := Integrable.of_bound hf.aestronglyMeasurable B (Filter.Eventually.of_forall (by intro z simpa only [Real.norm_eq_abs] using hB z.1.1 z.1.2 z.2)) calc _ = ∫ z : (X × X) × X, f z.1.1 z.1.2 z.2 ∂ (iidLaw P n).map (fun ω => ((ω i, ω j), ω k)) := by rw [integral_map (by fun_prop) hf.aestronglyMeasurable] _ = ∫ z : (X × X) × X, f z.1.1 z.1.2 z.2 ∂((P.prod P).prod P) := by rw [htriple] _ = ∫ z : X × X, ∫ w : X, f z.1 z.2 w ∂P ∂(P.prod P) := integral_prod _ hfi _ = _ := by exact integral_prod _ hfi.integral_prod_left
    Causalean.Stat.UStatistic.LocalizedVariance.integral_three_coordinates · Causalean/Stat/UStatistic/LocalizedVariance/Coordinates.lean:50
Counting 1 core · 7 supporting This module counts unordered index pairs and the ordered pairs of such pairs that are identical, share exactly one index, or are disjoint. ★ normalized_pair_counts_le

Counting unordered pair overlaps

This module counts unordered index pairs and the ordered pairs of such pairs that are identical, share exactly one index, or are disjoint. The counts are purely finite and independent of the observation space.

theorem normalized_pair_counts_le reviewed
Causalean.Stat.UStatistic.LocalizedVariance

For a sample size n of at least two and nonnegative reals a, p and r, with N = n(n − 1)/2 the number of unordered pairs, the quantity N⁻²·(N·a·p + 2N(n − 2)·2a·r) is at most 16·a·(r/n + p/n²). This is the counting step of the U-statistic variance bound: N identical pairs each contribute a·p, and the 2N(n − 2) ordered pairs of pairs sharing exactly one index each contribute 2a·r.

Formal statement
n :
ℕ
hn :
2 ≤ n
a p r :
ℝ
ha :
0 ≤ a
hp :
0 ≤ p
hr :
0 ≤ r
((n.choose 2 : ℝ)⁻¹) ^ 2 * ((n.choose 2 : ℝ) * (a * p) + ((2 * (n.choose 2) * (n - 2) : ℕ) : ℝ) * (2 * a * r))
≤ 16 * a * (r / (n : ℝ) + p / (n : ℝ) ^ 2)
Proof (Lean source)
theorem normalized_pair_counts_le {n : ℕ} (hn : 2 ≤ n) {a p r : ℝ} (ha : 0 ≤ a) (hp : 0 ≤ p) (hr : 0 ≤ r) : ((n.choose 2 : ℝ)⁻¹) ^ 2 * ((n.choose 2 : ℝ) * (a * p) + ((2 * (n.choose 2) * (n - 2) : ℕ) : ℝ) * (2 * a * r)) ≤ 16 * a * (r / (n : ℝ) + p / (n : ℝ) ^ 2) := by -- Rewrite `n.choose 2` with `Nat.choose_two_right`; `hn` makes its -- denominator positive. Separate the coefficients of `p` and `r`, then -- use `n - 1 ≥ n / 2` and `n - 2 ≤ n`. let q : ℝ := n.choose 2 let N : ℝ := n let t : ℝ := n - 2 have hN : 0 < N := by change 0 < (n : ℝ) exact_mod_cast (by omega : 0 < n) have hNtwo : 2 ≤ N := by change 2 ≤ (n : ℝ) exact_mod_cast hn have hq : 0 < q := by dsimp [q] exact_mod_cast (Nat.choose_pos hn) have hchoose : n.choose 2 = n * (n - 1) / 2 := Nat.choose_two_right n have hqeq : q = N * (N - 1) / 2 := by have hcast := Nat.cast_choose_two ℝ n rw [hchoose] at hcast dsimp [q, N] rw [hchoose] exact hcast have hqbound : N ^ 2 ≤ 4 * q := by nlinarith [mul_nonneg hN.le (sub_nonneg.mpr hNtwo)] have ht : t ≤ N := by dsimp [t, N] exact_mod_cast (sub_le n 2) have hpcoef : 1 / q ≤ 16 / N ^ 2 := by apply (div_le_div_iff₀ hq (sq_pos_of_pos hN)).2 nlinarith have hrcoef : 4 * t / q ≤ 16 / N := by apply (div_le_div_iff₀ hq hN).2 nlinarith [mul_le_mul_of_nonneg_right ht hN.le] have hap : 0 ≤ a * p := mul_nonneg ha hp have har : 0 ≤ a * r := mul_nonneg ha hr have hbound := add_le_add (mul_le_mul_of_nonneg_right hpcoef hap) (mul_le_mul_of_nonneg_right hrcoef har) dsimp [q, N, t] at hbound have hqne : (n.choose 2 : ℝ) ≠ 0 := ne_of_gt hq calc _ = 1 / (n.choose 2 : ℝ) * (a * p) + 4 * ((n - 2 : ℕ) : ℝ) / (n.choose 2 : ℝ) * (a * r) := by simp only [Nat.cast_mul, Nat.cast_ofNat] field_simp [hqne] ring _ ≤ 16 / (n : ℝ) ^ 2 * (a * p) + 16 / (n : ℝ) * (a * r) := by simpa [Nat.cast_sub hn] using hbound _ = _ := by ring
Causalean.Stat.UStatistic.LocalizedVariance.normalized_pair_counts_le · Causalean/Stat/UStatistic/LocalizedVariance/Counting.lean:212
7 supporting declarations (lemmas, instances)
  • card_pairIndices theorem — A sample size has exactly its binomial number of unordered pairs.
    n :
    ℕ
    (pairIndices n).card = n.choose 2
    Proof (Lean source)
    theorem card_pairIndices (n : ℕ) : (pairIndices n).card = n.choose 2 := by simpa [pairIndices] using (Finset.card_product_filter_lt (s := (Finset.univ : Finset (Fin n))))
    Causalean.Stat.UStatistic.LocalizedVariance.card_pairIndices · Causalean/Stat/UStatistic/LocalizedVariance/Counting.lean:16
  • card_identical_pair_configurations theorem — A sample size has one ordered identical-pair configuration for each unordered pair.
    n :
    ℕ
    ((pairIndices n).product (pairIndices n) |>.filter fun pq => pq.1 = pq.2).card
    = n.choose 2
    Proof (Lean source)
    theorem card_identical_pair_configurations (n : ℕ) : ((pairIndices n).product (pairIndices n) |>.filter fun pq => pq.1 = pq.2).card = n.choose 2 := by change ((pairIndices n ×ˢ pairIndices n).filter (fun pq => pq.1 = pq.2)).card = _ rw [← Finset.diag_eq_filter, Finset.diag_card, card_pairIndices]
    Causalean.Stat.UStatistic.LocalizedVariance.card_identical_pair_configurations · Causalean/Stat/UStatistic/LocalizedVariance/Counting.lean:21
  • card_pairs_sharing_fixed_pair theorem — Given at least two observations and an unordered pair, exactly twice the number of remaining vertices gives a distinct pair sharing an endpoint.
    n :
    ℕ
    hn :
    2 ≤ n
    p :
    Fin n × Fin n
    hp :
    p ∈ pairIndices n
    ((pairIndices n).filter fun q => p ≠ q ∧ SharesIndex p q).card = 2 * (n - 2)
    Proof (Lean source)
    theorem card_pairs_sharing_fixed_pair {n : ℕ} (hn : 2 ≤ n) {p : Fin n × Fin n} (hp : p ∈ pairIndices n) : ((pairIndices n).filter fun q => p ≠ q ∧ SharesIndex p q).card = 2 * (n - 2) := by -- Partition the filtered pairs by which endpoint of p they contain. The -- parts are disjoint because q ≠ p; each is indexed by the n - 2 remaining -- vertices. An order-free Finset erase of the two endpoints is convenient. have hcount (a b : Fin n) (hab : a ≠ b) : ((pairIndices n).filter (fun q => q ≠ (if a < b then (a,b) else (b,a)) ∧ (q.1 = a ∨ q.2 = a))).card = n - 2 := by let t := ((Finset.univ : Finset (Fin n)).erase a).erase b let f : Fin n → Fin n × Fin n := fun x => if a < x then (a,x) else (x,a) have heq : (pairIndices n).filter (fun q => q ≠ (if a < b then (a,b) else (b,a)) ∧ (q.1 = a ∨ q.2 = a)) = t.image f := by ext q simp only [mem_filter, pairIndices, Finset.mem_univ, true_and, mem_image] constructor · rintro ⟨hord, hne, hshare⟩ rcases hshare with h | h · refine ⟨q.2, ?_, ?_⟩ · grind · dsimp [f]; split_ifs <;> grind · refine ⟨q.1, ?_, ?_⟩ · grind · dsimp [f]; split_ifs <;> grind · rintro ⟨x, hx, hqx⟩ rw [← hqx] have hxa : x ≠ a := (Finset.mem_erase.mp (Finset.mem_erase.mp hx).2).1 have hxb : x ≠ b := (Finset.mem_erase.mp hx).1 dsimp [f] split_ifs <;> grind have hinj : InjOn f ↑t := by intro x hx y hy h have hxa : x ≠ a := (Finset.mem_erase.mp (Finset.mem_erase.mp hx).2).1 have hya : y ≠ a := (Finset.mem_erase.mp (Finset.mem_erase.mp hy).2).1 dsimp [f] at h split_ifs at h <;> grind rw [heq, Finset.card_image_of_injOn hinj] have hb : b ∈ (Finset.univ : Finset (Fin n)).erase a := by simp [hab.symm] rw [Finset.card_erase_of_mem hb, Finset.card_erase_of_mem (Finset.mem_univ a)] simp only [Finset.card_univ, Fintype.card_fin] omega have hpord : p.1 < p.2 := by simpa [pairIndices] using hp let A := (pairIndices n).filter fun q => q ≠ p ∧ (q.1 = p.1 ∨ q.2 = p.1) let B := (pairIndices n).filter fun q => q ≠ p ∧ (q.1 = p.2 ∨ q.2 = p.2) have hcover : ((pairIndices n).filter fun q => p ≠ q ∧ SharesIndex p q) = A ∪ B := by ext q simp only [mem_filter, mem_union] dsimp [A, B] simp only [mem_filter] unfold SharesIndex grind have hdisj : Disjoint A B := by apply Finset.disjoint_left.mpr intro q hA hB have hqord : q.1 < q.2 := by have hq : q ∈ pairIndices n := (Finset.mem_filter.mp hA).1 simpa [pairIndices] using hq have ha := (Finset.mem_filter.mp hA).2 have hb := (Finset.mem_filter.mp hB).2 grind have hA : A.card = n - 2 := by simpa [A, hpord] using hcount p.1 p.2 (ne_of_lt hpord) have hB : B.card = n - 2 := by have hnot : ¬ p.2 < p.1 := not_lt_of_ge (le_of_lt hpord) simpa [B, hnot] using hcount p.2 p.1 (Ne.symm (ne_of_lt hpord)) rw [hcover, Finset.card_union_of_disjoint hdisj, hA, hB] omega
    Causalean.Stat.UStatistic.LocalizedVariance.card_pairs_sharing_fixed_pair · Causalean/Stat/UStatistic/LocalizedVariance/Counting.lean:29
  • card_pairs_disjoint_fixed_pair theorem — Given an unordered pair, the pairs using neither endpoint have the binomial remaining-vertex count.
    n :
    ℕ
    Fin n × Fin n
    hp :
    p ∈ pairIndices n
    ((pairIndices n).filter fun q => ¬ SharesIndex p q).card = (n - 2).choose 2
    Proof (Lean source)
    theorem card_pairs_disjoint_fixed_pair {n : ℕ} {p : Fin n × Fin n} (hp : p ∈ pairIndices n) : ((pairIndices n).filter fun q => ¬ SharesIndex p q).card = (n - 2).choose 2 := by let s := ((Finset.univ : Finset (Fin n)).erase p.1).erase p.2 have hset : (pairIndices n).filter (fun q => ¬ SharesIndex p q) = (s ×ˢ s).filter (fun q => q.1 < q.2) := by ext q simp [s, pairIndices, SharesIndex, Finset.mem_product, and_comm, and_assoc] grind have hpord : p.1 < p.2 := by simpa [pairIndices] using hp have hp2 : p.2 ∈ (Finset.univ : Finset (Fin n)).erase p.1 := by simp [ne_of_gt hpord] have hs : s.card = n - 2 := by dsimp [s] rw [Finset.card_erase_of_mem hp2, Finset.card_erase_of_mem (Finset.mem_univ p.1)] simp only [Finset.card_univ, Fintype.card_fin] omega rw [hset, Finset.card_product_filter_lt, hs]
    Causalean.Stat.UStatistic.LocalizedVariance.card_pairs_disjoint_fixed_pair · Causalean/Stat/UStatistic/LocalizedVariance/Counting.lean:103
  • choose_two_mul_choose_sub_two theorem — A sample size satisfies the pair-then-disjoint-pair counting identity, which counts every four-element subset through its six ordered pairings.
    n :
    ℕ
    n.choose 2 * (n - 2).choose 2 = 6 * n.choose 4
    Proof (Lean source)
    theorem choose_two_mul_choose_sub_two (n : ℕ) : n.choose 2 * (n - 2).choose 2 = 6 * n.choose 4 := by have h := Nat.choose_mul (n := n) (k := 4) (s := 2) (by omega) have hchoose : choose 4 2 = 6 := by decide rw [hchoose] at h simpa [Nat.mul_comm] using h.symm
    Causalean.Stat.UStatistic.LocalizedVariance.choose_two_mul_choose_sub_two · Causalean/Stat/UStatistic/LocalizedVariance/Counting.lean:125
  • card_shared_pair_configurations theorem — Given at least two observations, the ordered count of distinct pair pairs sharing one index has the stated binomial form.
    n :
    ℕ
    hn :
    2 ≤ n
    ((pairIndices n).product (pairIndices n) |>.filter fun (pq : (Fin n × Fin n) × (Fin n × Fin n)) => pq.1 ≠ pq.2 ∧ SharesIndex pq.1 pq.2).card
    = 2 * (n.choose 2) * (n - 2)
    Proof (Lean source)
    theorem card_shared_pair_configurations {n : ℕ} (hn : 2 ≤ n) : ((pairIndices n).product (pairIndices n) |>.filter fun (pq : (Fin n × Fin n) × (Fin n × Fin n)) => pq.1 ≠ pq.2 ∧ SharesIndex pq.1 pq.2).card = 2 * (n.choose 2) * (n - 2) := by -- Sum the fixed-pair fiber count `card_pairs_sharing_fixed_pair` over -- `pairIndices`; then use `card_pairIndices`. classical let s := pairIndices n have hfiber (p : Fin n × Fin n) (hp : p ∈ s) : (((s ×ˢ s).filter (fun pq => pq.1 ≠ pq.2 ∧ SharesIndex pq.1 pq.2)).filter (fun pq => pq.1 = p)).card = 2 * (n - 2) := by have heq : ((s ×ˢ s).filter (fun pq => pq.1 ≠ pq.2 ∧ SharesIndex pq.1 pq.2)).filter (fun pq => pq.1 = p) = {p} ×ˢ (s.filter fun q => p ≠ q ∧ SharesIndex p q) := by ext pq simp only [mem_filter, Finset.mem_product, Finset.mem_singleton] constructor · rintro ⟨⟨⟨hpq, hqq⟩, hne, hshare⟩, hfst⟩ subst p exact ⟨rfl, hqq, hne, hshare⟩ · rintro ⟨hfst, hqq, hne, hshare⟩ subst p exact ⟨⟨⟨hp, hqq⟩, hne, hshare⟩, rfl⟩ rw [heq, Finset.card_product] simpa [s] using card_pairs_sharing_fixed_pair hn hp have hsum := Finset.card_eq_sum_card_fiberwise (s := (s ×ˢ s).filter (fun pq => pq.1 ≠ pq.2 ∧ SharesIndex pq.1 pq.2)) (t := s) (f := fst) (by intro pq hpq exact (Finset.mem_product.mp (Finset.mem_filter.mp hpq).1).1) rw [Finset.sum_const_nat hfiber] at hsum simpa [s, card_pairIndices, Nat.mul_comm, Nat.mul_left_comm, Nat.mul_assoc] using hsum
    Causalean.Stat.UStatistic.LocalizedVariance.card_shared_pair_configurations · Causalean/Stat/UStatistic/LocalizedVariance/Counting.lean:134
  • card_disjoint_pair_configurations theorem — A sample size has six ordered disjoint-pair configurations per four-element subset.
    n :
    ℕ
    ((pairIndices n).product (pairIndices n) |>.filter fun (pq : (Fin n × Fin n) × (Fin n × Fin n)) => ¬ SharesIndex pq.1 pq.2).card
    = 6 * n.choose 4
    Proof (Lean source)
    theorem card_disjoint_pair_configurations (n : ℕ) : ((pairIndices n).product (pairIndices n) |>.filter fun (pq : (Fin n × Fin n) × (Fin n × Fin n)) => ¬ SharesIndex pq.1 pq.2).card = 6 * n.choose 4 := by -- Sum `card_pairs_disjoint_fixed_pair` over first pairs, rewrite with -- `card_pairIndices`, then use `choose_two_mul_choose_sub_two`. classical let s := pairIndices n have hfiber (p : Fin n × Fin n) (hp : p ∈ s) : (((s ×ˢ s).filter (fun pq => ¬ SharesIndex pq.1 pq.2)).filter (fun pq => pq.1 = p)).card = (n - 2).choose 2 := by have heq : ((s ×ˢ s).filter (fun pq => ¬ SharesIndex pq.1 pq.2)).filter (fun pq => pq.1 = p) = {p} ×ˢ (s.filter fun q => ¬ SharesIndex p q) := by ext pq simp only [mem_filter, Finset.mem_product, Finset.mem_singleton] constructor · rintro ⟨⟨⟨hpq, hqq⟩, hdis⟩, hfst⟩ subst p exact ⟨rfl, hqq, hdis⟩ · rintro ⟨hfst, hqq, hdis⟩ subst p exact ⟨⟨⟨hp, hqq⟩, hdis⟩, rfl⟩ rw [heq, Finset.card_product] simpa [s] using card_pairs_disjoint_fixed_pair hp have hsum := Finset.card_eq_sum_card_fiberwise (s := (s ×ˢ s).filter (fun pq => ¬ SharesIndex pq.1 pq.2)) (t := s) (f := fst) (by intro pq hpq exact (Finset.mem_product.mp (Finset.mem_filter.mp hpq).1).1) rw [Finset.sum_const_nat hfiber] at hsum have hcard : ((pairIndices n ×ˢ pairIndices n).filter (fun pq => ¬ SharesIndex pq.1 pq.2)).card = n.choose 2 * (n - 2).choose 2 := by simpa [s, card_pairIndices] using hsum exact hcard.trans (choose_two_mul_choose_sub_two n)
    Causalean.Stat.UStatistic.LocalizedVariance.card_disjoint_pair_configurations · Causalean/Stat/UStatistic/LocalizedVariance/Counting.lean:171
Main 1 core · 1 supporting For a symmetric kernel bounded by a symmetric weight, the centered second moment of the unordered pair average is controlled by both the squared row mass at order 1/n and the pair mass at order 1/n². ★ centered_second_moment_le

Localized variance of an unordered order-two U-statistic

For a symmetric kernel bounded by a symmetric weight, the centered second moment of the unordered pair average is controlled by both the squared row mass at order 1/n and the pair mass at order 1/n². The extended nonnegative form is in Bridge.

theorem centered_second_moment_le reviewed
Causalean.Stat.UStatistic.LocalizedVariance

Under a probability law and a kernel H localized by a weight W with envelope M — both symmetric and measurable, W between zero and one, and |H| at most M·W — with at least two observations, the variance of the unordered order-two U-statistic of H under n independent draws (its expected squared deviation from its mean) is at most 16·M²·(R/n + Q/n²). Here Q, the pair mass, is the mean of W over two independent draws, and R, the squared row mass, is the mean over one draw of the square of W's mean over a second independent draw.

Formal statement
X :
Type u_1
shared
P :
shared
H :
X → X → ℝ
shared
W :
X → X → ℝ
shared
M :
ℝ
shared
h :
shared
n :
ℕ
hn :
2 ≤ n
(∫ ω, (uStatistic n H ω - ∫ z, uStatistic n H z ∂iidLaw P n) ^ 2 ∂iidLaw P n)
≤ 16 * M ^ 2 * (rowMassSq P W / (n : ℝ) + pairMass P W / (n : ℝ) ^ 2)
Proof (Lean source)
theorem centered_second_moment_le {n : ℕ} (hn : 2 ≤ n) : (∫ ω, (uStatistic n H ω - ∫ z, uStatistic n H z ∂iidLaw P n) ^ 2 ∂iidLaw P n) ≤ 16 * M ^ 2 * (rowMassSq P W / (n : ℝ) + pairMass P W / (n : ℝ) ^ 2) := by have hp : 0 ≤ pairMass P W := by unfold pairMass apply integral_nonneg intro x apply integral_nonneg intro y exact h.weight_nonneg x y have hr : 0 ≤ rowMassSq P W := by unfold rowMassSq apply integral_nonneg intro x exact sq_nonneg _ have hscale : variance (uStatistic n H) (iidLaw P n) = (((pairIndices n).card : ℝ)⁻¹) ^ 2 * variance (fun ω => ∑ p ∈ pairIndices n, pairValue H p ω) (iidLaw P n) := by have hfun : uStatistic n H = fun ω => (((pairIndices n).card : ℝ)⁻¹) * ∑ p ∈ pairIndices n, pairValue H p ω := by funext ω simp only [uStatistic, pairValue] rw [hfun] exact variance_const_mul (((pairIndices n).card : ℝ)⁻¹) (fun ω => ∑ p ∈ pairIndices n, pairValue H p ω) (iidLaw P n) calc _ = variance (uStatistic n H) (iidLaw P n) := (variance_eq_integral (uStatistic_memLp_two P h).aemeasurable).symm _ = (((pairIndices n).card : ℝ)⁻¹) ^ 2 * variance (fun ω => ∑ p ∈ pairIndices n, pairValue H p ω) (iidLaw P n) := hscale _ ≤ (((pairIndices n).card : ℝ)⁻¹) ^ 2 * ((n.choose 2 : ℝ) * (M ^ 2 * pairMass P W) + ((2 * (n.choose 2) * (n - 2) : ℕ) : ℝ) * (2 * M ^ 2 * rowMassSq P W)) := mul_le_mul_of_nonneg_left (pair_sum_variance_le_localized_counts P h hn) (sq_nonneg _) _ ≤ 16 * M ^ 2 * (rowMassSq P W / (n : ℝ) + pairMass P W / (n : ℝ) ^ 2) := by rw [card_pairIndices] exact normalized_pair_counts_le hn (sq_nonneg M) hp hr
Causalean.Stat.UStatistic.LocalizedVariance.centered_second_moment_le · Causalean/Stat/UStatistic/LocalizedVariance/Main.lean:35 · uses LocalizedKernel , iidLaw , pairMass , rowMassSq , uStatistic
1 supporting declaration (lemmas, instances)
Mean 1 core · 1 supporting For a measurable integrable symmetric pair kernel, each distinct finite-product coordinate pair has the independent two-draw expectation. ★ integral_uStatistic_eq_pair

Mean of an unordered order-two U-statistic

For a measurable integrable symmetric pair kernel, each distinct finite-product coordinate pair has the independent two-draw expectation. Averaging over unordered pairs preserves that mean. This module is independent of causal models and supplies the integrable finite-product transport.

theorem integral_uStatistic_eq_pair reviewed
Causalean.Stat.UStatistic.LocalizedVariance

A probability law, sample size, at least two observations, pair kernel, its measurability, and its integrability under the independent two-draw law give an unordered U-statistic mean equal to its independent two-draw mean.

Formal statement
X :
Type u_1
shared
P :
shared
n :
ℕ
hn :
2 ≤ n
H :
X → X → ℝ
hH :
Measurable fun z : X × X => H z.1 z.2
hInt :
Integrable (fun z : X × X => H z.1 z.2) (P.prod P)
∫ ω, uStatistic n H ω ∂iidLaw P n = ∫ z : X × X, H z.1 z.2 ∂(P.prod P)
Proof (Lean source)
theorem integral_uStatistic_eq_pair (n : ℕ) (hn : 2 ≤ n) (H : X → X → ℝ) (hH : Measurable fun z : X × X => H z.1 z.2) (hInt : Integrable (fun z : X × X => H z.1 z.2) (P.prod P)) : ∫ ω, uStatistic n H ω ∂iidLaw P n = ∫ z : X × X, H z.1 z.2 ∂(P.prod P) := by -- Integrate the finite sum in `uStatistic`, using the integrability supplied -- by `integral_two_coordinates_integrable` for every pair. Every summand -- has the same mean. `hn` makes `pairIndices n` nonempty, so its cardinal -- cancels the normalization. letI : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw; infer_instance have hcoord : iIndepFun (fun a : Fin n => fun ω : Fin n → X => ω a) (iidLaw P n) := by unfold iidLaw simpa using (iIndepFun_pi (μ := fun _ : Fin n => P) (X := fun _ : Fin n => id) (fun _ => aemeasurable_id)) have hpair (p : Fin n × Fin n) (hp : p ∈ pairIndices n) : (iidLaw P n).map (fun ω => (ω p.1, ω p.2)) = P.prod P := by have hpord : p.1 < p.2 := by simpa [pairIndices] using hp have hind := hcoord.indepFun (ne_of_lt hpord) simpa only [(measurePreserving_eval (fun _ : Fin n => P) p.1).map_eq, (measurePreserving_eval (fun _ : Fin n => P) p.2).map_eq, iidLaw] using (hind.map_prod_eq_prod_map_map (measurable_pi_apply p.1).aemeasurable (measurable_pi_apply p.2).aemeasurable) have hIntCoord (p : Fin n × Fin n) (hp : p ∈ pairIndices n) : Integrable (fun ω => H (ω p.1) (ω p.2)) (iidLaw P n) := by have hm : Measurable (fun ω : Fin n → X => (ω p.1, ω p.2)) := by fun_prop have hi : Integrable (fun z : X × X => H z.1 z.2) ((iidLaw P n).map (fun ω => (ω p.1, ω p.2))) := by rw [hpair p hp] exact hInt exact hi.comp_measurable hm have hsum : (∑ p ∈ pairIndices n, ∫ ω, H (ω p.1) (ω p.2) ∂iidLaw P n) = ((pairIndices n).card : ℝ) * ∫ z : X × X, H z.1 z.2 ∂(P.prod P) := by calc _ = ∑ _p ∈ pairIndices n, ∫ z : X × X, H z.1 z.2 ∂(P.prod P) := by apply Finset.sum_congr rfl intro p hp exact integral_two_coordinates_integrable P (ne_of_lt (by simpa [pairIndices] using hp)) H hH _ = _ := by simp have hcard : ((pairIndices n).card : ℝ) ≠ 0 := by rw [card_pairIndices] exact_mod_cast (Nat.choose_pos hn).ne' calc ∫ ω, uStatistic n H ω ∂iidLaw P n = ((pairIndices n).card : ℝ)⁻¹ * ∑ p ∈ pairIndices n, ∫ ω, H (ω p.1) (ω p.2) ∂iidLaw P n := by simp only [uStatistic, integral_const_mul] congr 1 exact integral_finsetSum (pairIndices n) hIntCoord _ = ∫ z : X × X, H z.1 z.2 ∂(P.prod P) := by rw [hsum] simp [hcard]
Causalean.Stat.UStatistic.LocalizedVariance.integral_uStatistic_eq_pair · Causalean/Stat/UStatistic/LocalizedVariance/Mean.lean:52 · uses iidLaw , uStatistic
1 supporting declaration (lemmas, instances)
  • integral_two_coordinates_integrable theorem — A probability law, sample size, two sample coordinates, their distinctness, pair kernel, and measurability of that kernel give a coordinate-pair mean equal to its independent two-draw mean.
    X :
    Type u_1
    shared
    P :
    shared
    n :
    ℕ
    Fin n
    hij :
    i ≠ j
    H :
    X → X → ℝ
    hH :
    Measurable fun z : X × X => H z.1 z.2
    ∫ ω, H (ω i) (ω j) ∂iidLaw P n = ∫ z : X × X, H z.1 z.2 ∂(P.prod P)
    Proof (Lean source)
    theorem integral_two_coordinates_integrable {n : ℕ} {i j : Fin n} (hij : i ≠ j) (H : X → X → ℝ) (hH : Measurable fun z : X × X => H z.1 z.2) : ∫ ω, H (ω i) (ω j) ∂iidLaw P n = ∫ z : X × X, H z.1 z.2 ∂(P.prod P) := by -- Follow `LocalizedVariance.integral_two_coordinates`: the joint coordinate -- map sends `iidLaw P n` to `P.prod P`. Use `integral_map`. letI : IsProbabilityMeasure (iidLaw P n) := by unfold iidLaw; infer_instance have hcoord : iIndepFun (fun a : Fin n => fun ω : Fin n → X => ω a) (iidLaw P n) := by unfold iidLaw simpa using (iIndepFun_pi (μ := fun _ : Fin n => P) (X := fun _ : Fin n => id) (fun _ => aemeasurable_id)) have hpair : (iidLaw P n).map (fun ω => (ω i, ω j)) = P.prod P := by have hind := hcoord.indepFun hij simpa only [(measurePreserving_eval (fun _ : Fin n => P) i).map_eq, (measurePreserving_eval (fun _ : Fin n => P) j).map_eq, iidLaw] using (hind.map_prod_eq_prod_map_map (measurable_pi_apply i).aemeasurable (measurable_pi_apply j).aemeasurable) calc _ = ∫ z : X × X, H z.1 z.2 ∂(iidLaw P n).map (fun ω => (ω i, ω j)) := by rw [integral_map (by fun_prop) hH.aestronglyMeasurable] _ = _ := by rw [hpair]
    Causalean.Stat.UStatistic.LocalizedVariance.integral_two_coordinates_integrable · Causalean/Stat/UStatistic/LocalizedVariance/Mean.lean:25
Sum­Bound 1 core · 1 supporting The variance of the unnormalized unordered pair sum is expanded into ordered pair-of-pairs covariances. ★ pair_sum_variance_le_localized_counts

Covariance expansion and localized count bound

The variance of the unnormalized unordered pair sum is expanded into ordered pair-of-pairs covariances. Identical, shared, and disjoint configurations are bounded separately using the pair and squared row masses.

theorem pair_sum_variance_le_localized_counts reviewed
Causalean.Stat.UStatistic.LocalizedVariance

Under a probability law and a kernel H localized by a weight W with envelope M, with at least two observations, the variance, under n independent draws, of the sum of the kernel values over all N = n(n − 1)/2 unordered pairs is at most N·M²·Q + 2N(n − 2)·2M²·R, where Q is the pair mass and R the squared row mass of W.

Formal statement
X :
Type u_1
shared
P :
shared
H :
X → X → ℝ
shared
W :
X → X → ℝ
shared
M :
ℝ
shared
h :
shared
n :
ℕ
hn :
2 ≤ n
variance (fun ω => ∑ p ∈ pairIndices n, pairValue H p ω) (iidLaw P n)
≤ (n.choose 2 : ℝ) * (M ^ 2 * pairMass P W)
+ ((2 * (n.choose 2) * (n - 2) : ℕ) : ℝ) * (2 * M ^ 2 * rowMassSq P W)
Proof (Lean source)
theorem pair_sum_variance_le_localized_counts {n : ℕ} (hn : 2 ≤ n) : variance (fun ω => ∑ p ∈ pairIndices n, pairValue H p ω) (iidLaw P n) ≤ (n.choose 2 : ℝ) * (M ^ 2 * pairMass P W) + ((2 * (n.choose 2) * (n - 2) : ℕ) : ℝ) * (2 * M ^ 2 * rowMassSq P W) := by classical let s := pairIndices n let A : ℝ := M ^ 2 * pairMass P W let B : ℝ := 2 * M ^ 2 * rowMassSq P W have hpoint (pq : (Fin n × Fin n) × (Fin n × Fin n)) (hpq : pq ∈ s.product s) : covariance (pairValue H pq.1) (pairValue H pq.2) (iidLaw P n) ≤ if pq.1 = pq.2 then A else if SharesIndex pq.1 pq.2 then B else 0 := by obtain ⟨hp, hq⟩ := Finset.mem_product.mp hpq split_ifs with heq hshare · simpa only [heq, A] using covariance_identical_pair_le_pairMass P h hp · exact covariance_shared_pairs_le_rowMassSq P h hp hq heq hshare · rw [covariance_disjoint_pairs_eq_zero P h hshare] calc variance (fun ω => ∑ p ∈ s, pairValue H p ω) (iidLaw P n) = ∑ pq ∈ s.product s, covariance (pairValue H pq.1) (pairValue H pq.2) (iidLaw P n) := by symm change (∑ pq ∈ s ×ˢ s, covariance (pairValue H pq.1) (pairValue H pq.2) (iidLaw P n)) = _ rw [Finset.sum_product] exact (pair_sum_variance_eq_covariance_sum P h).symm _ ≤ ∑ pq ∈ s.product s, (if pq.1 = pq.2 then A else if SharesIndex pq.1 pq.2 then B else 0) := Finset.sum_le_sum hpoint _ = (n.choose 2 : ℝ) * A + ((2 * (n.choose 2) * (n - 2) : ℕ) : ℝ) * B := by simp only [Finset.sum_ite, Finset.sum_const_zero, add_zero, Finset.sum_const, nsmul_eq_mul, Finset.filter_filter] rw [card_identical_pair_configurations, card_shared_pair_configurations hn] _ = _ := rfl
Causalean.Stat.UStatistic.LocalizedVariance.pair_sum_variance_le_localized_counts · Causalean/Stat/UStatistic/LocalizedVariance/SumBound.lean:34 · uses LocalizedKernel , iidLaw , pairIndices , pairMass , pairValue , rowMassSq
1 supporting declaration (lemmas, instances)