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
- mul : K → K → K
- one : K
- natCast_zero : NatCast.natCast 0 = 0
- neg : K → K
- sub : K → K → K
- inv : K → K
- div : K → K → K
- exists_pair_ne : ∃ (x : K) (y : K), 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}
- 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 #
ℝ and ℂ are both of 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.
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
ℝ-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
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 ⋯) ⋯