IsROrC
: a typeclass for ℝ or ℂ #
This file defines the typeclass IsROrC
intended to have only two instances:
ℝ and ℂ. It is meant for definitions and theorems which hold for both the real and the complex case,
and in particular when the real case follows directly from the complex case by setting re
to id
,
im
to zero and so on. Its API follows closely that of ℂ.
Applications include defining inner products and Hilbert spaces for both the real and complex case. One typically produces the definitions and proof for an arbitrary field of this typeclass, which basically amounts to doing the complex case, and the two cases then fall out immediately from the two instances of the class.
The instance for ℝ
is registered in this file.
The instance for ℂ
is declared in Mathlib/Analysis/Complex/Basic.lean
.
Implementation notes #
The coercion from reals into an IsROrC
field is done by registering IsROrC.ofReal
as
a CoeTC
. For this to work, we must proceed carefully to avoid problems involving circular
coercions in the case K=ℝ
; in particular, we cannot use the plain Coe
and must set
priorities carefully. This problem was already solved for ℕ
, and we copy the solution detailed
in Mathlib/Data/Nat/Cast/Defs.lean
. See also Note [coercion into rings] for more details.
In addition, several lemmas need to be set at priority 900 to make sure that they do not override
their counterparts in Mathlib/Analysis/Complex/Basic.lean
(which causes linter errors).
A few lemmas requiring heavier imports are in Mathlib/Data/IsROrC/Lemmas.lean
.
This typeclass captures properties shared by ℝ and ℂ, with an API that closely matches that of ℂ.
- norm : K → ℝ
- add : K → K → K
- zero : K
- nsmul : ℕ → K → K
- nsmul_zero : ∀ (x : K), AddMonoid.nsmul 0 x = 0
- nsmul_succ : ∀ (n : ℕ) (x : K), AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
- mul : K → K → K
- one : K
- natCast : ℕ → K
- natCast_zero : NatCast.natCast 0 = 0
- natCast_succ : ∀ (n : ℕ), NatCast.natCast (n + 1) = NatCast.natCast n + 1
- npow : ℕ → K → K
- npow_zero : ∀ (x : K), Semiring.npow 0 x = 1
- npow_succ : ∀ (n : ℕ) (x : K), Semiring.npow (n + 1) x = x * Semiring.npow n x
- neg : K → K
- sub : K → K → K
- zsmul : ℤ → K → K
- zsmul_zero' : ∀ (a : K), Ring.zsmul 0 a = 0
- zsmul_succ' : ∀ (n : ℕ) (a : K), Ring.zsmul (Int.ofNat (Nat.succ n)) a = a + Ring.zsmul (Int.ofNat n) a
- zsmul_neg' : ∀ (n : ℕ) (a : K), Ring.zsmul (Int.negSucc n) a = -Ring.zsmul (↑(Nat.succ n)) a
- intCast : ℤ → K
- intCast_ofNat : ∀ (n : ℕ), IntCast.intCast ↑n = ↑n
- intCast_negSucc : ∀ (n : ℕ), IntCast.intCast (Int.negSucc n) = -↑(n + 1)
- inv : K → K
- div : K → K → K
- zpow : ℤ → K → K
- zpow_zero' : ∀ (a : K), Field.zpow 0 a = 1
- zpow_succ' : ∀ (n : ℕ) (a : K), Field.zpow (Int.ofNat (Nat.succ n)) a = a * Field.zpow (Int.ofNat n) a
- zpow_neg' : ∀ (n : ℕ) (a : K), Field.zpow (Int.negSucc n) a = (Field.zpow (↑(Nat.succ n)) a)⁻¹
- exists_pair_ne : ∃ (x : K) (y : K), x ≠ y
- ratCast : ℚ → K
- ratCast_mk : ∀ (a : ℤ) (b : ℕ) (h1 : b ≠ 0) (h2 : Nat.Coprime (Int.natAbs a) b), ↑{ num := a, den := b, den_nz := h1, reduced := h2 } = ↑a * (↑b)⁻¹
- qsmul : ℚ → K → K
- qsmul_eq_mul' : ∀ (a : ℚ) (x : K), Field.qsmul a x = ↑a * x
- dist : K → K → ℝ
- edist : K → K → ENNReal
- edist_dist : ∀ (x y : K), PseudoMetricSpace.edist x y = ENNReal.ofReal (dist x y)
- toUniformSpace : UniformSpace K
- uniformity_dist : uniformity K = ⨅ (ε : ℝ), ⨅ (_ : ε > 0), Filter.principal {p : K × K | dist p.1 p.2 < ε}
- toBornology : Bornology K
- star : K → K
- star_involutive : Function.Involutive star
- smul : ℝ → K → K
- toFun : ℝ → K
- map_one' : Algebra.toRingHom.toFun 1 = 1
- map_zero' : Algebra.toRingHom.toFun 0 = 0
- I : K
Imaginary unit in
K
. Meant to be set to0
forK = ℝ
. - I_re_ax : IsROrC.re IsROrC.I = 0
- re_add_im_ax : ∀ (z : K), (algebraMap ℝ K) (IsROrC.re z) + (algebraMap ℝ K) (IsROrC.im z) * IsROrC.I = z
- ofReal_re_ax : ∀ (r : ℝ), IsROrC.re ((algebraMap ℝ K) r) = r
- ofReal_im_ax : ∀ (r : ℝ), IsROrC.im ((algebraMap ℝ K) r) = 0
- conj_re_ax : ∀ (z : K), IsROrC.re ((starRingEnd K) z) = IsROrC.re z
- conj_im_ax : ∀ (z : K), IsROrC.im ((starRingEnd K) z) = -IsROrC.im z
- conj_I_ax : (starRingEnd K) IsROrC.I = -IsROrC.I
- toPartialOrder : PartialOrder K
only an instance in the
ComplexOrder
locale - toDecidableEq : DecidableEq K
Instances
Characteristic zero #
The imaginary unit.
Conjugation as a ring equivalence. This is used to convert the inner product into a sesquilinear product.
Equations
- IsROrC.conjToRingEquiv K = starRingEquiv
Instances For
Inversion #
Cast lemmas #
Norm #
Cauchy sequences #
The real part of a K Cauchy sequence, as a real Cauchy sequence.
Equations
- IsROrC.cauSeqRe f = { val := fun (n : ℕ) => IsROrC.re (↑f n), property := ⋯ }
Instances For
The imaginary part of a K Cauchy sequence, as a real Cauchy sequence.
Equations
- IsROrC.cauSeqIm f = { val := fun (n : ℕ) => IsROrC.im (↑f n), property := ⋯ }
Instances For
Equations
- One or more equations did not get rendered due to their size.
With z ≤ w
iff w - z
is real and nonnegative, ℝ
and ℂ
are star ordered rings.
(That is, a star ring in which the nonnegative elements are those of the form star z * z
.)
Note this is only an instance with open scoped ComplexOrder
.
Equations
- IsROrC.toStarOrderedRing = StarOrderedRing.ofNonnegIff' ⋯ ⋯
Instances For
With z ≤ w
iff w - z
is real and nonnegative, ℝ
and ℂ
are strictly ordered rings.
Note this is only an instance with open scoped ComplexOrder
.
Equations
- IsROrC.toStrictOrderedCommRing = StrictOrderedCommRing.mk ⋯
Instances For
Conjugate as an ℝ
-algebra equivalence
Equations
- IsROrC.conjAe = let __src := starRingEnd K; { toEquiv := { toFun := __src.toFun, invFun := ⇑(starRingEnd K), left_inv := ⋯, right_inv := ⋯ }, map_mul' := ⋯, map_add' := ⋯, commutes' := ⋯ }
Instances For
Conjugate as a linear isometry
Equations
- IsROrC.conjLIE = { toLinearEquiv := AlgEquiv.toLinearEquiv IsROrC.conjAe, norm_map' := ⋯ }
Instances For
Equations
- ⋯ = ⋯
The ℝ → K coercion, as a linear isometry
Equations
- IsROrC.ofRealLI = { toLinearMap := AlgHom.toLinearMap IsROrC.ofRealAm, norm_map' := ⋯ }
Instances For
The ℝ → K
coercion, as a continuous linear map
Equations
- IsROrC.ofRealCLM = LinearIsometry.toContinuousLinearMap IsROrC.ofRealLI
Instances For
ℝ-dependent results #
Here we gather results that depend on whether K
is ℝ
.
The natural isomorphism between 𝕜
satisfying IsROrC 𝕜
and ℝ
when IsROrC.I = 0
.
Equations
- IsROrC.realRingEquiv h = { toEquiv := { toFun := ⇑IsROrC.re, invFun := IsROrC.ofReal, left_inv := ⋯, right_inv := ⋯ }, map_mul' := ⋯, map_add' := ⋯ }