Finite sets
This file defines predicates finite : set α → Prop
and infinite : set α → Prop
and proves some
basic facts about finite sets.
The subtype corresponding to a finite set is a finite type. Note
that because finite
isn't a typeclass, this will not fire if it
is made into an instance
Equations
- h.fintype = classical.choice h
Finite sets can be lifted to finsets.
Equations
- set.can_lift = {coe := coe lift_base, cond := set.finite α, prf := _}
Membership of a subset of a finite type is decidable.
Using this as an instance leads to potential loops with subtype.fintype
under certain decidability
assumptions, so it should only be declared a local instance.
Equations
Equations
- set.fintype_empty = fintype.of_finset ∅ set.fintype_empty._proof_1
A fintype
structure on insert a s
.
Equations
- s.fintype_insert' h = fintype.of_finset {val := a :: s.to_finset.val, nodup := _} _
Equations
- set.fintype_insert a s = dite (a ∈ s) (λ (h : a ∈ s), _.mpr (_.mpr _inst_2)) (λ (h : a ∉ s), s.fintype_insert' h)
Equations
Equations
Equations
Embedding of ℕ
into an infinite set.
Equations
Equations
- s.fintype_union t = fintype.of_finset (s.to_finset ∪ t.to_finset) _
Equations
- s.fintype_sep p = fintype.of_finset (finset.filter p s.to_finset) _
Equations
- s.fintype_inter t = s.fintype_sep t
A fintype
structure on a set defines a fintype
structure on its subset.
Equations
- s.fintype_subset h = _.mpr (s.fintype_inter t)
Equations
- s.fintype_image f = fintype.of_finset (finset.image f s.to_finset) _
Equations
Equations
If a function f
has a partial inverse and sends a set s
to a set with [fintype]
instance,
then s
has a fintype
structure as well.
Equations
- s.fintype_of_fintype_image I = fintype.of_finset {val := multiset.filter_map g (f '' s).to_finset.val, nodup := _} _
Equations
- set.fintype_Union f = fintype.of_finset (finset.univ.bind (λ (i : ι), (f i).to_finset)) _
A union of sets with fintype
structure over a set with fintype
structure has a fintype
structure.
Equations
- set.fintype_bUnion f H = _.mpr (set.fintype_Union (λ (i : ↥s), f ↑i))
Equations
- set.fintype_bUnion' f = set.fintype_bUnion (λ (i : ι), f i) (λ (i : ι) (_x : i ∈ s), H i)
Equations
Equations
- set.fintype_le_nat n = _.mp (set.fintype_lt_nat (n + 1))
image2 f s t
is finitype if s
and t
are.
Equations
- set.fintype_image2 f s t = _.mpr ((s.prod t).fintype_image (λ (x : α × β), f x.fst x.snd))
If s : set α
is a set with fintype
instance and f : α → set β
is a function such that
each f a
, a ∈ s
, has a fintype
structure, then s >>= f
has a fintype
structure.
Equations
- s.fintype_bind f H = set.fintype_bUnion (λ (i : α), f i) H
Equations
- s.fintype_bind' f = s.fintype_bind f (λ (i : α) (_x : i ∈ s), H i)
Equations
- f.fintype_seq s = _.mpr (f.fintype_bind' (λ (_x : α → β), _x <$> s))
Equations
If P
is some relation between terms of γ
and sets in γ
,
such that every finite set t : set γ
has some c : γ
related to it,
then there is a recursively defined sequence u
in γ
so u n
is related to the image of {0, 1, ..., n-1}
under u
.
(We use this later to show sequentially compact sets are totally bounded.)
A finite set is bounded above.
A finite set is bounded below.
A finset is bounded above.
A finset is bounded below.