AFTD Auto-Formalizing Theoretical Domains

littlestone_dim_le_restrict_add_restrict_compl

theoremverifiedformalization

For every nonempty class H of functions X → Bool and every subset Y of X, the Littlestone dimension of H (in ℕ∞) is at most the Littlestone dimension of the restriction of H to Y plus the Littlestone dimension of the restriction of H to the complement X \ Y.

Statement

theorem littlestone_dim_le_restrict_add_restrict_compl {X : Type*} (H : Set (X → Bool))
    (hH : H.Nonempty) (Y : Set X) :
    littlestone_dim H ≤
      littlestone_dim (concept_class_restrict H Y) + littlestone_dim (concept_class_restrict H Yᶜ)
Formalizes
arXiv:2611.26721 (Littlestone dimension and its dual), Fact 2.2 (subadditivity).
Verified
29 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 5
  • littlestone_dimThe Littlestone dimension of a class H of functions X → Bool, valued in ℕ∞: the supremum of the depths d such that H shatters a complete…
  • littlestone_shattersFor a class H of functions X → Bool and a natural number d, H shatters a complete binary tree of depth d (internal nodes labelled by…
  • concept_class_restrictThe restriction H|_Y of a class H of functions X → Bool to a subset Y of X: the set of functions Y → Bool obtained by restricting the…
  • concept_class_restrict_nonemptyThe restriction of a nonempty class of functions X → Bool to any subset Y of X is nonempty.
  • g$g(S,M) = \dim_{\mathbb{F}_p}(S^{\perp}_M) - \dim_{\mathbb{F}_p}(S_M)$.

Read back from the Lean

For any type X, any subset H of X → Bool that is nonempty, and any subset Y of X, the Littlestone dimension of H is less than or equal to the sum (in ℕ∞) of the Littlestone dimension of the restriction of H to Y and the Littlestone dimension of the restriction of H to Yᶜ.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The theorem establishes subadditivity of the Littlestone dimension under restriction: the dimension of H is at most the sum of the dimensions of its restrictions to Y and X \ Y. If either restriction has infinite dimension, the inequality holds trivially; otherwise, letting a and b be the finite dimensions of the restrictions, any depth d shattered by H must satisfy d ≤ a + b. If some d > a + b were shattered, downward monotonicity would imply that H shatters depth a + b + 1, so a technical splitting lemma would force H|_Y to shatter a + 1 or H|_(X \ Y) to shatter b + 1, contradicting the maximality of a or b.

  1. A concept class that shatters depth k + 1 is nonempty.

    By definition of shattering at depth k + 1, there exists an instance whose false-branch shatters at depth k. By the induction hypothesis on k (littlestone_shatters_nonempty), that branch contains a function g, which belongs to S and witnesses that S is nonempty.

    lines 4–6

    uses littlestone_shatters_nonempty

      | k + 1, _, ⟨_, hy, _⟩ => by
        obtain ⟨g, hg, _⟩ := littlestone_shatters_nonempty k _ hy
        exact ⟨g, hg⟩
  2. A concept class that shatters depth 1 also shatters depth 0.

    Shattering depth 0 means nonemptiness. A class shattering depth 1 has a root instance whose false-branch shatters depth 0; extracting a witness from that branch via littlestone_shatters_nonempty shows that the original class contains an element, hence shatters depth 0.

    lines 18–20

    uses littlestone_shatters_nonempty

      | 0, _, ⟨_, h0, _⟩ => by
        obtain ⟨g, hg, _⟩ := littlestone_shatters_nonempty 0 _ h0
        exact ⟨g, hg⟩
  3. If a concept class shatters depth d and k ≤ d, then it also shatters depth k.

    We induct on d. For d = 0, k ≤ 0 forces k = 0 via Nat.le_zero.1. For d + 1, we case split on whether k < d + 1 or k ≥ d + 1 using Nat.lt_or_ge. If k < d + 1, then k ≤ d and the class shatters depth d by littlestone_shatters_succ, so the induction hypothesis applies. If k ≥ d + 1, then k = d + 1 by le_antisymm, matching the hypothesis directly.

    lines 26–31

    uses Nat.le_zero.1, Nat.lt_or_ge, littlestone_shatters_succ, le_antisymm

      induction d with
      | zero => rwa [Nat.le_zero.1 hkd]
      | succ d ih =>
        rcases Nat.lt_or_ge k (d + 1) with hk | hk
        · exact ih (by omega) (littlestone_shatters_succ d S h)
        · rwa [le_antisymm hkd hk]
  4. Restricting a coordinate fiber of S to Y embeds into the corresponding fiber of the restriction S|_Y.

    Any function g in the restriction of {h ∈ S | h(y) = b} to Y is the restriction of some h ∈ S with h(y) = b. Therefore g ∈ S|_Y and g(y) = h(y) = b, placing g in the fiber of S|_Y at y.

    lines 37–38

      rintro g ⟨h, ⟨hS, hb⟩, rfl⟩
      exact ⟨⟨h, hS, rfl⟩, hb⟩
  5. Base case of the splitting lemma: if d1 + d2 = 0, Y ∪ Z = X, and S shatters depth 1, then either S|_Y shatters depth 1 or S|_Z shatters depth 1.

    Since d1 + d2 = 0, we have d1 = 0 and d2 = 0. Shattering depth 1 provides a root instance x ∈ X whose false and true fibers in S shatter depth 0 (are nonempty). Since x ∈ Y ∨ x ∈ Z, if x ∈ Y then x witnesses that S|_Y shatters depth 1, because its fibers contain the restrictions of the nonempty fibers of S by concept_class_restrict_nonempty and littlestone_restrict_fiber. Symmetrically, if x ∈ Z, then S|_Z shatters depth 1.

    lines 49–69

    uses concept_class_restrict_nonempty, littlestone_restrict_fiber

      intro n
      induction n with
      | zero =>
        intro S d1 d2 Y Z hd hYZ hS
        obtain ⟨x, h0, h1⟩ := hS
        have hd1 : d1 = 0 := by omega
        have hd2 : d2 = 0 := by omega
        subst hd1 hd2
        rcases hYZ x with hx | hx
        · left
          refine ⟨⟨x, hx⟩, ?_, ?_⟩
          · exact (concept_class_restrict_nonempty _ Y h0).mono
              (littlestone_restrict_fiber S Y ⟨x, hx⟩ false)
          · exact (concept_class_restrict_nonempty _ Y h1).mono
              (littlestone_restrict_fiber S Y ⟨x, hx⟩ true)
        · right
          refine ⟨⟨x, hx⟩, ?_, ?_⟩
          · exact (concept_class_restrict_nonempty _ Z h0).mono
              (littlestone_restrict_fiber S Z ⟨x, hx⟩ false)
          · exact (concept_class_restrict_nonempty _ Z h1).mono
              (littlestone_restrict_fiber S Z ⟨x, hx⟩ true)
  6. Inductive step of the splitting lemma when the root instance x belongs to Y.

    Let x be the root instance for S shattering depth n + 2, so both fibers S_{x=0} and S_{x=1} shatter depth n + 1. If d1 = 0, x ∈ Y witnesses that S|_Y shatters depth 1 since both fibers are nonempty by littlestone_shatters_nonempty and concept_class_restrict_nonempty. If d1 = d'1 + 1, we apply the induction hypothesis to each fiber with depths d'1 and d2. If either fiber shatters on Z at depth d2 + 1, monotonicity (littlestone_restrict_mono, littlestone_shatters_mono) ensures S|_Z shatters d2 + 1. If both fibers shatter on Y at depth d'1 + 1, then x ∈ Y witnesses that S|_Y shatters depth (d'1 + 1) + 1 = d1 + 1 via littlestone_restrict_fiber.

    lines 71–94

    uses concept_class_restrict_nonempty, littlestone_shatters_nonempty, littlestone_restrict_fiber, littlestone_shatters_mono, littlestone_restrict_mono

        intro S d1 d2 Y Z hd hYZ hS
        obtain ⟨x, h0, h1⟩ := hS
        have sub0 : {h ∈ S | h x = false} ⊆ S := fun _ hg => hg.1
        have sub1 : {h ∈ S | h x = true} ⊆ S := fun _ hg => hg.1
        rcases hYZ x with hx | hx
        · rcases d1 with _ | d1
          · left
            refine ⟨⟨x, hx⟩, ?_, ?_⟩
            · exact (concept_class_restrict_nonempty _ Y
                (littlestone_shatters_nonempty _ _ h0)).mono
                (littlestone_restrict_fiber S Y ⟨x, hx⟩ false)
            · exact (concept_class_restrict_nonempty _ Y
                (littlestone_shatters_nonempty _ _ h1)).mono
                (littlestone_restrict_fiber S Y ⟨x, hx⟩ true)
          · rcases ih _ d1 d2 Y Z (by omega) hYZ h0 with a0 | a0
            · rcases ih _ d1 d2 Y Z (by omega) hYZ h1 with a1 | a1
              · left
                exact ⟨⟨x, hx⟩,
                  littlestone_shatters_mono _ _ _ (littlestone_restrict_fiber S Y ⟨x, hx⟩ false) a0,
                  littlestone_shatters_mono _ _ _ (littlestone_restrict_fiber S Y ⟨x, hx⟩ true) a1⟩
              · right
                exact littlestone_shatters_mono _ _ _ (littlestone_restrict_mono _ _ Z sub1) a1
            · right
              exact littlestone_shatters_mono _ _ _ (littlestone_restrict_mono _ _ Z sub0) a0
  7. Inductive step of the splitting lemma when the root instance x belongs to Z.

    Symmetrically, if x ∈ Z and d2 = 0, x witnesses that S|_Z shatters depth 1. If d2 = d'2 + 1, the induction hypothesis applied to both fibers gives that either one fiber shatters on Y at depth d1 + 1 (in which case S|_Y shatters d1 + 1 by monotonicity), or both fibers shatter on Z at depth d'2 + 1 (in which case x witnesses that S|_Z shatters depth d'2 + 2 = d2 + 1).

    lines 95–113

    uses concept_class_restrict_nonempty, littlestone_shatters_nonempty, littlestone_restrict_fiber, littlestone_shatters_mono, littlestone_restrict_mono

        · rcases d2 with _ | d2
          · right
            refine ⟨⟨x, hx⟩, ?_, ?_⟩
            · exact (concept_class_restrict_nonempty _ Z
                (littlestone_shatters_nonempty _ _ h0)).mono
                (littlestone_restrict_fiber S Z ⟨x, hx⟩ false)
            · exact (concept_class_restrict_nonempty _ Z
                (littlestone_shatters_nonempty _ _ h1)).mono
                (littlestone_restrict_fiber S Z ⟨x, hx⟩ true)
          · rcases ih _ d1 d2 Y Z (by omega) hYZ h0 with a0 | a0
            · left
              exact littlestone_shatters_mono _ _ _ (littlestone_restrict_mono _ _ Y sub0) a0
            · rcases ih _ d1 d2 Y Z (by omega) hYZ h1 with a1 | a1
              · left
                exact littlestone_shatters_mono _ _ _ (littlestone_restrict_mono _ _ Y sub1) a1
              · right
                exact ⟨⟨x, hx⟩,
                  littlestone_shatters_mono _ _ _ (littlestone_restrict_fiber S Z ⟨x, hx⟩ false) a0,
                  littlestone_shatters_mono _ _ _ (littlestone_restrict_fiber S Z ⟨x, hx⟩ true) a1⟩
  8. If either restricted dimension is infinite, the subadditivity inequality holds trivially.

    Using eq_top_or_lt_top, each restricted dimension is either ⊤ or finite. If littlestone_dim (H|_Y) = ⊤, the right-hand side is ⊤ + littlestone_dim (H|_Yᶜ) = ⊤ by top_add, and any value in ℕ∞ is at most ⊤ by le_top. If littlestone_dim (H|_Yᶜ) = ⊤, the right-hand side is littlestone_dim (H|_Y) + ⊤ = ⊤ by add_top, which is likewise at least any value.

    lines 119–122

    uses eq_top_or_lt_top, top_add, le_top, add_top

      rcases eq_top_or_lt_top (littlestone_dim (concept_class_restrict H Y)) with ha | ha
      · rw [ha, top_add]; exact le_top
      rcases eq_top_or_lt_top (littlestone_dim (concept_class_restrict H Yᶜ)) with hb | hb
      · rw [hb, add_top]; exact le_top
  9. Representing the finite restricted dimensions as natural numbers a and b, it suffices to show that every depth d shattered by H satisfies d ≤ a + b.

    Since both dimensions are strictly less than ⊤, ENat.ne_top_iff_exists.1 provides natural numbers a and b such that littlestone_dim (H|_Y) = a and littlestone_dim (H|_Yᶜ) = b. Unfolding the definition of littlestone_dim as the supremum over all shattered depths d, iSup₂_le reduces the goal to proving d ≤ a + b for every depth d shattered by H.

    lines 123–128

    uses ENat.ne_top_iff_exists.1, iSup₂_le

      obtain ⟨a, ha'⟩ := ENat.ne_top_iff_exists.1 ha.ne
      obtain ⟨b, hb'⟩ := ENat.ne_top_iff_exists.1 hb.ne
      rw [← ha', ← hb']
      unfold littlestone_dim
      apply iSup₂_le
      intro d hd
  10. Assuming for contradiction that d > a + b, H must shatter depth a + b + 1.

    Assuming ¬ d ≤ a + b, linear arithmetic yields a + b + 1 ≤ d, where Nat.cast_add and Nat.cast_le.2 handle the conversion between ℕ and ℕ∞. By downward monotonicity of shattering (littlestone_shatters_le), since H shatters d, H also shatters depth a + b + 1.

    lines 129–133

    uses Nat.cast_add, Nat.cast_le.2, littlestone_shatters_le

      by_contra hlt
      have hlt' : a + b + 1 ≤ d := by
        have : ¬ d ≤ a + b := fun h => hlt (by rw [← Nat.cast_add]; exact Nat.cast_le.2 h)
        omega
      have hs := littlestone_shatters_le H (a + b + 1) d hlt' hd
  11. The splitting lemma produces a contradiction in both branches, concluding the proof.

    Applying the splitting lemma littlestone_split_aux with n = a + b, d1 = a, d2 = b, and the covering Y ∪ Yᶜ = X (via excluded middle em), H shattering (a + b) + 1 implies that either H|_Y shatters a + 1 or H|_(Yᶜ) shatters b + 1. In the first case, a + 1 is at most littlestone_dim (H|_Y) = a by le_iSup₂ and Nat.cast_le.1, so a + 1 ≤ a, an impossibility. In the second case, b + 1 ≤ littlestone_dim (H|_Yᶜ) = b, which is likewise impossible. Both branches contradict d > a + b.

    lines 134–146

    uses littlestone_split_aux, em, le_iSup₂, Nat.cast_le.1

      rcases littlestone_split_aux (a + b) H a b Y Yᶜ rfl (fun x => em (x ∈ Y)) hs with h | h
      · have : ((a + 1 : ℕ) : ℕ∞) ≤ littlestone_dim (concept_class_restrict H Y) :=
          le_iSup₂ (f := fun (d : ℕ) (_ : littlestone_shatters (concept_class_restrict H Y) d) =>
            (d : ℕ∞)) (a + 1) h
        rw [← ha'] at this
        have : a + 1 ≤ a := Nat.cast_le.1 this
        omega
      · have : ((b + 1 : ℕ) : ℕ∞) ≤ littlestone_dim (concept_class_restrict H Yᶜ) :=
          le_iSup₂ (f := fun (d : ℕ) (_ : littlestone_shatters (concept_class_restrict H Yᶜ) d) =>
            (d : ℕ∞)) (b + 1) h
        rw [← hb'] at this
        have : b + 1 ≤ b := Nat.cast_le.1 this
        omega
littlestone_shatters_nonempty
If a concept class shatters depth k, then it is nonempty.
Nat.le_zero.1
If a natural number is at most 0, then it is 0.
Nat.lt_or_ge
For any two natural numbers n and m, either n < m or n ≥ m.
littlestone_shatters_succ
If a concept class shatters depth k + 1, then it also shatters depth k.
le_antisymm
If a ≤ b and b ≤ a, then a = b.
concept_class_restrict_nonempty
If a concept class is nonempty, then its restriction to any subset is also nonempty.
littlestone_restrict_fiber
Restricting the fiber of functions in S taking value b at y ∈ Y to Y is contained in the fiber of S|_Y taking value b at y.
littlestone_shatters_mono
If S ⊆ T and S shatters depth k, then T shatters depth k.
littlestone_restrict_mono
If S ⊆ T, then the restriction of S to Y is a subset of the restriction of T to Y.
littlestone_split_aux
If Y ∪ Z = X, d1 + d2 = n, and S shatters depth n + 1, then either S|_Y shatters depth d1 + 1 or S|_Z shatters depth d2 + 1.
eq_top_or_lt_top
Every element in a type with a top element is either ⊤ or strictly less than ⊤.
top_add
Adding ⊤ on the left in an ordered monoid with ⊤ yields ⊤: ⊤ + a = ⊤.
le_top
Every element in an order with ⊤ is at most ⊤: a ≤ ⊤.
add_top
Adding ⊤ on the right in an ordered monoid with ⊤ yields ⊤: a + ⊤ = ⊤.
ENat.ne_top_iff_exists.1
An extended natural number is not ⊤ if and only if it is the coercion of some natural number.
iSup₂_le
The supremum of a doubly-indexed family is at most a bound if each element is at most that bound.
Nat.cast_add
Natural number coercion preserves addition: ↑(m + n) = ↑m + ↑n.
Nat.cast_le.2
Coercion preserves ordering: m ≤ n implies ↑m ≤ ↑n.
littlestone_shatters_le
If a concept class shatters depth d and k ≤ d, then it also shatters depth k.
em
The law of excluded middle: for any proposition p, p ∨ ¬p.
le_iSup₂
Each term of a doubly-indexed family is at most the supremum of the family.
Nat.cast_le.1
Coercion reflects ordering: ↑m ≤ ↑n implies m ≤ n.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem littlestone_shatters_nonempty {X : Type*} :    ∀ (k : ℕ) (S : Set (X → Bool)), littlestone_shatters S k → S.Nonempty  | 0, _, h => h  | k + 1, _, ⟨_, hy, _⟩ => by    obtain ⟨g, hg, _⟩ := littlestone_shatters_nonempty k _ hy    exact ⟨g, hg⟩theorem littlestone_shatters_mono {X : Type*} :    ∀ (k : ℕ) (S T : Set (X → Bool)), S ⊆ T → littlestone_shatters S k →      littlestone_shatters T k  | 0, _, _, hST, h => Set.Nonempty.mono hST h  | k + 1, _, _, hST, ⟨x, h0, h1⟩ =>    ⟨x, littlestone_shatters_mono k _ _ (fun g hg => ⟨hST hg.1, hg.2⟩) h0,      littlestone_shatters_mono k _ _ (fun g hg => ⟨hST hg.1, hg.2⟩) h1⟩theorem littlestone_shatters_succ {X : Type*} :    ∀ (k : ℕ) (S : Set (X → Bool)), littlestone_shatters S (k + 1) → littlestone_shatters S k  | 0, _, ⟨_, h0, _⟩ => by    obtain ⟨g, hg, _⟩ := littlestone_shatters_nonempty 0 _ h0    exact ⟨g, hg⟩  | k + 1, _, ⟨x, h0, h1⟩ =>    ⟨x, littlestone_shatters_succ k _ h0, littlestone_shatters_succ k _ h1⟩theorem littlestone_shatters_le {X : Type*} (S : Set (X → Bool)) (k d : ℕ) (hkd : k ≤ d)    (h : littlestone_shatters S d) : littlestone_shatters S k := by  induction d with  | zero => rwa [Nat.le_zero.1 hkd]  | succ d ih =>    rcases Nat.lt_or_ge k (d + 1) with hk | hk    · exact ih (by omega) (littlestone_shatters_succ d S h)    · rwa [le_antisymm hkd hk]theorem littlestone_restrict_fiber {X : Type*} (S : Set (X → Bool)) (Y : Set X) (y : Y)    (b : Bool) :    concept_class_restrict {h ∈ S | h y.1 = b} Y ⊆      {g ∈ concept_class_restrict S Y | g y = b} := by  rintro g ⟨h, ⟨hS, hb⟩, rfl⟩  exact ⟨⟨h, hS, rfl⟩, hb⟩theorem littlestone_restrict_mono {X : Type*} (S T : Set (X → Bool)) (Y : Set X)    (hST : S ⊆ T) : concept_class_restrict S Y ⊆ concept_class_restrict T Y :=  Set.image_mono hSTtheorem littlestone_split_aux {X : Type*} :    ∀ (n : ℕ) (S : Set (X → Bool)) (d1 d2 : ℕ) (Y Z : Set X), d1 + d2 = n →      (∀ x, x ∈ Y ∨ x ∈ Z) → littlestone_shatters S (n + 1) →      littlestone_shatters (concept_class_restrict S Y) (d1 + 1) ∨        littlestone_shatters (concept_class_restrict S Z) (d2 + 1) := by  intro n  induction n with  | zero =>    intro S d1 d2 Y Z hd hYZ hS    obtain ⟨x, h0, h1⟩ := hS    have hd1 : d1 = 0 := by omega    have hd2 : d2 = 0 := by omega    subst hd1 hd2    rcases hYZ x with hx | hx    · left      refine ⟨⟨x, hx⟩, ?_, ?_⟩      · exact (concept_class_restrict_nonempty _ Y h0).mono          (littlestone_restrict_fiber S Y ⟨x, hx⟩ false)      · exact (concept_class_restrict_nonempty _ Y h1).mono          (littlestone_restrict_fiber S Y ⟨x, hx⟩ true)    · right      refine ⟨⟨x, hx⟩, ?_, ?_⟩      · exact (concept_class_restrict_nonempty _ Z h0).mono          (littlestone_restrict_fiber S Z ⟨x, hx⟩ false)      · exact (concept_class_restrict_nonempty _ Z h1).mono          (littlestone_restrict_fiber S Z ⟨x, hx⟩ true)  | succ n ih =>    intro S d1 d2 Y Z hd hYZ hS    obtain ⟨x, h0, h1⟩ := hS    have sub0 : {h ∈ S | h x = false} ⊆ S := fun _ hg => hg.1    have sub1 : {h ∈ S | h x = true} ⊆ S := fun _ hg => hg.1    rcases hYZ x with hx | hx    · rcases d1 with _ | d1      · left        refine ⟨⟨x, hx⟩, ?_, ?_⟩        · exact (concept_class_restrict_nonempty _ Y            (littlestone_shatters_nonempty _ _ h0)).mono            (littlestone_restrict_fiber S Y ⟨x, hx⟩ false)        · exact (concept_class_restrict_nonempty _ Y            (littlestone_shatters_nonempty _ _ h1)).mono            (littlestone_restrict_fiber S Y ⟨x, hx⟩ true)      · rcases ih _ d1 d2 Y Z (by omega) hYZ h0 with a0 | a0        · rcases ih _ d1 d2 Y Z (by omega) hYZ h1 with a1 | a1          · left            exact ⟨⟨x, hx⟩,              littlestone_shatters_mono _ _ _ (littlestone_restrict_fiber S Y ⟨x, hx⟩ false) a0,              littlestone_shatters_mono _ _ _ (littlestone_restrict_fiber S Y ⟨x, hx⟩ true) a1⟩          · right            exact littlestone_shatters_mono _ _ _ (littlestone_restrict_mono _ _ Z sub1) a1        · right          exact littlestone_shatters_mono _ _ _ (littlestone_restrict_mono _ _ Z sub0) a0    · rcases d2 with _ | d2      · right        refine ⟨⟨x, hx⟩, ?_, ?_⟩        · exact (concept_class_restrict_nonempty _ Z            (littlestone_shatters_nonempty _ _ h0)).mono            (littlestone_restrict_fiber S Z ⟨x, hx⟩ false)        · exact (concept_class_restrict_nonempty _ Z            (littlestone_shatters_nonempty _ _ h1)).mono            (littlestone_restrict_fiber S Z ⟨x, hx⟩ true)      · rcases ih _ d1 d2 Y Z (by omega) hYZ h0 with a0 | a0        · left          exact littlestone_shatters_mono _ _ _ (littlestone_restrict_mono _ _ Y sub0) a0        · rcases ih _ d1 d2 Y Z (by omega) hYZ h1 with a1 | a1          · left            exact littlestone_shatters_mono _ _ _ (littlestone_restrict_mono _ _ Y sub1) a1          · right            exact ⟨⟨x, hx⟩,              littlestone_shatters_mono _ _ _ (littlestone_restrict_fiber S Z ⟨x, hx⟩ false) a0,              littlestone_shatters_mono _ _ _ (littlestone_restrict_fiber S Z ⟨x, hx⟩ true) a1⟩theorem littlestone_dim_le_restrict_add_restrict_compl {X : Type*} (H : Set (X → Bool))    (hH : H.Nonempty) (Y : Set X) :    littlestone_dim H ≤      littlestone_dim (concept_class_restrict H Y) + littlestone_dim (concept_class_restrict H Yᶜ) := by  rcases eq_top_or_lt_top (littlestone_dim (concept_class_restrict H Y)) with ha | ha  · rw [ha, top_add]; exact le_top  rcases eq_top_or_lt_top (littlestone_dim (concept_class_restrict H Yᶜ)) with hb | hb  · rw [hb, add_top]; exact le_top  obtain ⟨a, ha'⟩ := ENat.ne_top_iff_exists.1 ha.ne  obtain ⟨b, hb'⟩ := ENat.ne_top_iff_exists.1 hb.ne  rw [← ha', ← hb']  unfold littlestone_dim  apply iSup₂_le  intro d hd  by_contra hlt  have hlt' : a + b + 1 ≤ d := by    have : ¬ d ≤ a + b := fun h => hlt (by rw [← Nat.cast_add]; exact Nat.cast_le.2 h)    omega  have hs := littlestone_shatters_le H (a + b + 1) d hlt' hd  rcases littlestone_split_aux (a + b) H a b Y Yᶜ rfl (fun x => em (x ∈ Y)) hs with h | h  · have : ((a + 1 : ℕ) : ℕ∞) ≤ littlestone_dim (concept_class_restrict H Y) :=      le_iSup₂ (f := fun (d : ℕ) (_ : littlestone_shatters (concept_class_restrict H Y) d) =>        (d : ℕ∞)) (a + 1) h    rw [← ha'] at this    have : a + 1 ≤ a := Nat.cast_le.1 this    omega  · have : ((b + 1 : ℕ) : ℕ∞) ≤ littlestone_dim (concept_class_restrict H Yᶜ) :=      le_iSup₂ (f := fun (d : ℕ) (_ : littlestone_shatters (concept_class_restrict H Yᶜ) d) =>        (d : ℕ∞)) (b + 1) h    rw [← hb'] at this    have : b + 1 ≤ b := Nat.cast_le.1 this    omega
See it in the graphDiscuss this resultChallenge it