Stat.Concentration.Covering

Covering-number, packing, and entropy-integral tools for function classes, including empirical pseudometrics and the finite-VC localized covering and uniform-deviation specializations housed under Covering/.

VCLocalized­Regime 21 core · 44 supporting · 8 submodules Localized Rademacher envelopes for function classes of finite VC dimension: each function in the class is determined on any sample by a Boolean labelling whose patterns have VC dimension at most d (BinaryFactoredVCClass) Dudley­Entropy 13 core · 18 supporting · 6 submodules Dudley's chaining bound.
Empirical­Pseudo­Metric 5 core · 8 supporting Defines the empirical L² pseudometric on function classes used by Dudley entropy bounds. ★ empiricalDist_def

Defines the empirical L² pseudometric on function classes used by Dudley entropy bounds.

The file provides empiricalNorm, empiricalDist, the pseudometric empiricalPMet, and the indexed EmpiricalFunctionSpace wrapper. It also records the coordinate projection bound empiricalDist_proj, which converts an empirical-norm bound into pointwise control on the fixed sample.

UPSTREAM-DELTA: declarations are placed in the Causalean.Stat.Concentration namespace. The proofs are otherwise kept close to upstream, with only Mathlib API-drift adjustments for Lean 4.29.

def empiricalNorm reviewed
Causalean.Stat.Concentration

For a sample of nn observations and a real-valued function on its observation space, the empirical norm of the function on that sample is the square root of the average of its squared values at the sample observations.

Definition (Lean source)
𝒳 :
Type v
shared
n :
ℕ
shared
S :
Fin n → 𝒳
f :
𝒳 → ℝ
empiricalNorm S f :
ℝ
sqrt ((1 / n) * ∑ i : Fin n, (f (S i)^2))
Causalean.Stat.Concentration.empiricalNorm · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:33
def empiricalDist reviewed
Causalean.Stat.Concentration

For a sample of nn observations and two real-valued functions on its observation space, the empirical distance between the functions is the empirical norm of their pointwise difference on that sample.

Definition (Lean source)
𝒳 :
Type v
shared
n :
ℕ
shared
S :
Fin n → 𝒳
f g :
𝒳 → ℝ
empiricalDist S f g :
ℝ
empiricalNorm S (f - g)
Causalean.Stat.Concentration.empiricalDist · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:47
lemma empiricalDist_def reviewed
Causalean.Stat.Concentration

For a fixed sample S and functions f and g, the empirical distance between f and g equals the empirical norm of their pointwise difference.

Formal statement
𝒳 :
Type v
shared
n :
ℕ
shared
S :
Fin n → 𝒳
f g :
𝒳 → ℝ
empiricalDist S f g = empiricalNorm S (f - g)
Proof (Lean source)
@[simp] lemma empiricalDist_def (S : Fin n → 𝒳) (f g : 𝒳 → ℝ) : empiricalDist S f g = empiricalNorm S (f - g) := rfl
def empiricalPMet reviewed
Causalean.Stat.Concentration

For a sample of nn observations, the empirical pseudometric on real-valued functions on the observation space is the pseudometric whose distance between two functions is their empirical distance on that sample.

Definition (Lean source)
𝒳 :
Type v
shared
n :
ℕ
shared
S :
Fin n → 𝒳
empiricalPMet S :
PseudoMetricSpace (𝒳 → ℝ)
clause 1
dist := fun f g => empiricalDist S f g
clause 2
dist_self := by intro x; dsimp[empiricalDist] simp only [sub_self]; dsimp [empiricalNorm]; simp
clause 3
dist_comm := by intro x y dsimp[empiricalDist, empiricalNorm] grind
clause 4
dist_triangle := by intro x y z dsimp[empiricalDist,empiricalNorm] suffices sqrt (∑ i, (x (S i) - z (S i)) ^ 2)
≤ sqrt (∑ i, (x (S i) - y (S i)) ^ 2)
+ sqrt (∑ i, (y (S i) - z (S i)) ^ 2) from by calc _
= √(1 / ↑n) * √(∑ i, (x (S i) - z (S i)) ^ 2) := by simp _ ≤ √(1 / ↑n) * (√(∑ i, (x (S i) - y (S i)) ^ 2) + √(∑ i, (y (S i) - z (S i)) ^ 2)) := by apply mul_le_mul · simp · exact this · apply Real.sqrt_nonneg simp _ = √(1 / ↑n) * √(∑ i, (x (S i) - y (S i)) ^ 2)
+ √(1 / ↑n) * √(∑ i, (y (S i) - z (S i)) ^ 2) := by apply LeftDistribClass.left_distrib _
= _ := by simp let xS : EuclideanSpace ℝ (Fin n) := toLp 2 (fun i ↦ x (S i)) let yS : EuclideanSpace ℝ (Fin n) := toLp 2 (fun i ↦ y (S i)) let zS : EuclideanSpace ℝ (Fin n) := toLp 2 (fun i ↦ z (S i)) calc _ = √(∑ i, (xS i - zS i) ^ 2) := by rfl _ = √(∑ i, ‖xS i - zS i‖ ^ 2) := by simp _ = ‖xS - zS‖ := symm (EuclideanSpace.norm_eq (xS - zS)) _ ≤ ‖xS - yS‖
+ ‖yS - zS‖ := norm_sub_le_norm_sub_add_norm_sub xS yS zS _
= _ := by apply Mathlib.Tactic.LinearCombination.add_eq_eq · calc _ = √(∑ i, ‖xS i - yS i‖ ^ 2) := EuclideanSpace.norm_eq (xS - yS) _ = √(∑ i, (xS i - yS i) ^ 2) := by simp · calc _ = √(∑ i, ‖yS i - zS i‖ ^ 2) := EuclideanSpace.norm_eq (yS - zS) _ = √(∑ i, (yS i - zS i) ^ 2) := by simp
Causalean.Stat.Concentration.empiricalPMet · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:62
structure EmpiricalFunctionSpace reviewed
Causalean.Stat.Concentration

An element of the empirical function space is an index picking out one function of the class; the structure packages the indexed class of functions equipped with the empirical pseudometric induced by a fixed sample.

Definition (Lean source)
𝒳 :
Type v
shared
n :
ℕ
shared
ι :
Type u
shared
F :
ι → 𝒳 → ℝ
S :
Fin n → 𝒳
The index selecting a function from the class.
index :
ι
Causalean.Stat.Concentration.EmpiricalFunctionSpace · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:149
8 supporting declarations (lemmas, instances)
  • empiricalNorm_def lemma — The empirical norm unfolds to the square root of the average squared sample values.
    𝒳 :
    Type v
    shared
    n :
    ℕ
    shared
    S :
    Fin n → 𝒳
    f :
    𝒳 → ℝ
    empiricalNorm S f = sqrt ((1 / n) * ∑ i : Fin n, (f (S i))^2)
    Proof (Lean source)
    @[causal_defs_simps] lemma empiricalNorm_def (S : Fin n → 𝒳) (f : 𝒳 → ℝ) : empiricalNorm S f = sqrt ((1 / n) * ∑ i : Fin n, (f (S i))^2) := rfl
    Causalean.Stat.Concentration.empiricalNorm_def · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:40
  • empiricalDist_comm lemma — The empirical distance is symmetric.
    𝒳 :
    Type v
    shared
    n :
    ℕ
    shared
    S :
    Fin n → 𝒳
    f g :
    𝒳 → ℝ
    Proof (Lean source)
    @[simp] lemma empiricalDist_comm (S : Fin n → 𝒳) (f g : 𝒳 → ℝ) : empiricalDist S f g = empiricalDist S g f := by dsimp [empiricalDist, empiricalNorm] grind
    Causalean.Stat.Concentration.empiricalDist_comm · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:112
  • empiricalDist_proj lemma — A single sample coordinate is bounded by the empirical norm up to the sample-size scaling.
    𝒳 :
    Type v
    shared
    n :
    ℕ
    shared
    S :
    Fin n → 𝒳
    f :
    𝒳 → ℝ
    i :
    Fin n
    |f (S i)|/√n ≤ empiricalNorm S f
    Proof (Lean source)
    lemma empiricalDist_proj (S : Fin n → 𝒳) (f : 𝒳 → ℝ) (i : Fin n) : |f (S i)|/√n ≤ empiricalNorm S f := by calc _ = √(f (S i)^2)/√n := by have : √(f (S i)^2) = |f (S i)| := by exact Real.sqrt_sq_eq_abs (f (S i)) rw [this] _ = √((f (S i)^2)/n) := by simp _ ≤ _ := by dsimp [empiricalNorm] apply Real.sqrt_le_sqrt rw [one_div_mul_eq_div] refine div_le_div_of_nonneg_right ?_ ?_ · have hnonneg : ∀ j ∈ univ, 0 ≤ (f (S j))^2 := by intro j hj; exact sq_nonneg _ have hi : i ∈ univ := by simp simpa using (Finset.single_le_sum (s := univ) (f := fun j => (f (S j))^2) hnonneg hi) · simp
    Causalean.Stat.Concentration.empiricalDist_proj · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:118
  • instCoeFunEmpiricalFunctionSpaceForallReal instance — For every observation space, sample size, index set, real-valued function class on that space, and sample of that size, the function-evaluation coercion identifies each empirical-function-space element with the function selected by its index; its evaluation rule returns that selected function.
    𝒳 :
    Type v
    shared
    n :
    ℕ
    shared
    ι :
    Type u
    ι → 𝒳 → ℝ
    shared
    S :
    Fin n → 𝒳
    shared
    instCoeFunEmpiricalFunctionSpaceForallReal :
    CoeFun (EmpiricalFunctionSpace F S) (fun _ ↦ 𝒳 → ℝ)
    coe f := F f.index
    Causalean.Stat.Concentration.instCoeFunEmpiricalFunctionSpaceForallReal · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:156
  • coe_apply lemma — Coercing an empirical function-space element gives the indexed function it stores.
    𝒳 :
    Type v
    shared
    n :
    ℕ
    shared
    ι :
    Type u
    ι → 𝒳 → ℝ
    shared
    S :
    Fin n → 𝒳
    shared
    (q : 𝒳 → ℝ) = F q.index
    Proof (Lean source)
    @[simp] lemma EmpiricalFunctionSpace.coe_apply (q : EmpiricalFunctionSpace F S) : (q : 𝒳 → ℝ) = F q.index := rfl
    Causalean.Stat.Concentration.EmpiricalFunctionSpace.coe_apply · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:163
  • instDistEmpiricalFunctionSpace instance — For every observation space, sample size, index set, real-valued function class on that space, and sample of that size, the distance structure on the empirical function space assigns to two selected functions their empirical distance on the sample; its distance rule is that empirical distance.
    𝒳 :
    Type v
    shared
    n :
    ℕ
    shared
    ι :
    Type u
    ι → 𝒳 → ℝ
    shared
    S :
    Fin n → 𝒳
    shared
    instDistEmpiricalFunctionSpace :
    dist f g := empiricalDist S f g
    Causalean.Stat.Concentration.instDistEmpiricalFunctionSpace · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:169
  • dist_def theorem
    ∀ {𝒳 : Type v} {n : ℕ} {ι : Type u} {F : ι → 𝒳 → ℝ} {S : Fin n → 𝒳} (f g : EmpiricalFunctionSpace F S), dist f g = empiricalNorm S (F f.index - F g.index)
    Proof (Lean source)
    @[simps!]
  • instPseudoMetricSpaceEmpiricalFunctionSpace instance — For every observation space, sample size, index set, real-valued function class on that space, and sample of that size, the pseudometric-space structure on the empirical function space is the one induced by the empirical pseudometric of the selected functions on that sample.
    𝒳 :
    Type v
    shared
    n :
    ℕ
    shared
    ι :
    Type u
    ι → 𝒳 → ℝ
    shared
    S :
    Fin n → 𝒳
    shared
    instPseudoMetricSpaceEmpiricalFunctionSpace :
    PseudoMetricSpace.induced (fun f ↦ F f.index) (empiricalPMet S)
    Causalean.Stat.Concentration.instPseudoMetricSpaceEmpiricalFunctionSpace · Causalean/Stat/Concentration/Covering/EmpiricalPseudoMetric.lean:177
Covering­Number 4 core · 9 supporting Defines extended metric covering numbers for arbitrary sets and proves their basic properties. ★ coveringNumber_eq

Defines extended metric covering numbers for arbitrary sets and proves their basic properties.

This file provides the extended-natural coveringNumber, the natural-valued compatibility function coveringNumber', the chosen minimizing net coveringFinset, and the basic facts used by the Dudley entropy-integral bound: positivity on nonempty sets, antitonicity in the radius, and almost-everywhere measurability of the covering-number function.

UPSTREAM-DELTA: unlike the vendored original, coveringNumber is defined for every set and takes value ∞ when no finite cover exists. This intentional departure permits entropy bounds to be stated before total boundedness is established. The natural-valued API is retained under the primed name to keep the downstream Dudley development close to upstream.

def coveringNumber reviewed
Causalean.Stat.Concentration

For any subset AA of a pseudometric space and any real radius ε\varepsilon, the extended covering number is the infimum of the extended-natural cardinalities of finite families of open ε\varepsilon-balls that cover AA; it is infinite when there is no such finite cover.

Definition (Lean source)
X :
A :
Set X
ε :
ℝ
coveringNumber A ε :
ℕ∞
sInf {n : ℕ∞ | ∃ t : Finset X, (t.card : ℕ∞) = n ∧ A ⊆ ⋃ y ∈ t, ball y ε}
Causalean.Stat.Concentration.coveringNumber · Causalean/Stat/Concentration/Covering/CoveringNumber.lean:49
def coveringNumber' reviewed
Causalean.Stat.Concentration

For a totally bounded set and a radius, the natural-valued compatibility covering number is the finite part of its extended covering number.

Definition (Lean source)
X :
ε :
ℝ
coveringNumber' ha ε :
ℕ
(coveringNumber A ε).toNat
Causalean.Stat.Concentration.coveringNumber' · Causalean/Stat/Concentration/Covering/CoveringNumber.lean:58
theorem coveringNumber_eq reviewed
Causalean.Stat.Concentration

For a totally bounded subset of a pseudometric space and a positive covering radius, the extended covering number is the natural minimum cardinality selected by coveringNumber_exists.

