Subsets of finite types #
In a Fintype, all Sets are automatically Finsets, and there are only finitely many of them.
Main results #
Set.toFinset: convert a subset of a finite type to aFinsetFinset.fintypeCoeSort:((s : Finset α) : Type*)is a finite typeFintype.finsetEquivSet:Finset αandSet αare equivalent ifαis aFintype
Membership of a set with a Fintype instance 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
Instances For
Alias of the reverse direction of Set.toFinset_nonempty.
@[simp]
@[simp]
@[simp]
theorem
Set.toFinset_setOf
{α : Type u_1}
[Fintype α]
(p : α → Prop)
[DecidablePred p]
[Fintype ↑{x : α | p x}]
:
@[simp]
theorem
Set.toFinset_image
{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
(f : α → β)
(s : Set α)
[Fintype ↑s]
[Fintype ↑(f '' s)]
:
@[simp]
theorem
Set.toFinset_range
{α : Type u_1}
{β : Type u_2}
[DecidableEq α]
[Fintype β]
(f : β → α)
[Fintype ↑(range f)]
:
theorem
Fintype.coe_image_univ
{α : Type u_1}
{β : Type u_2}
[Fintype α]
[DecidableEq β]
{f : α → β}
:
def
setFintype
{α : Type u_1}
[Fintype α]
(s : Set α)
[DecidablePred fun (x : α) => x ∈ s]
:
Fintype ↑s
A set on a fintype, when coerced to a type, is a fintype.
Equations
Instances For
@[simp]
@[simp]
@[simp]
Given a fintype α, finsetOrderIsoSet is the order isomorphism between Finset α and Set α
(all sets on a finite type are finite).
Equations
Instances For
@[simp]
@[simp]
@[simp]
theorem
mem_image_univ_iff_mem_range
{α : Type u_4}
{β : Type u_5}
[Fintype α]
[DecidableEq β]
{f : α → β}
{b : β}
:
finset% t elaborates t as a Finset.
If t is a Set, then inserts Set.toFinset.
Does not make use of the expected type; useful for big operators over finsets.
#check finset% Finset.range 2 -- Finset Nat
#check finset% (Set.univ : Set Bool) -- Finset Bool
Equations
Instances For
quot_precheck for the finset% syntax.