Cardinality of a finite set and subtraction #
This file contains results on the cardinality of a Finset and subtraction, by casting the
cardinality as element of an AddGroupWithOne.
Main results #
Finset.cast_card_erase_of_mem: erasing an element of a finset decrements the cardinality (avoidingℕsubtraction).Finset.cast_card_inter,Finset.cast_card_union: inclusion/exclusion principle.Finset.cast_card_sdiff: cardinality oft \ sis the difference of cardinalities ifs ⊆ t.
theorem
Finset.cast_card_erase_of_mem
{α : Type u_1}
{R : Type u_2}
{s : Finset α}
{a : α}
[DecidableEq α]
[AddGroupWithOne R]
(hs : a ∈ s)
:
$\#(s \setminus \{a\}) = \#s - 1$ if $a \in s$.
This result is casted to any additive group with 1,
so that we don't have to work with ℕ-subtraction.
theorem
Finset.cast_card_sdiff
{α : Type u_1}
{R : Type u_2}
{s t : Finset α}
[DecidableEq α]
[AddGroupWithOne R]
(h : s ⊆ t)
: