The areas / V03. Sets, finite structures and big operators
Mathlib.Data.Fintype.Defs
42 declarations. Mathlib docs · Source
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
def Fintype.ctorIdx E1 #
{α : Type u_3} → Fintype α → ℕ
class Fintype E3 #
Type u_3 → Type u_3
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.
ctor Fintype.mk E0 #
{α : Type u_3} → (elems : Finset α) → (∀ (x : α), x ∈ elems) → Fintype α
abbrev Fintype.elems E1 #
{α : Type u_3} → [self : Fintype α] → Finset α
The Finset containing all elements of a Fintype
theorem Fintype.complete E1 #
∀ {α : Type u_3} [self : Fintype α] (x : α), x ∈ Fintype.elems
A proof that elems contains every element of the type
theorem Finset.nodup_map_iff_injOn E1 #
∀ {α : Type u_1} {β : Type u_2} {f : α → β} {s : Finset α}, (Multiset.map f s.val).Nodup ↔ Set.InjOn f ↑s
instance List.instDecidableInjOnCoeFinsetOfDecidableEq E0 #
{α : Type u_1} → {β : Type u_2} → {f : α → β} → {s : Finset α} → [DecidableEq β] → Decidable (Set.InjOn f ↑s)
instance List.instDecidableBijOnCoeFinsetOfDecidableEq E0 #
{α : Type u_1} →
{β : Type u_2} → {f : α → β} → {s : Finset α} → {t' : Finset β} → [DecidableEq β] → Decidable (Set.BijOn f ↑s ↑t')
def Finset.univ E3 #
{α : Type u_1} → [Fintype α] → Finset α
univ is the universal finite set of type Finset α implied from
the assumption Fintype α.
theorem Finset.mem_univ E0 #
∀ {α : Type u_1} [inst : Fintype α] (x : α), x ∈ Finset.univ
theorem Finset.mem_univ_val E0 #
∀ {α : Type u_1} [inst : Fintype α] (x : α), x ∈ Finset.univ.val
theorem Finset.coe_univ E0 #
∀ {α : Type u_1} [inst : Fintype α], ↑Finset.univ = Set.univ
theorem Finset.coe_eq_univ E0 #
∀ {α : Type u_1} [inst : Fintype α] {s : Finset α}, ↑s = Set.univ ↔ s = Finset.univ
theorem Finset.subset_univ E0 #
∀ {α : Type u_1} [inst : Fintype α] (s : Finset α), s ⊆ Finset.univ
theorem Finset.mem_filter_univ E0 #
∀ {α : Type u_1} [inst : Fintype α] {p : α → Prop} [inst_1 : DecidablePred p] (x : α),
x ∈ Finset.filter p Finset.univ ↔ p x
def Mathlib.Meta.elabFinsetBuilderSetOf E1 #
Lean.Elab.Term.TermElab
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}.
def Mathlib.Meta.delabFinsetFilter E1 #
Lean.PrettyPrinter.Delaborator.Delab
Delaborator for Finset.filter. The pp.funBinderTypes option controls whether
to show the domain type when the filter is over Finset.univ.
instance Fintype.decidablePiFintype E0 #
{α : Type u_1} → {β : α → Type u_3} → [(a : α) → DecidableEq (β a)] → [Fintype α] → DecidableEq ((a : α) → β a)
instance Fintype.decidableForallFintype E0 #
{α : Type u_1} → {p : α → Prop} → [DecidablePred p] → [Fintype α] → Decidable (∀ (a : α), p a)
instance Fintype.decidableExistsFintype E0 #
{α : Type u_1} → {p : α → Prop} → [DecidablePred p] → [Fintype α] → Decidable (∃ a, p a)
instance Fintype.instDecidableLEForall E0 #
{α : Type u_1} →
{β : α → Type u_3} →
[inst : (a : α) → LE (β a)] → [(a : α) → DecidableLE (β a)] → [Fintype α] → DecidableLE ((a : α) → β a)
instance Fintype.decidableMemRangeFintype E0 #
{α : Type u_1} → {β : Type u_2} → [Fintype α] → [DecidableEq β] → (f : α → β) → DecidablePred fun x ↦ x ∈ Set.range f
instance Fintype.decidableSubsingleton E0 #
{α : Type u_1} → [Fintype α] → [DecidableEq α] → {s : Set α} → [DecidablePred fun x ↦ x ∈ s] → Decidable s.Subsingleton
instance Fintype.decidableEqEquivFintype E0 #
{α : Type u_1} → {β : Type u_2} → [DecidableEq β] → [Fintype α] → DecidableEq (α ≃ β)
instance Fintype.decidableEqEmbeddingFintype E0 #
{α : Type u_1} → {β : Type u_2} → [DecidableEq β] → [Fintype α] → DecidableEq (α ↪ β)
theorem Fintype.nodup_map_univ_iff_injective E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] {f : α → β},
(Multiset.map f Finset.univ.val).Nodup ↔ Function.Injective f
instance Fintype.decidableInjectiveFintype E0 #
{α : Type u_1} → {β : Type u_2} → [DecidableEq β] → [Fintype α] → DecidablePred Function.Injective
instance Fintype.decidableSurjectiveFintype E0 #
{α : Type u_1} → {β : Type u_2} → [DecidableEq β] → [Fintype α] → [Fintype β] → DecidablePred Function.Surjective
instance Fintype.decidableBijectiveFintype E0 #
{α : Type u_1} → {β : Type u_2} → [DecidableEq β] → [Fintype α] → [Fintype β] → DecidablePred Function.Bijective
instance Fintype.decidableRightInverseFintype E0 #
{α : Type u_1} →
{β : Type u_2} → [DecidableEq α] → [Fintype α] → (f : α → β) → (g : β → α) → Decidable (Function.RightInverse f g)
instance Fintype.decidableLeftInverseFintype E0 #
{α : Type u_1} →
{β : Type u_2} → [DecidableEq β] → [Fintype β] → (f : α → β) → (g : β → α) → Decidable (Function.LeftInverse f g)
instance Fintype.instDecidableRelWCovByOfDecidableLE E0 #
{α : Type u_1} → [Fintype α] → [inst : Preorder α] → [DecidableLE α] → DecidableRel WCovBy
instance Fintype.instDecidableRelCovByOfDecidableLT E0 #
{α : Type u_1} → [Fintype α] → [inst : LT α] → [DecidableLT α] → DecidableRel CovBy
instance Fintype.subsingleton E0 #
∀ (α : Type u_3), Subsingleton (Fintype α)
instance Fintype.instFastSubsingleton E0 #
∀ (α : Type u_3), Lean.Meta.FastSubsingleton (Fintype α)
def Fintype.subtype E1 #
{α : Type u_1} → {p : α → Prop} → (s : Finset α) → (∀ (x : α), x ∈ s ↔ p x) → Fintype { x // p x }
Given a predicate that can be represented by a finset, the subtype associated to the predicate is a fintype.
def Fintype.ofFinset E1 #
{α : Type u_1} → {p : Set α} → (s : Finset α) → (∀ (x : α), x ∈ s ↔ x ∈ p) → Fintype ↑p
Construct a fintype from a finset with the same elements.
instance Bool.fintype E0 #
Fintype Bool
instance Ordering.fintype E0 #
Fintype Ordering
instance OrderDual.fintype E0 #
(α : Type u_3) → [Fintype α] → Fintype αᵒᵈ
instance OrderDual.finite E0 #
∀ (α : Type u_3) [Finite α], Finite αᵒᵈ
instance Lex.fintype E0 #
(α : Type u_3) → [Fintype α] → Fintype (Lex α)