Invertible elements #
This file defines a typeclass Invertible a
for elements a
with a two-sided
multiplicative inverse.
The intent of the typeclass is to provide a way to write e.g. ⅟2
in a ring
like ℤ[1/2]
where some inverses exist but there is no general ⁻¹
operator;
or to specify that a field has characteristic ≠ 2
.
It is the Type
-valued analogue to the Prop
-valued IsUnit
.
For constructions of the invertible element given a characteristic, see
Algebra/Char_P/Invertible
and other lemmas in that file.
Notation #
⅟a
isInvertible.invOf a
, the inverse ofa
Implementation notes #
The Invertible
class lives in Type
, not Prop
, to make computation easier.
If multiplication is associative, Invertible
is a subsingleton anyway.
The simp
normal form tries to normalize ⅟a
to a ⁻¹
. Otherwise, it pushes
⅟
inside the expression as much as possible.
Since Invertible a
is not a Prop
(but it is a Subsingleton
), we have to be careful about
coherence issues: we should avoid having multiple non-defeq instances for Invertible a
in the
same context. This file plays it safe and uses def
rather than instance
for most definitions,
users can choose which instances to use at the point of use.
For example, here's how you can use an Invertible 1
instance:
variables {α : Type _} [monoid α]
def something_that_needs_inverses (x : α) [Invertible x] := sorry
section
local attribute [instance] invertibleOne
def something_one := something_that_needs_inverses 1
end
Tags #
invertible, inverse element, invOf, a half, one half, a third, one third, ½, ⅓
The inverse of an
Invertible
elementinvOf : αinvOf a
is a left inverse ofa
invOf a
is a right inverse ofa
Invertible a
gives a two-sided multiplicative inverse of a
.
Instances
The inverse of an Invertible
element
Equations
- «term⅟_» = Lean.ParserDescr.node `term⅟_ 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "⅟") (Lean.ParserDescr.cat `term 1024))
If r
is invertible and s = r
, then s
is invertible.
If a
is invertible and a = b
, then ⅟a = ⅟b
.
An invertible
element is a unit.
Convert IsUnit
to Invertible
using Classical.choice
.
Prefer casesI h.nonempty_invertible
over letI := h.invertible
if you want to avoid choice.
Equations
- IsUnit.invertible h = Classical.choice (_ : Nonempty (Invertible a))
Each element of a group is invertible.
-⅟a
is the inverse of -a
⅟b * ⅟a
is the inverse of a * b
A variant of Ring.inverse_unit
.
a⁻¹
is an inverse of a
if a ≠ 0
b / a
is the inverse of a / b
a
is the inverse of a⁻¹
Monoid homs preserve invertibility.
Note that the invertible (f r)
argument can be satisfied by using letI := invertible.map f r
before applying this lemma.
If a function f : R → S
has a left-inverse that is a monoid hom,
then r : R
is invertible if f r
is.
The inverse is computed as g (⅟(f r))
Equations
- Invertible.ofLeftInverse f g r h = Invertible.copy (Invertible.map g (f r)) r (_ : r = ↑g (f r))
Invertibility on either side of a monoid hom with a left-inverse is equivalent.
Equations
- One or more equations did not get rendered due to their size.