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 various- Types or- Sorts are equivalent.
- Equiv.Perm α: the group of permutations- α ≃ α. More lemmas about- Equiv.Permcan be found in- Mathlib/GroupTheory/Perm.lean.
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 of- e : α ≃ β;
- Equiv.trans e₁ e₂ : α ≃ γis the composition of- e₁ : α ≃ βand- e₂ : β ≃ γ(note the order of the arguments!);
 
- definitions that transfer some instances along an equivalence. By convention, we transfer instances from right to left. - Equiv.inhabitedtakes- e : α ≃ βand- [Inhabited β]and returns- Inhabited α;
- Equiv.uniquetakes- e : α ≃ βand- [Unique β]and returns- Unique α;
- Equiv.decidableEqtakes- e : α ≃ βand- [DecidableEq β]and returns- DecidableEq α.
 - More definitions of this kind can be found in other files. E.g., - Mathlib/Algebra/Equiv/TransferInstance.leandoes it for many algebraic type classes like- Group,- Module, etc.
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
Perm α is the type of bijections from α to itself.
Equations
- Equiv.Perm α = (α ≃ α)
Instances For
Equations
- Equiv.instEquivLike = { coe := Equiv.toFun, inv := Equiv.invFun, left_inv := ⋯, right_inv := ⋯, coe_injective' := ⋯ }
Deprecated helper instance for when inference gets stuck on following the normal chain
EquivLike → FunLike.
Equations
- Equiv.instFunLike = { coe := Equiv.toFun, coe_injective' := ⋯ }
Instances For
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.12} {b : Sort ?u.13} {c : Sort ?u.11} => 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
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
If α is an empty type, then it is equivalent to the PEmpty type in any universe.
Equations
Instances For
α is equivalent to an empty type iff α is empty.
Equations
- Equiv.equivEmptyEquiv α = { toFun := ⋯, invFun := @Equiv.equivEmpty α, left_inv := ⋯, right_inv := ⋯ }
Instances For
ULift α is equivalent to α.
Equations
- Equiv.ulift = { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }
Instances For
PLift α is equivalent to α.
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
Prop is noncomputably equivalent to Bool.
Equations
- Equiv.propEquivBool = { toFun := fun (p : Prop) => decide p, invFun := fun (b : Bool) => b = true, left_inv := Equiv.propEquivBool._proof_1, right_inv := Equiv.propEquivBool._proof_2 }
Instances For
The sort of maps to PUnit.{v} is equivalent to PUnit.{w}.
Equations
- Equiv.arrowPUnitEquivPUnit α = { toFun := fun (x : α → PUnit.{?u.13}) => PUnit.unit, invFun := fun (x : PUnit.{?u.12}) (x : α) => 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.{?u.22}) (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
An equivalence f : α₁ ≃ α₂ generates an equivalence between Σ a, β (f a) and Σ a, β a.
Equations
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.
Equations
Instances For
The left summand of α ⊕ β is equivalent to α.
Equations
Instances For
The right summand of α ⊕ β is equivalent to β.