AFTD Auto-Formalizing Theoretical Domains

littlestone_dim_singleton

theoremverified

A class consisting of a single function X → Bool has Littlestone dimension 0.

Statement

theorem littlestone_dim_singleton {X : Type*} (h : X → Bool) :
    littlestone_dim ({h} : Set (X → Bool)) = 0
Source
Sanity check of littlestone_dim; arXiv:2611.26721 (Littlestone dimension and its dual), Section 2 (singleton classes have dimension zero).
Verified
29 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • 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…

The proof, explained

The Littlestone dimension of a class H is the supremum of all depths d shattered by H. Since 0 is the minimal element of ℕ∞, it suffices to show that any depth shattered by the singleton class {h} is at most 0. The case d = 0 is immediate, while shattering at depth d' + 1 requires the existence of a point x such that both sub-classes {f ∈ {h} | f(x) = false} and {f ∈ {h} | f(x) = true} shatter d'. By induction on depth, every shattered class is nonempty, which forces h(x) = false and h(x) = true simultaneously, contradicting false ≠ true.

  1. It suffices to show that any depth d shattered by {h} satisfies d ≤ 0.

    Since 0 is the minimum element (⊥) in ℕ∞, antisymmetry reduces littlestone_dim {h} = 0 to littlestone_dim {h} ≤ 0 via bot_le. By definition, the Littlestone dimension is the supremum over all shattered depths d; iSup₂_le reduces this inequality to proving d ≤ 0 for an arbitrary shattered depth d.

    lines 3–5

    uses le_antisymm, bot_le, iSup₂_le

      refine le_antisymm ?_ bot_le
      apply iSup₂_le
      intro d hd
  2. The base case d = 0 holds trivially.

    We split on whether d is zero or a successor. When d = 0, the inequality 0 ≤ 0 holds immediately.

    lines 6–7

      cases d with
      | zero => simp
  3. In the successor case d = d' + 1, the goal reduces to deriving a contradiction from the shattering witness.

    Since d' + 1 ≤ 0 cannot hold, we switch to proving False (via exfalso). Unfolding the definition of shattering at depth d' + 1 produces a test point x ∈ X such that both the false-branch {f ∈ {h} | f x = false} and the true-branch {f ∈ {h} | f x = true} shatter d'.

    lines 8–10

      | succ d =>
        exfalso
        obtain ⟨x, h0, h1⟩ := hd
  4. Any concept class that shatters a depth k is nonempty.

    We prove the helper lemma ne by induction on the depth k. For k = 0, shattering depth 0 is defined as nonemptiness, so the identity map id proves the claim. For k + 1, shattering provides an evaluation point y such that the sub-class of functions sending y to false shatters k. By the induction hypothesis, that sub-class contains some function g, which is also in S, showing S is nonempty.

    lines 11–18

    uses id

        have ne : ∀ (S : Set (X → Bool)) (k : ℕ), littlestone_shatters S k → S.Nonempty := by
          intro S k
          induction k generalizing S with
          | zero => exact id
          | succ k ih =>
            rintro ⟨y, hy, _⟩
            obtain ⟨g, hg, _⟩ := ih _ hy
            exact ⟨g, hg⟩
  5. Both branches must contain the sole function h, forcing false = true, a contradiction.

    Applying the nonemptiness lemma to each branch yields functions g₀, g₁ ∈ {h} with g₀(x) = false and g₁(x) = true. Since {h} is a singleton, Set.mem_singleton_iff gives g₀ = h and g₁ = h. Substituting h for both shows h(x) = false and h(x) = true, so false = true, which contradicts Bool.false_ne_true and closes the proof.

    lines 19–24

    uses Set.mem_singleton_iff, Bool.false_ne_true

        obtain ⟨g0, hg0, hg0x⟩ := ne _ _ h0
        obtain ⟨g1, hg1, hg1x⟩ := ne _ _ h1
        rw [Set.mem_singleton_iff] at hg0 hg1
        subst hg0 hg1
        rw [hg0x] at hg1x
        exact Bool.false_ne_true hg1x
le_antisymm
If a ≤ b and b ≤ a, then a = b (antisymmetry of the ordering).
bot_le
The bottom element ⊥ is less than or equal to any element.
iSup₂_le
A doubly indexed supremum ⨆ i, ⨆ j, f i j is bounded above by a if every individual term f i j ≤ a.
id
The identity function, mapping any term to itself.
Set.mem_singleton_iff
An element a belongs to the singleton set {b} if and only if a = b.
Bool.false_ne_true
The boolean values false and true are not equal.

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_dim_singleton {X : Type*} (h : X → Bool) :    littlestone_dim ({h} : Set (X → Bool)) = 0 := by  refine le_antisymm ?_ bot_le  apply iSup₂_le  intro d hd  cases d with  | zero => simp  | succ d =>    exfalso    obtain ⟨x, h0, h1⟩ := hd    have ne : ∀ (S : Set (X → Bool)) (k : ℕ), littlestone_shatters S k → S.Nonempty := by      intro S k      induction k generalizing S with      | zero => exact id      | succ k ih =>        rintro ⟨y, hy, _⟩        obtain ⟨g, hg, _⟩ := ih _ hy        exact ⟨g, hg⟩    obtain ⟨g0, hg0, hg0x⟩ := ne _ _ h0    obtain ⟨g1, hg1, hg1x⟩ := ne _ _ h1    rw [Set.mem_singleton_iff] at hg0 hg1    subst hg0 hg1    rw [hg0x] at hg1x    exact Bool.false_ne_true hg1x
See it in the graphDiscuss this resultChallenge it