# Documentation

Mathlib.Data.FinEnum

Type class for finitely enumerable types. The property is stronger than Fintype in that it assigns each element a rank in a finite enumeration.

class FinEnum (α : Sort u_1) :
Sort (max 1 u_1)
• card :

FinEnum.card is the cardinality of the FinEnum

• equiv : α Fin ()

FinEnum.Equiv states that type α is in bijection with Fin card, the size of the FinEnum

• decEq :

FinEnum α means that α is finite and can be enumerated in some order, i.e. α has an explicit bijection with Fin n for some n.

Instances
def FinEnum.ofEquiv (α : Sort u_1) {β : Sort u_2} [] (h : β α) :

transport a FinEnum instance across an equivalence

Instances For
def FinEnum.ofNodupList {α : Type u} [] (xs : List α) (h : ∀ (x : α), x xs) (h' : ) :

create a FinEnum instance from an exhaustive list without duplicates

Instances For
def FinEnum.ofList {α : Type u} [] (xs : List α) (h : ∀ (x : α), x xs) :

create a FinEnum instance from an exhaustive list; duplicates are removed

Instances For
def FinEnum.toList (α : Type u_1) [] :
List α

create an exhaustive list of the values of a given type

Instances For
@[simp]
theorem FinEnum.mem_toList {α : Type u} [] (x : α) :
@[simp]
theorem FinEnum.nodup_toList {α : Type u} [] :
def FinEnum.ofSurjective {α : Type u} {β : Type u_1} (f : βα) [] [] (h : ) :

create a FinEnum instance using a surjection

Instances For
noncomputable def FinEnum.ofInjective {α : Type u_1} {β : Type u_2} (f : αβ) [] [] (h : ) :

create a FinEnum instance using an injection

Instances For
instance FinEnum.prod {α : Type u} {β : Type u_1} [] [] :
FinEnum (α × β)
instance FinEnum.sum {α : Type u} {β : Type u_1} [] [] :
FinEnum (α β)
instance FinEnum.fin {n : } :
instance FinEnum.Quotient.enum {α : Type u} [] (s : ) [DecidableRel fun x x_1 => x x_1] :
def FinEnum.Finset.enum {α : Type u} [] :
List αList ()

enumerate all finite sets of a given type

Equations
Instances For
@[simp]
theorem FinEnum.Finset.mem_enum {α : Type u} [] (s : ) (xs : List α) :
∀ (x : α), x sx xs
instance FinEnum.Finset.finEnum {α : Type u} [] :
instance FinEnum.Subtype.finEnum {α : Type u} [] (p : αProp) [] :
FinEnum { x // p x }
instance FinEnum.instFinEnumSigma {α : Type u} (β : αType v) [] [(a : α) → FinEnum (β a)] :
instance FinEnum.PSigma.finEnum {α : Type u} {β : αType v} [] [(a : α) → FinEnum (β a)] :
FinEnum ((a : α) ×' β a)
instance FinEnum.PSigma.finEnumPropLeft {α : Prop} {β : αType v} [(a : α) → FinEnum (β a)] [] :
FinEnum ((a : α) ×' β a)
instance FinEnum.PSigma.finEnumPropRight {α : Type u} {β : αProp} [] [(a : α) → Decidable (β a)] :
FinEnum ((a : α) ×' β a)
instance FinEnum.PSigma.finEnumPropProp {α : Prop} {β : αProp} [] [(a : α) → Decidable (β a)] :
FinEnum ((a : α) ×' β a)
instance FinEnum.instFintype {α : Type u} [] :
def FinEnum.Pi.cons {α : Type u} {β : αType v} [] (x : α) (xs : List α) (y : β x) (f : (a : α) → a xsβ a) (a : α) :
a x :: xsβ a

For Pi.cons x xs y f create a function where every i ∈ xs is mapped to f i and x is mapped to y

Instances For
def FinEnum.Pi.tail {α : Type u} {β : αType v} {x : α} {xs : List α} (f : (a : α) → a x :: xsβ a) (a : α) :
a xsβ a

Given f a function whose domain is x :: xs, produce a function whose domain is restricted to xs.

Instances For
def FinEnum.pi {α : Type u} {β : αType (max u v)} [] (xs : List α) :
((a : α) → List (β a)) → List ((a : α) → a xsβ a)

pi xs f creates the list of functions g such that, for x ∈ xs, g x ∈ f x

Equations
Instances For
theorem FinEnum.mem_pi {α : Type u} {β : αType (max u u_1)} [] [(a : α) → FinEnum (β a)] (xs : List α) (f : (a : α) → a xsβ a) :
f FinEnum.pi xs fun x => FinEnum.toList (β x)
def FinEnum.pi.enum {α : Type u} (β : αType (max u v)) [] [(a : α) → FinEnum (β a)] :
List ((a : α) → β a)

enumerate all functions whose domain and range are finitely enumerable

Instances For
theorem FinEnum.pi.mem_enum {α : Type u} {β : αType (max u v)} [] [(a : α) → FinEnum (β a)] (f : (a : α) → β a) :
instance FinEnum.pi.finEnum {α : Type u} {β : αType (max u v)} [] [(a : α) → FinEnum (β a)] :
FinEnum ((a : α) → β a)
instance FinEnum.pfunFinEnum (p : Prop) [] (α : pType) [(hp : p) → FinEnum (α hp)] :
FinEnum ((hp : p) → α hp)