The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Data.List.Count

6 declarations. Mathlib docs · Source

theorem List.countP_lt_length_iff E0 #

∀ {α : Type u_1} {l : List α} {p : α → Bool}, List.countP p l < l.length ↔ ∃ a ∈ l, p a = false

theorem List.count_lt_length_iff E0 #

∀ {α : Type u_1} [inst : BEq α] [LawfulBEq α] {l : List α} {a : α}, List.count a l < l.length ↔ ∃ b ∈ l, b ≠ a

theorem List.countP_erase E1 #

∀ {α : Type u_1} [inst : BEq α] [inst_1 : LawfulBEq α] (p : α → Bool) (l : List α) (a : α),
  List.countP p (l.erase a) = List.countP p l - if a ∈ l ∧ p a = true then 1 else 0

theorem List.count_diff E1 #

∀ {α : Type u_1} [inst : BEq α] [LawfulBEq α] (a : α) (l₁ l₂ : List α),
  List.count a (l₁.diff l₂) = List.count a l₁ - List.count a l₂

theorem List.countP_diff E1 #

∀ {α : Type u_1} [inst : BEq α] [LawfulBEq α] {l₁ l₂ : List α},
  l₂.Subperm l₁ → ∀ (p : α → Bool), List.countP p (l₁.diff l₂) = List.countP p l₁ - List.countP p l₂

theorem List.count_map_of_injective E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : BEq α] [LawfulBEq α] [inst_2 : BEq β] [LawfulBEq β] (l : List α) (f : α → β),
  Function.Injective f → ∀ (x : α), List.count (f x) (List.map f l) = List.count x l