is_R_or_C
: a typeclass for ℝ or ℂ #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines the typeclass is_R_or_C
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 analysis.complex.basic
.
Implementation notes #
The coercion from reals into an is_R_or_C
field is done by registering algebra_map ℝ K
as
a has_coe_t
. 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 has_coe
and must set
priorities carefully. This problem was already solved for ℕ
, and we copy the solution detailed
in data/nat/cast
. 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 complex.lean
(which causes linter errors).
A few lemmas requiring heavier imports are in data.is_R_or_C.lemmas
.
- to_densely_normed_field : densely_normed_field K
- to_star_ring : star_ring K
- to_normed_algebra : normed_algebra ℝ K
- to_complete_space : complete_space K
- re : K →+ ℝ
- im : K →+ ℝ
- I : K
- I_re_ax : ⇑is_R_or_C.re is_R_or_C.I = 0
- I_mul_I_ax : is_R_or_C.I = 0 ∨ is_R_or_C.I * is_R_or_C.I = -1
- re_add_im_ax : ∀ (z : K), ⇑(algebra_map ℝ K) (⇑is_R_or_C.re z) + ⇑(algebra_map ℝ K) (⇑is_R_or_C.im z) * is_R_or_C.I = z
- of_real_re_ax : ∀ (r : ℝ), ⇑is_R_or_C.re (⇑(algebra_map ℝ K) r) = r
- of_real_im_ax : ∀ (r : ℝ), ⇑is_R_or_C.im (⇑(algebra_map ℝ K) r) = 0
- mul_re_ax : ∀ (z w : K), ⇑is_R_or_C.re (z * w) = ⇑is_R_or_C.re z * ⇑is_R_or_C.re w - ⇑is_R_or_C.im z * ⇑is_R_or_C.im w
- mul_im_ax : ∀ (z w : K), ⇑is_R_or_C.im (z * w) = ⇑is_R_or_C.re z * ⇑is_R_or_C.im w + ⇑is_R_or_C.im z * ⇑is_R_or_C.re w
- conj_re_ax : ∀ (z : K), ⇑is_R_or_C.re (⇑(star_ring_end K) z) = ⇑is_R_or_C.re z
- conj_im_ax : ∀ (z : K), ⇑is_R_or_C.im (⇑(star_ring_end K) z) = -⇑is_R_or_C.im z
- conj_I_ax : ⇑(star_ring_end K) is_R_or_C.I = -is_R_or_C.I
- norm_sq_eq_def_ax : ∀ (z : K), ‖z‖ ^ 2 = ⇑is_R_or_C.re z * ⇑is_R_or_C.re z + ⇑is_R_or_C.im z * ⇑is_R_or_C.im z
- mul_im_I_ax : ∀ (z : K), ⇑is_R_or_C.im z * ⇑is_R_or_C.im is_R_or_C.I = ⇑is_R_or_C.im z
This typeclass captures properties shared by ℝ and ℂ, with an API that closely matches that of ℂ.
Instances of this typeclass
Instances of other typeclasses for is_R_or_C
- is_R_or_C.has_sizeof_inst
Equations
- is_R_or_C.algebra_map_coe = {coe := ⇑(algebra_map ℝ K)}
Characteristic zero #
ℝ and ℂ are both of characteristic zero.
The imaginary unit, I
#
The imaginary unit.
The norm squared function.
Equations
- is_R_or_C.norm_sq = {to_fun := λ (z : K), ⇑is_R_or_C.re z * ⇑is_R_or_C.re z + ⇑is_R_or_C.im z * ⇑is_R_or_C.im z, map_zero' := _, map_one' := _, map_mul' := _}
Inversion #
Cast lemmas #
Norm #
Cauchy sequences #
The real part of a K Cauchy sequence, as a real Cauchy sequence.
Equations
- is_R_or_C.cau_seq_re f = ⟨λ (n : ℕ), ⇑is_R_or_C.re (⇑f n), _⟩
The imaginary part of a K Cauchy sequence, as a real Cauchy sequence.
Equations
- is_R_or_C.cau_seq_im f = ⟨λ (n : ℕ), ⇑is_R_or_C.im (⇑f n), _⟩
Equations
- real.is_R_or_C = {to_densely_normed_field := {to_normed_field := densely_normed_field.to_normed_field real.densely_normed_field, lt_norm_lt := _}, to_star_ring := real.star_ring, to_normed_algebra := normed_algebra.id ℝ real.normed_field, to_complete_space := real.complete_space, re := add_monoid_hom.id ℝ (add_monoid.to_add_zero_class ℝ), im := 0, I := 0, I_re_ax := real.is_R_or_C._proof_1, I_mul_I_ax := real.is_R_or_C._proof_2, re_add_im_ax := real.is_R_or_C._proof_3, of_real_re_ax := real.is_R_or_C._proof_4, of_real_im_ax := real.is_R_or_C._proof_5, mul_re_ax := real.is_R_or_C._proof_6, mul_im_ax := real.is_R_or_C._proof_7, conj_re_ax := real.is_R_or_C._proof_8, conj_im_ax := real.is_R_or_C._proof_9, conj_I_ax := real.is_R_or_C._proof_10, norm_sq_eq_def_ax := real.is_R_or_C._proof_11, mul_im_I_ax := real.is_R_or_C._proof_12}
The real part in a is_R_or_C
field, as a continuous linear map.
Equations
- is_R_or_C.re_clm = is_R_or_C.re_lm.mk_continuous 1 is_R_or_C.re_clm._proof_1
The imaginary part in a is_R_or_C
field, as a continuous linear map.
Equations
- is_R_or_C.im_clm = is_R_or_C.im_lm.mk_continuous 1 is_R_or_C.im_clm._proof_1
Conjugate as a linear isometry
Equations
Conjugate as a continuous linear equivalence
Equations
The ℝ → K
coercion, as a linear map
Equations
The ℝ → K coercion, as a linear isometry
Equations
The ℝ → K
coercion, as a continuous linear map