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 aFinsetand 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.subtypeOption αare inData.Fintype.Optionα × βare inData.Fintype.Prodα ⊕ βare inData.Fintype.SumΣ (a : α), β aare inData.Fintype.Sigma
These files also contain appropriate Infinite instances for these types.
Infinite instances for ℕ, ℤ, Multiset α, and List α are in Data.Fintype.Lattice.
Preparatory lemmas #
Elaborate set builder notation for Finset.
{x | p x}is elaborated asFinset.filter (fun x ↦ p x) Finset.univif the expected type isFinset ?α.{x : α | p x}is elaborated asFinset.filter (fun x : α ↦ p x) Finset.univif 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 ?αandshas expected typeFinset ?α.{x ≠ a | p x}is elaborated asFinset.filter (fun x ↦ p x) {a}ᶜif the expected type isFinset ?α.
See also
Data.Set.Defsfor theSetbuilder notation elaborator that this elaborator partly overrides.Data.Finset.Basicfor theFinsetbuilder notation elaborator partly overriding this one for syntax of the form{x ∈ s | p x}.Data.Fintype.Basicfor theFinsetbuilder notation elaborator handling syntax of the form{x | p x},{x : α | p x},{x ∉ s | p x},{x ≠ a | p x}.Order.LocallyFinite.Basicfor theFinsetbuilder notation elaborator handling syntax of the form{x ≤ a | p x},{x ≥ a | p x},{x < a | p x},{x > a | p x}.
Instances For
Delaborator for Finset.filter. The pp.funBinderTypes option controls whether
to show the domain type when the filter is over Finset.univ.
Instances For
Given a predicate that can be represented by a finset, the subtype associated to the predicate is a fintype.
Instances For
Construct a fintype from a finset with the same elements.