Skip to content

Commit

Permalink
feat(data/list/count): add lemma list.count_singleton' (#10880)
Browse files Browse the repository at this point in the history
A generalisation of `count_singleton`: `count a [b] = ite (a = b) 1 0`
  • Loading branch information
stuart-presnell committed Dec 19, 2021
1 parent 9e5cbc1 commit 68d9b42
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/data/list/count.lean
Expand Up @@ -89,6 +89,8 @@ lemma count_le_count_cons (a b : α) (l : list α) : count a l ≤ count a (b ::

lemma count_singleton (a : α) : count a [a] = 1 := if_pos rfl

lemma count_singleton' (a b : α) : count a [b] = ite (a = b) 1 0 := rfl

@[simp] lemma count_append (a : α) : ∀ l₁ l₂, count a (l₁ ++ l₂) = count a l₁ + count a l₂ :=
countp_append _

Expand Down

0 comments on commit 68d9b42

Please sign in to comment.