RCLike
: a typeclass for ℝ or ℂ #
This file defines the typeclass RCLike
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 RCLike
field is done by registering RCLike.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/Analysis/RCLike/Lemmas.lean
.
This typeclass captures properties shared by ℝ and ℂ, with an API that closely matches that of ℂ.
- add : K → K → K
- zero : K
- nsmul_zero : ∀ (x : K), AddMonoid.nsmul 0 x = 0
- nsmul_succ : ∀ (n : ℕ) (x : K), AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x
- mul : K → K → K
- one : K
- natCast_zero : NatCast.natCast 0 = 0
- natCast_succ : ∀ (n : ℕ), NatCast.natCast (n + 1) = NatCast.natCast n + 1
- npow_zero : ∀ (x : K), Semiring.npow 0 x = 1
- npow_succ : ∀ (n : ℕ) (x : K), Semiring.npow (n + 1) x = Semiring.npow n x * x
- neg : K → K
- sub : K → K → K
- sub_eq_add_neg : ∀ (a b : K), a - b = a + -b
- zsmul_zero' : ∀ (a : K), Ring.zsmul 0 a = 0
- zsmul_succ' : ∀ (n : ℕ) (a : K), Ring.zsmul (↑n.succ) a = Ring.zsmul (↑n) a + a
- zsmul_neg' : ∀ (n : ℕ) (a : K), Ring.zsmul (Int.negSucc n) a = -Ring.zsmul (↑n.succ) a
- neg_add_cancel : ∀ (a : K), -a + a = 0
- intCast_ofNat : ∀ (n : ℕ), IntCast.intCast ↑n = ↑n
- intCast_negSucc : ∀ (n : ℕ), IntCast.intCast (Int.negSucc n) = -↑(n + 1)
- inv : K → K
- div : K → K → K
- div_eq_mul_inv : ∀ (a b : K), a / b = a * b⁻¹
- zpow_zero' : ∀ (a : K), Field.zpow 0 a = 1
- zpow_succ' : ∀ (n : ℕ) (a : K), Field.zpow (↑n.succ) a = Field.zpow (↑n) a * a
- zpow_neg' : ∀ (n : ℕ) (a : K), Field.zpow (Int.negSucc n) a = (Field.zpow (↑n.succ) a)⁻¹
- exists_pair_ne : ∃ (x : K) (y : K), x ≠ y
- mul_inv_cancel : ∀ (a : K), a ≠ 0 → a * a⁻¹ = 1
- nnratCast_def : ∀ (q : ℚ≥0), ↑q = ↑q.num / ↑q.den
- nnqsmul_def : ∀ (q : ℚ≥0) (a : K), Field.nnqsmul q a = ↑q * a
- ratCast_def : ∀ (q : ℚ), ↑q = ↑q.num / ↑q.den
- qsmul_def : ∀ (a : ℚ) (x : K), Field.qsmul a x = ↑a * x
- edist_dist : ∀ (x y : K), PseudoMetricSpace.edist x y = ENNReal.ofReal (dist x y)
- uniformity_dist : uniformity K = ⨅ (ε : ℝ), ⨅ (_ : ε > 0), Filter.principal {p : K × K | dist p.1 p.2 < ε}
- toBornology : Bornology K
- cobounded_sets : (Bornology.cobounded K).sets = {s : Set K | ∃ (C : ℝ), ∀ x ∈ sᶜ, ∀ y ∈ sᶜ, dist x y ≤ C}
- eq_of_dist_eq_zero : ∀ {x y : K}, dist x y = 0 → x = y
- star : K → K
- I : K
Imaginary unit in
K
. Meant to be set to0
forK = ℝ
. - I_re_ax : RCLike.re RCLike.I = 0
- re_add_im_ax : ∀ (z : K), (algebraMap ℝ K) (RCLike.re z) + (algebraMap ℝ K) (RCLike.im z) * RCLike.I = z
- ofReal_re_ax : ∀ (r : ℝ), RCLike.re ((algebraMap ℝ K) r) = r
- ofReal_im_ax : ∀ (r : ℝ), RCLike.im ((algebraMap ℝ K) r) = 0
- conj_re_ax : ∀ (z : K), RCLike.re ((starRingEnd K) z) = RCLike.re z
- conj_im_ax : ∀ (z : K), RCLike.im ((starRingEnd K) z) = -RCLike.im z
- conj_I_ax : (starRingEnd K) RCLike.I = -RCLike.I
- toPartialOrder : PartialOrder K
only an instance in the
ComplexOrder
locale - toDecidableEq : DecidableEq K
Instances
Characteristic zero #
The imaginary unit.
There are several equivalent ways to say that a number z
is in fact a real number.
Conjugation as a ring equivalence. This is used to convert the inner product into a sesquilinear product.
Equations
- RCLike.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
- RCLike.cauSeqRe f = ⟨fun (n : ℕ) => RCLike.re (↑f n), ⋯⟩
Instances For
The imaginary part of a K Cauchy sequence, as a real Cauchy sequence.
Equations
- RCLike.cauSeqIm f = ⟨fun (n : ℕ) => RCLike.im (↑f n), ⋯⟩
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
.
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
- RCLike.toStrictOrderedCommRing = StrictOrderedCommRing.mk ⋯
Instances For
A star algebra over K
has a scalar multiplication that respects the order.
Equations
- ⋯ = ⋯
Conjugate as an ℝ
-algebra equivalence
Equations
- RCLike.conjAe = { toFun := (↑↑(starRingEnd K)).toFun, invFun := ⇑(starRingEnd K), left_inv := ⋯, right_inv := ⋯, map_mul' := ⋯, map_add' := ⋯, commutes' := ⋯ }
Instances For
Equations
- ⋯ = ⋯
ℝ-dependent results #
Here we gather results that depend on whether K
is ℝ
.
The natural isomorphism between 𝕜
satisfying RCLike 𝕜
and ℝ
when RCLike.I = 0
.
Equations
- RCLike.realRingEquiv h = { toFun := ⇑RCLike.re, invFun := RCLike.ofReal, left_inv := ⋯, right_inv := ⋯, map_mul' := ⋯, map_add' := ⋯ }
Instances For
A mixin over a normed field, saying that the norm field structure is the same as ℝ
or ℂ
.
To endow such a field with a compatible RCLike
structure in a proof, use
letI := IsRCLikeNormedField.rclike 𝕜
.
Instances
Equations
- ⋯ = ⋯
A copy of an RCLike
field in which the NormedField
field is adjusted to be become defeq
to a propeq one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a normed field 𝕜
satisfying IsRCLikeNormedField 𝕜
, build an associated RCLike 𝕜
structure on 𝕜
which is definitionally compatible with the given normed field structure.
Equations
- IsRCLikeNormedField.rclike 𝕜 = (fun (p : RCLike 𝕜) (hp : hk = DenselyNormedField.toNormedField) => p.copy_of_normedField hk hp) (Classical.choose ⋯) ⋯