Cardinality of a finite set #
This defines the cardinality of a Finset and provides induction principles for finsets.
Main declarations #
Finset.card:s.card : ℕreturns the cardinality ofs : Finset α.
Induction principles #
Finset.strongInduction: Strong inductionFinset.strongInductionOnFinset.strongDownwardInductionFinset.strongDownwardInductionOnFinset.case_strong_induction_on
TODO #
Should we add a noncomputable version?
s.card is the number of elements of s, aka its cardinality.
Equations
- Finset.card s = ↑Multiset.card s.val
Instances For
Alias of the reverse direction of Finset.card_pos.
If a ∈ s is known, see also Finset.card_insert_of_mem and Finset.card_insert_of_not_mem.
$#(s \setminus {a}) = #s - 1$ if $a \in 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.
If a ∈ s is known, see also Finset.card_erase_of_mem and Finset.erase_eq_of_not_mem.
If there are more pigeons than pigeonholes, then there are two pigeons in the same pigeonhole.
Lattice structure #
Given a set A and a set B inside it, we can shrink A to any appropriate size, and keep B
inside it.
We can shrink A to any smaller size.
Explicit description of a finset from its card #
A Finset of a subsingleton type has cardinality at most one.
If a Finset in a Pi type is nontrivial (has at least two elements), then its projection to some factor is nontrivial, and the fibers of the projection are proper subsets.
Inductions #
Suppose that, given objects defined on all strict subsets of any finset s, one knows how to
define an object on s. Then one can inductively define an object on all finsets, starting from
the empty set and iterating. This can be used either to define data, or to prove properties.
Equations
- Finset.strongInduction H x = H x fun t h => let_fun this := (_ : Finset.card t < Finset.card x); Finset.strongInduction H t
Instances For
Analogue of strongInduction with order of arguments swapped.
Equations
Instances For
Suppose that, given that p t can be defined on all supersets of s of cardinality less than
n, one knows how to define p s. Then one can inductively define p s for all finsets s of
cardinality less than n, starting from finsets of card n and iterating. This
can be used either to define data, or to prove properties.
Equations
- Finset.strongDownwardInduction H x = H x fun {t} ht h => let_fun this := (_ : n - Finset.card t < n - Finset.card x); Finset.strongDownwardInduction H t ht
Instances For
Analogue of strongDownwardInduction with order of arguments swapped.