Finite types #
This file defines a typeclass to state that a type is finite.
Main declarations #
Fintype α
: Typeclass saying that a type is finite. It takes as fields aFinset
and a proof that all terms of typeα
are in it.Finset.univ
: The finset of all elements of a fintype.
See Data.Fintype.Basic
for elementary results,
Data.Fintype.Card
for the cardinality of a fintype,
the equivalence with Fin (Fintype.card α)
, and pigeonhole principles.
Instances #
Instances for Fintype
for
{x // p x}
are in this file asFintype.subtype
Option α
are inData.Fintype.Option
α × β
are inData.Fintype.Prod
α ⊕ β
are inData.Fintype.Sum
Σ (a : α), β a
are inData.Fintype.Sigma
These files also contain appropriate Infinite
instances for these types.
Infinite
instances for ℕ
, ℤ
, Multiset α
, and List α
are in Data.Fintype.Lattice
.
Fintype α
means that α
is finite, i.e. there are only
finitely many distinct elements of type α
. The evidence of this
is a finset elems
(a list up to permutation without duplicates),
together with a proof that everything of type α
is in the list.
Instances
- Bool.fintype
- Fin.fintype
- Finset.Subtype.fintype
- Finset.fintype
- Finset.fintypeCoeSort
- FinsetCoe.fintype
- Fintype.instEmpty
- Fintype.instPEmpty
- Fintype.subtypeEq
- Fintype.subtypeEq'
- Function.Embedding.fintype
- LO.FirstOrder.Semiformula.instFintypeFuncLanguageFinset
- LO.FirstOrder.Semiformula.instFintypeRelLanguageFinset
- Lex.fintype
- List.Subtype.fintype
- Multiset.Subtype.fintype
- OrderDual.fintype
- Ordering.fintype
- PLift.fintype
- PLift.fintypeProp
- PSigma.fintypePropLeft
- PSigma.fintypePropProp
- PSigma.fintypePropRight
- PSigma.instFintype
- PUnit.fintype
- Pi.instFintype
- Prop.fintype
- Quotient.fintype
- RelEmbedding.instFintype
- RelHom.instFintype
- Set.fintype
- Set.fintypeBiUnion'
- Set.fintypeDiff
- Set.fintypeDiffLeft
- Set.fintypeEmpty
- Set.fintypeImage
- Set.fintypeImage2
- Set.fintypeInsert
- Set.fintypeInsert'
- Set.fintypeInter
- Set.fintypeInterOfLeft
- Set.fintypeInterOfRight
- Set.fintypeLENat
- Set.fintypeLTNat
- Set.fintypeMap
- Set.fintypeMemFinset
- Set.fintypeOffDiag
- Set.fintypeProd
- Set.fintypeRange
- Set.fintypeSep
- Set.fintypeSingleton
- Set.fintypeTop
- Set.fintypeUIcc
- Set.fintypeUnion
- Set.fintypeUniv
- Set.fintypeiUnion
- Set.fintypesUnion
- Set.instFintypeIcc
- Set.instFintypeIci
- Set.instFintypeIco
- Set.instFintypeIic
- Set.instFintypeIio
- Set.instFintypeIoc
- Set.instFintypeIoi
- Set.instFintypeIoo
- Sigma.instFintype
- Subtype.fintype
- ULift.fintype
- Unique.fintype
- Unit.fintype
- Vector.fintype
- ZMod.fintype
- fintypeNodupList
- instFintypeOption
- instFintypeProd
- instFintypeSum
- instFintypeSym'OfDecidableEq
- instFintypeSymOfDecidableEq
- pfunFintype
Preparatory lemmas #
Equations
Equations
- List.instDecidableBijOnToSetOfDecidableEq = inferInstanceAs (Decidable (Set.MapsTo f ↑s ↑t' ∧ Set.InjOn f ↑s ∧ Set.SurjOn f ↑s ↑t'))
Elaborate set builder notation for Finset
.
{x | p x}
is elaborated asFinset.filter (fun x ↦ p x) Finset.univ
if the expected type isFinset ?α
.{x : α | p x}
is elaborated asFinset.filter (fun x : α ↦ p x) Finset.univ
if the expected type isFinset ?α
.{x ∉ s | p x}
is elaborated asFinset.filter (fun x ↦ p x) sᶜ
if either the expected type isFinset ?α
or the expected type is notSet ?α
ands
has expected typeFinset ?α
.{x ≠ a | p x}
is elaborated asFinset.filter (fun x ↦ p x) {a}ᶜ
if the expected type isFinset ?α
.
See also
Data.Set.Defs
for theSet
builder notation elaborator that this elaborator partly overrides.Data.Finset.Basic
for theFinset
builder notation elaborator partly overriding this one for syntax of the form{x ∈ s | p x}
.Data.Fintype.Basic
for theFinset
builder notation elaborator handling syntax of the form{x | p x}
,{x : α | p x}
,{x ∉ s | p x}
,{x ≠ a | p x}
.Order.LocallyFinite.Basic
for theFinset
builder notation elaborator handling syntax of the form{x ≤ a | p x}
,{x ≥ a | p x}
,{x < a | p x}
,{x > a | p x}
.
Equations
- One or more equations did not get rendered due to their size.
Delaborator for Finset.filter
. The pp.funBinderTypes
option controls whether
to show the domain type when the filter is over Finset.univ
.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Fintype.decidablePiFintype f g = decidable_of_iff (∀ a ∈ Fintype.elems, f a = g a) ⋯
Equations
- Fintype.decidableForallFintype = decidable_of_iff (∀ a ∈ Finset.univ, p a) ⋯
Equations
- Fintype.decidableExistsFintype = decidable_of_iff (∃ a ∈ Finset.univ, p a) ⋯
Equations
Equations
- Fintype.decidableSubsingleton = decidable_of_iff (∀ a ∈ s, ∀ b ∈ s, a = b) ⋯
Equations
- Fintype.decidableEqEquivFintype a b = decidable_of_iff (a.toFun = b.toFun) ⋯
Equations
- Fintype.decidableEqEmbeddingFintype a b = decidable_of_iff (⇑a = ⇑b) ⋯
Equations
Equations
Equations
Equations
Equations
Given a predicate that can be represented by a finset, the subtype associated to the predicate is a fintype.
Equations
- Fintype.subtype s H = { elems := { val := Multiset.pmap Subtype.mk s.val ⋯, nodup := ⋯ }, complete := ⋯ }
Construct a fintype from a finset with the same elements.
Equations
- Fintype.ofFinset s H = Fintype.subtype s H
Equations
- Bool.fintype = { elems := { val := {true, false}, nodup := Bool.fintype._proof_1 }, complete := Bool.fintype._proof_2 }
Equations
- Ordering.fintype = { elems := { val := {Ordering.lt, Ordering.eq, Ordering.gt}, nodup := Ordering.fintype._proof_1 }, complete := Ordering.fintype._proof_2 }
Equations
- OrderDual.fintype α = inst✝
Equations
- Lex.fintype α = inst✝