Formal statement
X :
ε :
ℝ
hε :
ε > 0
coveringNumber A ε = (find (coveringNumber_exists ha hε) : ℕ∞)
Proof (Lean source)
theorem coveringNumber_eq {X : Type*} [PseudoMetricSpace X] {A : Set X} (ha : TotallyBounded A) {ε : ℝ} (hε : ε > 0) : coveringNumber A ε = (find (coveringNumber_exists ha hε) : ℕ∞) := by apply IsLeast.csInf_eq constructor · obtain ⟨t, htcard, htcover⟩ := Nat.find_spec (coveringNumber_exists ha hε) exact ⟨t, by exact_mod_cast htcard, htcover⟩ · intro n hn obtain ⟨t, htcard, htcover⟩ := hn rw [← htcard] exact_mod_cast Nat.find_min' (coveringNumber_exists ha hε) ⟨t, rfl, htcover⟩
def coveringFinset reviewed
Causalean.Stat.Concentration

For a totally bounded subset AA of a pseudometric space and a strictly positive real radius ε\varepsilon, the chosen finite ε\varepsilon-net for AA is a finite set whose cardinality attains the covering number.

Definition (Lean source)
X :
ε :
ℝ
hε :
ε > 0
coveringFinset ha hε :
choose (Nat.find_spec (coveringNumber_exists (X := X) (A := A) ha hε))
Causalean.Stat.Concentration.coveringFinset · Causalean/Stat/Concentration/Covering/CoveringNumber.lean:169
9 supporting declarations (lemmas, instances)
VCCovering 5 core · 9 supporting For a binary-indexed function class, the empirical covering number is bounded by the Sauer-Shelah growth function of the underlying VC class, avoiding the Haussler packing argument. ★ vc_coveringNumber_le_sum_choose★ log_coveringNumber_le

For a binary-indexed function class, the empirical covering number is bounded by the Sauer-Shelah growth function of the underlying VC class, avoiding the Haussler packing argument.

The sample restriction of a real-valued class F is assumed to factor through a Boolean class π: at sample coordinate j, the real value is a fixed transform φ j of the bit π i (S j). Distinct empirical vectors of F are therefore indexed by distinct Boolean restriction patterns on the sample. One representative per realized pattern covers the empirical pseudometric space at every positive radius, and Sauer-Shelah bounds the number of such patterns. The main exported results are vc_coveringNumber_le_growth, vc_coveringNumber_le_sum_choose, log_coveringNumber_le_of_card_bound, and log_coveringNumber_le.

def restrictionPattern reviewed
Causalean.Stat.Concentration

For a Boolean-valued classifier and a sample of nn observations, the restriction pattern of the classifier on the sample is the finite set of sample coordinates at which the classifier is true.

Definition (Lean source)
𝒳 :
Type v
shared
n :
ℕ
shared
p :
𝒳 → Bool
S :
Fin n → 𝒳
restrictionPattern p S :
by classical exact Finset.univ.filter fun j => p (S j)
Causalean.Stat.Concentration.restrictionPattern · Causalean/Stat/Concentration/Covering/VCCovering.lean:33
def growthFamily reviewed
Causalean.Stat.Concentration

For a family of Boolean-valued classifiers and a sample of nn observations, the growth family of the classifier family on the sample is the finite collection of all restriction patterns realized by at least one classifier in the family.

Definition (Lean source)
𝒳 :
Type v
shared
ι :
Type u
shared
n :
ℕ
shared
π :
ι → 𝒳 → Bool
S :
Fin n → 𝒳
growthFamily π S :
by classical exact Finset.univ.filter fun A : Finset (Fin n)
=> ∃ i : ι, restrictionPattern (π i) S = A
Causalean.Stat.Concentration.growthFamily · Causalean/Stat/Concentration/Covering/VCCovering.lean:41
def patternCover reviewed
Causalean.Stat.Concentration

For a family of real-valued functions, a family of Boolean-valued classifiers, and a sample of nn observations, the pattern cover contains one empirical-function representative for each Boolean restriction pattern realized by the classifier family on that sample.

Definition (Lean source)
𝒳 :
Type v
shared
ι :
Type u
shared
n :
ℕ
shared
F :
ι → 𝒳 → ℝ
π :
ι → 𝒳 → Bool
S :
Fin n → 𝒳
patternCover π S :
by classical exact (growthFamily π S).attach.image fun A
=> EmpiricalFunctionSpace.mk (F := F) (S := S) (choose ((mem_growthFamily_iff (π := π) (S := S) (A := A.1)).mp A.2))
theorem vc_coveringNumber_le_sum_choose reviewed
Causalean.Stat.Concentration

Sauer-Shelah covering-number bound for a binary-factored class. Suppose the real-valued class factors through a Boolean classifier at each sample coordinate: F i (S j) = φ j (π i (S j)), so that the sample-restricted class is totally bounded in the empirical pseudometric, the covering radius ε is positive, and the induced Boolean growth family on the sample has VC dimension at most d. Then the empirical covering number at radius ε is at most the Sauer-Shelah binomial sum ∑_{k≤d} C(n,k).

Formal statement
𝒳 :
Type v
shared
ι :
Type u
shared
n :
ℕ
shared
d :
ℕ
shared
F :
ι → 𝒳 → ℝ
S :
Fin n → 𝒳
π :
ι → 𝒳 → Bool
φ :
Fin n → Bool → ℝ
hfactor :
∀ i j, F i (S j) = φ j (π i (S j))
h' :
ε :
ℝ
hε :
0 < ε
hvd :
(growthFamily π S).vcDim ≤ d
coveringNumber' h' ε ≤ ∑ k ∈ Iic d, n.choose k
Proof (Lean source)
theorem vc_coveringNumber_le_sum_choose {F : ι → 𝒳 → ℝ} {S : Fin n → 𝒳} {π : ι → 𝒳 → Bool} {φ : Fin n → Bool → ℝ} (hfactor : ∀ i j, F i (S j) = φ j (π i (S j))) (h' : TotallyBounded (Set.univ : Set (EmpiricalFunctionSpace F S))) {ε : ℝ} (hε : 0 < ε) (hvd : (growthFamily π S).vcDim ≤ d) : coveringNumber' h' ε ≤ ∑ k ∈ Iic d, n.choose k := by exact le_trans (vc_coveringNumber_le_growth hfactor h' hε) (card_growthFamily_le_sum_choose (growthFamily π S) hvd)
theorem log_coveringNumber_le reviewed
Causalean.Stat.Concentration

Logarithmic Sauer-Shelah covering-number bound. Under the binary-factoring hypothesis F i (S j) = φ j (π i (S j)), with the sample-restricted class totally bounded in the empirical pseudometric, a positive covering radius ε, a positive sample size n, and VC dimension at most d for the induced Boolean growth family on the sample, the logarithm of the empirical covering number at radius ε is at most log(d+1) + d·log n.

