Equivalence between types #
In this file we define two types:
Equiv α βa.k.a.α ≃ β: a bijective mapα → βbundled with its inverse map; we use this (and not equality!) to express that variousTypes orSorts are equivalent.Equiv.Perm α: the group of permutationsα ≃ α. More lemmas aboutEquiv.Permcan be found inMathlib/GroupTheory/Perm/.
Then we define
canonical isomorphisms between various types: e.g.,
Equiv.refl αis the identity map interpreted asα ≃ α;
operations on equivalences: e.g.,
Equiv.symm e : β ≃ αis the inverse ofe : α ≃ β;Equiv.trans e₁ e₂ : α ≃ γis the composition ofe₁ : α ≃ βande₂ : β ≃ γ(note the order of the arguments!);
definitions that transfer some instances along an equivalence. By convention, we transfer instances from right to left.
Equiv.inhabitedtakese : α ≃ βand[Inhabited β]and returnsInhabited α;Equiv.uniquetakese : α ≃ βand[Unique β]and returnsUnique α;Equiv.decidableEqtakese : α ≃ βand[DecidableEq β]and returnsDecidableEq α.
More definitions of this kind can be found in other files. E.g.,
Mathlib/Algebra/Group/TransferInstance.leandoes it forGroup,Mathlib/Algebra/Module/TransferInstance.leandoes it forModule, and similar files exist for other algebraic type classes.
Many more such isomorphisms and operations are defined in Mathlib/Logic/Equiv/Basic.lean.
Tags #
equivalence, congruence, bijective map
α ≃ β is the type of functions from α → β with a two-sided inverse.
- toFun : α → β
The forward map of an equivalence.
Do NOT use directly. Use the coercion instead.
- invFun : β → α
- left_inv : Function.LeftInverse self.invFun self.toFun
- right_inv : Function.RightInverse self.invFun self.toFun
Instances For
α ≃ β is the type of functions from α → β with a two-sided inverse.
Equations
- «term_≃_» = Lean.ParserDescr.trailingNode `«term_≃_» 25 25 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ≃ ") (Lean.ParserDescr.cat `term 26))
Instances For
Any type satisfying EquivLike can be cast into Equiv via EquivLike.toEquiv.
Equations
Equations
- Equiv.instEquivLike = { coe := Equiv.toFun, inv := Equiv.invFun, left_inv := ⋯, right_inv := ⋯, coe_injective' := ⋯ }
The map (r ≃ s) → (r → s) is injective.
Any type is equivalent to itself.
Instances For
Equations
- Equiv.inhabited' = { default := Equiv.refl α }
Restatement of Equiv.left_inv in terms of Function.LeftInverse.
Restatement of Equiv.right_inv in terms of Function.RightInverse.
Equations
- Equiv.instTrans = { trans := fun {a : Sort ?u.13} {b : Sort ?u.14} {c : Sort ?u.12} => Equiv.trans }
Equiv.symm defines an equivalence between α ≃ β and β ≃ α.
Equations
- Equiv.symmEquiv α β = { toFun := Equiv.symm, invFun := Equiv.symm, left_inv := ⋯, right_inv := ⋯ }
Instances For
Equations
Transfer DecidableEq across an equivalence.
Equations
- e.decidableEq = ⋯.decidableEq
Instances For
This cannot be a simp lemmas as it incorrectly matches against e : α ≃ synonym α, when
synonym α is semireducible. This makes a mess of Multiplicative.ofAdd etc.
Two empty types are equivalent.
Equations
- Equiv.equivOfIsEmpty α β = { toFun := fun (a : α) => isEmptyElim a, invFun := fun (a : β) => isEmptyElim a, left_inv := ⋯, right_inv := ⋯ }
Instances For
α is equivalent to an empty type iff α is empty.
Equations
- Equiv.equivEmptyEquiv α = { toFun := ⋯, invFun := @Equiv.equivEmpty α, left_inv := ⋯, right_inv := ⋯ }
Instances For
Equations
- Equiv.ulift = { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }
Instances For
Equations
- Equiv.plift = { toFun := PLift.down, invFun := PLift.up, left_inv := ⋯, right_inv := ⋯ }
Instances For
equivalence of propositions is the same as iff
Equations
- Equiv.ofIff h = { toFun := ⋯, invFun := ⋯, left_inv := ⋯, right_inv := ⋯ }
Instances For
A version of Equiv.arrowCongr in Type, rather than Sort.
The equiv_rw tactic is not able to use the default Sort level Equiv.arrowCongr,
because Lean's universe rules will not unify ?l_1 with imax (1 ?m_1).
Equations
- hα.arrowCongr' hβ = hα.arrowCongr hβ
Instances For
The sort of maps to PUnit.{v} is equivalent to PUnit.{w}.
Equations
- Equiv.arrowPUnitEquivPUnit α = { toFun := fun (x : α → PUnit) => PUnit.unit, invFun := fun (x : PUnit) (x_1 : α) => PUnit.unit, left_inv := ⋯, right_inv := ⋯ }
Instances For
The equivalence (∀ i, β i) ≃ β ⋆ when the domain of β only contains ⋆
Equations
- Equiv.piUnique β = { toFun := fun (f : (i : α) → β i) => f default, invFun := uniqueElim, left_inv := ⋯, right_inv := ⋯ }
Instances For
If α has a unique term, then the type of function α → β is equivalent to β.
Equations
- Equiv.funUnique α β = Equiv.piUnique fun (a : α) => β
Instances For
The sort of maps from a type that IsEmpty is equivalent to PUnit.
Equations
- Equiv.arrowPUnitOfIsEmpty α β = { toFun := fun (x : α → β) => PUnit.unit, invFun := fun (x : PUnit) (a : α) => isEmptyElim a, left_inv := ⋯, right_inv := ⋯ }
Instances For
A family of equivalences Π a, β₁ a ≃ β₂ a generates an equivalence between Σ' a, β₁ a and
Σ' a, β₂ a.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A family of equivalences Π a, β₁ a ≃ β₂ a generates an equivalence between Σ a, β₁ a and
Σ a, β₂ a.
Equations
Instances For
A Sigma with PLift fibers is equivalent to the subtype.
Equations
- Equiv.sigmaPLiftEquivSubtype P = ((Equiv.psigmaEquivSigma fun (x : α) => PLift (P x)).symm.trans (Equiv.psigmaCongrRight fun (x : α) => Equiv.plift)).trans (Equiv.psigmaEquivSubtype P)
Instances For
A Sigma with fun i ↦ ULift (PLift (P i)) fibers is equivalent to { x // P x }.
Variant of sigmaPLiftEquivSubtype.
Equations
- Equiv.sigmaULiftPLiftEquivSubtype P = (Equiv.sigmaCongrRight fun (x : α) => Equiv.ulift).trans (Equiv.sigmaPLiftEquivSubtype P)
Instances For
Function.swap as an equivalence.
Equations
- Equiv.functionSwap α β γ = { toFun := Function.swap, invFun := Function.swap, left_inv := ⋯, right_inv := ⋯ }
Instances For
Transporting a sigma type through an equivalence of the base
Equations
Instances For
Transporting a sigma type through an equivalence of the base and a family of equivalences of matching fibers
Equations
- f.sigmaCongr F = (Equiv.sigmaCongrRight F).trans f.sigmaCongrLeft
Instances For
The dependent product of types is associative up to an equivalence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The dependent product of sorts is associative up to an equivalence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If f is a bijective function, then its domain is equivalent to its codomain.
Equations
- Equiv.ofBijective f hf = { toFun := f, invFun := Function.surjInv ⋯, left_inv := ⋯, right_inv := ⋯ }
Instances For
Quotients are congruent on equivalences under equality of their relation.
An alternative is just to use rewriting with eq, but then computational proofs get stuck.
Equations
- Quot.congrRight eq = Quot.congr (Equiv.refl α) eq
Instances For
An equivalence e : α ≃ β generates an equivalence between the quotient space of α
by a relation ra and the quotient space of β by the image of this relation under e.
Equations
- Quot.congrLeft e = Quot.congr e ⋯
Instances For
An equivalence e : α ≃ β generates an equivalence between quotient spaces,
if ra a₁ a₂ ↔ rb (e a₁) (e a₂).
Equations
- Quotient.congr e eq = Quot.congr e eq
Instances For
Quotients are congruent on equivalences under equality of their relation.
An alternative is just to use rewriting with eq, but then computational proofs get stuck.