Mathesis

The fundamental theorem of statistical learning. For a measurable concept class, finite VC dimension, eventually polynomial growth, and PAC learnability are mutually equivalent.

DeclvcDim_fundamental_theorem
∀ {X : Type u} [inst : MeasurableSpace X] [MeasurableSingletonClass X] (C : ConceptClass X Bool)
  [MeasurableConceptClass X C],
  (VCDim X C < ⊤ ↔ PACLearnable X C) ∧
    (VCDim X C < ⊤ ↔ ∃ K d, ∀ᶠ (m : ℕ) in Filter.atTop, ↑(GrowthFunction X C m) ≤ K * ↑m ^ d)
Layout
ThesisStepDefinition
vcDim_fundamental_theoremtheoremvcDim_lt_top_iff_pacLearn…theoremvc_characterizationtheoremvcdim_finite_imp_pactheoremvcdim_finite_imp_uc'theoremuc_bad_event_le_delta_pro…theoremsymmetrization_uc_boundtheoremsymmetrization_step_lowertheoremsymmetrization_steptheoremdouble_sample_pattern_bou…theoremexchangeability_chain_bou…theoremcongr_simptheoremrestriction_pattern_counttheoremrademacher_mgf_boundtheoremcosh_le_exp_sq_halftheoremfinite_exchangeability_bo…theoremgrowth_exp_le_deltatheoremsum_choose_le_exp_powtheorempow_mul_exp_neg_le_factor…theoremgrowth_function_le_two_powtheoremhoeffding_one_sided_uppertheoremhoeffding_one_sidedtheoremuc_imp_pactheoremoutput_in_Htheoremhmeas_Ctheoremmem_measurabletheoremhc_meastheoremall_measurabletheoremhWBtheoremwellBehavedtheorempac_imp_vcdim_finitetheoremvcdim_infinite_not_pactheoremuniformMeasure_isProbabil…theoremnfl_counting_coretheoremper_sample_labeling_boundtheoremvcDim_lt_top_iff_growth_p…theoremvcDim_lt_top_of_growth_po…theoremtwo_pow_le_growthFunction…theoremshatters_of_subsettheoremgrowthFunction_ge_two_pow…theoremrestrictionSet_ncard_le_g…theoremrestrictionSet_ncard_le_t…theoremgrowthFunction_eqtheoremrestrictionSet_eq_univ_of…theoremno_eventually_two_pow_le_…theoremvcDim_finite_imp_growth_p…theoremvcdim_finite_imp_growth_b…theoremBatchLearnerstructurehypothesesdeflearndefConceptClassdefEmpiricalErrordefConceptdefGrowthFunctiondefHasUniformConvergencedefHypothesisSpacedefIsConsistentWithdefMeasurableConceptClassstructurePACLearnabledefShattersdefSignVectordefTrueErrordefTrueErrorRealdefVCDimdefWellBehavedVCdefboolToSigndefrestrictionSetdefuniformMeasuredefzeroOneLossdef
  1. DeclvcDim_fundamental_theoremDeclaration kindtheorem
    ∀ {X : Type u} [inst : MeasurableSpace X] [MeasurableSingletonClass X] (C : ConceptClass X Bool)
      [MeasurableConceptClass X C],
      (VCDim X C < ⊤ ↔ PACLearnable X C) ∧
        (VCDim X C < ⊤ ↔ ∃ K d, ∀ᶠ (m : ℕ) in Filter.atTop, ↑(GrowthFunction X C m) ≤ K * ↑m ^ d)
    Uses
  2. DeclvcDim_lt_top_iff_pacLearnableDeclaration kindtheorem

    Finite VC dimension ⟺ PAC learnability. The measure-theoretic half: VCDim X C < ⊤ exactly when C is PAC learnable. This is the kernel's vc_characterization, surfaced for the independent module; it requires the domain's measurability structure.

    ∀ {X : Type u} [inst : MeasurableSpace X] [MeasurableSingletonClass X] (C : ConceptClass X Bool)
      [MeasurableConceptClass X C], VCDim X C < ⊤ ↔ PACLearnable X C
    Uses
    Used by
  3. Declvc_characterizationDeclaration kindtheorem

    VC characterization: C is PAC-learnable iff VCDim(C) < ∞.

    PROOF DECOMPOSITION: This theorem factors through the two directions above: ← : vcdim_finite_imp_uc + uc_imp_pac (in Generalization.lean) → : pac_imp_vcdim_finite (contrapositive via double-sample)

    HC at this joint: The ← direction crosses from combinatorics (VCDim, GrowthFunction) to measure theory (Measure.pi, TrueError). The → direction crosses from measure theory back to combinatorics. Both crossings have HC > 0.

    UK₈: The ↔ hides an ASYMMETRY: the ← proof is constructive (produces ERM), while the → proof is non-constructive (produces hard distribution).

    ∀ (X : Type u) [inst : MeasurableSpace X] [MeasurableSingletonClass X] (C : ConceptClass X Bool)
      [MeasurableConceptClass X C], PACLearnable X C ↔ VCDim X C < ⊤
    Uses
    Used by
  4. Declvcdim_finite_imp_pacDeclaration kindtheorem

    Direction ←: finite VCDim implies PAC learnability.

    PROOF ROUTE (via new infrastructure in Generalization.lean): Step 1: VCDim < ∞ → HasUniformConvergence (vcdim_finite_imp_uc) Sub-step 1a: Sauer-Shelah gives GrowthFunction bound Sub-step 1b: Symmetrization reduces UC to growth function counting Sub-step 1c: Concentration inequality closes the bound Step 2: HasUniformConvergence → PACLearnable (uc_imp_pac) Sub-step 2a: Construct ERM learner Sub-step 2b: ERM is consistent in realizable case Sub-step 2c: Consistent + UC → low TrueError

    KU₁₈: C.Nonempty is needed for ERM but not stated as hypothesis. If C = ∅, then PACLearnable is vacuously true (∀ c ∈ C, ... is vacuous). But ERM needs a fallback hypothesis from C. Is this a genuine gap or does the empty case work out vacuously?

    Counterdefinition (COUNTER-4): If the ERM approach fails for computational reasons (ERM is noncomputable, and we need a computable learner for computational learning theory), swap to the compression-based proof: VCDim < ∞ → finite compression scheme (Moran-Yehudayoff 2016) → compression scheme learner is PAC. Swap condition: When proving COMPUTATIONAL PAC learnability (polynomial time).

    ∀ (X : Type u) [inst : MeasurableSpace X] [MeasurableSingletonClass X] (C : ConceptClass X Bool),
      VCDim X C < ⊤ → ∀ [MeasurableConceptClass X C], PACLearnable X C
    Uses
    Used by
  5. Declvcdim_finite_imp_uc'Declaration kindtheorem

    Finite VCDim implies uniform convergence. Proof: VCDim < ∞ → UC.

    • Finite X: direct Hoeffding per-hypothesis + finite union bound.
    • Infinite X: Sauer-Shelah → symmetrization + growth function → UC.
    ∀ (X : Type u) [inst : MeasurableSpace X] (C : ConceptClass X Bool),
      VCDim X C < ⊤ →
        (∀ h ∈ C, Measurable h) → (∀ (c : Concept X Bool), Measurable c) → WellBehavedVC X C → HasUniformConvergence X C
    Uses
    Used by
  6. Decluc_bad_event_le_delta_provedDeclaration kindtheorem

    UC bad-event bound: for m ≥ m₀(v,ε,δ), the probability of the bad event (∃ h with |TrueErr-EmpErr| ≥ ε) is at most δ. Composes symmetrization_uc_bound with growth_exp_le_delta.

    ∀ {X : Type u} [inst : MeasurableSpace X] [Infinite X] (D : MeasureTheory.Measure X)
      [MeasureTheory.IsProbabilityMeasure D] (C : ConceptClass X Bool) (c : Concept X Bool),
      (∀ h ∈ C, Measurable h) →
        Measurable c →
          ∀ (m : ℕ),
            0 < m →
              ∀ (ε δ : ℝ),
                0 < ε →
                  0 < δ →
                    δ < 1 →
                      ∀ (v : ℕ),
                        0 < v →
                          (∀ (n : ℕ), v ≤ n → GrowthFunction X C n ≤ ∑ i ∈ Finset.range (v + 1), n.choose i) →
                            (16 * Real.exp 1 * (↑v + 1) / ε ^ 2) ^ (v + 1) / δ ≤ ↑m →
                              MeasureTheory.NullMeasurableSet
                                  {p |
                                    ∃ h ∈ C,
                                      EmpiricalError X Bool h (fun i => (p.2 i, c (p.2 i))) (zeroOneLoss Bool) -
                                          EmpiricalError X Bool h (fun i => (p.1 i, c (p.1 i))) (zeroOneLoss Bool) ≥
                                        ε / 2}
                                  ((MeasureTheory.Measure.pi fun x => D).prod (MeasureTheory.Measure.pi fun x => D)) →
                                (MeasureTheory.Measure.pi fun x => D)
                                    {xs |
                                      ∃ h ∈ C,
                                        |TrueErrorReal X h c D -
                                              EmpiricalError X Bool h (fun i => (xs i, c (xs i))) (zeroOneLoss Bool)| ≥
                                          ε} ≤
                                  ENNReal.ofReal δ
    Uses
    Used by
  7. Declsymmetrization_uc_boundDeclaration kindtheorem

    The symmetrization uniform convergence bound: two-sided version. P[∃h∈C: |TrueErr-EmpErr| ≥ ε] ≤ 4·GF(C,2m)·exp(-mε²/8).

    Proof strategy (4 steps):

    1. Decompose absolute value: |TrueErr - EmpErr| ≥ ε ↔ (TrueErr - EmpErr ≥ ε) ∨ (EmpErr - TrueErr ≥ ε)

    have abs_decomp : ∀ (a b : ℝ), |a - b| ≥ ε ↔ a - b ≥ ε ∨ b - a ≥ ε := by intro a b; constructor · intro h; by_cases h' : a - b ≥ ε · exact Or.inl h' · exact Or.inr (by linarith [abs_sub_comm a b, le_abs_self (a - b)]) · intro h; cases h with | inl h => exact le_trans (le_of_eq (abs_of_nonneg (by linarith))) (by linarith) | inr h => exact le_trans (le_of_eq (abs_of_nonpos (by linarith) ▸ ...)) ...

    2. Upper tail: P[∃h∈C: TrueErr-EmpErr ≥ ε] ≤ 2·GF(C,2m)·exp(-mε²/8)

    • Direct application of symmetrization_step + double_sample_pattern_bound.

    3. Lower tail: P[∃h∈C: EmpErr-TrueErr ≥ ε] ≤ 2·GF(C,2m)·exp(-mε²/8)

    • Apply the symmetric argument: swap roles of S and S' in the double sample.
    • Equivalently, apply symmetrization_step to the event EmpErr-TrueErr ≥ ε and bound the double-sample event {EmpErr_S - EmpErr_{S'} ≥ ε/2}.
    • The bound is symmetric because D^m ⊗ D^m is symmetric under swapping factors. have swap_symmetry : DoubleSampleMeasure D m {p | ∃ h ∈ C, EmpErr(S) - EmpErr(S') ≥ ε/2} = DoubleSampleMeasure D m {p | ∃ h ∈ C, EmpErr(S') - EmpErr(S) ≥ ε/2} := Measure.prod_swap ...

    4. Union bound: P[|gap| ≥ ε] ≤ P[gap ≥ ε] + P[gap ≤ -ε] ≤ 2·GF·exp(...) + 2·GF·exp(...) = 4·GF(C,2m)·exp(-mε²/8)

    -- Uses: MeasureTheory.measure_union_le for the union of two events -- CAST: 2 * X + 2 * X = 4 * X in ENNReal (need ENNReal.add_mul or similar)

    References: SSBD Theorem 6.7, Kakade-Tewari Lecture 19

    ∀ {X : Type u} [inst : MeasurableSpace X] [Infinite X] (D : MeasureTheory.Measure X)
      [MeasureTheory.IsProbabilityMeasure D] (C : ConceptClass X Bool) (c : Concept X Bool),
      (∀ h ∈ C, Measurable h) →
        Measurable c →
          ∀ (m : ℕ),
            0 < m →
              ∀ (ε : ℝ),
                0 < ε →
                  2 * Real.log 2 ≤ ↑m * ε ^ 2 →
                    MeasureTheory.NullMeasurableSet
                        {p |
                          ∃ h ∈ C,
                            EmpiricalError X Bool h (fun i => (p.2 i, c (p.2 i))) (zeroOneLoss Bool) -
                                EmpiricalError X Bool h (fun i => (p.1 i, c (p.1 i))) (zeroOneLoss Bool) ≥
                              ε / 2}
                        ((MeasureTheory.Measure.pi fun x => D).prod (MeasureTheory.Measure.pi fun x => D)) →
                      (MeasureTheory.Measure.pi fun x => D)
                          {xs |
                            ∃ h ∈ C,
                              |TrueErrorReal X h c D -
                                    EmpiricalError X Bool h (fun i => (xs i, c (xs i))) (zeroOneLoss Bool)| ≥
                                ε} ≤
                        ENNReal.ofReal (4 * ↑(GrowthFunction X C (2 * m)) * Real.exp (-(↑m * ε ^ 2 / 8)))
    Uses
    Used by
  8. Declsymmetrization_step_lowerDeclaration kindtheorem

    Symmetrization step for the lower tail: P[∃h: EmpErr-TrueErr ≥ ε] ≤ 2·P_{double}[∃h: EmpErr_S-EmpErr_{S'} ≥ ε/2].

    Mirror of symmetrization_step for the opposite direction. Uses hoeffding_one_sided_upper instead of hoeffding_one_sided.

    ∀ {X : Type u} [inst : MeasurableSpace X] (D : MeasureTheory.Measure X) [MeasureTheory.IsProbabilityMeasure D]
      (C : ConceptClass X Bool) (c : Concept X Bool),
      (∀ h ∈ C, Measurable h) →
        Measurable c →
          ∀ (m : ℕ),
            0 < m →
              ∀ (ε : ℝ),
                0 < ε →
                  2 * Real.log 2 ≤ ↑m * ε ^ 2 →
                    (MeasureTheory.Measure.pi fun x => D)
                        {xs |
                          ∃ h ∈ C,
                            EmpiricalError X Bool h (fun i => (xs i, c (xs i))) (zeroOneLoss Bool) - TrueErrorReal X h c D ≥
                              ε} ≤
                      2 *
                        ((MeasureTheory.Measure.pi fun x => D).prod (MeasureTheory.Measure.pi fun x => D))
                          {p |
                            ∃ h ∈ C,
                              EmpiricalError X Bool h (fun i => (p.1 i, c (p.1 i))) (zeroOneLoss Bool) -
                                  EmpiricalError X Bool h (fun i => (p.2 i, c (p.2 i))) (zeroOneLoss Bool) ≥
                                ε / 2}
    Uses
    Used by
  9. Declsymmetrization_stepDeclaration kindtheorem

    Symmetrization: the probability of a large gap TrueErr-EmpErr is at most twice the probability of a large gap EmpErr'-EmpErr on the double sample.

    Proof strategy (6 steps):

    1. Witness selection: For S in the bad event, ∃h* ∈ C with TrueErr(h) - EmpErr_S(h) ≥ ε.

    -- In the bad event set, extract h* by classical choice have h_witness : ∀ xs ∈ bad_event, ∃ h* ∈ C, TrueErrorReal X h* c D - EmpiricalError X Bool h* (sample xs) (zeroOneLoss Bool) ≥ ε

    2. Ghost sample mean: E_{S'}[EmpErr_{S'}(h)] = TrueErr(h) ≥ EmpErr_S(h*) + ε.

    • Uses: MeasureTheory.integral_pi to compute E[EmpErr] over product measure.
    • KEY LEMMA: For fixed h, E_{D^m}[EmpiricalError(h,S)] = TrueErrorReal(h,c,D). This is because EmpErr = (1/m)∑ indicator(x_i), and E[indicator(x_i)] = TrueErrorReal. have expected_emp_err : ∀ h* : Concept X Bool, ∫ xs, EmpiricalError X Bool h* (sample xs) (zeroOneLoss Bool) ∂(Measure.pi (fun _ : Fin m => D)) = TrueErrorReal X h* c D := by ...

    3. Hoeffding on ghost sample: P_{S'}[EmpErr_{S'}(h) < TrueErr(h) - ε/2] ≤ exp(-mε²/2).

    • Apply hoeffding_one_sided with t = ε/2.
    • The hm_large hypothesis ensures exp(-mε²/2) < 1/2: 2·ln2 ≤ mε² ⟹ mε²/2 ≥ ln2 ⟹ exp(-mε²/2) ≤ 1/2. have hoeffding_ghost : ∀ h* ∈ C, Measure.pi (fun _ : Fin m => D) {xs' | EmpiricalError X Bool h* (sample xs') (zeroOneLoss Bool) < TrueErrorReal X h* c D - ε/2} ≤ ENNReal.ofReal (Real.exp (-m * (ε/2)^2 * 2)) := by intro h* _; exact hoeffding_one_sided D h* c m hm (ε/2) (by linarith) (by ...) (by ...)

    4. Complementary probability: P_{S'}[EmpErr_{S'}(h) - EmpErr_S(h) ≥ ε/2] ≥ 1/2.

    • From step 2: TrueErr(h) ≥ EmpErr_S(h) + ε
    • From step 3: P[EmpErr_{S'} ≥ TrueErr - ε/2] ≥ 1/2
    • Chain: EmpErr_{S'} ≥ TrueErr - ε/2 ≥ EmpErr_S + ε - ε/2 = EmpErr_S + ε/2

    5. Conditional to unconditional: The witness h* from step 1 also witnesses the double-sample event ∃h∈C: EmpErr'-EmpErr ≥ ε/2. So: P_{S'}[double event | S bad] ≥ 1/2.

    have conditional_bound : ∀ xs ∈ bad_event, Measure.pi (fun _ : Fin m => D) {xs' | ∃ h ∈ C, EmpiricalError ... xs' - EmpiricalError ... xs ≥ ε/2} ≥ ENNReal.ofReal (1/2) := by ...

    6. Fubini integration: By Measure.prod_apply and Fubini: P_{S,S'}[double event] = ∫_S P_{S'}[double event | S] ≥ (1/2) · P_S[bad event] ⟹ P_S[bad event] ≤ 2 · P_{S,S'}[double event].

    -- Uses: MeasureTheory.Measure.prod_apply or lintegral_prod -- MEASURABILITY: the double-sample event is measurable as a finite union -- of sets of the form {(xs,xs') | EmpErr'(h) - EmpErr(h) ≥ ε/2} for h ∈ C. -- Since C may be infinite, measurability requires care: the sup over h -- must be shown to be measurable. For finite restriction patterns (≤ 2^m -- on Fin m → Bool), this is a finite union.

    MEASURABILITY CONCERNS:

    • {xs | ∃ h ∈ C, ...} is NOT obviously measurable for infinite C. Strategy: decompose via restriction patterns. On any fixed xs, the set of labelings {(h(xs 0), ..., h(xs(m-1))) | h ∈ C} has at most GF(C,m) ≤ 2^m elements. So the ∃h event is a finite union of measurable sets.
    • EmpiricalError is a finite sum of measurable functions, hence measurable.
    • The product σ-algebra on (Fin m → X) × (Fin m → X) is generated by cylinder sets, and our events are in this σ-algebra.

    References: SSBD Lemma 4.5, Kakade-Tewari Lecture 19 Lemma 1

    ∀ {X : Type u} [inst : MeasurableSpace X] (D : MeasureTheory.Measure X) [MeasureTheory.IsProbabilityMeasure D]
      (C : ConceptClass X Bool) (c : Concept X Bool),
      (∀ h ∈ C, Measurable h) →
        Measurable c →
          ∀ (m : ℕ),
            0 < m →
              ∀ (ε : ℝ),
                0 < ε →
                  2 * Real.log 2 ≤ ↑m * ε ^ 2 →
                    (MeasureTheory.Measure.pi fun x => D)
                        {xs |
                          ∃ h ∈ C,
                            TrueErrorReal X h c D - EmpiricalError X Bool h (fun i => (xs i, c (xs i))) (zeroOneLoss Bool) ≥
                              ε} ≤
                      2 *
                        ((MeasureTheory.Measure.pi fun x => D).prod (MeasureTheory.Measure.pi fun x => D))
                          {p |
                            ∃ h ∈ C,
                              EmpiricalError X Bool h (fun i => (p.2 i, c (p.2 i))) (zeroOneLoss Bool) -
                                  EmpiricalError X Bool h (fun i => (p.1 i, c (p.1 i))) (zeroOneLoss Bool) ≥
                                ε / 2}
    Uses
    Used by
  10. Decldouble_sample_pattern_boundDeclaration kindtheorem

    On the double sample, the probability that any hypothesis has EmpErr' - EmpErr ≥ ε/2 is bounded by GF(C,2m) · exp(-mε²/8).

    Proof strategy (Approach A — standard exchangeability, 5 steps):

    1. EXCHANGEABILITY: Under D^m ⊗ D^m, the 2m draws z₁,...,z_{2m} are iid from D. The joint distribution is invariant under permutations of {1,...,2m}.

    Key lemma: P_{D^m⊗D^m}[event(S,S')] = E_z[P_{split}[event | z]] where z = merged sample and the split is uniformly random among all C(2m,m) ways to partition z into two groups of m.

    -- Measure.pi permutation invariance have pi_perm_invariant : ∀ (σ : Equiv.Perm (Fin (2*m))), (Measure.pi (fun _ : Fin (2*m) => D)).map (fun z i => z (σ i)) = Measure.pi (fun _ : Fin (2*m) => D) := by ... -- Consequence: the event probability equals the split-averaged probability have exchangeability : DoubleSampleMeasure D m {p | ∃ h ∈ C, gap(p) ≥ ε/2} = ∫ z, SplitMeasure m {vs | ∃ h ∈ C, gap(split z vs) ≥ ε/2} ∂(Measure.pi (fun _ : Fin (2*m) => D)) := by ...

    2. CONDITIONING: For fixed merged sample z of 2m points:

    • C restricts to at most GF(C,2m) distinct labeling patterns on z (deterministic).
    • For each pattern p, define: diff(p, split) = EmpErr_{S'}(p) - EmpErr_S(p) = (1/m) ∑_{i∈S'} a_i - (1/m) ∑_{i∈S} a_i where a_i = 1[pattern(z_i) ≠ c(z_i)] ∈ {0,1}.
    -- Number of distinct patterns have num_patterns : ∀ (z : MergedSample X m), Set.ncard {p : Fin (2*m) → Bool | ∃ h ∈ C, ∀ i, p i = (h (z i) ≠ c (z i))} ≤ GrowthFunction X C (2*m) := by ...

    3. PER-PATTERN HOEFFDING ON SPLITS: For fixed z and fixed pattern p: Under uniformly random split (S,S') of z into two groups of m: diff(p, split) = (1/m) ∑_{i∈S'} a_i - (1/m) ∑_{i∈S} a_i

    This is a function of the random partition. By Hoeffding's inequality for sampling without replacement (Serfling 1974): P_split[diff ≥ ε/2] ≤ exp(-mε²/8)

    Alternative derivation: Hoeffding without replacement from Hoeffding with replacement (iid signs) via coupling. The without-replacement bound is actually TIGHTER (variance reduction), but the with-replacement bound suffices.

    -- Per-pattern concentration have per_pattern_bound : ∀ (z : MergedSample X m) (a : Fin (2*m) → ℝ) (ha : ∀ i, a i ∈ Set.Icc 0 1), SplitMeasure m {vs | (1/m) * ∑ i ∈ second_group vs, a i - (1/m) * ∑ i ∈ first_group vs, a i ≥ ε/2} ≤ ENNReal.ofReal (Real.exp (-(m : ℝ) * (ε/2)^2 / 2)) := by ... -- Note: m*(ε/2)^2/2 = mε²/8

    4. UNION BOUND: P_split[∃ pattern: diff ≥ ε/2 | z] ≤ (number of patterns) · max_pattern P_split[diff ≥ ε/2] ≤ GF(C,2m) · exp(-mε²/8)

    have union_bound : ∀ (z : MergedSample X m), SplitMeasure m {vs | ∃ h ∈ C, gap(split z vs, h) ≥ ε/2} ≤ ENNReal.ofReal (GrowthFunction X C (2*m) * Real.exp (-(m : ℝ) * ε^2 / 8)) := by ...

    5. INTEGRATE: P_{D^m⊗D^m}[event] = E_z[P_split[event|z]] (by step 1) ≤ E_z[GF(C,2m) · exp(-mε²/8)] (by step 4, pointwise) = GF(C,2m) · exp(-mε²/8) (bound is independent of z)

    -- The bound is a constant, so integrating gives the same constant -- (using IsProbabilityMeasure for the 2m-fold product)

    Infrastructure needed:

    • Fin.sumFinEquiv : Fin m ⊕ Fin n ≃ Fin (m + n) (available in Mathlib)
    • mergeSamples / splitMergedSample (defined above)
    • SplitMeasure and ValidSplit (defined above)
    • Measure.pi permutation invariance (to be proved or imported)
    • Hoeffding for sampling without replacement
    • GrowthFunction on 2m points + sauer_shelah_exp_bound from Rademacher.lean

    MEASURABILITY CONCERNS:

    • The merged sample z ↦ P_split[event|z] must be measurable as a function of z. Since the event is a finite union over patterns, and each pattern's indicator is a measurable function of z (finite evaluation), this follows.
    • GrowthFunction X C (2*m) is a natural number (deterministic), no measurability issue.

    References: SSBD Theorem 6.7, Hoeffding (1963), Serfling (1974)

    ∀ {X : Type u} [inst : MeasurableSpace X] [Infinite X] (D : MeasureTheory.Measure X)
      [MeasureTheory.IsProbabilityMeasure D] (C : ConceptClass X Bool) (c : Concept X Bool),
      (∀ h ∈ C, Measurable h) →
        Measurable c →
          ∀ (m : ℕ),
            0 < m →
              ∀ (ε : ℝ),
                0 < ε →
                  MeasureTheory.NullMeasurableSet
                      {p |
                        ∃ h ∈ C,
                          EmpiricalError X Bool h (fun i => (p.2 i, c (p.2 i))) (zeroOneLoss Bool) -
                              EmpiricalError X Bool h (fun i => (p.1 i, c (p.1 i))) (zeroOneLoss Bool) ≥
                            ε / 2}
                      ((MeasureTheory.Measure.pi fun x => D).prod (MeasureTheory.Measure.pi fun x => D)) →
                    ((MeasureTheory.Measure.pi fun x => D).prod (MeasureTheory.Measure.pi fun x => D))
                        {p |
                          ∃ h ∈ C,
                            EmpiricalError X Bool h (fun i => (p.2 i, c (p.2 i))) (zeroOneLoss Bool) -
                                EmpiricalError X Bool h (fun i => (p.1 i, c (p.1 i))) (zeroOneLoss Bool) ≥
                              ε / 2} ≤
                      ENNReal.ofReal (↑(GrowthFunction X C (2 * m)) * Real.exp (-(↑m * ε ^ 2 / 8)))
    Uses
    Used by
  11. Declexchangeability_chain_boundDeclaration kindtheorem
    ∀ {X : Type u} [inst : MeasurableSpace X] [Infinite X] (D : MeasureTheory.Measure X)
      [MeasureTheory.IsProbabilityMeasure D] (C : ConceptClass X Bool) (c : Concept X Bool),
      (∀ h ∈ C, Measurable h) →
        Measurable c →
          ∀ (m : ℕ),
            0 < m →
              ∀ (ε : ℝ),
                0 < ε →
                  ε ≤ 2 →
                    Set.Nonempty C →
                      MeasureTheory.NullMeasurableSet
                          {p |
                            ∃ h ∈ C,
                              EmpiricalError X Bool h (fun i => (p.2 i, c (p.2 i))) (zeroOneLoss Bool) -
                                  EmpiricalError X Bool h (fun i => (p.1 i, c (p.1 i))) (zeroOneLoss Bool) ≥
                                ε / 2}
                          ((MeasureTheory.Measure.pi fun x => D).prod (MeasureTheory.Measure.pi fun x => D)) →
                        have μ := MeasureTheory.Measure.pi fun x => D;
                        (μ.prod μ)
                            {p |
                              ∃ h ∈ C,
                                EmpiricalError X Bool h (fun i => (p.2 i, c (p.2 i))) (zeroOneLoss Bool) -
                                    EmpiricalError X Bool h (fun i => (p.1 i, c (p.1 i))) (zeroOneLoss Bool) ≥
                                  ε / 2} ≤
                          ENNReal.ofReal (↑(GrowthFunction X C (2 * m)) * Real.exp (-(↑m * ε ^ 2 / 8)))
    Uses
    Used by
  12. DeclzeroOneLoss.congr_simpDeclaration kindtheorem
    ∀ (Y : Type v) {inst : DecidableEq Y} [inst_1 : DecidableEq Y] (a a_1 : Y),
      a = a_1 → ∀ (a_2 a_3 : Y), a_2 = a_3 → zeroOneLoss Y a a_2 = zeroOneLoss Y a_1 a_3
    Used by
  13. Declrestriction_pattern_countDeclaration kindtheorem

    The number of distinct restriction patterns of C on any n points is at most GF(C,n). For z : Fin n → X, define patterns(z) = {p : Fin n → Bool | ∃ h ∈ C, ∀ i, p i = (h(z i) ≠ c(z i))}. Then patterns(z).ncard ≤ GrowthFunction X C n by definition of GrowthFunction.

    ∀ {X : Type u} [MeasurableSpace X] [Infinite X] (C : ConceptClass X Bool) (c : Concept X Bool) (n : ℕ) (z : Fin n → X),
      {p | ∃ h ∈ C, ∀ (i : Fin n), p i = decide (h (z i) ≠ c (z i))}.ncard ≤ GrowthFunction X C n
    Used by
  14. Declrademacher_mgf_boundDeclaration kindtheorem

    Rademacher MGF bound.

    ∀ {m : ℕ},
      0 < m →
        ∀ (a : Fin m → ℝ) (c : ℝ),
          0 ≤ c →
            (∀ (i : Fin m), |a i| ≤ c) →
              ∀ (t : ℝ),
                0 ≤ t →
                  1 / ↑(Fintype.card (SignVector m)) * ∑ σ, Real.exp (t * (1 / ↑m * ∑ i, a i * boolToSign (σ i))) ≤
                    Real.exp (t ^ 2 * c ^ 2 / (2 * ↑m))
    Uses
    Used by
  15. Declcosh_le_exp_sq_halfDeclaration kindtheorem

    cosh(x) ≤ exp(x²/2). Standard sub-Gaussian bound.

    ∀ (x : ℝ), Real.cosh x ≤ Real.exp (x ^ 2 / 2)
    Used by
  16. Declfinite_exchangeability_boundDeclaration kindtheorem

    Generic finite exchangeability bound. Given a measure-preserving family of transformations on a probability space, a NullMeasurableSet S, and a pointwise bound on the sum of preimage indicators, conclude ν(S) ≤ B.

    ∀ {Ω : Type u_1} {G : Type u_2} [inst : MeasurableSpace Ω] [inst_1 : Fintype G] [Nonempty G]
      {ν : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure ν] (T : G → Ω → Ω) (S : Set Ω),
      (∀ (g : G), MeasureTheory.MeasurePreserving (T g) ν ν) →
        MeasureTheory.NullMeasurableSet S ν →
          ∀ (B : ENNReal), (∀ (z : Ω), ∑ g, (T g ⁻¹' S).indicator 1 z ≤ B * ↑(Fintype.card G)) → ν S ≤ B
    Used by
  17. Declgrowth_exp_le_deltaDeclaration kindtheorem
    ∀ {X : Type u} [MeasurableSpace X] (C : ConceptClass X Bool) (v : ℕ),
      0 < v →
        ∀ (m : ℕ),
          0 < m →
            ∀ (ε δ : ℝ),
              0 < ε →
                0 < δ →
                  δ < 1 →
                    (∀ (n : ℕ), v ≤ n → GrowthFunction X C n ≤ ∑ i ∈ Finset.range (v + 1), n.choose i) →
                      (16 * Real.exp 1 * (↑v + 1) / ε ^ 2) ^ (v + 1) / δ ≤ ↑m →
                        4 * ↑(GrowthFunction X C (2 * m)) * Real.exp (-(↑m * ε ^ 2 / 8)) ≤ δ ∧ 2 * Real.log 2 ≤ ↑m * ε ^ 2
    Uses
    Used by
  18. Declsum_choose_le_exp_powDeclaration kindtheorem

    Pure combinatorial inequality: ∑_{i=0}^d C(m,i) ≤ (em/d)^d for d ≤ m, d ≥ 1.

    ∀ (d m : ℕ), 0 < d → d ≤ m → ∑ i ∈ Finset.range (d + 1), ↑(m.choose i) ≤ (Real.exp 1 * ↑m / ↑d) ^ d
    Used by
  19. Declpow_mul_exp_neg_le_factorial_divDeclaration kindtheorem

    Key arithmetic lemma for PAC bound: for t > 0, t^d * exp(-t) ≤ (d+1)!/t. Follows from exp(t) ≥ t^(d+1)/(d+1)! (partial sum of Taylor series).

    ∀ {d : ℕ} {t : ℝ}, 0 < t → t ^ d * Real.exp (-t) ≤ ↑(d + 1).factorial / t
    Used by
  20. Declgrowth_function_le_two_powDeclaration kindtheorem

    Trivial bound: GrowthFunction ≤ 2^n for all concept classes. Each restriction to an n-element set yields a function in S → Bool, and there are at most 2^n such functions.

    ∀ {X : Type u} (C : ConceptClass X Bool) (n : ℕ), GrowthFunction X C n ≤ 2 ^ n
    Used by
  21. Declhoeffding_one_sided_upperDeclaration kindtheorem

    Upper-tail Hoeffding: for iid Bernoulli(p) draws, the empirical average overshoots the mean by ≥ t with probability ≤ exp(-2mt²).

    This is the mirror of hoeffding_one_sided (which bounds the lower tail). The proof uses the same sub-Gaussian machinery with Z_i = indicator(x_i) - p (instead of p - indicator(x_i)).

    ∀ {X : Type u} [inst : MeasurableSpace X] (D : MeasureTheory.Measure X) [MeasureTheory.IsProbabilityMeasure D]
      (h c : Concept X Bool) (m : ℕ),
      0 < m →
        ∀ (t : ℝ),
          0 < t →
            t ≤ 1 →
              MeasurableSet {x | h x ≠ c x} →
                (MeasureTheory.Measure.pi fun x => D)
                    {xs |
                      EmpiricalError X Bool h (fun i => (xs i, c (xs i))) (zeroOneLoss Bool) ≥ TrueErrorReal X h c D + t} ≤
                  ENNReal.ofReal (Real.exp (-2 * ↑m * t ^ 2))
    Used by
  22. Declhoeffding_one_sidedDeclaration kindtheorem

    One-sided Hoeffding: for iid Bernoulli(p) draws, the empirical average undershoots the mean by ≥ t with probability ≤ exp(-2mt²).

    Proof strategy (3 steps):

    1. MGF bound (Hoeffding's lemma): For X ∈ [0,1] with E[X] = p, E[exp(s(X-p))] ≤ exp(s²/8).

    • Adapt from cosh_le_exp_sq_half infrastructure in Rademacher.lean.
    • Key: convexity of exp on [0,1] gives E[exp(sX)] ≤ p·exp(s) + (1-p)·exp(0), then the s²/8 bound follows from ln(1 + x) ≤ x and Taylor expansion. have mgf_bound : ∀ (s : ℝ), ∫ x, Real.exp (s * (indicator x - p)) ∂D ≤ Real.exp (s^2 / 8) := by ...

    2. Product independence: E[exp(s·∑(X_i-p))] = ∏ E[exp(s(X_i-p))] ≤ exp(ms²/8).

    • Uses MeasureTheory.Measure.pi independence structure.
    • Needs: Measure.pi integral factorization for product of functions.
    • MEASURABILITY: fun xs => Real.exp (s * ∑ i, f (xs i)) is measurable (composition of measurable functions). have product_bound : ∀ (s : ℝ), ∫ xs, Real.exp (s * ∑ i, (indicator (xs i) - p)) ∂Measure.pi (fun _ => D) ≤ Real.exp (m * s^2 / 8) := by ...

    3. Exponential Markov + optimize: P[∑(X_i-p) ≤ -mt] = P[exp(-s·∑(X_i-p)) ≥ exp(smt)] ≤ exp(-smt + ms²/8). Optimize over s: set s = 4t to get ≤ exp(-2mt²).

    • Uses Markov's inequality in ENNReal form.
    • CAST ISSUE: Markov gives ENNReal bound, need to convert exp(-2mt²) between ENNReal.ofReal and the measure value. have markov_step : ∀ (s : ℝ) (hs : 0 < s), Measure.pi (fun _ => D) {xs | ∑ i, (indicator (xs i) - p) ≤ -(m : ℝ) * t} ≤ ENNReal.ofReal (Real.exp (-(s * m * t) + m * s^2 / 8)) := by ... have optimize : Real.exp (-(4*t * m * t) + m * (4*t)^2 / 8) = Real.exp (-2 * m * t^2) := by ring_nf

    CAST ISSUES to watch:

    • m : ℕ needs cast to ℝ in the exponent: (m : ℝ)
    • EmpiricalError returns ℝ, TrueErrorReal returns ℝ, good — no ENNReal gap
    • The measure value is ENNReal, the bound exp(-2mt²) is ℝ≥0∞ via ENNReal.ofReal

    References: SSBD Lemma B.3, Hoeffding (1963)

    ∀ {X : Type u} [inst : MeasurableSpace X] (D : MeasureTheory.Measure X) [MeasureTheory.IsProbabilityMeasure D]
      (h c : Concept X Bool) (m : ℕ),
      0 < m →
        ∀ (t : ℝ),
          0 < t →
            t ≤ 1 →
              MeasurableSet {x | h x ≠ c x} →
                (MeasureTheory.Measure.pi fun x => D)
                    {xs |
                      EmpiricalError X Bool h (fun i => (xs i, c (xs i))) (zeroOneLoss Bool) ≤ TrueErrorReal X h c D - t} ≤
                  ENNReal.ofReal (Real.exp (-2 * ↑m * t ^ 2))
    Used by
  23. Decluc_imp_pacDeclaration kindtheorem

    Uniform convergence implies PAC learnability via ERM. The ERM learner (which exists by ermLearn) achieves PAC learning when uniform convergence holds. This is the second half of vcdim_finite_imp_pac.

    ∀ (X : Type u) [inst : MeasurableSpace X] (C : ConceptClass X Bool),
      Set.Nonempty C → HasUniformConvergence X C → PACLearnable X C
    Uses
    Used by
  24. DeclBatchLearner.output_in_HDeclaration kindtheorem

    Output is in the hypothesis space

    ∀ {X : Type u} {Y : Type v} (self : BatchLearner X Y) {m : ℕ} (S : Fin m → X × Y), self.learn S ∈ self.hypotheses
    Used by
  25. DeclMeasurableConceptClass.hmeas_CDeclaration kindtheorem
    ∀ {X : Type u} [inst : MeasurableSpace X] (C : ConceptClass X Bool) [h : MeasurableConceptClass X C],
      ∀ c ∈ C, Measurable c
    Uses
    Used by
  26. DeclMeasurableConceptClass.mem_measurableDeclaration kindtheorem

    Every concept in C is measurable

    ∀ {X : Type u} {inst : MeasurableSpace X} {C : ConceptClass X Bool} [self : MeasurableConceptClass X C],
      ∀ h ∈ C, Measurable h
    Used by
  27. DeclMeasurableConceptClass.hc_measDeclaration kindtheorem
    ∀ {X : Type u} [inst : MeasurableSpace X] (C : ConceptClass X Bool) [h : MeasurableConceptClass X C]
      (c : Concept X Bool), Measurable c
    Uses
    Used by
  28. DeclMeasurableConceptClass.all_measurableDeclaration kindtheorem

    All concepts X → Bool are measurable (for disagreement sets)

    ∀ {X : Type u} {inst : MeasurableSpace X} (C : ConceptClass X Bool) [self : MeasurableConceptClass X C]
      (c : Concept X Bool), Measurable c
    Used by
  29. DeclMeasurableConceptClass.hWBDeclaration kindtheorem
    ∀ {X : Type u} [inst : MeasurableSpace X] (C : ConceptClass X Bool) [h : MeasurableConceptClass X C], WellBehavedVC X C
    Uses
    Used by
  30. DeclMeasurableConceptClass.wellBehavedDeclaration kindtheorem

    Uniform convergence bad event is NullMeasurableSet

    ∀ {X : Type u} {inst : MeasurableSpace X} {C : ConceptClass X Bool} [self : MeasurableConceptClass X C],
      WellBehavedVC X C
    Used by
  31. Declpac_imp_vcdim_finiteDeclaration kindtheorem

    Direction →: PAC learnability implies finite VCDim.

    PROOF ROUTE (via double-sample infrastructure in Generalization.lean): Step 1: Contrapositive — assume VCDim = ∞ Step 2: For m = mf(ε,δ), extract S with |S| = 2m shattered by C (uses WithTop.eq_top_iff_forall_ge, same as vcdim_univ_infinite) Step 3: Construct D = uniform on S (Finset.uniformMeasure?) KU₁₉: Mathlib's uniform measure on a finite set — does MeasureTheory.Measure.count / Finset.card give IsProbabilityMeasure? Step 4: Double-sample trick via GhostSample + symmetrization Step 5: Counting argument on restricted labelings

    HC at this joint: Step 3 requires constructing a specific probability measure from a combinatorial object (the shattered set). This is a P₁→P₂ crossing. UK₉: The construction of the hard distribution is the only non-constructive step. Can it be made constructive? (Related to derandomization in learning.)

    ∀ (X : Type u) [inst : MeasurableSpace X] [MeasurableSingletonClass X] (C : ConceptClass X Bool),
      PACLearnable X C → VCDim X C < ⊤
    Uses
    Used by
  32. Declvcdim_infinite_not_pacDeclaration kindtheorem

    If VCDim = ⊤, then C is not PAC learnable. Proof: for any learner L with sample function mf, pick ε = 1/4, δ = 1/4. Let m = mf(1/4, 1/4). Since VCDim = ⊤, ∃ shattered set S with |S| ≥ 2m. Put D = uniform on S. For random labeling, any m-sample learner has expected error ≥ 1/4 on unseen points. This is the core of pac_imp_vcdim_finite (contrapositive direction).

    ∀ (X : Type u) [inst : MeasurableSpace X] [MeasurableSingletonClass X] (C : ConceptClass X Bool),
      VCDim X C = ⊤ → ¬PACLearnable X C
    Uses
    Used by
  33. DecluniformMeasure_isProbabilityDeclaration kindtheorem

    The uniform measure is a probability measure when X is nonempty and finite.

    ∀ (X : Type u) [inst : MeasurableSpace X] [inst_1 : Fintype X] [MeasurableSingletonClass X] (hne : Nonempty X),
      0 < Fintype.card X → MeasureTheory.IsProbabilityMeasure (uniformMeasure X hne)
    Used by
  34. Declnfl_counting_coreDeclaration kindtheorem

    NFL counting core: for a shattered set T with |T| > 2m, there exists a labeling f₀ : ↥T → Bool and its shattering witness c₀ ∈ C such that the number of samples xs : Fin m → ↥T where the learner achieves low error (≤ |T|/4) is at most half the total number of samples. Proof: double-counting + pigeonhole using per_sample_labeling_bound.

    ∀ {X : Type u} {C : ConceptClass X Bool} {T : Finset X},
      Shatters X C T →
        ∀ {m : ℕ},
          2 * m < T.card →
            ∀ (L : BatchLearner X Bool),
              ∃ f₀,
                ∃ c₀ ∈ C,
                  (∀ (t : ↥T), c₀ ↑t = f₀ t) ∧
                    2 * {xs | {t | c₀ ↑t ≠ L.learn (fun i => (↑(xs i), c₀ ↑(xs i))) ↑t}.card * 4 ≤ T.card}.card ≤
                      Fintype.card (Fin m → ↥T)
    Uses
    Used by
  35. Declper_sample_labeling_boundDeclaration kindtheorem

    Per-sample labeling bound: for any fixed xs : Fin m → α on a Fintype α with 2m < |α|, and any function output : (α → Bool) → (α → Bool) that only depends on the restriction of f to {xs i}, at most half the labelings f : α → Bool have error(f, output(f)) * 4 ≤ |α|.

    Proof: pair each f with flip_unseen(f). The pair has complementary disagreements on unseen points, and |unseen| > |α|/2, so at most one can have low error.

    ∀ {α : Type u_1} [inst : Fintype α] [inst_1 : DecidableEq α] (m : ℕ),
      2 * m < Fintype.card α →
        ∀ (xs : Fin m → α) (output : (α → Bool) → α → Bool),
          (∀ (f f' : α → Bool), (∀ (i : Fin m), f (xs i) = f' (xs i)) → output f = output f') →
            2 * {f | {t | f t ≠ output f t}.card * 4 ≤ Fintype.card α}.card ≤ Fintype.card (α → Bool)
    Used by
  36. DeclvcDim_lt_top_iff_growth_polyDeclaration kindtheorem

    Finite VC dimension ⟺ eventually polynomial growth. The purely combinatorial half of the fundamental theorem: VCDim X C < ⊤ exactly when the growth function is eventually bounded by a polynomial.

    ∀ {X : Type u} {C : ConceptClass X Bool},
      VCDim X C < ⊤ ↔ ∃ K d, ∀ᶠ (m : ℕ) in Filter.atTop, ↑(GrowthFunction X C m) ≤ K * ↑m ^ d
    Uses
    Used by
  37. DeclvcDim_lt_top_of_growth_polyDeclaration kindtheorem

    Polynomial growth implies finite VC dimension. If GrowthFunction X C m ≤ K · m ^ d for all large m, then VCDim X C < ⊤: an infinite VC dimension produces shattered sets of every size, forcing 2 ^ m ≤ K · m ^ d for arbitrarily large m, which is impossible. The hypothesis is the eventually filter (the ∀ m form is unsatisfiable at m = 0); Sauer-Shelah supplies it for m ≥ d.

    ∀ {X : Type u} {C : ConceptClass X Bool} (K : ℝ) (d : ℕ),
      (∀ᶠ (m : ℕ) in Filter.atTop, ↑(GrowthFunction X C m) ≤ K * ↑m ^ d) → VCDim X C < ⊤
    Uses
    Used by
  38. Decltwo_pow_le_growthFunction_of_topDeclaration kindtheorem

    An infinite VC dimension forces the growth function to be at least 2 ^ m at every size: it shatters sets of every size, by iSup₂_eq_top and downward closure.

    ∀ {X : Type u} {C : ConceptClass X Bool}, VCDim X C = ⊤ → ∀ (m : ℕ), 2 ^ m ≤ GrowthFunction X C m
    Uses
    Used by
  39. Declshatters_of_subsetDeclaration kindtheorem

    Shattering is closed under restriction of the sample: if C shatters S and T ⊆ S, then C shatters T. Any labelling of T extends to a labelling of S, which is realized.

    ∀ {X : Type u} {C : ConceptClass X Bool} {S T : Finset X}, Shatters X C S → T ⊆ S → Shatters X C T
    Used by
  40. DeclgrowthFunction_ge_two_pow_of_shattersDeclaration kindtheorem

    A shattered sample of size m forces the growth function at m to be at least 2 ^ m.

    ∀ {X : Type u} {C : ConceptClass X Bool} {S : Finset X}, Shatters X C S → 2 ^ S.card ≤ GrowthFunction X C S.card
    Uses
    Used by
  41. DeclrestrictionSet_ncard_le_growthFunctionDeclaration kindtheorem

    Each restriction count is at most the growth function at the matching sample size.

    ∀ {X : Type u} (C : ConceptClass X Bool) {S : Finset X} {m : ℕ},
      S.card = m → (restrictionSet C S).ncard ≤ GrowthFunction X C m
    Uses
    Used by
  42. DeclrestrictionSet_ncard_le_two_powDeclaration kindtheorem
    ∀ {X : Type u} (C : ConceptClass X Bool) (S : Finset X), (restrictionSet C S).ncard ≤ 2 ^ S.card
    Used by
  43. DeclgrowthFunction_eqDeclaration kindtheorem
    ∀ {X : Type u} (C : ConceptClass X Bool) (m : ℕ),
      GrowthFunction X C m = sSup (Set.range fun S => (restrictionSet C ↑S).ncard)
    Used by
  44. DeclrestrictionSet_eq_univ_of_shattersDeclaration kindtheorem

    A shattered sample realizes every labelling, so its restriction-pattern set is everything.

    ∀ {X : Type u} {C : ConceptClass X Bool} {S : Finset X}, Shatters X C S → restrictionSet C S = Set.univ
    Used by
  45. Declno_eventually_two_pow_le_polyDeclaration kindtheorem

    The exponential-beats-polynomial crux. 2 ^ m ≤ K · m ^ d cannot hold for arbitrarily large m, since m ^ d = o(2 ^ m). Stated with the eventually filter so it is applicable (the ∀ m form is unsatisfiable at m = 0 for d ≥ 1).

    ∀ (K : ℝ) (d : ℕ), (∀ᶠ (m : ℕ) in Filter.atTop, 2 ^ m ≤ K * ↑m ^ d) → False
    Used by
  46. DeclvcDim_finite_imp_growth_polyDeclaration kindtheorem

    Finite VC dimension implies eventual polynomial growth. If VCDim X C < ⊤ then the growth function is eventually bounded by a polynomial K · m ^ d.

    ∀ {X : Type u} {C : ConceptClass X Bool},
      VCDim X C < ⊤ → ∃ K d, ∀ᶠ (m : ℕ) in Filter.atTop, ↑(GrowthFunction X C m) ≤ K * ↑m ^ d
    Uses
    Used by
  47. Declvcdim_finite_imp_growth_boundedDeclaration kindtheorem

    VCDim < ⊤ → growth function polynomially bounded by partial binomial sum. Forward direction of fundamental_theorem conjunct 5. Uses Sauer-Shelah: GrowthFunction(m) ≤ ∑_{i≤d} C(m,i) where d = VCDim.

    ∀ (X : Type u) (C : ConceptClass X Bool),
      VCDim X C < ⊤ → ∃ d, ∀ (m : ℕ), d ≤ m → GrowthFunction X C m ≤ ∑ i ∈ Finset.range (d + 1), m.choose i
    Used by
  48. DefinitionBatchLearnerstructure

    A batch learner (PAC paradigm): takes a finite sample, returns a hypothesis.

    Type u → Type v → Type (max u v)
  49. DefinitionBatchLearner.hypothesesdef

    The learner's hypothesis space

    {X : Type u} → {Y : Type v} → BatchLearner X Y → HypothesisSpace X Y
  50. DefinitionBatchLearner.learndef

    The learning algorithm: given a sample, produce a hypothesis

    {X : Type u} → {Y : Type v} → BatchLearner X Y → {m : ℕ} → (Fin m → X × Y) → Concept X Y
  51. DefinitionConceptClassdef

    A concept class is a set of concepts. Used by every paradigm, complexity measure, and criterion.

    Primary definition: Set of functions. Used for PAC/agnostic PAC where concept classes are sets over which VC dimension, Rademacher complexity, covering numbers, etc. are measured. Alternative definitions below for contexts requiring decidability, enumerability, or measurability.

    Type u → Type v → Type (max v u)
  52. DefinitionEmpiricalErrordef

    Empirical error: average loss on a finite sample.

    (X : Type u) → (Y : Type v) → Concept X Y → {m : ℕ} → (Fin m → X × Y) → LossFunction Y → ℝ
  53. DefinitionFLT.Conceptdef

    A concept is a function from domain to label. This is the atomic unit that concept classes collect and learners try to approximate.

    Type u → Type v → Type (max u v)
  54. DefinitionGrowthFunctiondef

    Growth function (shattering coefficient): π_C(m) = max_{|S|=m} |{c|_S : c ∈ C}|. For each m-element set S, counts the number of distinct restrictions of C to S, then takes the supremum over all such S.

    (X : Type u) → ConceptClass X Bool → ℕ → ℕ
  55. DefinitionHasUniformConvergencedef

    Uniform convergence of empirical error to true error over a hypothesis class. This is the property that makes finite VCDim → PAC learnability work. BP₅ connects here: this is ONE of the five characterizations.

    M-DefinitionRepair (Γ₃₅ → Γ₄₁): The m₀ must be INDEPENDENT of D and c. That's what "uniform" means — convergence is uniform over all distributions and all target concepts. The original definition had m₀ depending on D and c, making uc_imp_pac unprovable (PACLearnable's mf must be independent of D, c). Repaired: ∃ m₀ is now BEFORE ∀ D, ∀ c. This STRENGTHENS the definition (A5-valid: adds content, doesn't simplify).

    (X : Type u) → [MeasurableSpace X] → HypothesisSpace X Bool → Prop
  56. DefinitionHypothesisSpacedef

    A hypothesis space is a set of candidate concepts that the learner searches over. When H = C (the realizable case), every concept in the target class is available. When H ⊂ C or H ⊃ C, we are in the improper/agnostic regime.

    Structurally identical to ConceptClass but semantically distinct: ConceptClass is the ground truth collection; HypothesisSpace is what the learner has access to.

    Type u → Type v → Type (max v u)
  57. DefinitionIsConsistentWithdef

    A hypothesis h is consistent with labeled sample S.

    (X : Type u) → (Y : Type v) → [DecidableEq Y] → Concept X Y → {m : ℕ} → (Fin m → X × Y) → Prop
  58. DefinitionMeasurableConceptClassstructure

    A concept class with the measure-theoretic regularity needed for PAC theory.

    Bundles three conditions: 1. Every concept in C is measurable 2. All concepts are measurable (needed for disagreement set measurability) 3. The UC bad event satisfies NullMeasurableSet (WellBehavedVC)

    Condition 3 is the deep one: for uncountable C, the existential {∃ h ∈ C, |TrueErr - EmpErr| ≥ ε} is NOT MeasurableSet in general. WellBehavedVC asserts it is NullMeasurableSet, which suffices for integration (lintegral_indicator_one₀).

    (X : Type u) → [MeasurableSpace X] → ConceptClass X Bool → Prop
  59. DefinitionPACLearnabledef

    PAC (Probably Approximately Correct) learning. The central definition of computational learning theory.

    Sample space: Fin m → X with i.i.d. product measure D^m. Labels: derived deterministically from target concept c (realizable case). Error: D-probability of disagreement between learner output and c.

    (X : Type u) → [MeasurableSpace X] → ConceptClass X Bool → Prop
  60. DefinitionShattersdefYaël Dillies

    A set S ⊆ X is shattered by concept class C if every labeling of S is realized by some concept in C.

    (X : Type u) → ConceptClass X Bool → Finset X → Prop
  61. DefinitionSignVectordef
    ℕ → Type
  62. DefinitionTrueErrordef

    True error (0-1 loss, realizable case): D-probability of disagreement. This is what PACLearnable's success event measures.

    (X : Type u) → [inst : MeasurableSpace X] → Concept X Bool → Concept X Bool → MeasureTheory.Measure X → ENNReal
  63. DefinitionTrueErrorRealdef

    True error in ℝ: for use in bounds involving subtraction/absolute value. COUNTER-1 of TrueError. The toReal bridge loses information when the measure is ⊤.

    (X : Type u) → [inst : MeasurableSpace X] → Concept X Bool → Concept X Bool → MeasureTheory.Measure X → ℝ
  64. DefinitionVCDimdef

    VC dimension of a concept class: the size of the largest shattered set. Returns ℕ∞ = WithTop ℕ.

    (X : Type u) → ConceptClass X Bool → WithTop ℕ
  65. DefinitionWellBehavedVCdef

    A concept class is well-behaved if the ghost gap event is null-measurable. This is the minimal regularity assumption for the symmetrization proof.

    (X : Type u) → [MeasurableSpace X] → ConceptClass X Bool → Prop
  66. DefinitionboolToSigndef

    Convert Bool labels to ±1 reals. true ↦ 1, false ↦ -1.

    Bool → ℝ
  67. DefinitionrestrictionSetdef

    The set of labelling patterns that C realizes on a finite sample S.

    {X : Type u} → ConceptClass X Bool → (S : Finset X) → Set (↥S → Bool)
  68. DefinitionuniformMeasuredef

    Uniform probability measure on a Fintype: (1/|X|) · count. This gives each point probability 1/|X|. Requires |X| > 0 (nonempty).

    (X : Type u) → [inst : MeasurableSpace X] → [Fintype X] → Nonempty X → MeasureTheory.Measure X
  69. DefinitionzeroOneLossdef

    The 0-1 loss for classification.

    (Y : Type v) → [DecidableEq Y] → LossFunction Y
DOIMTH.R-2026-6027
Cite

Verification

Replay
accepted
Axioms
Classical.choiceQuot.soundpropext
Statement identity
not-applicable
Substrate
Lean 4 kernel v4.31.0
Dictionary pin
design-lab@5802df4 · initial
Frozen export
2ee3cd939923
Verified
2026-09-24T00:00:00Z