Formal statement
𝒳 :
Type v
shared
ι :
Type u
shared
n :
ℕ
shared
d :
ℕ
shared
Nonempty ι
F :
ι → 𝒳 → ℝ
S :
Fin n → 𝒳
π :
ι → 𝒳 → Bool
φ :
Fin n → Bool → ℝ
hfactor :
∀ i j, F i (S j) = φ j (π i (S j))
h' :
ε :
ℝ
hε :
0 < ε
hn_pos :
0 < n
hvd :
(growthFamily π S).vcDim ≤ d
log (coveringNumber' h' ε) ≤ log ((d + 1 : ℕ) : ℝ) + (d : ℝ) * log n
Proof (Lean source)
theorem log_coveringNumber_le [Nonempty ι] {F : ι → 𝒳 → ℝ} {S : Fin n → 𝒳} {π : ι → 𝒳 → Bool} {φ : Fin n → Bool → ℝ} (hfactor : ∀ i j, F i (S j) = φ j (π i (S j))) (h' : TotallyBounded (Set.univ : Set (EmpiricalFunctionSpace F S))) {ε : ℝ} (hε : 0 < ε) (hn_pos : 0 < n) (hvd : (growthFamily π S).vcDim ≤ d) : log (coveringNumber' h' ε) ≤ log ((d + 1 : ℕ) : ℝ) + (d : ℝ) * log n := by classical let s : ℕ := ∑ k ∈ Iic d, n.choose k have hcov_sum : coveringNumber' h' ε ≤ s := vc_coveringNumber_le_sum_choose hfactor h' hε hvd have hcov_pos : 0 < coveringNumber' h' ε := by have hnonempty : (Set.univ : Set (EmpiricalFunctionSpace F S)).Nonempty := by obtain ⟨i⟩ := (inferInstance : Nonempty ι) exact ⟨⟨i⟩, by simp⟩ exact coveringNumber'_nonzero hnonempty h' hε have hcov_bound : ((coveringNumber' h' ε : ℕ) : ℝ) ≤ ((d + 1 : ℕ) : ℝ) * (n : ℝ) ^ d := by calc ((coveringNumber' h' ε : ℕ) : ℝ) ≤ (s : ℝ) := by exact_mod_cast hcov_sum _ ≤ ((d + 1 : ℕ) : ℝ) * (n : ℝ) ^ d := sum_choose_le_succ_mul_pow (n := n) (d := d) hn_pos calc log (coveringNumber' h' ε) ≤ log (((d + 1 : ℕ) : ℝ) * (n : ℝ) ^ d) := by exact Real.log_le_log (Nat.cast_pos.mpr hcov_pos) hcov_bound _ = log ((d + 1 : ℕ) : ℝ) + log ((n : ℝ) ^ d) := by rw [Real.log_mul] · exact_mod_cast Nat.succ_ne_zero d · exact pow_ne_zero d (Nat.cast_ne_zero.mpr (ne_of_gt hn_pos)) _ = log ((d + 1 : ℕ) : ℝ) + (d : ℝ) * log n := by rw [Real.log_pow]
9 supporting declarations (lemmas, instances)
Haussler­Packing 3 core · 12 supporting Elementary VC packing estimates for finite Boolean classes. ★ vc_weightedHamming_packing_log_card_le

Elementary VC packing estimates for finite Boolean classes.

This file isolates the probabilistic random-subsample extraction used in the classical packing argument, then derives a self-logarithmic estimate from Sauer-Shelah. The public API includes weightedHammingSq, the separating-subsample extraction exists_separating_subsample, the self-referential logarithmic solver self_log_solve, and the final logarithmic estimate vc_weightedHamming_packing_log_card_le.

def weightedHammingSq reviewed
Causalean.Stat.Concentration

Given a finite collection of real coordinate weights and two Boolean-valued vectors on the same finite coordinate set, the weighted squared Hamming pseudo-distance is the sum of the weights at exactly those coordinates where the vectors differ.

Definition (Lean source)
n :
ℕ
w :
Fin n → ℝ
a b :
Fin n → Bool
weightedHammingSq w a b :
ℝ
∑ j : Fin n, if a j = b j then 0 else w j
Causalean.Stat.Concentration.weightedHammingSq · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:22
def subsamplePattern reviewed
Causalean.Stat.Concentration

Given a map from a finite sample-coordinate set into a finite original-coordinate set and a Boolean-valued vector on the original-coordinate set, the subsample pattern is the finite set of sample coordinates whose mapped original coordinates have Boolean value true.

Definition (Lean source)
n m :
ℕ
J :
Fin m → Fin n
a :
Fin n → Bool
subsamplePattern J a :
by classical exact Finset.univ.filter fun i => a (J i) = true
Causalean.Stat.Concentration.subsamplePattern · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:29
theorem vc_weightedHamming_packing_log_card_le reviewed
Causalean.Stat.Concentration

Elementary VC ε-packing estimate, logarithmic form. Let w be a nonnegative weight on the n sample coordinates with total weight at most r², where ε is positive and at most r. If the Boolean family P, viewed as the sets of coordinates where each member is true, has VC dimension at most d and every two distinct members of P are separated by weighted Hamming distance at least ε² in that weighting, then the logarithm of the cardinality of P is at most 1 + 2d·log(4d·r²/ε²) — a bound depending only on d and the ratio r²/ε², with no dependence on the ambient coordinate count n.

Formal statement
n :
ℕ
d :
ℕ
w :
Fin n → ℝ
hw :
∀ j, 0 ≤ w j
r ε :
ℝ
hε :
0 < ε
hεr :
ε ≤ r
hwsum :
∑ j, w j ≤ r ^ 2
P :
Finset (Fin n → Bool)
hvc :
(P.image (fun a => (Finset.univ.filter (fun j => a j = true)))).vcDim ≤ d
hsep :
∀ a ∈ P, ∀ b ∈ P, a ≠ b → ε ^ 2 ≤ weightedHammingSq w a b
log (P.card) ≤ 1 + 2 * (d : ℝ) * log (4 * (d : ℝ) * r ^ 2 / ε ^ 2)
Proof (Lean source)
theorem vc_weightedHamming_packing_log_card_le {n : ℕ} (d : ℕ) (w : Fin n → ℝ) (hw : ∀ j, 0 ≤ w j) (r ε : ℝ) (hε : 0 < ε) (hεr : ε ≤ r) (hwsum : ∑ j, w j ≤ r ^ 2) (P : Finset (Fin n → Bool)) (hvc : (P.image (fun a => (Finset.univ.filter (fun j => a j = true)))).vcDim ≤ d) (hsep : ∀ a ∈ P, ∀ b ∈ P, a ≠ b → ε ^ 2 ≤ weightedHammingSq w a b) : log (P.card) ≤ 1 + 2 * (d : ℝ) * log (4 * (d : ℝ) * r ^ 2 / ε ^ 2) := by classical by_cases hsmall : P.card ≤ 1 · have hlog_nonpos : log (P.card) ≤ 0 := by have hcases : P.card = 0 ∨ P.card = 1 := by omega rcases hcases with hzero | hone · simp [hzero] · simp [hone] exact le_trans hlog_nonpos (haussler_log_rhs_nonneg hε hεr) have hPcard : 2 ≤ P.card := by omega have hr : 0 < r := hε.trans_le hεr obtain ⟨m, J, hm, hvcJ, hinj⟩ := exists_separating_subsample d w hw r ε hr hε hwsum P hPcard hvc hsep have hcard_image : (P.image (subsamplePattern J)).card = P.card := Finset.card_image_of_injOn hinj have hcard_nat : P.card ≤ (m + 1) ^ d := by rw [← hcard_image] exact card_subsample_family_le_succ_pow J P hvcJ by_cases hd0 : d = 0 · have : P.card ≤ 1 := by simpa [hd0] using hcard_nat omega have hd : 1 ≤ d := succ_le_of_lt (Nat.pos_of_ne_zero hd0) let L : ℝ := log (P.card) let a : ℝ := 2 * r ^ 2 / ε ^ 2 have hPcard_pos : 0 < P.card := by omega have hPcard_one : 1 ≤ P.card := by omega have hL_nonneg : 0 ≤ L := by exact Real.log_nonneg (by exact_mod_cast hPcard_one) have ha : 2 ≤ a := by have hx : 1 ≤ r / ε := (one_le_div hε).mpr hεr have hsq : 1 ≤ r ^ 2 / ε ^ 2 := by rw [← div_pow] nlinarith [sq_nonneg (r / ε)] dsimp [a] calc 2 ≤ 2 * (r ^ 2 / ε ^ 2) := by nlinarith _ = 2 * r ^ 2 / ε ^ 2 := by ring have hcard_real : (P.card : ℝ) ≤ (((m + 1) ^ d : ℕ) : ℝ) := by exact_mod_cast hcard_nat have hlog_card_le_pow : L ≤ log ((((m + 1) ^ d : ℕ) : ℝ)) := by dsimp [L] exact Real.log_le_log (by exact_mod_cast hPcard_pos) hcard_real have hlog_pow : log ((((m + 1) ^ d : ℕ) : ℝ)) = (d : ℝ) * log (((m + 1 : ℕ) : ℝ)) := by rw [Nat.cast_pow, Real.log_pow] have hL_le_m : L ≤ (d : ℝ) * log (((m + 1 : ℕ) : ℝ)) := by rwa [hlog_pow] at hlog_card_le_pow have hm_succ : (((m + 1 : ℕ) : ℝ)) ≤ 2 + a * L := by dsimp [a, L] at hm ⊢ norm_num [Nat.cast_add, Nat.cast_one] linarith have hm_succ_pos : 0 < (((m + 1 : ℕ) : ℝ)) := by positivity have hlog_m_le : log (((m + 1 : ℕ) : ℝ)) ≤ log (2 + a * L) := Real.log_le_log hm_succ_pos hm_succ have hd_nonneg : 0 ≤ (d : ℝ) := by positivity have hbound : L ≤ (d : ℝ) * log (2 + a * L) := by exact le_trans hL_le_m (mul_le_mul_of_nonneg_left hlog_m_le hd_nonneg) have hsolve := self_log_solve (a := a) (L := L) (d := d) hd ha hL_nonneg hbound dsimp [L, a] at hsolve convert hsolve using 2 ring_nf
Causalean.Stat.Concentration.vc_weightedHamming_packing_log_card_le · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:623 · uses weightedHammingSq
12 supporting declarations (lemmas, instances)
  • weightedHammingSq_nonneg lemma — Nonnegative coordinate weights make the weighted Hamming pseudo-distance nonnegative.
    n :
    ℕ
    w :
    Fin n → ℝ
    hw :
    ∀ j, 0 ≤ w j
    a b :
    Fin n → Bool
    0 ≤ weightedHammingSq w a b
    Proof (Lean source)
    lemma weightedHammingSq_nonneg {n : ℕ} (w : Fin n → ℝ) (hw : ∀ j, 0 ≤ w j) (a b : Fin n → Bool) : 0 ≤ weightedHammingSq w a b := by classical unfold weightedHammingSq exact Finset.sum_nonneg fun j _ => by by_cases h : a j = b j · simp [h] · simp [h, hw j]
    Causalean.Stat.Concentration.weightedHammingSq_nonneg · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:38
  • subsamplePattern_mem_iff lemma — A sampled coordinate belongs to a Boolean pattern exactly when the original Boolean vector is true at the coordinate from which it was sampled.
    n m :
    ℕ
    Fin m → Fin n
    Fin n → Bool
    Fin m
    i ∈ subsamplePattern J a ↔ a (J i) = true
    Proof (Lean source)
    lemma subsamplePattern_mem_iff {n m : ℕ} {J : Fin m → Fin n} {a : Fin n → Bool} {i : Fin m} : i ∈ subsamplePattern J a ↔ a (J i) = true := by classical simp [subsamplePattern]
    Causalean.Stat.Concentration.subsamplePattern_mem_iff · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:50
  • sum_choose_le_succ_pow lemma — A partial sum of binomial coefficients is no larger than a polynomial power, providing the elementary growth bound used in VC estimates.
    n d :
    ℕ
    (∑ k ∈ Iic d, n.choose k) ≤ (n + 1) ^ d
    Proof (Lean source)
    lemma sum_choose_le_succ_pow (n d : ℕ) : (∑ k ∈ Iic d, n.choose k) ≤ (n + 1) ^ d := by calc (∑ k ∈ Iic d, n.choose k) ≤ ∑ k ∈ Iic d, n ^ k := by refine Finset.sum_le_sum ?_ intro k _hk exact Nat.choose_le_pow n k _ ≤ ∑ k ∈ Iic d, d.choose k * n ^ k := by refine Finset.sum_le_sum ?_ intro k hk have hk' : k ≤ d := by simpa using hk have hchoose_pos : 1 ≤ d.choose k := succ_le_of_lt (Nat.choose_pos hk') simpa [one_mul] using Nat.mul_le_mul_right (n ^ k) hchoose_pos _ = (n + 1) ^ d := by rw [add_pow] simp only [one_pow, mul_one, Nat.cast_id] apply Finset.sum_congr · ext k simp · intro k _hk rw [Nat.mul_comm]
    Causalean.Stat.Concentration.sum_choose_le_succ_pow · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:58
  • subsamplePattern_eq_iff lemma — Equality of sampled Boolean patterns means that the two patterns agree at every coordinate selected by the sample.
    n m :
    ℕ
    Fin m → Fin n
    Fin n → Bool
    subsamplePattern J a = subsamplePattern J b ↔ ∀ t : Fin m, a (J t) = b (J t)
    Proof (Lean source)
    lemma subsamplePattern_eq_iff {n m : ℕ} {J : Fin m → Fin n} {a b : Fin n → Bool} : subsamplePattern J a = subsamplePattern J b ↔ ∀ t : Fin m, a (J t) = b (J t) := by classical constructor · intro h t by_cases ha : a (J t) = true · have ht : t ∈ subsamplePattern J b := by rw [← h, subsamplePattern_mem_iff] exact ha rw [subsamplePattern_mem_iff] at ht rw [ha, ht] · have ha_false : a (J t) = false := by exact Bool.eq_false_of_not_eq_true ha by_cases hb : b (J t) = true · have ht : t ∈ subsamplePattern J a := by rw [h, subsamplePattern_mem_iff] exact hb rw [subsamplePattern_mem_iff] at ht exact False.elim (ha ht) · have hb_false : b (J t) = false := by exact Bool.eq_false_of_not_eq_true hb rw [ha_false, hb_false] · intro h ext t simp [subsamplePattern_mem_iff, h t]
    Causalean.Stat.Concentration.subsamplePattern_eq_iff · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:87
  • per_pair_collision_sum lemma — The weighted sum over all fixed-length coordinate selections that agree under two Boolean patterns equals the corresponding power of the total weight of their agreeing coordinates.
    n m :
    ℕ
    w :
    Fin n → ℝ
    a b :
    Fin n → Bool
    (∑ J : Fin m → Fin n, (∏ t : Fin m, w (J t)) * (if (∀ t : Fin m, a (J t) = b (J t)) then (1 : ℝ) else 0))
    = (∑ j ∈ Finset.univ.filter (fun j : Fin n => a j = b j), w j) ^ m
    Proof (Lean source)
    lemma per_pair_collision_sum {n m : ℕ} (w : Fin n → ℝ) (a b : Fin n → Bool) : (∑ J : Fin m → Fin n, (∏ t : Fin m, w (J t)) * (if (∀ t : Fin m, a (J t) = b (J t)) then (1 : ℝ) else 0)) = (∑ j ∈ Finset.univ.filter (fun j : Fin n => a j = b j), w j) ^ m := by classical let g : Fin n → ℝ := fun j => w j * (if a j = b j then (1 : ℝ) else 0) have hpoint : ∀ J : Fin m → Fin n, (∏ t : Fin m, w (J t)) * (if (∀ t : Fin m, a (J t) = b (J t)) then (1 : ℝ) else 0) = ∏ t : Fin m, g (J t) := by intro J by_cases h : ∀ t : Fin m, a (J t) = b (J t) · simp [g, h] · have hprod_zero : ∏ t : Fin m, (if a (J t) = b (J t) then (1 : ℝ) else 0) = 0 := by rw [Finset.prod_eq_zero_iff] push_neg at h rcases h with ⟨t, ht⟩ exact ⟨t, Finset.mem_univ t, by simp [ht]⟩ have hgprod_zero : (∏ t : Fin m, g (J t)) = 0 := by rw [Finset.prod_eq_zero_iff] push_neg at h rcases h with ⟨t, ht⟩ exact ⟨t, Finset.mem_univ t, by simp [g, ht]⟩ simp [h, hgprod_zero] calc (∑ J : Fin m → Fin n, (∏ t : Fin m, w (J t)) * (if (∀ t : Fin m, a (J t) = b (J t)) then (1 : ℝ) else 0)) = ∑ J : Fin m → Fin n, ∏ t : Fin m, g (J t) := by exact Finset.sum_congr rfl fun J _ => hpoint J _ = (∑ j : Fin n, g j) ^ m := product_sum_normalization g _ = (∑ j ∈ Finset.univ.filter (fun j : Fin n => a j = b j), w j) ^ m := by congr 1 simp [g, Finset.sum_filter]
    Causalean.Stat.Concentration.per_pair_collision_sum · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:116
  • averaging_exists_zero_count lemma — A nonnegative finite probability weighting with average count below one must assign count zero to at least one index.
    ι :
    Type*
    μ :
    ι → ℝ
    cnt :
    ι → ℕ
    hμsum :
    ∑ i : ι, μ i = 1
    hμnonneg :
    ∀ i, 0 ≤ μ i
    hmean :
    ∑ i : ι, μ i * (cnt i : ℝ) < 1
    ∃ i, cnt i = 0
    Proof (Lean source)
    lemma averaging_exists_zero_count {ι : Type*} [Fintype ι] (μ : ι → ℝ) (cnt : ι → ℕ) (hμsum : ∑ i : ι, μ i = 1) (hμnonneg : ∀ i, 0 ≤ μ i) (hmean : ∑ i : ι, μ i * (cnt i : ℝ) < 1) : ∃ i, cnt i = 0 := by classical by_contra hnone push_neg at hnone have hge : 1 ≤ ∑ i : ι, μ i * (cnt i : ℝ) := by calc 1 = ∑ i : ι, μ i := by rw [hμsum] _ = ∑ i : ι, μ i * (1 : ℝ) := by simp _ ≤ ∑ i : ι, μ i * (cnt i : ℝ) := by refine Finset.sum_le_sum ?_ intro i _hi exact mul_le_mul_of_nonneg_left (by exact_mod_cast succ_le_of_lt (Nat.pos_of_ne_zero (hnone i))) (hμnonneg i) exact not_lt_of_ge hge hmean
    Causalean.Stat.Concentration.averaging_exists_zero_count · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:156
  • collision_bound lemma — When two Boolean vectors are separated under nonnegative coordinate weights, their probability of agreeing on every coordinate of a repeated weighted sample decays exponentially with the sample length.
    n m :
    ℕ
    w :
    Fin n → ℝ
    hw :
    ∀ j, 0 ≤ w j
    r ε W :
    ℝ
    hr :
    0 < r
    hW :
    W = ∑ j : Fin n, w j
    hWpos :
    0 < W
    hwsum :
    W ≤ r ^ 2
    a b :
    Fin n → Bool
    hsep :
    ε ^ 2 ≤ weightedHammingSq w a b
    (∑ j ∈ Finset.univ.filter (fun j : Fin n => a j = b j), w j / W) ^ m
    ≤ exp (-(m : ℝ) * ε ^ 2 / r ^ 2)
    Proof (Lean source)
    lemma collision_bound {n m : ℕ} (w : Fin n → ℝ) (hw : ∀ j, 0 ≤ w j) (r ε W : ℝ) (hr : 0 < r) (hW : W = ∑ j : Fin n, w j) (hWpos : 0 < W) (hwsum : W ≤ r ^ 2) (a b : Fin n → Bool) (hsep : ε ^ 2 ≤ weightedHammingSq w a b) : (∑ j ∈ Finset.univ.filter (fun j : Fin n => a j = b j), w j / W) ^ m ≤ exp (-(m : ℝ) * ε ^ 2 / r ^ 2) := by classical -- The agreeing-coordinate weight is the total minus the weighted Hamming gap. have hagree : (∑ j ∈ Finset.univ.filter (fun j : Fin n => a j = b j), w j) = W - weightedHammingSq w a b := by rw [hW] unfold weightedHammingSq rw [← Finset.sum_sub_distrib, Finset.sum_filter] apply Finset.sum_congr rfl intro j _ by_cases h : a j = b j <;> simp [h] have hr2pos : 0 < r ^ 2 := by positivity have hWH_nonneg : 0 ≤ weightedHammingSq w a b := weightedHammingSq_nonneg w hw a b -- Normalize: the collision factor `s = (W - WH)/W` lies in `[0, 1 - ε²/r²]`. rw [← Finset.sum_div, hagree] set s : ℝ := (W - weightedHammingSq w a b) / W with hs_def have hs_nonneg : 0 ≤ s := by rw [hs_def] refine div_nonneg ?_ (le_of_lt hWpos) rw [← hagree] exact Finset.sum_nonneg (fun j _ => hw j) have hs_le1 : s ≤ 1 - ε ^ 2 / r ^ 2 := by rw [hs_def, sub_div, div_self (ne_of_gt hWpos)] have hratio : ε ^ 2 / r ^ 2 ≤ weightedHammingSq w a b / W := by rw [div_le_div_iff₀ hr2pos hWpos] nlinarith [hsep, hwsum, hWH_nonneg, sq_nonneg ε] linarith have hexp : 1 - ε ^ 2 / r ^ 2 ≤ exp (-(ε ^ 2 / r ^ 2)) := by have h := Real.add_one_le_exp (-(ε ^ 2 / r ^ 2)) linarith have hs_le_exp : s ≤ exp (-(ε ^ 2 / r ^ 2)) := le_trans hs_le1 hexp calc s ^ m ≤ (exp (-(ε ^ 2 / r ^ 2))) ^ m := pow_le_pow_left₀ hs_nonneg hs_le_exp m _ = exp (-(m : ℝ) * ε ^ 2 / r ^ 2) := by rw [← Real.exp_nat_mul] congr 1 ring
    Causalean.Stat.Concentration.collision_bound · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:179
  • card_subsample_family_le_succ_pow lemma — A sampled Boolean trace family with bounded VC dimension has polynomially many realized restricted patterns.
    n m d :
    ℕ
    J :
    Fin m → Fin n
    P :
    Finset (Fin n → Bool)
    hvcJ :
    (P.image (subsamplePattern J)).vcDim ≤ d
    (P.image (subsamplePattern J)).card ≤ (m + 1) ^ d
    Proof (Lean source)
    lemma card_subsample_family_le_succ_pow {n m d : ℕ} (J : Fin m → Fin n) (P : Finset (Fin n → Bool)) (hvcJ : (P.image (subsamplePattern J)).vcDim ≤ d) : (P.image (subsamplePattern J)).card ≤ (m + 1) ^ d := by exact le_trans (card_growthFamily_le_sum_choose (P.image (subsamplePattern J)) hvcJ) (sum_choose_le_succ_pow m d)
    Causalean.Stat.Concentration.card_subsample_family_le_succ_pow · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:227
  • subsample_image_vcDim_le lemma — Restricting a Boolean set family along a coordinate map does not increase VC dimension.
    n m :
    ℕ
    d :
    ℕ
    J :
    Fin m → Fin n
    P :
    Finset (Fin n → Bool)
    hvc :
    (P.image (fun a => Finset.univ.filter (fun j => a j = true))).vcDim ≤ d
    (P.image (subsamplePattern J)).vcDim ≤ d
    Proof (Lean source)
    lemma subsample_image_vcDim_le {n m : ℕ} (d : ℕ) (J : Fin m → Fin n) (P : Finset (Fin n → Bool)) (hvc : (P.image (fun a => Finset.univ.filter (fun j => a j = true))).vcDim ≤ d) : (P.image (subsamplePattern J)).vcDim ≤ d := by classical let A : Finset (Finset (Fin n)) := P.image (fun a => Finset.univ.filter (fun j => a j = true)) let B : Finset (Finset (Fin m)) := P.image (subsamplePattern J) have hB_le_A : B.vcDim ≤ A.vcDim := by unfold vcDim refine Finset.sup_le ?_ intro T hTmem have hT : B.Shatters T := Finset.mem_shatterer.mp hTmem let U : Finset (Fin n) := T.image J have hinj : InjOn J (↑T) := by intro i hi k hk hJ by_contra hik have hsingle : ({i} : Finset (Fin m)) ⊆ T := Finset.singleton_subset_iff.mpr hi obtain ⟨u, huB, hTu⟩ := hT hsingle rcases Finset.mem_image.mp huB with ⟨a, _haP, rfl⟩ have hi_inter : i ∈ T ∩ subsamplePattern J a := by rw [hTu] simp have hi_pat : i ∈ subsamplePattern J a := (Finset.mem_inter.mp hi_inter).2 have hk_pat : k ∈ subsamplePattern J a := by rw [subsamplePattern_mem_iff] at hi_pat ⊢ simpa [hJ] using hi_pat have hk_inter : k ∈ T ∩ subsamplePattern J a := Finset.mem_inter.mpr ⟨hk, hk_pat⟩ have hk_single : k ∈ ({i} : Finset (Fin m)) := by rw [← hTu] exact hk_inter have hki : k = i := by simpa using hk_single exact hik hki.symm have hAshat : A.Shatters U := by intro S hS let S' : Finset (Fin m) := T.filter fun i => J i ∈ S have hS'T : S' ⊆ T := by intro i hi exact (Finset.mem_filter.mp hi).1 obtain ⟨u, huB, hTu⟩ := hT hS'T rcases Finset.mem_image.mp huB with ⟨a, haP, rfl⟩ refine ⟨Finset.univ.filter (fun j => a j = true), ?_, ?_⟩ · exact Finset.mem_image.mpr ⟨a, haP, rfl⟩ · ext x constructor · intro hx rcases Finset.mem_inter.mp hx with ⟨hxU, hxtrue⟩ rcases Finset.mem_image.mp hxU with ⟨i, hiT, rfl⟩ have hi_pat : i ∈ subsamplePattern J a := by rw [subsamplePattern_mem_iff] simpa using (Finset.mem_filter.mp hxtrue).2 have hiS' : i ∈ S' := by rw [← hTu] exact Finset.mem_inter.mpr ⟨hiT, hi_pat⟩ exact (Finset.mem_filter.mp hiS').2 · intro hxS have hxU : x ∈ U := hS hxS rcases Finset.mem_image.mp hxU with ⟨i, hiT, hJi⟩ have hiS' : i ∈ S' := Finset.mem_filter.mpr ⟨hiT, by simpa [hJi] using hxS⟩ have hi_inter : i ∈ T ∩ subsamplePattern J a := by rw [hTu] exact hiS' have hi_pat : i ∈ subsamplePattern J a := (Finset.mem_inter.mp hi_inter).2 refine Finset.mem_inter.mpr ⟨hxU, ?_⟩ rw [mem_filter] constructor · simp · rw [subsamplePattern_mem_iff] at hi_pat simpa [hJi] using hi_pat have hU_le : U.card ≤ A.vcDim := Finset.Shatters.card_le_vcDim hAshat have hcard : U.card = T.card := Finset.card_image_of_injOn hinj exact hcard.ge.trans hU_le exact hB_le_A.trans hvc
    Causalean.Stat.Concentration.subsample_image_vcDim_le · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:237
  • finite_averaging_exists_separating_subsample lemma — Finite averaging core for the weighted random-coordinate extraction.
    n :
    ℕ
    w :
    Fin n → ℝ
    hw :
    ∀ j, 0 ≤ w j
    r ε :
    ℝ
    hr :
    0 < r
    hε :
    0 < ε
    hwsum :
    ∑ j, w j ≤ r ^ 2
    P :
    Finset (Fin n → Bool)
    hPcard :
    2 ≤ P.card
    hsep :
    ∀ a ∈ P, ∀ b ∈ P, a ≠ b → ε ^ 2 ≤ weightedHammingSq w a b
    ∃ (m : ℕ) (J : Fin m → Fin n),
    conclusion 1
    (m : ℝ) ≤ 1 + (2 * r ^ 2 / ε ^ 2) * log (P.card)
    conclusion 2
    Proof (Lean source)
    lemma finite_averaging_exists_separating_subsample {n : ℕ} (w : Fin n → ℝ) (hw : ∀ j, 0 ≤ w j) (r ε : ℝ) (hr : 0 < r) (hε : 0 < ε) (hwsum : ∑ j, w j ≤ r ^ 2) (P : Finset (Fin n → Bool)) (hPcard : 2 ≤ P.card) (hsep : ∀ a ∈ P, ∀ b ∈ P, a ≠ b → ε ^ 2 ≤ weightedHammingSq w a b) : ∃ (m : ℕ) (J : Fin m → Fin n), (m : ℝ) ≤ 1 + (2 * r ^ 2 / ε ^ 2) * log (P.card) ∧ InjOn (subsamplePattern J) ↑P := by classical let W : ℝ := ∑ j : Fin n, w j have hWdef : W = ∑ j : Fin n, w j := rfl have hWpos : 0 < W := by have htwo : 1 < P.card := by omega rcases Finset.one_lt_card.mp htwo with ⟨a, haP, b, hbP, hab⟩ have hdist_le_W : weightedHammingSq w a b ≤ W := by dsimp [W] unfold weightedHammingSq refine Finset.sum_le_sum ?_ intro j _hj by_cases h : a j = b j · simp [h, hw j] · simp [h] have hdist_pos : 0 < weightedHammingSq w a b := by have hεsq : 0 < ε ^ 2 := sq_pos_of_ne_zero (ne_of_gt hε) exact lt_of_lt_of_le hεsq (hsep a haP b hbP hab) exact lt_of_lt_of_le hdist_pos hdist_le_W have hwsumW : W ≤ r ^ 2 := by simpa [W] using hwsum let L : ℝ := (2 * r ^ 2 / ε ^ 2) * log (P.card) let m : ℕ := ⌊L⌋₊ + 1 have hPpos_nat : 0 < P.card := by omega have hPone_nat : 1 ≤ P.card := by omega have hPpos_real : 0 < (P.card : ℝ) := by exact_mod_cast hPpos_nat have hLnonneg : 0 ≤ L := by have hcoef_nonneg : 0 ≤ 2 * r ^ 2 / ε ^ 2 := by positivity have hlog_nonneg : 0 ≤ log (P.card) := Real.log_nonneg (by exact_mod_cast hPone_nat) exact mul_nonneg hcoef_nonneg hlog_nonneg have hm_bound : (m : ℝ) ≤ 1 + (2 * r ^ 2 / ε ^ 2) * log (P.card) := by have hfloor : ((⌊L⌋₊ : ℕ) : ℝ) ≤ L := Nat.floor_le hLnonneg dsimp [m, L] norm_num [Nat.cast_add, Nat.cast_one] linarith let μ : (Fin m → Fin n) → ℝ := fun J => ∏ t : Fin m, (w (J t) / W) let cnt : (Fin m → Fin n) → ℕ := fun J => (P.offDiag.filter fun ab => subsamplePattern J ab.1 = subsamplePattern J ab.2).card have hμsum : ∑ J : Fin m → Fin n, μ J = 1 := by dsimp [μ] rw [product_sum_normalization (n := n) (m := m) (fun j : Fin n => w j / W)] have hsum : (∑ j : Fin n, w j / W) = 1 := by rw [← Finset.sum_div] rw [← hWdef] exact div_self (ne_of_gt hWpos) rw [hsum, one_pow] have hμnonneg : ∀ J : Fin m → Fin n, 0 ≤ μ J := by intro J dsimp [μ] exact Finset.prod_nonneg fun t _ht => div_nonneg (hw (J t)) (le_of_lt hWpos) have hcnt_cast : ∀ J : Fin m → Fin n, (cnt J : ℝ) = ∑ ab ∈ P.offDiag, if subsamplePattern J ab.1 = subsamplePattern J ab.2 then (1 : ℝ) else 0 := by intro J dsimp [cnt] simp have hinner : ∀ ab ∈ P.offDiag, (∑ J : Fin m → Fin n, μ J * (if subsamplePattern J ab.1 = subsamplePattern J ab.2 then (1 : ℝ) else 0)) = (∑ j ∈ Finset.univ.filter (fun j : Fin n => ab.1 j = ab.2 j), w j / W) ^ m := by intro ab _hab calc (∑ J : Fin m → Fin n, μ J * (if subsamplePattern J ab.1 = subsamplePattern J ab.2 then (1 : ℝ) else 0)) = ∑ J : Fin m → Fin n, (∏ t : Fin m, (w (J t) / W)) * (if (∀ t : Fin m, ab.1 (J t) = ab.2 (J t)) then (1 : ℝ) else 0) := by refine Finset.sum_congr rfl ?_ intro J _hJ dsimp [μ] by_cases h : subsamplePattern J ab.1 = subsamplePattern J ab.2 · have hforall : ∀ t : Fin m, ab.1 (J t) = ab.2 (J t) := subsamplePattern_eq_iff.mp h simp [h, hforall] · have hforall : ¬ ∀ t : Fin m, ab.1 (J t) = ab.2 (J t) := by intro hall exact h (subsamplePattern_eq_iff.mpr hall) simp [h, hforall] _ = (∑ j ∈ Finset.univ.filter (fun j : Fin n => ab.1 j = ab.2 j), w j / W) ^ m := by exact per_pair_collision_sum (fun j : Fin n => w j / W) ab.1 ab.2 have hmean_le : (∑ J : Fin m → Fin n, μ J * (cnt J : ℝ)) ≤ (P.offDiag.card : ℝ) * exp (-(m : ℝ) * ε ^ 2 / r ^ 2) := by calc (∑ J : Fin m → Fin n, μ J * (cnt J : ℝ)) = ∑ J : Fin m → Fin n, μ J * (∑ ab ∈ P.offDiag, if subsamplePattern J ab.1 = subsamplePattern J ab.2 then (1 : ℝ) else 0) := by refine Finset.sum_congr rfl ?_ intro J _hJ rw [hcnt_cast J] _ = ∑ J : Fin m → Fin n, ∑ ab ∈ P.offDiag, μ J * (if subsamplePattern J ab.1 = subsamplePattern J ab.2 then (1 : ℝ) else 0) := by refine Finset.sum_congr rfl ?_ intro J _hJ rw [Finset.mul_sum] _ = ∑ ab ∈ P.offDiag, ∑ J : Fin m → Fin n, μ J * (if subsamplePattern J ab.1 = subsamplePattern J ab.2 then (1 : ℝ) else 0) := by rw [Finset.sum_comm] _ ≤ ∑ ab ∈ P.offDiag, exp (-(m : ℝ) * ε ^ 2 / r ^ 2) := by refine Finset.sum_le_sum ?_ intro ab hab rw [hinner ab hab] rcases Finset.mem_offDiag.mp hab with ⟨haP, hbP, habne⟩ exact collision_bound w hw r ε W hr hWdef hWpos hwsumW ab.1 ab.2 (hsep ab.1 haP ab.2 hbP habne) _ = (P.offDiag.card : ℝ) * exp (-(m : ℝ) * ε ^ 2 / r ^ 2) := by simp have hmean_lt_one : (∑ J : Fin m → Fin n, μ J * (cnt J : ℝ)) < 1 := by have hm_gt_L : L < (m : ℝ) := by dsimp [m] simpa [Nat.cast_add, Nat.cast_one] using (Nat.lt_floor_add_one L) have hscale_pos : 0 < ε ^ 2 / r ^ 2 := by positivity have hscaled : L * (ε ^ 2 / r ^ 2) < (m : ℝ) * (ε ^ 2 / r ^ 2) := mul_lt_mul_of_pos_right hm_gt_L hscale_pos have hLscale : L * (ε ^ 2 / r ^ 2) = 2 * log (P.card) := by dsimp [L] field_simp [ne_of_gt hε, ne_of_gt hr] have hmexp : 2 * log (P.card) < (m : ℝ) * ε ^ 2 / r ^ 2 := by rw [hLscale] at hscaled convert hscaled using 1 ring have hneg : -((m : ℝ) * ε ^ 2 / r ^ 2) < -(2 * log (P.card)) := by linarith have hexp_lt : exp (-((m : ℝ) * ε ^ 2 / r ^ 2)) < exp (-(2 * log (P.card))) := Real.exp_lt_exp.mpr hneg have hoff_card : (P.offDiag.card : ℝ) ≤ (P.card : ℝ) ^ 2 := by have hn : P.offDiag.card ≤ P.card * P.card := by rw [Finset.offDiag_card] omega have hnreal : (P.offDiag.card : ℝ) ≤ (P.card * P.card : ℕ) := by exact_mod_cast hn simpa [sq] using hnreal have hN2pos : 0 < (P.card : ℝ) ^ 2 := sq_pos_of_ne_zero (ne_of_gt hPpos_real) have hprod_lt : (P.card : ℝ) ^ 2 * exp (-((m : ℝ) * ε ^ 2 / r ^ 2)) < (P.card : ℝ) ^ 2 * exp (-(2 * log (P.card))) := mul_lt_mul_of_pos_left hexp_lt hN2pos have hexp_neg_eq : exp (-(2 * log (P.card))) = ((P.card : ℝ) ^ 2)⁻¹ := by rw [Real.exp_neg] have htwice : exp (2 * log (P.card)) = (P.card : ℝ) ^ 2 := by have hrewrite : 2 * log (P.card) = log (P.card) + log (P.card) := by ring rw [hrewrite, Real.exp_add, Real.exp_log hPpos_real] ring rw [htwice] have hprod_eq : (P.card : ℝ) ^ 2 * exp (-(2 * log (P.card))) = 1 := by rw [hexp_neg_eq] exact mul_inv_cancel₀ (ne_of_gt hN2pos) have hcardexp_le : (P.offDiag.card : ℝ) * exp (-(m : ℝ) * ε ^ 2 / r ^ 2) ≤ (P.card : ℝ) ^ 2 * exp (-(m : ℝ) * ε ^ 2 / r ^ 2) := by exact mul_le_mul_of_nonneg_right hoff_card (le_of_lt (Real.exp_pos _)) have hprod_lt_one : (P.card : ℝ) ^ 2 * exp (-(m : ℝ) * ε ^ 2 / r ^ 2) < 1 := by convert (by simpa [hprod_eq] using hprod_lt) using 2 ring_nf exact lt_of_le_of_lt (hmean_le.trans hcardexp_le) hprod_lt_one obtain ⟨J, hcnt_zero⟩ := averaging_exists_zero_count μ cnt hμsum hμnonneg hmean_lt_one refine ⟨m, J, hm_bound, ?_⟩ intro a haP b hbP hpat by_contra hab have hbad_mem : (a, b) ∈ P.offDiag.filter (fun ab => subsamplePattern J ab.1 = subsamplePattern J ab.2) := by rw [mem_filter] exact ⟨Finset.mem_offDiag.mpr ⟨haP, hbP, hab⟩, hpat⟩ have hcnt_pos : 0 < cnt J := by dsimp [cnt] exact Finset.card_pos.mpr ⟨(a, b), hbad_mem⟩ exact (Nat.ne_of_gt hcnt_pos) hcnt_zero
    Causalean.Stat.Concentration.finite_averaging_exists_separating_subsample · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:321
  • exists_separating_subsample lemma — Honest isolated core: the weighted random-coordinate extraction.
    n :
    ℕ
    d :
    ℕ
    w :
    Fin n → ℝ
    hw :
    ∀ j, 0 ≤ w j
    r ε :
    ℝ
    hr :
    0 < r
    hε :
    0 < ε
    hwsum :
    ∑ j, w j ≤ r ^ 2
    P :
    Finset (Fin n → Bool)
    hPcard :
    2 ≤ P.card
    hvc :
    (P.image (fun a => (Finset.univ.filter (fun j => a j = true)))).vcDim ≤ d
    hsep :
    ∀ a ∈ P, ∀ b ∈ P, a ≠ b → ε ^ 2 ≤ weightedHammingSq w a b
    ∃ (m : ℕ) (J : Fin m → Fin n),
    conclusion 1
    (m : ℝ) ≤ 1 + (2 * r ^ 2 / ε ^ 2) * log (P.card)
    conclusion 2
    (P.image (subsamplePattern J)).vcDim ≤ d
    conclusion 3
    Proof (Lean source)
    lemma exists_separating_subsample {n : ℕ} (d : ℕ) (w : Fin n → ℝ) (hw : ∀ j, 0 ≤ w j) (r ε : ℝ) (hr : 0 < r) (hε : 0 < ε) (hwsum : ∑ j, w j ≤ r ^ 2) (P : Finset (Fin n → Bool)) (hPcard : 2 ≤ P.card) (hvc : (P.image (fun a => (Finset.univ.filter (fun j => a j = true)))).vcDim ≤ d) (hsep : ∀ a ∈ P, ∀ b ∈ P, a ≠ b → ε ^ 2 ≤ weightedHammingSq w a b) : ∃ (m : ℕ) (J : Fin m → Fin n), (m : ℝ) ≤ 1 + (2 * r ^ 2 / ε ^ 2) * log (P.card) ∧ (P.image (subsamplePattern J)).vcDim ≤ d ∧ InjOn (subsamplePattern J) ↑P := by obtain ⟨m, J, hm, hinj⟩ := finite_averaging_exists_separating_subsample w hw r ε hr hε hwsum P hPcard hsep exact ⟨m, J, hm, subsample_image_vcDim_le d J P hvc, hinj⟩
    Causalean.Stat.Concentration.exists_separating_subsample · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:530
  • self_log_solve lemma — A self-referential logarithmic inequality implies an explicit linear-log upper bound.
    a L :
    ℝ
    d :
    ℕ
    hd :
    1 ≤ d
    ha :
    2 ≤ a
    hL :
    0 ≤ L
    hbound :
    L ≤ (d : ℝ) * log (2 + a * L)
    L ≤ 1 + 2 * (d : ℝ) * log (2 * a * (d : ℝ))
    Proof (Lean source)
    lemma self_log_solve {a L : ℝ} {d : ℕ} (hd : 1 ≤ d) (ha : 2 ≤ a) (hL : 0 ≤ L) (hbound : L ≤ (d : ℝ) * log (2 + a * L)) : L ≤ 1 + 2 * (d : ℝ) * log (2 * a * (d : ℝ)) := by have hd_pos_nat : 0 < d := lt_of_lt_of_le Nat.zero_lt_one hd have hd_pos : 0 < (d : ℝ) := by exact_mod_cast hd_pos_nat have hd_nonneg : 0 ≤ (d : ℝ) := le_of_lt hd_pos have ha_pos : 0 < a := by linarith have ha_nonneg : 0 ≤ a := le_of_lt ha_pos have hy_pos : 0 < 2 + a * L := by have hmul_nonneg : 0 ≤ a * L := mul_nonneg ha_nonneg hL linarith have ht_pos : 0 < 2 * a * (d : ℝ) := by positivity have hlog_tangent : log (2 + a * L) ≤ (2 + a * L) / (2 * a * (d : ℝ)) + log (2 * a * (d : ℝ)) - 1 := by have hratio_pos : 0 < (2 + a * L) / (2 * a * (d : ℝ)) := div_pos hy_pos ht_pos have h0 := Real.log_le_sub_one_of_pos hratio_pos have hlog_div : log ((2 + a * L) / (2 * a * (d : ℝ))) = log (2 + a * L) - log (2 * a * (d : ℝ)) := by exact Real.log_div (ne_of_gt hy_pos) (ne_of_gt ht_pos) rw [hlog_div] at h0 linarith have hstep : L ≤ (d : ℝ) * ((2 + a * L) / (2 * a * (d : ℝ)) + log (2 * a * (d : ℝ)) - 1) := by exact le_trans hbound (mul_le_mul_of_nonneg_left hlog_tangent hd_nonneg) have hrewrite : (d : ℝ) * ((2 + a * L) / (2 * a * (d : ℝ)) + log (2 * a * (d : ℝ)) - 1) = 1 / a + L / 2 + (d : ℝ) * log (2 * a * (d : ℝ)) - (d : ℝ) := by field_simp [ne_of_gt ha_pos, ne_of_gt hd_pos] have hstep' : L ≤ 1 / a + L / 2 + (d : ℝ) * log (2 * a * (d : ℝ)) - (d : ℝ) := by rwa [hrewrite] at hstep have hdrop : L ≤ 1 / a + L / 2 + (d : ℝ) * log (2 * a * (d : ℝ)) := by linarith have hhalf' : L ≤ 2 * (1 / a + (d : ℝ) * log (2 * a * (d : ℝ))) := by linarith have hhalf : L ≤ 2 / a + 2 * (d : ℝ) * log (2 * a * (d : ℝ)) := by convert hhalf' using 1 ring have htwo_div_le_one : 2 / a ≤ 1 := (div_le_one ha_pos).2 ha linarith
    Causalean.Stat.Concentration.self_log_solve · Causalean/Stat/Concentration/Covering/HausslerPacking.lean:549
Sqrt­Log­Integral 1 core · 6 supporting Dudley entropy-integral evaluation for a logarithmic square-root kernel. ★ sqrtLog_integral_le

Dudley entropy-integral evaluation for a logarithmic square-root kernel.

This file proves the elementary bound ∫ x in ε..δ, sqrt (log (δ / x)) ≤ δ - ε for 0 < ε ≤ δ. The proof uses the AM-GM inequality sqrt t ≤ (t + 1) / 2 for t ≥ 0 and the explicit antiderivative of log.

lemma sqrtLog_integral_le reviewed
Causalean.Stat.Concentration

Dudley entropy-integral evaluation. For a positive lower limit ε that is at most the upper limit δ, the integral of √(log(δ/x)) over [ε,δ] is at most δ - ε.

Formal statement
δ ε :
ℝ
hε :
0 < ε
hεδ :
ε ≤ δ
(∫ x in ε..δ, sqrt (log (δ / x))) ≤ δ - ε
Proof (Lean source)
lemma sqrtLog_integral_le {δ ε : ℝ} (hε : 0 < ε) (hεδ : ε ≤ δ) : (∫ x in ε..δ, sqrt (log (δ / x))) ≤ δ - ε := by have hmono : (∫ x in ε..δ, sqrt (log (δ / x))) ≤ ∫ x in ε..δ, (log (δ / x) + 1) / 2 := by refine intervalIntegral.integral_mono_on hεδ (intervalIntegrable_sqrt_log_div hε hεδ) (intervalIntegrable_log_div_avg hε hεδ) ?_ intro x hx exact sqrt_le_add_one_div_two (log_div_nonneg_of_mem_Icc hε hx) have hlog : (∫ x in ε..δ, log (δ / x)) ≤ δ - ε := integral_log_div_le hε hεδ have havg : (∫ x in ε..δ, (log (δ / x) + 1) / 2) ≤ δ - ε := by have hint : (∫ x in ε..δ, (log (δ / x) + 1) / 2) = ((∫ x in ε..δ, log (δ / x)) + (δ - ε)) / 2 := by rw [intervalIntegral.integral_div] rw [intervalIntegral.integral_add] · rw [intervalIntegral.integral_const] simp [smul_eq_mul] · exact intervalIntegrable_log_div hε hεδ · exact intervalIntegrable_const rw [hint] linarith calc (∫ x in ε..δ, sqrt (log (δ / x))) ≤ ∫ x in ε..δ, (log (δ / x) + 1) / 2 := hmono _ ≤ δ - ε := havg
Causalean.Stat.Concentration.sqrtLog_integral_le · Causalean/Stat/Concentration/Covering/SqrtLogIntegral.lean:130
6 supporting declarations (lemmas, instances)
  • sqrt_le_add_one_div_two lemma — For nonnegative t, the square root is bounded by the arithmetic mean of t and 1.
    t :
    ℝ
    ht :
    0 ≤ t
    sqrt t ≤ (t + 1) / 2
    Proof (Lean source)
    lemma sqrt_le_add_one_div_two {t : ℝ} (ht : 0 ≤ t) : sqrt t ≤ (t + 1) / 2 := by have hsq : 0 ≤ (sqrt t - 1) ^ 2 := sq_nonneg _ have hsqrt_sq : (sqrt t) ^ 2 = t := by rw [Real.sq_sqrt ht] nlinarith [hsq, Real.sqrt_nonneg t, hsqrt_sq]
    Causalean.Stat.Concentration.sqrt_le_add_one_div_two · Causalean/Stat/Concentration/Covering/SqrtLogIntegral.lean:21
  • log_div_nonneg_of_mem_Icc lemma — On the interval [ε, δ], the log-ratio kernel is nonnegative.
    δ ε x :
    ℝ
    hε :
    0 < ε
    hx :
    x ∈ Icc ε δ
    0 ≤ log (δ / x)
    Proof (Lean source)
    lemma log_div_nonneg_of_mem_Icc {δ ε x : ℝ} (hε : 0 < ε) (hx : x ∈ Icc ε δ) : 0 ≤ log (δ / x) := by have hxpos : 0 < x := lt_of_lt_of_le hε hx.1 have hratio : 1 ≤ δ / x := by rw [le_div_iff₀ hxpos] simpa using hx.2 exact Real.log_nonneg hratio
    Causalean.Stat.Concentration.log_div_nonneg_of_mem_Icc · Causalean/Stat/Concentration/Covering/SqrtLogIntegral.lean:30
  • intervalIntegrable_sqrt_log_div lemma — When ε is positive and no larger than δ, the square-root log-ratio kernel is integrable on the interval from ε to δ with respect to Lebesgue measure.
    δ ε :
    ℝ
    hε :
    0 < ε
    hεδ :
    ε ≤ δ
    IntervalIntegrable (fun x : ℝ => sqrt (log (δ / x))) volume ε δ
    Proof (Lean source)
    lemma intervalIntegrable_sqrt_log_div {δ ε : ℝ} (hε : 0 < ε) (hεδ : ε ≤ δ) : IntervalIntegrable (fun x : ℝ => sqrt (log (δ / x))) volume ε δ := by have hcont : ContinuousOn (fun x : ℝ => sqrt (log (δ / x))) [[ε, δ]] := by simpa [Set.uIcc_of_le hεδ] using continuousOn_sqrt_log_div_Icc hε hεδ exact hcont.intervalIntegrable
    Causalean.Stat.Concentration.intervalIntegrable_sqrt_log_div · Causalean/Stat/Concentration/Covering/SqrtLogIntegral.lean:51
  • intervalIntegrable_log_div lemma — When ε is positive and no larger than δ, the logarithm of the ratio δ divided by x is interval-integrable from ε to δ with respect to Lebesgue measure.
    δ ε :
    ℝ
    hε :
    0 < ε
    hεδ :
    ε ≤ δ
    IntervalIntegrable (fun x : ℝ => log (δ / x)) volume ε δ
    Proof (Lean source)
    lemma intervalIntegrable_log_div {δ ε : ℝ} (hε : 0 < ε) (hεδ : ε ≤ δ) : IntervalIntegrable (fun x : ℝ => log (δ / x)) volume ε δ := by have hδ : 0 < δ := lt_of_lt_of_le hε hεδ have hcont : ContinuousOn (fun x : ℝ => log (δ / x)) (Icc ε δ) := by refine ContinuousOn.log ?_ ?_ · exact (continuousOn_const (c := δ)).div continuousOn_id (fun x hx => by linarith [hx.1]) · intro x hx exact div_ne_zero (ne_of_gt hδ) (by linarith [hx.1]) have hcont' : ContinuousOn (fun x : ℝ => log (δ / x)) [[ε, δ]] := by simpa [Set.uIcc_of_le hεδ] using hcont exact hcont'.intervalIntegrable
    Causalean.Stat.Concentration.intervalIntegrable_log_div · Causalean/Stat/Concentration/Covering/SqrtLogIntegral.lean:77
  • integral_log_div_eq lemma — Exact evaluation of the logarithmic ratio integral on [ε, δ].
    δ ε :
    ℝ
    hε :
    0 < ε
    hεδ :
    ε ≤ δ
    (∫ x in ε..δ, log (δ / x)) = δ - ε - ε * log (δ / ε)
    Proof (Lean source)
    lemma integral_log_div_eq {δ ε : ℝ} (hε : 0 < ε) (hεδ : ε ≤ δ) : (∫ x in ε..δ, log (δ / x)) = δ - ε - ε * log (δ / ε) := by have hδ : 0 < δ := lt_of_lt_of_le hε hεδ calc (∫ x in ε..δ, log (δ / x)) = ∫ x in ε..δ, (log δ - log x) := by refine intervalIntegral.integral_congr ?_ intro x hx have hxIcc : x ∈ Icc ε δ := by simpa [Set.uIcc_of_le hεδ] using hx have hxpos : 0 < x := lt_of_lt_of_le hε hxIcc.1 simpa using Real.log_div (ne_of_gt hδ) (ne_of_gt hxpos) _ = (δ - ε) * log δ - (δ * log δ - ε * log ε - δ + ε) := by rw [intervalIntegral.integral_sub] · rw [intervalIntegral.integral_const] rw [integral_log] simp [smul_eq_mul] · exact intervalIntegrable_const · exact intervalIntegral.intervalIntegrable_log' _ = δ - ε - ε * log (δ / ε) := by rw [Real.log_div (ne_of_gt hδ) (ne_of_gt hε)] ring
    Causalean.Stat.Concentration.integral_log_div_eq · Causalean/Stat/Concentration/Covering/SqrtLogIntegral.lean:93
  • integral_log_div_le lemma — The logarithmic ratio integral over [ε, δ] is at most the interval length.
    δ ε :
    ℝ
    hε :
    0 < ε
    hεδ :
    ε ≤ δ
    (∫ x in ε..δ, log (δ / x)) ≤ δ - ε
    Proof (Lean source)
    lemma integral_log_div_le {δ ε : ℝ} (hε : 0 < ε) (hεδ : ε ≤ δ) : (∫ x in ε..δ, log (δ / x)) ≤ δ - ε := by have hratio : 1 ≤ δ / ε := by rw [le_div_iff₀ hε] simpa using hεδ have hnonneg : 0 ≤ ε * log (δ / ε) := mul_nonneg (le_of_lt hε) (Real.log_nonneg hratio) rw [integral_log_div_eq hε hεδ] linarith
    Causalean.Stat.Concentration.integral_log_div_le · Causalean/Stat/Concentration/Covering/SqrtLogIntegral.lean:119
VCLocalized­Covering 1 core · 0 supporting A standalone metric identity for binary-factored function classes. ★ empiricalDist_sq_eq_weightedHammingSq

A standalone metric identity for binary-factored function classes.

The result identifies empirical L² distance with weighted Boolean Hamming distance on a fixed sample. It is available as an algebraic bridge but is not used by the finite-pattern localized Rademacher pipeline.

theorem empiricalDist_sq_eq_weightedHammingSq reviewed
Causalean.Stat.Concentration

Empirical L² distance as weighted Hamming distance. For a real-valued class that factors through a Boolean classifier at each sample coordinate, F i (S j) = φ j (π i (S j)), the squared empirical L²(Pₙ) distance between two members F i and F i' equals the weighted Hamming distance² of their induced Boolean sample-patterns, with per-coordinate weight (φ j true − φ j false)² / n.

Formal statement
ι 𝒳 :
Type*
n :
ℕ
F :
ι → 𝒳 → ℝ
S :
Fin n → 𝒳
π :
ι → 𝒳 → Bool
φ :
Fin n → Bool → ℝ
hfactor :
∀ i j, F i (S j) = φ j (π i (S j))
i i' :
ι
(empiricalDist S (F i) (F i')) ^ 2
= weightedHammingSq (fun j => (φ j true - φ j false) ^ 2 / (n : ℝ)) (fun j => π i (S j)) (fun j => π i' (S j))
Proof (Lean source)
theorem empiricalDist_sq_eq_weightedHammingSq {ι 𝒳 : Type*} {n : ℕ} (F : ι → 𝒳 → ℝ) (S : Fin n → 𝒳) (π : ι → 𝒳 → Bool) (φ : Fin n → Bool → ℝ) (hfactor : ∀ i j, F i (S j) = φ j (π i (S j))) (i i' : ι) : (empiricalDist S (F i) (F i')) ^ 2 = weightedHammingSq (fun j => (φ j true - φ j false) ^ 2 / (n : ℝ)) (fun j => π i (S j)) (fun j => π i' (S j)) := by classical unfold empiricalDist empiricalNorm weightedHammingSq rw [Real.sq_sqrt] · rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro j _hj simp only [Pi.sub_apply] rw [hfactor i j, hfactor i' j] cases π i (S j) <;> cases π i' (S j) all_goals simp only [reduceCtorEq, if_true, if_false] ring · positivity
Causalean.Stat.Concentration.empiricalDist_sq_eq_weightedHammingSq · Causalean/Stat/Concentration/Covering/VCLocalizedCovering.lean:20 · uses empiricalDist , weightedHammingSq
VCUniform­Deviation 2 core · 7 supporting Finite-VC localized uniform-deviation bounds under a universal samplewise empirical-radius assumption, derived from the peeled localized empirical-process theorem. ★ vc_localized_deviation_event★ vc_localized_deviation_event_of_card

Finite-VC localized uniform-deviation bounds under a universal samplewise empirical-radius assumption, derived from the peeled localized empirical-process theorem.

For a finite-VC binary-indexed function class, with high probability the localized empirical process deviates from its mean by at most 10ρ * ‖f‖ + 5ρ² uniformly over members satisfying 0 ≤ norm f ≤ b, with critical radius ρ of order sqrt(d * log n / n) -- derived, under that stronger samplewise assumption, by instantiating localized_uniform_deviation_peeled with the finite-VC localized envelope.

This file is the samplewise-radius finite-VC specialization layer for the peeled localized uniform-deviation theorem. The empirical-process content is supplied by finite-pattern Massart bounds; the only rate arithmetic is supplied by vcLocalizedSlope_peelingCondition_eventually. It exports the VC-dimension event vc_localized_deviation_event, the direct growth-cardinality variant vc_localized_deviation_event_of_card, and the measurability/integrability bridges needed to instantiate the peeled theorem.

theorem vc_localized_deviation_event reviewed
Causalean.Stat.Concentration

Finite-VC localized uniform deviation event. For a class of measurable real-valued functions uniformly bounded in absolute value by a nonnegative constant b, with a nonnegative localization norm, variance controlled by its square, a localization constant K at least 1 and a positive sample size n, suppose the class factors through a binary Boolean family of VC dimension at most d and has the samplewise localization certificate. For a failure probability δ in (0,1], writing ρ for the localized slope vcLocalizedSlope K d n, if ρ is at most b and the peeling/log-domination side condition holds at one dyadic depth covering the class, then there is a measurable event of probability at least 1 - δ on which every class member i with 0 ≤ norm (F i) ≤ b satisfies the peeled localized deviation bound |n⁻¹ ∑ₖ F i(ωₖ) − 𝔼[F i]| ≤ 10ρ·norm(F i) + 5ρ².

Formal statement
ι :
Type u
shared
𝒳 :
Type v
shared
F :
ι → 𝒳 → ℝ
norm :
(𝒳 → ℝ) → ℝ
hF_meas :
∀ i, Measurable (F i)
b :
ℝ
hb :
0 ≤ b
hbound :
∀ i x, |F i x| ≤ b
hnorm_nonneg :
∀ i, 0 ≤ norm (F i)
hvariance :
∀ i, variance (F i) μ ≤ norm (F i) ^ 2
K :
ℝ
d n :
ℕ
hK :
(1 : ℝ) ≤ K
hn :
0 < n
δ :
ℝ
hδ :
0 < δ
hδ' :
δ ≤ 1
hρ_le_b :
vcLocalizedSlope K d n ≤ b
hδ_dom :
∃ E : Set (Fin n → 𝒳),
Measure.pi (fun _ => μ) E ≥ 1 - ofReal δ
conclusion 1
ω ∈ E :
i :
ι
0 ≤ norm (F i)
norm (F i) ≤ b
|(n : ℝ)⁻¹ * (Finset.univ.sum fun k : Fin n => F i (ω k)) - μ[fun x => F i x]|
≤ 10 * vcLocalizedSlope K d n * norm (F i) + 5 * (vcLocalizedSlope K d n) ^ 2
Proof (Lean source)
theorem vc_localized_deviation_event (F : ι → 𝒳 → ℝ) (norm : (𝒳 → ℝ) → ℝ) (μ : Measure 𝒳) [IsProbabilityMeasure μ] (hF_meas : ∀ i, Measurable (F i)) (b : ℝ) (hb : 0 ≤ b) (hbound : ∀ i x, |F i x| ≤ b) (hnorm_nonneg : ∀ i, 0 ≤ norm (F i)) (hvariance : ∀ i, variance (F i) μ ≤ norm (F i) ^ 2) (K : ℝ) (d n : ℕ) (hK : (1 : ℝ) ≤ K) (hn : 0 < n) (Hvc : BinaryFactoredVCClass F d) (Hloc : SamplewiseLocalizedVCDudleyHypotheses F norm) {δ : ℝ} (hδ : 0 < δ) (hδ' : δ ≤ 1) (hρ_le_b : vcLocalizedSlope K d n ≤ b) (hδ_dom : PeelingCondition b δ (vcLocalizedSlope K d n) n) : ∃ E : Set (Fin n → 𝒳), MeasurableSet E ∧ Measure.pi (fun _ => μ) E ≥ 1 - ofReal δ ∧ ∀ ω ∈ E, ∀ i : ι, 0 ≤ norm (F i) → norm (F i) ≤ b → |(n : ℝ)⁻¹ * (Finset.univ.sum fun k : Fin n => F i (ω k)) - μ[fun x => F i x]| ≤ 10 * vcLocalizedSlope K d n * norm (F i) + 5 * (vcLocalizedSlope K d n) ^ 2 := by classical have hK0 : 0 ≤ K := le_trans zero_le_one hK let R : LocalizedRegime 𝒳 ι 𝒳 F norm μ id := vcLocalizedRegime F norm μ id b hb (by simpa using hbound) (by simpa using hvariance) K d hK Hvc Hloc let ρ : ℝ := vcLocalizedSlope K d n have hρ_pos : 0 < ρ := vcLocalizedSlope_pos hK0 hn have hcrit_eq : criticalRadius (R.ψ n) = ρ := by dsimp [R, vcLocalizedRegime, vcLocalizedPsi, ρ] exact criticalRadius_linear_eq hρ_pos have hcrit_le_ρ : criticalRadius (R.ψ n) ≤ ρ := by rw [hcrit_eq] have hcrit_pos : 0 < criticalRadius (R.ψ n) := by rw [hcrit_eq] exact hρ_pos have hrad_bdd : ∀ r : ℝ, ρ ≤ r → ∀ S : Fin n → 𝒳, ∀ σ : Signs n, BddAbove (Set.range fun p : starHullParam ι => |(n : ℝ)⁻¹ * ∑ k : Fin n, (σ k : ℝ) * starHullZeroOut F norm r p (S k)|) := by intro r _hr exact fun S σ => starHullZeroOut_bddAbove_of_bound F norm hb n r S (fun i k => hbound i _) σ have hrad_int : ∀ r : ℝ, ρ ≤ r → Integrable (fun ω : Fin n → 𝒳 => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω)) (Measure.pi (fun _ => μ)) := by intro r hr exact vc_starHullZeroOut_empirical_rademacher_integrable F norm μ hF_meas b hb hbound K d n hK hn Hvc Hloc r hr rcases localized_uniform_deviation_peeled F norm μ id measurable_id hF_meas hnorm_nonneg R hδ hδ' n hn (ρ := ρ) (Rmax := b) hcrit_le_ρ hρ_pos hcrit_pos hrad_bdd hrad_int (by simpa [PeelingCondition, R, ρ, vcLocalizedRegime] using hδ_dom) with ⟨E, hE_meas, hE_prob, hE_bound⟩ refine ⟨E, hE_meas, hE_prob, ?_⟩ intro ω hω i hi_nonneg hi_b simpa [R, ρ] using hE_bound ω hω i hi_nonneg hi_b
theorem vc_localized_deviation_event_of_card reviewed
Causalean.Stat.Concentration

Growth-cardinality localized uniform deviation event. For a class of measurable real-valued functions uniformly bounded in absolute value by a nonnegative constant b, with a nonnegative localization norm and variance controlled by its square, that factors through a Boolean classifier π at every finite sample, for a coordinate transform φ with F i (S j) = φ j (π i (S j)), with a localization constant K at least 1 and a positive sample size n, suppose the induced Boolean growth family satisfies the direct cardinality bound #growthFamily π S ≤ (m+1)^dPi on every finite sample of size m and the class has the samplewise localization certificate. For a failure probability δ in (0,1], writing ρ for the localized slope vcLocalizedSlope K dPi n, if ρ is at most b and the peeling/log-domination side condition holds at one dyadic depth covering the class, then there is a measurable event of probability at least 1 - δ on which every class member i with 0 ≤ norm (F i) ≤ b satisfies the peeled localized deviation bound |n⁻¹ ∑ₖ F i(ωₖ) − 𝔼[F i]| ≤ 10ρ·norm(F i) + 5ρ².

Formal statement
ι :
Type u
shared
𝒳 :
Type v
shared
F :
ι → 𝒳 → ℝ
norm :
(𝒳 → ℝ) → ℝ
π :
ι → 𝒳 → Bool
hF_meas :
∀ i, Measurable (F i)
b :
ℝ
hb :
0 ≤ b
hbound :
∀ i x, |F i x| ≤ b
hnorm_nonneg :
∀ i, 0 ≤ norm (F i)
hvariance :
∀ i, variance (F i) μ ≤ norm (F i) ^ 2
hfactor :
∀ {m : ℕ} (S : Fin m → 𝒳), ∃ φ : Fin m → Bool → ℝ, ∀ i j, F i (S j) = φ j (π i (S j))
K :
ℝ
dPi n :
ℕ
hK :
(1 : ℝ) ≤ K
hn :
0 < n
hcard :
∀ (m : ℕ) (S : Fin m → 𝒳), (growthFamily π S).card ≤ (m + 1) ^ dPi
δ :
ℝ
hδ :
0 < δ
hδ' :
δ ≤ 1
hρ_le_b :
vcLocalizedSlope K dPi n ≤ b
hδ_dom :
∃ E : Set (Fin n → 𝒳),
Measure.pi (fun _ => μ) E ≥ 1 - ofReal δ
conclusion 1
ω ∈ E :
i :
ι
0 ≤ norm (F i)
norm (F i) ≤ b
|(n : ℝ)⁻¹ * (Finset.univ.sum fun k : Fin n => F i (ω k)) - μ[fun x => F i x]|
≤ 10 * vcLocalizedSlope K dPi n * norm (F i) + 5 * (vcLocalizedSlope K dPi n) ^ 2
Proof (Lean source)
theorem vc_localized_deviation_event_of_card (F : ι → 𝒳 → ℝ) (norm : (𝒳 → ℝ) → ℝ) (π : ι → 𝒳 → Bool) (μ : Measure 𝒳) [IsProbabilityMeasure μ] (hF_meas : ∀ i, Measurable (F i)) (b : ℝ) (hb : 0 ≤ b) (hbound : ∀ i x, |F i x| ≤ b) (hnorm_nonneg : ∀ i, 0 ≤ norm (F i)) (hvariance : ∀ i, variance (F i) μ ≤ norm (F i) ^ 2) (hfactor : ∀ {m : ℕ} (S : Fin m → 𝒳), ∃ φ : Fin m → Bool → ℝ, ∀ i j, F i (S j) = φ j (π i (S j))) (K : ℝ) (dPi n : ℕ) (hK : (1 : ℝ) ≤ K) (hn : 0 < n) (hcard : ∀ (m : ℕ) (S : Fin m → 𝒳), (growthFamily π S).card ≤ (m + 1) ^ dPi) (Hloc : SamplewiseLocalizedVCDudleyHypotheses F norm) {δ : ℝ} (hδ : 0 < δ) (hδ' : δ ≤ 1) (hρ_le_b : vcLocalizedSlope K dPi n ≤ b) (hδ_dom : PeelingCondition b δ (vcLocalizedSlope K dPi n) n) : ∃ E : Set (Fin n → 𝒳), MeasurableSet E ∧ Measure.pi (fun _ => μ) E ≥ 1 - ofReal δ ∧ ∀ ω ∈ E, ∀ i : ι, 0 ≤ norm (F i) → norm (F i) ≤ b → |(n : ℝ)⁻¹ * (Finset.univ.sum fun k : Fin n => F i (ω k)) - μ[fun x => F i x]| ≤ 10 * vcLocalizedSlope K dPi n * norm (F i) + 5 * (vcLocalizedSlope K dPi n) ^ 2 := by classical have hK0 : 0 ≤ K := le_trans zero_le_one hK let R : LocalizedRegime 𝒳 ι 𝒳 F norm μ id := vcLocalizedRegime_of_card F norm π μ id b hb (by simpa using hbound) (by simpa using hvariance) hfactor K dPi hK hcard Hloc let ρ : ℝ := vcLocalizedSlope K dPi n have hρ_pos : 0 < ρ := vcLocalizedSlope_pos hK0 hn have hcrit_eq : criticalRadius (R.ψ n) = ρ := by dsimp [R, vcLocalizedRegime_of_card, vcLocalizedPsi, ρ] exact criticalRadius_linear_eq hρ_pos have hcrit_le_ρ : criticalRadius (R.ψ n) ≤ ρ := by rw [hcrit_eq] have hcrit_pos : 0 < criticalRadius (R.ψ n) := by rw [hcrit_eq] exact hρ_pos have hrad_bdd : ∀ r : ℝ, ρ ≤ r → ∀ S : Fin n → 𝒳, ∀ σ : Signs n, BddAbove (Set.range fun p : starHullParam ι => |(n : ℝ)⁻¹ * ∑ k : Fin n, (σ k : ℝ) * starHullZeroOut F norm r p (S k)|) := by intro r _hr exact fun S σ => starHullZeroOut_bddAbove_of_bound F norm hb n r S (fun i k => hbound i _) σ have hrad_int : ∀ r : ℝ, ρ ≤ r → Integrable (fun ω : Fin n → 𝒳 => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω)) (Measure.pi (fun _ => μ)) := by intro r hr exact vc_starHullZeroOut_empirical_rademacher_integrable_of_card F norm π μ hF_meas b hb hbound hfactor K dPi n hK hn hcard Hloc r hr rcases localized_uniform_deviation_peeled F norm μ id measurable_id hF_meas hnorm_nonneg R hδ hδ' n hn (ρ := ρ) (Rmax := b) hcrit_le_ρ hρ_pos hcrit_pos hrad_bdd hrad_int (by simpa [PeelingCondition, R, ρ, vcLocalizedRegime_of_card] using hδ_dom) with ⟨E, hE_meas, hE_prob, hE_bound⟩ refine ⟨E, hE_meas, hE_prob, ?_⟩ intro ω hω i hi_nonneg hi_b simpa [R, ρ] using hE_bound ω hω i hi_nonneg hi_b
7 supporting declarations (lemmas, instances)
  • criticalRadius_linear_eq lemma — The critical radius of a positive-slope linear envelope equals its slope, giving the exact fixed-point scale for a localized empirical-process bound.
    C :
    ℝ
    hC :
    0 < C
    criticalRadius (fun r : ℝ => C * r) = C
    Proof (Lean source)
    lemma criticalRadius_linear_eq {C : ℝ} (hC : 0 < C) : criticalRadius (fun r : ℝ => C * r) = C := by apply le_antisymm · exact criticalRadius_linear_le hC · rw [criticalRadius] apply le_csInf · exact ⟨C, hC, by rw [pow_two]⟩ · rintro δ ⟨hδ_pos, hδ⟩ have hδ' : C * δ ≤ δ * δ := by simpa [pow_two] using hδ nlinarith [hδ', hδ_pos]
    Causalean.Stat.Concentration.criticalRadius_linear_eq · Causalean/Stat/Concentration/Covering/VCUniformDeviation.lean:45
  • vcLocalizedPsi_criticalRadius_fp lemma — For the finite-VC localized envelope, its value at the critical radius is no larger than the square of that radius.
    K :
    ℝ
    d n :
    ℕ
    hK :
    0 ≤ K
    hn :
    0 < n
    Proof (Lean source)
    lemma vcLocalizedPsi_criticalRadius_fp {K : ℝ} {d n : ℕ} (hK : 0 ≤ K) (hn : 0 < n) : vcLocalizedPsi K d n (criticalRadius (vcLocalizedPsi K d n)) ≤ (criticalRadius (vcLocalizedPsi K d n)) ^ 2 := by let ρ := vcLocalizedSlope K d n have hρ_pos : 0 < ρ := vcLocalizedSlope_pos hK hn have hcrit_eq : criticalRadius (vcLocalizedPsi K d n) = ρ := by unfold vcLocalizedPsi exact criticalRadius_linear_eq hρ_pos rw [hcrit_eq] unfold vcLocalizedPsi ρ rw [pow_two]
    Causalean.Stat.Concentration.vcLocalizedPsi_criticalRadius_fp · Causalean/Stat/Concentration/Covering/VCUniformDeviation.lean:59
  • ciSup_prod_eq_of_bddAbove lemma — The bounded supremum of a real-valued quantity indexed by two choices is unchanged when the two choices are optimized one after the other.
    A B :
    Type*
    Nonempty A
    Nonempty B
    f :
    A → B → ℝ
    hb :
    BddAbove (Set.range fun p : A × B => f p.1 p.2)
    (⨆ p : A × B, f p.1 p.2) = ⨆ b : B, ⨆ a : A, f a b
    Proof (Lean source)
    lemma ciSup_prod_eq_of_bddAbove {A B : Type*} [Nonempty A] [Nonempty B] (f : A → B → ℝ) (hb : BddAbove (Set.range fun p : A × B => f p.1 p.2)) : (⨆ p : A × B, f p.1 p.2) = ⨆ b : B, ⨆ a : A, f a b := by classical have hinner_bdd : ∀ b : B, BddAbove (Set.range fun a : A => f a b) := by intro b rcases hb with ⟨M, hM⟩ refine ⟨M, ?_⟩ rintro _ ⟨a, rfl⟩ exact hM ⟨(a, b), rfl⟩ have houter_bdd : BddAbove (Set.range fun b : B => ⨆ a : A, f a b) := by rcases hb with ⟨M, hM⟩ refine ⟨M, ?_⟩ rintro _ ⟨b, rfl⟩ exact ciSup_le fun a => hM ⟨(a, b), rfl⟩ apply le_antisymm · refine ciSup_le ?_ intro p exact le_trans (le_ciSup (hinner_bdd p.2) p.1) (le_ciSup houter_bdd p.2) · refine ciSup_le ?_ intro b refine ciSup_le ?_ intro a exact le_ciSup hb (a, b)
    Causalean.Stat.Concentration.ciSup_prod_eq_of_bddAbove · Causalean/Stat/Concentration/Covering/VCUniformDeviation.lean:74
  • vc_starHullZeroOut_empirical_rademacher_aemeasurable lemma — Measurability bridge for the empirical Rademacher process of the finite-VC localized star hull.
    ι :
    Type u
    shared
    𝒳 :
    Type v
    shared
    Nonempty ι
    Countable ι
    F :
    ι → 𝒳 → ℝ
    norm :
    (𝒳 → ℝ) → ℝ
    hF_meas :
    ∀ i, Measurable (F i)
    μ :
    Measure 𝒳
    b r :
    ℝ
    hb :
    0 ≤ b
    hbound :
    ∀ i x, |F i x| ≤ b
    n :
    ℕ
    AEMeasurable (fun ω : Fin n → 𝒳 => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω)) (Measure.pi (fun _ => μ))
    Proof (Lean source)
    lemma vc_starHullZeroOut_empirical_rademacher_aemeasurable [MeasurableSpace 𝒳] [Nonempty ι] [Countable ι] (F : ι → 𝒳 → ℝ) (norm : (𝒳 → ℝ) → ℝ) (hF_meas : ∀ i, Measurable (F i)) (μ : Measure 𝒳) (b r : ℝ) (hb : 0 ≤ b) (hbound : ∀ i x, |F i x| ≤ b) (n : ℕ) : AEMeasurable (fun ω : Fin n → 𝒳 => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω)) (Measure.pi (fun _ => μ)) := by classical apply Measurable.aemeasurable unfold empiricalRademacherComplexity apply measurable_const.mul apply Finset.univ.measurable_sum intro σ _ have hsup_eq : (fun ω : Fin n → 𝒳 => ⨆ p : starHullParam ι, |(n : ℝ)⁻¹ * ∑ k : Fin n, (σ k : ℝ) * starHullZeroOut F norm r p ((id ∘ ω) k)|) = fun ω : Fin n → 𝒳 => ⨆ i : ι, starHullZeroOutScaleCoeff F norm r i * |(n : ℝ)⁻¹ * ∑ k : Fin n, (σ k : ℝ) * F i (ω k)| := by funext ω have hbdd : BddAbove (Set.range fun p : starHullParam ι => |(n : ℝ)⁻¹ * ∑ k : Fin n, (σ k : ℝ) * starHullZeroOut F norm r p ((id ∘ ω) k)|) := by simpa using starHullZeroOut_bddAbove_of_bound F norm hb n r (id ∘ ω) (fun i k => hbound i _) σ calc (⨆ p : starHullParam ι, |(n : ℝ)⁻¹ * ∑ k : Fin n, (σ k : ℝ) * starHullZeroOut F norm r p ((id ∘ ω) k)|) = ⨆ i : ι, ⨆ a : Icc (0 : ℝ) 1, |(n : ℝ)⁻¹ * ∑ k : Fin n, (σ k : ℝ) * starHullZeroOut F norm r (a, i) (ω k)| := by unfold starHullParam simpa [Function.comp_def] using ciSup_prod_eq_of_bddAbove (fun a : Icc (0 : ℝ) 1 => fun i : ι => |(n : ℝ)⁻¹ * ∑ k : Fin n, (σ k : ℝ) * starHullZeroOut F norm r (a, i) (ω k)|) hbdd _ = ⨆ i : ι, starHullZeroOutScaleCoeff F norm r i * |(n : ℝ)⁻¹ * ∑ k : Fin n, (σ k : ℝ) * F i (ω k)| := by congr ext i exact starHullZeroOut_inner_sup_eq F norm r ω σ i rw [hsup_eq] apply Measurable.iSup intro i apply measurable_const.mul apply Measurable.abs apply measurable_const.mul apply Finset.univ.measurable_sum intro k _ apply measurable_const.mul exact (hF_meas i).comp (measurable_pi_apply k)
    Causalean.Stat.Concentration.vc_starHullZeroOut_empirical_rademacher_aemeasurable · Causalean/Stat/Concentration/Covering/VCUniformDeviation.lean:129
  • vc_starHullZeroOut_empirical_rademacher_integrable lemma — Integrability of the finite-VC localized star-hull empirical Rademacher process follows from the deterministic linear envelope once the residual measurability bridge above is available.
    ι :
    Type u
    shared
    𝒳 :
    Type v
    shared
    Nonempty ι
    Countable ι
    F :
    ι → 𝒳 → ℝ
    norm :
    (𝒳 → ℝ) → ℝ
    hF_meas :
    ∀ i, Measurable (F i)
    b :
    ℝ
    hb :
    0 ≤ b
    hbound :
    ∀ i x, |F i x| ≤ b
    K :
    ℝ
    d n :
    ℕ
    hK :
    (1 : ℝ) ≤ K
    hn :
    0 < n
    r :
    ℝ
    vcLocalizedSlope K d n ≤ r
    Integrable (fun ω : Fin n → 𝒳 => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω)) (Measure.pi (fun _ => μ))
    Proof (Lean source)
    lemma vc_starHullZeroOut_empirical_rademacher_integrable [MeasurableSpace 𝒳] [Nonempty ι] [Countable ι] (F : ι → 𝒳 → ℝ) (norm : (𝒳 → ℝ) → ℝ) (μ : Measure 𝒳) [IsProbabilityMeasure μ] (hF_meas : ∀ i, Measurable (F i)) (b : ℝ) (hb : 0 ≤ b) (hbound : ∀ i x, |F i x| ≤ b) (K : ℝ) (d n : ℕ) (hK : (1 : ℝ) ≤ K) (hn : 0 < n) (Hvc : BinaryFactoredVCClass F d) (Hloc : SamplewiseLocalizedVCDudleyHypotheses F norm) : ∀ r : ℝ, vcLocalizedSlope K d n ≤ r → Integrable (fun ω : Fin n → 𝒳 => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω)) (Measure.pi (fun _ => μ)) := by intro r hr let g : (Fin n → 𝒳) → ℝ := fun ω => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω) have hr_nonneg : 0 ≤ r := le_trans (vcLocalizedSlope_nonneg K d n) hr have hg_meas : AEMeasurable g (Measure.pi (fun _ : Fin n => μ)) := by simpa [g] using vc_starHullZeroOut_empirical_rademacher_aemeasurable F norm hF_meas μ b r hb hbound n have hg_nonneg : ∀ᵐ ω : Fin n → 𝒳 ∂(Measure.pi (fun _ : Fin n => μ)), 0 ≤ g ω := by exact Filter.Eventually.of_forall fun ω => by dsimp [g] unfold empiricalRademacherComplexity refine mul_nonneg ?_ ?_ · positivity · refine Finset.sum_nonneg ?_ intro σ _ refine Real.iSup_nonneg ?_ intro p exact abs_nonneg _ have hg_upper : ∀ᵐ ω : Fin n → 𝒳 ∂(Measure.pi (fun _ : Fin n => μ)), g ω ≤ vcLocalizedPsi K d n r := by exact Filter.Eventually.of_forall fun ω => by dsimp [g] simpa using vc_starHullZeroOut_empirical_rademacher_le_linear F norm K d n hK Hvc Hloc (id ∘ ω) r hr_nonneg have hg_Icc : ∀ᵐ ω : Fin n → 𝒳 ∂(Measure.pi (fun _ : Fin n => μ)), g ω ∈ Icc 0 (vcLocalizedPsi K d n r) := by filter_upwards [hg_nonneg, hg_upper] with ω h0 h1 exact ⟨h0, h1⟩ exact integrable_bounded 0 (vcLocalizedPsi K d n r) hg_meas hg_Icc
    Causalean.Stat.Concentration.vc_starHullZeroOut_empirical_rademacher_integrable · Causalean/Stat/Concentration/Covering/VCUniformDeviation.lean:201
  • vc_starHullZeroOut_empirical_rademacher_integrable_of_card lemma — Cardinality-bound variant of the integrability bridge for the localized star-hull empirical Rademacher process.
    ι :
    Type u
    shared
    𝒳 :
    Type v
    shared
    Nonempty ι
    Countable ι
    F :
    ι → 𝒳 → ℝ
    norm :
    (𝒳 → ℝ) → ℝ
    π :
    ι → 𝒳 → Bool
    hF_meas :
    ∀ i, Measurable (F i)
    b :
    ℝ
    hb :
    0 ≤ b
    hbound :
    ∀ i x, |F i x| ≤ b
    hfactor :
    ∀ {m : ℕ} (S : Fin m → 𝒳), ∃ φ : Fin m → Bool → ℝ, ∀ i j, F i (S j) = φ j (π i (S j))
    K :
    ℝ
    dPi n :
    ℕ
    hK :
    (1 : ℝ) ≤ K
    hn :
    0 < n
    hcard :
    ∀ (m : ℕ) (S : Fin m → 𝒳), (growthFamily π S).card ≤ (m + 1) ^ dPi
    r :
    ℝ
    vcLocalizedSlope K dPi n ≤ r
    Integrable (fun ω : Fin n → 𝒳 => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω)) (Measure.pi (fun _ => μ))
    Proof (Lean source)
    lemma vc_starHullZeroOut_empirical_rademacher_integrable_of_card [MeasurableSpace 𝒳] [Nonempty ι] [Countable ι] (F : ι → 𝒳 → ℝ) (norm : (𝒳 → ℝ) → ℝ) (π : ι → 𝒳 → Bool) (μ : Measure 𝒳) [IsProbabilityMeasure μ] (hF_meas : ∀ i, Measurable (F i)) (b : ℝ) (hb : 0 ≤ b) (hbound : ∀ i x, |F i x| ≤ b) (hfactor : ∀ {m : ℕ} (S : Fin m → 𝒳), ∃ φ : Fin m → Bool → ℝ, ∀ i j, F i (S j) = φ j (π i (S j))) (K : ℝ) (dPi n : ℕ) (hK : (1 : ℝ) ≤ K) (hn : 0 < n) (hcard : ∀ (m : ℕ) (S : Fin m → 𝒳), (growthFamily π S).card ≤ (m + 1) ^ dPi) (Hloc : SamplewiseLocalizedVCDudleyHypotheses F norm) : ∀ r : ℝ, vcLocalizedSlope K dPi n ≤ r → Integrable (fun ω : Fin n → 𝒳 => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω)) (Measure.pi (fun _ => μ)) := by intro r hr let g : (Fin n → 𝒳) → ℝ := fun ω => empiricalRademacherComplexity n (starHullZeroOut F norm r) (id ∘ ω) have hr_nonneg : 0 ≤ r := le_trans (vcLocalizedSlope_nonneg K dPi n) hr have hg_meas : AEMeasurable g (Measure.pi (fun _ : Fin n => μ)) := by simpa [g] using vc_starHullZeroOut_empirical_rademacher_aemeasurable F norm hF_meas μ b r hb hbound n have hg_nonneg : ∀ᵐ ω : Fin n → 𝒳 ∂(Measure.pi (fun _ : Fin n => μ)), 0 ≤ g ω := by exact Filter.Eventually.of_forall fun ω => by dsimp [g] unfold empiricalRademacherComplexity refine mul_nonneg ?_ ?_ · positivity · refine Finset.sum_nonneg ?_ intro σ _ refine Real.iSup_nonneg ?_ intro p exact abs_nonneg _ have hg_upper : ∀ᵐ ω : Fin n → 𝒳 ∂(Measure.pi (fun _ : Fin n => μ)), g ω ≤ vcLocalizedPsi K dPi n r := by exact Filter.Eventually.of_forall fun ω => by dsimp [g] simpa using vc_starHullZeroOut_empirical_rademacher_le_linear_of_card F norm π hfactor K dPi n hK hcard Hloc (id ∘ ω) r hr_nonneg have hg_Icc : ∀ᵐ ω : Fin n → 𝒳 ∂(Measure.pi (fun _ : Fin n => μ)), g ω ∈ Icc 0 (vcLocalizedPsi K dPi n r) := by filter_upwards [hg_nonneg, hg_upper] with ω h0 h1 exact ⟨h0, h1⟩ exact integrable_bounded 0 (vcLocalizedPsi K dPi n r) hg_meas hg_Icc
    Causalean.Stat.Concentration.vc_starHullZeroOut_empirical_rademacher_integrable_of_card · Causalean/Stat/Concentration/Covering/VCUniformDeviation.lean:253
  • vc_localized_deviation_event_eventually theorem — For a measurable finite-VC function class, a nonnegative localization norm, a probability law, a nonnegative envelope and its uniform bound, the variance control, a VC tuning constant, a positive VC dimension, the samplewise localization certificate, and a confidence level in (0,1], eventually every logarithmic peeling depth covering the envelope yields the finite-VC localized deviation event without a separate peeling-arithmetic hypothesis.
    ι :
    Type u
    shared
    𝒳 :
    Type v
    shared
    F :
    ι → 𝒳 → ℝ
    norm :
    (𝒳 → ℝ) → ℝ
    hF_meas :
    ∀ i, Measurable (F i)
    b :
    ℝ
    hb :
    0 ≤ b
    hbound :
    ∀ i x, |F i x| ≤ b
    hnorm_nonneg :
    ∀ i, 0 ≤ norm (F i)
    hvariance :
    ∀ i, variance (F i) μ ≤ norm (F i) ^ 2
    K :
    ℝ
    d :
    ℕ
    hK :
    (1 : ℝ) ≤ K
    hd :
    0 < d
    δ :
    ℝ
    hδ :
    0 < δ
    hδ' :
    δ ≤ 1
    ∃ n₀ : ℕ,
    ∀ n ≥ n₀,
    ∀ L : ℕ,
    (L : ℝ)
    ≤ log ((n : ℝ) + 1) → b ≤ vcLocalizedSlope K d n * (2 : ℝ) ^ L → vcLocalizedSlope K d n ≤ b → ∃ E : Set (Fin n → 𝒳), MeasurableSet E ∧ Measure.pi (fun _ => μ) E ≥ 1
    - ofReal δ ∧
    ∀ ω ∈ E,
    ∀ i : ι,
    0
    ≤ norm (F i) → norm (F i) ≤ b → |(n : ℝ)⁻¹ * (Finset.univ.sum fun k : Fin n => F i (ω k))
    - μ[fun x => F i x]| ≤ 10 * vcLocalizedSlope K d n * norm (F i)
    + 5 * (vcLocalizedSlope K d n) ^ 2
    Proof (Lean source)
    theorem vc_localized_deviation_event_eventually (F : ι → 𝒳 → ℝ) (norm : (𝒳 → ℝ) → ℝ) (μ : Measure 𝒳) [IsProbabilityMeasure μ] (hF_meas : ∀ i, Measurable (F i)) (b : ℝ) (hb : 0 ≤ b) (hbound : ∀ i x, |F i x| ≤ b) (hnorm_nonneg : ∀ i, 0 ≤ norm (F i)) (hvariance : ∀ i, variance (F i) μ ≤ norm (F i) ^ 2) (K : ℝ) (d : ℕ) (hK : (1 : ℝ) ≤ K) (hd : 0 < d) (Hvc : BinaryFactoredVCClass F d) (Hloc : SamplewiseLocalizedVCDudleyHypotheses F norm) {δ : ℝ} (hδ : 0 < δ) (hδ' : δ ≤ 1) : ∃ n₀ : ℕ, ∀ n ≥ n₀, ∀ L : ℕ, (L : ℝ) ≤ log ((n : ℝ) + 1) → b ≤ vcLocalizedSlope K d n * (2 : ℝ) ^ L → vcLocalizedSlope K d n ≤ b → ∃ E : Set (Fin n → 𝒳), MeasurableSet E ∧ Measure.pi (fun _ => μ) E ≥ 1 - ofReal δ ∧ ∀ ω ∈ E, ∀ i : ι, 0 ≤ norm (F i) → norm (F i) ≤ b → |(n : ℝ)⁻¹ * (Finset.univ.sum fun k : Fin n => F i (ω k)) - μ[fun x => F i x]| ≤ 10 * vcLocalizedSlope K d n * norm (F i) + 5 * (vcLocalizedSlope K d n) ^ 2 := by obtain ⟨n₀, hn₀⟩ := vcLocalizedSlope_peelingCondition_eventually hb hδ hδ' hK hd refine ⟨max n₀ 1, ?_⟩ intro n hn L hL hcover hρ_le_b have hn₀n : n₀ ≤ n := (Nat.le_max_left n₀ 1).trans hn have hnpos : 0 < n := Nat.zero_lt_one.trans_le ((Nat.le_max_right n₀ 1).trans hn) exact vc_localized_deviation_event F norm μ hF_meas b hb hbound hnorm_nonneg hvariance K d n hK hnpos Hvc Hloc hδ hδ' hρ_le_b (hn₀ n hn₀n L hL hcover)
    Causalean.Stat.Concentration.vc_localized_deviation_event_eventually · Causalean/Stat/Concentration/Covering/VCUniformDeviation.lean:488