Documentation

Acmoi.Basic

VC-dimensions of nondeterministic finite automata for words of equal length #

Definition 10, Lemma 11, and Lemma 12 from the paper.
(Bonus material for ac-exercises)
def shatters_card {V : Type u_1} [DecidableEq V] (𝓕 : Finset (Finset V)) (d : ) :

To make this computable, restrict A ⊆ ⋃ 𝓕

Equations
Instances For
    instance instDecidableEqFinsetInter_acmoi {V : Type u_1} [DecidableEq V] (A : Finset V) (B : Finset V) (C : Finset V) :
    Decidable (A C = B)
    Equations
    instance instDecidableEqFinset_acmoi {V : Type u_1} [DecidableEq V] (𝓕 : Finset (Finset V)) (𝓖 : Finset (Finset V)) :
    Decidable (𝓕 = 𝓖)
    Equations
    instance instDecidableExistsFinsetAndMemEqInter_acmoi {V : Type u_1} [DecidableEq V] (A : Finset V) (B : Finset V) (𝓕 : Finset (Finset V)) :
    Decidable (∃ C𝓕, A C = B)
    Equations
    instance instDecidableForallForallSubsetFinsetExistsAndMemEqInter_acmoi {V : Type u_1} [DecidableEq V] [Fintype V] (A : Finset V) (𝓕 : Finset (Finset V)) :
    Decidable (∀ BA, C𝓕, A C = B)
    Equations
    instance instDecidableAndEqNatCardForallForallSubsetFinsetExistsMemInter_acmoi {V : Type u_1} [DecidableEq V] [Fintype V] (A : Finset V) (𝓕 : Finset (Finset V)) (d : ) :
    Decidable (A.card = d BA, C𝓕, A C = B)
    Equations
    instance instDecidableShatters_card {V : Type u_1} [DecidableEq V] [Fintype V] (𝓕 : Finset (Finset V)) (d : ) :
    Equations
    theorem nonempty_shatters {V : Type u_1} [DecidableEq V] [Fintype V] (𝓕 : Finset (Finset V)) {A : Finset V} (hA : A 𝓕) :
    theorem filter_condition {V : Type u_1} (𝓕 : Finset (Finset V)) (condition : Finset (Finset V)Prop) [DecidablePred (condition 𝓕)] (h₀ : 0 < 𝓕.card) (h₁ : condition 𝓕 0) :
    0 Finset.filter (fun (k : ) => condition 𝓕 k) (Finset.range 𝓕.card)
    theorem equivVC {V : Type u_1} [DecidableEq V] [Fintype V] (F : Finset (Finset V)) :
    0 < F.card shatters_card F 0
    theorem VC_filter {V : Type u_1} [DecidableEq V] [Fintype V] (F : Finset (Finset V)) (h₀ : 0 < F.card) :
    0 Finset.filter (fun (k : ) => shatters_card F k) (Finset.range F.card)

    TODO: Simplify since the two assumptions are equivalent.

    def dimVC {V : Type u_1} [DecidableEq V] [Fintype V] (𝓕 : { 𝓕 : Finset (Finset V) // ∃ (f : Finset V), f 𝓕 }) :

    The VC dimension of a finite set family.

    Equations
    Instances For
      theorem subset_of_size {α : Type u_1} {s : Finset α} (a : ) (b : ) (h_card : s.card = b) (h_le : a b) :
      ts, t.card = a

      Obtain a smaller subset of a given set.

      theorem of_size_subset (V : Type u_1) [Fintype V] (S : Finset V) (k : ) (l : ) (h₀ : k l) (h : S.card = l) :
      ∃ (T : Finset V), T.card = k T S
      theorem shatters_monotone {V : Type u_1} [DecidableEq V] [Fintype V] (𝓕 : { 𝓕 : Finset (Finset V) // ∃ (f : Finset V), f 𝓕 }) (k : ) (l : ) (h : k l) (h₀ : shatters_card (↑𝓕) l) :
      shatters_card (↑𝓕) k
      theorem le_max'_iff (S : Finset ) (h : S.Nonempty) (k : ) :
      k S.max' h yS, k y
      theorem VC_as_a_function {V : Type u_1} [DecidableEq V] [Fintype V] (F : Finset (Finset V)) (k : ) (h : shatters_card F k) :
      ∃ (A : Finset V), A.card = k ∃ (φ : { B : Finset V // B A }{ C : Finset V // C F }), ∀ (B : { B : Finset V // B A }), A (φ B) = B
      theorem VC_injective_function {V : Type u_1} [DecidableEq V] [Fintype V] (F : Finset (Finset V)) (A : Finset V) (φ : { B : Finset V // B A }{ C : Finset V // C F }) (h : ∀ (B : { B : Finset V // B A }), A (φ B) = B) :
      theorem card_of_injective {V : Type u_1} [DecidableEq V] [Fintype V] (F : Finset (Finset V)) (A : Finset V) (φ : { B : Finset V // B A }{ C : Finset V // C F }) (h : Function.Injective φ) :
      A.powerset.card F.card

      Lean 3 version thanks to Adam Topaz.

      theorem pow_le_of_shatters {V : Type u_1} [DecidableEq V] [Fintype V] (F : Finset (Finset V)) (k : ) (h : shatters_card F k) :
      2 ^ k F.card
      theorem pow_le (m : ) :
      m < 2 ^ m
      theorem VC_works {V : Type u_1} [DecidableEq V] [Fintype V] (𝓕 : { 𝓕 : Finset (Finset V) // ∃ (f : Finset V), f 𝓕 }) (k : ) :
      k dimVC 𝓕 shatters_card (↑𝓕) k

      Dec 21 2024 with just a little ChatGPT help.

      theorem dimVC_eq {V : Type u_1} [DecidableEq V] [Fintype V] (𝓕 : { 𝓕 : Finset (Finset V) // ∃ (f : Finset V), f 𝓕 }) (k : ) :
      shatters_card (↑𝓕) k ¬shatters_card (↑𝓕) (k + 1)dimVC 𝓕 = k
      theorem rescue_lemma_12 {m : } :
      (2 * m.succ).succ < 2 ^ Nat.clog 2 (2 * m.succ).succ
      def ν₂ (n : ) :

      ν₂ is called t in the paper.

      Equations
      Instances For
        theorem ν₂_odd (n : ) :
        ν₂ (2 * n + 1) = 0
        theorem ν₂_2 (n : ) (h : 0 < n) :
        ν₂ (2 * n) = ν₂ n + 1
        theorem bits_odd {n : } :
        (2 * n + 1).bits = true :: n.bits
        theorem bits_even {n : } (h : n 0) :
        (2 * n).bits = false :: n.bits
        theorem length_map_sum (l : List Bool) :
        (List.map Bool.toNat l).sum l.length
        def hammingBits (n : ) :
        Equations
        Instances For
          theorem hammingBits_odd (n : ) :
          theorem mentioned_in_lemma_12 {n : } {s : } (h : n < 2 ^ s) :
          theorem andhence {m : } :
          hammingBits (2 * m.succ) < Nat.clog 2 (2 * m.succ).succ
          theorem ν₂_hammingBits (n : ) :
          ν₂ (n + 1) + hammingBits (n + 1) = hammingBits n + 1
          def arndt :

          This function is called a at https://oeis.org/A005187 and we name it in honor of Jörg Arndt.

          Equations
          Instances For
            theorem lemma11 (m : ) :
            arndt m + hammingBits (2 * m) = 2 * m

            Jörg Arndt (2019) claimed this without proof as a resolution of a conjecture of Benoit Cloitre (2003). Cloitre is a coauthor of Shallit (2023) and Jean-Paul Allouche.

            theorem lemma12 (n : ) :
            arndt n + Nat.clog 2 n.succ 2 * n