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 variousType
s orSort
s are equivalent. -
Equiv.Perm α
: the group of permutationsα ≃ α
. More lemmas aboutEquiv.Perm
can be found inGroupTheory.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.inhabited
takese : α ≃ β
and[Inhabited β]
and returnsInhabited α
;Equiv.unique
takese : α ≃ β
and[Unique β]
and returnsUnique α
;Equiv.decidableEq
takese : α ≃ β
and[DecidableEq β]
and returnsDecidableEq α
.
More definitions of this kind can be found in other files. E.g.,
Data.Equiv.TransferInstance
does it for many algebraic type classes likeGroup
,Module
, etc.
Many more such isomorphisms and operations are defined in Logic.Equiv.Basic
.
Tags #
equivalence, congruence, bijective map
α ≃ β
is the type of functions from α → β
with a two-sided inverse.
- toFun : α → β
- 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
Perm α
is the type of bijections from α
to itself.
Equations
- Equiv.Perm α = (α ≃ α)
Instances For
Helper instance when inference gets stuck on following the normal chain
EquivLike → FunLike
.
TODO: this instance doesn't appear to be necessary: remove it (after benchmarking?)
Equations
- Equiv.instFunLikeEquiv = { coe := Equiv.toFun, coe_injective' := (_ : Function.Injective fun (f : α ≃ β) => ⇑f) }
The map (r ≃ s) → (r → s)
is injective.
Equations
- Equiv.inhabited' = { default := Equiv.refl α }
Inverse of an equivalence e : α ≃ β
.
Equations
- e.symm = { toFun := e.invFun, invFun := e.toFun, left_inv := (_ : Function.RightInverse e.invFun e.toFun), right_inv := (_ : Function.LeftInverse e.invFun e.toFun) }
Instances For
Equations
- (_ : Subsingleton (α ≃ β)) = (_ : Subsingleton (α ≃ β))
Equations
- (_ : Subsingleton (α ≃ β)) = (_ : Subsingleton (α ≃ β))
Equations
- Equiv.permUnique = uniqueOfSubsingleton (Equiv.refl α)
If α ≃ β
and β
is inhabited, then so is α
.
Equations
- Equiv.inhabited e = { default := e.symm default }
Instances For
If α ≃ β
and β
is a singleton type, then so is α
.
Equations
- Equiv.unique e = Function.Surjective.unique ⇑e.symm (_ : Function.Surjective ⇑e.symm)
Instances For
Equivalence between equal types.
Equations
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.
If α
is equivalent to β
and γ
is equivalent to δ
, then the type of equivalences α ≃ γ
is equivalent to the type of equivalences β ≃ δ
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If α
is equivalent to β
, then Perm α
is equivalent to Perm β
.
Equations
- Equiv.permCongr e = Equiv.equivCongr e e
Instances For
If α
is an empty type, then it is equivalent to the PEmpty
type in any universe.
Equations
Instances For
If both α
and β
have a unique element, then α ≃ β
.
Equations
Instances For
ULift α
is equivalent to α
.
Equations
- Equiv.ulift = { toFun := ULift.down, invFun := ULift.up, left_inv := (_ : ∀ (b : ULift.{u, v} α), { down := b.down } = b), right_inv := (_ : ∀ (a : α), { down := a }.down = a) }
Instances For
equivalence of propositions is the same as iff
Equations
- Equiv.ofIff h = { toFun := (_ : P → Q), invFun := (_ : Q → P), left_inv := (_ : ∀ (x : P), (_ : P) = (_ : P)), right_inv := (_ : ∀ (x : Q), (_ : Q) = (_ : Q)) }
Instances For
If α₁
is equivalent to α₂
and β₁
is equivalent to β₂
, then the type of maps α₁ → β₁
is equivalent to the type of maps α₂ → β₂
.
Equations
- One or more equations did not get rendered due to their size.
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
- Equiv.arrowCongr' hα hβ = Equiv.arrowCongr hα hβ
Instances For
Conjugate a map f : α → α
by an equivalence α ≃ β
.
Equations
- Equiv.conj e = Equiv.arrowCongr e e
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
If α
has a unique term, then the type of function α → β
is equivalent to β
.
Equations
- Equiv.funUnique α β = Equiv.piUnique fun (a : α) => β
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
- One or more equations did not get rendered due to their size.
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
A family of permutations Π a, Perm (β a)
generates a permutation Perm (Σ a, β₁ a)
.
Equations
Instances For
Transporting a sigma type through an equivalence of the base
Equations
- Equiv.sigmaCongrLeft' f = (Equiv.sigmaCongrLeft f.symm).symm
Instances For
Transporting a sigma type through an equivalence of the base and a family of equivalences of matching fibers
Equations
- Equiv.sigmaCongr f F = (Equiv.sigmaCongrRight F).trans (Equiv.sigmaCongrLeft f)
Instances For
If each fiber of a Sigma
type is equivalent to a fixed type, then the sigma type
is equivalent to the product.
Equations
- Equiv.sigmaEquivProdOfEquiv F = (Equiv.sigmaCongrRight F).trans (Equiv.sigmaEquivProd α β)
Instances For
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
If f
is a bijective function, then its domain is equivalent to its codomain.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An equivalence e : α ≃ β
generates an equivalence between quotient spaces,
if ra a₁ a₂ ↔ rb (e a₁) (e a₂)
.
Equations
- One or more equations did not get rendered due to their size.
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 (_ : ∀ (x x_1 : α), r x x_1 ↔ r (e.symm (e x)) (e.symm (e x_1)))
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.