Documentation

LeanAPAP.Prereqs.Density

Density of a finite set #

This defines the density of a Finset and provides induction principles for finsets.

Main declarations #

Notation #

If you need to specify the field the density is valued in, dens[𝕜] s is notation for (dens s : 𝕜). Note that no dot notation is allowed.

def Finset.dens {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] (s : Finset α) :
𝕜

dens s is the number of elements of s, aka its density.

Equations
Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Finset.card_div_card_eq_dens {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] (s : Finset α) :
      s.dens = s.card / (Fintype.card α)
      @[simp]
      theorem Finset.dens_empty {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] :
      .dens = 0
      @[simp]
      theorem Finset.dens_singleton {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] (a : α) :
      {a}.dens = ((Fintype.card α))⁻¹
      @[simp]
      theorem Finset.dens_cons {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} {a : α} (h : as) :
      (Finset.cons a s h).dens = s.dens + ((Fintype.card α))⁻¹
      @[simp]
      theorem Finset.dens_disjUnion {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] (s : Finset α) (t : Finset α) (h : Disjoint s t) :
      (Finset.disjUnion s t h).dens = s.dens + t.dens
      theorem Finset.dens_union_add_dens_inter {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] [DecidableEq α] (s : Finset α) (t : Finset α) :
      (s t).dens + (s t).dens = s.dens + t.dens
      theorem Finset.dens_inter_add_dens_union {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] [DecidableEq α] (s : Finset α) (t : Finset α) :
      (s t).dens + (s t).dens = s.dens + t.dens
      @[simp]
      theorem Finset.dens_union_of_disjoint {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} {t : Finset α} [DecidableEq α] (h : Disjoint s t) :
      (s t).dens = s.dens + t.dens
      theorem Finset.dens_sdiff_add_dens_eq_dens {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} {t : Finset α} [DecidableEq α] (h : s t) :
      (t \ s).dens + s.dens = t.dens
      theorem Finset.dens_sdiff_add_dens {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} {t : Finset α} [DecidableEq α] :
      (s \ t).dens + t.dens = (s t).dens
      theorem Finset.dens_sdiff_comm {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} {t : Finset α} [DecidableEq α] [IsCancelAdd 𝕜] (h : s.card = t.card) :
      (s \ t).dens = (t \ s).dens
      @[simp]
      theorem Finset.dens_sdiff_add_dens_inter {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] [DecidableEq α] (s : Finset α) (t : Finset α) :
      (s \ t).dens + (s t).dens = s.dens
      @[simp]
      theorem Finset.dens_inter_add_dens_sdiff {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] [DecidableEq α] (s : Finset α) (t : Finset α) :
      (s t).dens + (s \ t).dens = s.dens
      theorem Finset.dens_filter_add_dens_filter_not_eq_dens {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} [DecidableEq α] (p : αProp) [DecidablePred p] [(x : α) → Decidable ¬p x] :
      (Finset.filter p s).dens + (Finset.filter (fun (a : α) => ¬p a) s).dens = s.dens
      @[simp]
      theorem Finset.dens_eq_zero {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} [CharZero 𝕜] :
      s.dens = 0 s =
      theorem Finset.dens_ne_zero {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} [CharZero 𝕜] :
      s.dens 0 s.Nonempty
      theorem Finset.Nonempty.dens_ne_zero {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} [CharZero 𝕜] :
      s.Nonemptys.dens 0

      Alias of the reverse direction of Finset.dens_ne_zero.

      @[simp]
      theorem Finset.dens_univ {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] [CharZero 𝕜] [Nonempty α] :
      Finset.univ.dens = 1
      @[simp]
      theorem Finset.dens_eq_one {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} [CharZero 𝕜] [Nonempty α] :
      s.dens = 1 s = Finset.univ
      theorem Finset.dens_ne_one {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [Semifield 𝕜] {s : Finset α} [CharZero 𝕜] [Nonempty α] :
      s.dens 1 s Finset.univ
      @[simp]
      theorem Finset.dens_nonneg {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] {s : Finset α} :
      0 s.dens
      theorem Finset.dens_le_dens {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] {s : Finset α} {t : Finset α} (h : s t) :
      s.dens t.dens
      theorem Finset.dens_lt_dens {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] {s : Finset α} {t : Finset α} (h : s t) :
      s.dens < t.dens
      theorem Finset.dens_mono {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] :
      Monotone Finset.dens
      theorem Finset.dens_strictMono {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] :
      StrictMono Finset.dens
      theorem Finset.dens_map_le {𝕜 : Type u_1} {α : Type u_2} {β : Type u_3} [Fintype α] [LinearOrderedSemifield 𝕜] {s : Finset α} [Fintype β] (f : α β) :
      (Finset.map f s).dens s.dens
      theorem Finset.dens_union_le {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] [DecidableEq α] (s : Finset α) (t : Finset α) :
      (s t).dens s.dens + t.dens
      theorem Finset.dens_le_dens_sdiff_add_dens {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] {s : Finset α} {t : Finset α} [DecidableEq α] :
      s.dens (s \ t).dens + t.dens
      theorem Finset.dens_sdiff {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] {s : Finset α} {t : Finset α} [DecidableEq α] [Sub 𝕜] [OrderedSub 𝕜] (h : s t) :
      (t \ s).dens = t.dens - s.dens
      theorem Finset.le_dens_sdiff {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] [DecidableEq α] [Sub 𝕜] [OrderedSub 𝕜] (s : Finset α) (t : Finset α) :
      t.dens - s.dens (t \ s).dens
      @[simp]
      theorem Finset.dens_pos {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] {s : Finset α} [CharZero 𝕜] :
      0 < s.dens s.Nonempty
      theorem Finset.Nonempty.dens_pos {𝕜 : Type u_1} {α : Type u_2} [Fintype α] [LinearOrderedSemifield 𝕜] {s : Finset α} [CharZero 𝕜] :
      s.Nonempty0 < s.dens

      Alias of the reverse direction of Finset.dens_pos.