Skip to content

Commit

Permalink
feat(data/finset/basic): Cardinality of intersection with singleton (#…
Browse files Browse the repository at this point in the history
…3480)

Intersecting with a singleton produces a set of cardinality either 0 or 1.
  • Loading branch information
Smaug123 committed Jul 20, 2020
1 parent 1f74ddd commit 2915fae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/data/finset/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,13 @@ rw [card_insert_of_not_mem h]]

@[simp] theorem card_singleton (a : α) : card ({a} : finset α) = 1 := card_singleton _

lemma card_singleton_inter [decidable_eq α] {x : α} {s : finset α} : ({x} ∩ s).card ≤ 1 :=
begin
cases (finset.decidable_mem x s),
{ simp [finset.singleton_inter_of_not_mem h] },
{ simp [finset.singleton_inter_of_mem h] },
end

theorem card_erase_of_mem [decidable_eq α] {a : α} {s : finset α} :
a ∈ s → card (erase s a) = pred (card s) := card_erase_of_mem

Expand Down

0 comments on commit 2915fae

Please sign in to comment.