The areas / V01. The language of Mathlib
Mathlib.Logic.Equiv.Fintype
19 declarations. Mathlib docs · Source
Equivalence between fintypes
This file contains some basic results on equivalences where one or both
sides of the equivalence are Fintypes.
Main definitions
Function.Embedding.toEquivRange: computably turn an embedding of a fintype into anEquivof the domain to its rangeEquiv.Perm.viaFintypeEmbedding : Perm α → (α ↪ β) → Perm βextends the domain of a permutation, fixing everything outside the range of the embedding
Implementation notes
Function.Embedding.toEquivRangeuses a computable inverse, but one that has poor computational performance, since it operates by exhaustive search over the inputFintypes.
theorem Equiv.toCompl.congr_simp E1 #
∀ {α : Type u_1} {p q : α → Prop} [inst : Finite ↑{x | p x}] (e e_1 : ↑{x | p x} ≃ ↑{x | q x}),
e = e_1 → e.toCompl = e_1.toCompl
theorem Equiv.extendSubtype.congr_simp E1 #
∀ {α : Type u_1} {p q : α → Prop} {inst : DecidablePred p} [inst_1 : DecidablePred p] {inst_2 : DecidablePred q}
[inst_3 : DecidablePred q] [inst_4 : Finite ↑{x | p x}] (e e_1 : { x // p x } ≃ { x // q x }),
e = e_1 → e.extendSubtype = e_1.extendSubtype
def Function.Embedding.toEquivRange E3 #
{α : Type u_1} → {β : Type u_2} → [Fintype α] → [DecidableEq β] → (f : α ↪ β) → α ≃ ↑(Set.range ⇑f)
Computably turn an embedding f : α ↪ β into an equiv α ≃ Set.range f,
if α is a Fintype. Has poor computational performance, due to exhaustive searching in
constructed inverse. When a better inverse is known, use Equiv.ofLeftInverse' or
Equiv.ofLeftInverse instead. This is the computable version of Equiv.ofInjective.
theorem Function.Embedding.toEquivRange_apply E0 #
∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : DecidableEq β] (f : α ↪ β) (a : α),
f.toEquivRange a = ⟨f a, ⋯⟩
theorem Function.Embedding.toEquivRange_symm_apply_self E0 #
∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : DecidableEq β] (f : α ↪ β) (a : α),
f.toEquivRange.symm ⟨f a, ⋯⟩ = a
theorem Function.Embedding.toEquivRange_eq_ofInjective E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : DecidableEq β] (f : α ↪ β),
f.toEquivRange = Equiv.ofInjective ⇑f ⋯
def Equiv.Perm.viaFintypeEmbedding E1 #
{α : Type u_1} → {β : Type u_2} → [Fintype α] → [DecidableEq β] → Equiv.Perm α → (α ↪ β) → Equiv.Perm β
Extend the domain of e : Equiv.Perm α, mapping it through f : α ↪ β.
Everything outside of Set.range f is kept fixed. Has poor computational performance,
due to exhaustive searching in constructed inverse due to using Function.Embedding.toEquivRange.
When a better α ≃ Set.range f is known, use Equiv.Perm.viaSetRange.
When [Fintype α] is not available, a noncomputable version is available as
Equiv.Perm.viaEmbedding.
theorem Equiv.Perm.viaFintypeEmbedding_apply_image E0 #
∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : DecidableEq β] (e : Equiv.Perm α) (f : α ↪ β) (a : α),
(e.viaFintypeEmbedding f) (f a) = f (e a)
theorem Equiv.Perm.viaFintypeEmbedding_apply_mem_range E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : DecidableEq β] (e : Equiv.Perm α) (f : α ↪ β) {b : β}
(h : b ∈ Set.range ⇑f), (e.viaFintypeEmbedding f) b = f (e (f.invOfMemRange ⟨b, h⟩))
theorem Equiv.Perm.viaFintypeEmbedding_apply_notMem_range E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : DecidableEq β] (e : Equiv.Perm α) (f : α ↪ β) {b : β},
b ∉ Set.range ⇑f → (e.viaFintypeEmbedding f) b = b
def Equiv.setDiffEquiv E1 #
{α : Type u_1} →
{s t : Set α} → [inst : Fintype ↑s] → [inst_1 : Fintype ↑t] → Fintype.card ↑s = Fintype.card ↑t → ↑(s \ t) ≃ ↑(t \ s)
If two sets have the same finite cardinality, their set differences are equivalent.
def Equiv.toCompl E1 #
{α : Type u_1} → {p q : α → Prop} → [Finite ↑{x | p x}] → ↑{x | p x} ≃ ↑{x | q x} → ↑{x | ¬p x} ≃ ↑{x | ¬q x}
If e is an equivalence between two subtypes of a type α, e.toCompl
is an equivalence between the complement of those subtypes.
See also Equiv.compl, for a computable version when a term of type
{e' : α ≃ α // ∀ x : {x // p x}, e' x = e x} is known.
abbrev Equiv.extendSubtype E1 #
{α : Type u_1} →
{p q : α → Prop} →
[DecidablePred p] → [DecidablePred q] → [Finite ↑{x | p x}] → { x // p x } ≃ { x // q x } → Equiv.Perm α
If e is an equivalence between two subtypes of a type α, e.extendSubtype
is a permutation of α acting like e on the subtypes and doing something arbitrary outside.
Note that when p = q, Equiv.Perm.subtypeCongr e (Equiv.refl _) can be used instead.
theorem Equiv.extendSubtype_apply_of_mem E1 #
∀ {α : Type u_1} {p q : α → Prop} [inst : DecidablePred p] [inst_1 : DecidablePred q] [inst_2 : Finite ↑{x | p x}]
(e : { x // p x } ≃ { x // q x }) (x : α) (hx : p x), e.extendSubtype x = ↑(e ⟨x, hx⟩)
theorem Equiv.extendSubtype_mem E1 #
∀ {α : Type u_1} {p q : α → Prop} [inst : DecidablePred p] [inst_1 : DecidablePred q] [inst_2 : Finite ↑{x | p x}]
(e : { x // p x } ≃ { x // q x }) (x : α), p x → q (e.extendSubtype x)
theorem Equiv.extendSubtype_apply_of_not_mem E1 #
∀ {α : Type u_1} {p q : α → Prop} [inst : DecidablePred p] [inst_1 : DecidablePred q] [inst_2 : Finite ↑{x | p x}]
(e : { x // p x } ≃ { x // q x }) (x : α) (hx : ¬p x), e.extendSubtype x = ↑(e.toCompl ⟨x, hx⟩)
theorem Equiv.extendSubtype_not_mem E1 #
∀ {α : Type u_1} {p q : α → Prop} [inst : DecidablePred p] [inst_1 : DecidablePred q] [inst_2 : Finite ↑{x | p x}]
(e : { x // p x } ≃ { x // q x }) (x : α), ¬p x → ¬q (e.extendSubtype x)
theorem Equiv.Perm.exists_extending_pair E1 #
∀ {α : Type u_1} {β : Type u_2} [Finite α] (f g : α → β),
Function.Injective f → Function.Injective g → ∃ σ, ∀ (a : α), σ (f a) = g a
Given two injective functions f and g from a finite type α to any type β,
there exists a permutation of β that maps f to g.
theorem Equiv.Perm.exists_map_finset_eq E0 #
∀ {β : Type u_2} (s t : Finset β), s.card = t.card → ∃ σ, Finset.map (Equiv.toEmbedding σ) s = t
Any two same-cardinality finsets are related by a permutation.