# 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)

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

• 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 :
Instances
def FinEnum.ofEquiv (α : Sort u_1) {β : Sort u_2} [] (h : β α) :

transport a FinEnum instance across an equivalence

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

create a FinEnum instance from an exhaustive list without duplicates

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

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

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

create an exhaustive list of the values of a given type

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

create a FinEnum instance using a surjection

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

create a FinEnum instance using an injection

Equations
Instances For
instance FinEnum.pempty :
Equations
instance FinEnum.empty :
Equations
instance FinEnum.punit :
Equations
instance FinEnum.prod {α : Type u} {β : Type u_1} [] [] :
FinEnum (α × β)
Equations
• FinEnum.prod =
instance FinEnum.sum {α : Type u} {β : Type u_1} [] [] :
FinEnum (α β)
Equations
instance FinEnum.fin {n : } :
Equations
• FinEnum.fin =
instance FinEnum.Quotient.enum {α : Type u} [] (s : ) [DecidableRel fun (x x_1 : α) => x x_1] :
Equations
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 α) :
xs, x xs
instance FinEnum.Finset.finEnum {α : Type u} [] :
Equations
• FinEnum.Finset.finEnum =
instance FinEnum.Subtype.finEnum {α : Type u} [] (p : αProp) [] :
FinEnum { x : α // p x }
Equations
instance FinEnum.instSigma {α : Type u} (β : αType v) [] [(a : α) → FinEnum (β a)] :
Equations
instance FinEnum.PSigma.finEnum {α : Type u} {β : αType v} [] [(a : α) → FinEnum (β a)] :
FinEnum ((a : α) ×' β a)
Equations
instance FinEnum.PSigma.finEnumPropLeft {α : Prop} {β : αType v} [(a : α) → FinEnum (β a)] [] :
FinEnum ((a : α) ×' β a)
Equations
instance FinEnum.PSigma.finEnumPropRight {α : Type u} {β : αProp} [] [(a : α) → Decidable (β a)] :
FinEnum ((a : α) ×' β a)
Equations
• One or more equations did not get rendered due to their size.
instance FinEnum.PSigma.finEnumPropProp {α : Prop} {β : αProp} [] [(a : α) → Decidable (β a)] :
FinEnum ((a : α) ×' β a)
Equations
• FinEnum.PSigma.finEnumPropProp = if h : ∃ (a : α), β a then FinEnum.ofList [, ] else
@[instance 100]
instance FinEnum.instFintype {α : Type u} [] :
Equations
• FinEnum.instFintype = { elems := Finset.map FinEnum.equiv.symm.toEmbedding Finset.univ, complete := }
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

Equations
• FinEnum.Pi.cons x✝¹ xs y f x✝ x = match x✝, x with | b, h => if h' : b = x✝¹ then cast y else f b
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.

Equations
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

Equations
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)
Equations
instance FinEnum.pfunFinEnum (p : Prop) [] (α : pType) [(hp : p) → FinEnum (α hp)] :
FinEnum ((hp : p) → α hp)
Equations