mathlib documentation

data.complex.is_R_or_C

is_R_or_C: a typeclass for ℝ or ℂ #

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).

@[class]
structure is_R_or_C (K : Type u_1) :
Type u_1

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

Simp attribute for lemmas about is_R_or_C

@[protected, instance]
noncomputable def is_R_or_C.algebra_map_coe {K : Type u_1} [is_R_or_C K] :
Equations
theorem is_R_or_C.of_real_alg {K : Type u_1} [is_R_or_C K] (x : ) :
x = x 1
theorem is_R_or_C.real_smul_eq_coe_mul {K : Type u_1} [is_R_or_C K] (r : ) (z : K) :
r z = r * z
theorem is_R_or_C.real_smul_eq_coe_smul {K : Type u_1} {E : Type u_2} [is_R_or_C K] [add_comm_group E] [module K E] [module E] [is_scalar_tower K E] (r : ) (x : E) :
r x = r x
@[simp]
theorem is_R_or_C.re_add_im {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp, norm_cast]
theorem is_R_or_C.of_real_re {K : Type u_1} [is_R_or_C K] (r : ) :
@[simp, norm_cast]
theorem is_R_or_C.of_real_im {K : Type u_1} [is_R_or_C K] (r : ) :
@[simp]
@[simp]
theorem is_R_or_C.inv_def {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.ext {K : Type u_1} [is_R_or_C K] {z w : K} :
@[simp, norm_cast]
theorem is_R_or_C.of_real_zero {K : Type u_1} [is_R_or_C K] :
0 = 0
@[simp]
theorem is_R_or_C.zero_re' {K : Type u_1} [is_R_or_C K] :
@[simp, norm_cast]
theorem is_R_or_C.of_real_one {K : Type u_1} [is_R_or_C K] :
1 = 1
@[simp]
theorem is_R_or_C.one_re {K : Type u_1} [is_R_or_C K] :
@[simp]
theorem is_R_or_C.one_im {K : Type u_1} [is_R_or_C K] :
@[simp, norm_cast]
theorem is_R_or_C.of_real_inj {K : Type u_1} [is_R_or_C K] {z w : } :
z = w z = w
@[simp]
theorem is_R_or_C.bit0_re {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.bit1_re {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.bit0_im {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.bit1_im {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.of_real_eq_zero {K : Type u_1} [is_R_or_C K] {z : } :
z = 0 z = 0
theorem is_R_or_C.of_real_ne_zero {K : Type u_1} [is_R_or_C K] {z : } :
z 0 z 0
@[simp, norm_cast]
theorem is_R_or_C.of_real_add {K : Type u_1} [is_R_or_C K] ⦃r s :  :
(r + s) = r + s
@[simp, norm_cast]
theorem is_R_or_C.of_real_bit0 {K : Type u_1} [is_R_or_C K] (r : ) :
@[simp, norm_cast]
theorem is_R_or_C.of_real_bit1 {K : Type u_1} [is_R_or_C K] (r : ) :
theorem is_R_or_C.two_ne_zero {K : Type u_1} [is_R_or_C K] :
2 0
@[simp, norm_cast]
theorem is_R_or_C.of_real_neg {K : Type u_1} [is_R_or_C K] (r : ) :
@[simp, norm_cast]
theorem is_R_or_C.of_real_mul {K : Type u_1} [is_R_or_C K] (r s : ) :
(r * s) = r * s
@[simp, norm_cast]
theorem is_R_or_C.of_real_smul {K : Type u_1} [is_R_or_C K] (r x : ) :
r x = r * x
theorem is_R_or_C.of_real_mul_re {K : Type u_1} [is_R_or_C K] (r : ) (z : K) :
theorem is_R_or_C.of_real_mul_im {K : Type u_1} [is_R_or_C K] (r : ) (z : K) :
theorem is_R_or_C.smul_re {K : Type u_1} [is_R_or_C K] (r : ) (z : K) :
theorem is_R_or_C.smul_im {K : Type u_1} [is_R_or_C K] (r : ) (z : K) :
@[simp]
theorem is_R_or_C.norm_real {K : Type u_1} [is_R_or_C K] (r : ) :

The imaginary unit, I #

@[simp]
theorem is_R_or_C.I_re {K : Type u_1} [is_R_or_C K] :

The imaginary unit.

@[simp]
@[simp]
@[simp]
theorem is_R_or_C.I_mul_re {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.conj_re {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.conj_im {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
@[simp]
theorem is_R_or_C.conj_of_real {K : Type u_1} [is_R_or_C K] (r : ) :
@[simp]
theorem is_R_or_C.conj_bit0 {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.conj_bit1 {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.conj_smul {K : Type u_1} [is_R_or_C K] (r : ) (z : K) :
theorem is_R_or_C.eq_conj_iff_real {K : Type u_1} [is_R_or_C K] {z : K} :
(star_ring_end K) z = z ∃ (r : ), z = r
@[simp]
theorem is_R_or_C.star_def {K : Type u_1} [is_R_or_C K] :
@[reducible]
def is_R_or_C.conj_to_ring_equiv (K : Type u_1) [is_R_or_C K] :

Conjugation as a ring equivalence. This is used to convert the inner product into a sesquilinear product.

theorem is_R_or_C.eq_conj_iff_re {K : Type u_1} [is_R_or_C K] {z : K} :
def is_R_or_C.norm_sq {K : Type u_1} [is_R_or_C K] :

The norm squared function.

Equations
theorem is_R_or_C.norm_sq_eq_def' {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.norm_sq_zero {K : Type u_1} [is_R_or_C K] :
theorem is_R_or_C.norm_sq_one {K : Type u_1} [is_R_or_C K] :
theorem is_R_or_C.norm_sq_nonneg {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.norm_sq_eq_zero {K : Type u_1} [is_R_or_C K] {z : K} :
@[simp]
theorem is_R_or_C.norm_sq_pos {K : Type u_1} [is_R_or_C K] {z : K} :
@[simp]
theorem is_R_or_C.norm_sq_neg {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
@[simp]
theorem is_R_or_C.mul_conj {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.add_conj {K : Type u_1} [is_R_or_C K] (z : K) :
noncomputable def is_R_or_C.of_real_hom {K : Type u_1} [is_R_or_C K] :

The pseudo-coercion of_real as a ring_hom.

Equations
noncomputable def is_R_or_C.coe_hom {K : Type u_1} [is_R_or_C K] :

The coercion from reals as a ring_hom.

Equations
@[simp, norm_cast]
theorem is_R_or_C.of_real_sub {K : Type u_1} [is_R_or_C K] (r s : ) :
(r - s) = r - s
@[simp, norm_cast]
theorem is_R_or_C.of_real_pow {K : Type u_1} [is_R_or_C K] (r : ) (n : ) :
(r ^ n) = r ^ n
theorem is_R_or_C.sub_conj {K : Type u_1} [is_R_or_C K] (z : K) :

Inversion #

@[simp]
@[simp]
@[simp, norm_cast]
theorem is_R_or_C.of_real_inv {K : Type u_1} [is_R_or_C K] (r : ) :
@[protected]
theorem is_R_or_C.inv_zero {K : Type u_1} [is_R_or_C K] :
0⁻¹ = 0
@[protected]
theorem is_R_or_C.mul_inv_cancel {K : Type u_1} [is_R_or_C K] {z : K} (h : z 0) :
z * z⁻¹ = 1
@[simp]
theorem is_R_or_C.conj_inv {K : Type u_1} [is_R_or_C K] (x : K) :
@[simp, norm_cast]
theorem is_R_or_C.of_real_div {K : Type u_1} [is_R_or_C K] (r s : ) :
(r / s) = r / s
theorem is_R_or_C.div_re_of_real {K : Type u_1} [is_R_or_C K] {z : K} {r : } :
@[simp, norm_cast]
theorem is_R_or_C.of_real_zpow {K : Type u_1} [is_R_or_C K] (r : ) (n : ) :
(r ^ n) = r ^ n
@[simp]
theorem is_R_or_C.div_I {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.inv_I {K : Type u_1} [is_R_or_C K] :
@[simp]
@[simp]
theorem is_R_or_C.norm_conj {K : Type u_1} [is_R_or_C K] {z : K} :
@[protected, instance]
def is_R_or_C.cstar_ring {K : Type u_1} [is_R_or_C K] :

Cast lemmas #

@[simp, norm_cast]
theorem is_R_or_C.of_real_nat_cast {K : Type u_1} [is_R_or_C K] (n : ) :
@[simp, norm_cast]
theorem is_R_or_C.nat_cast_re {K : Type u_1} [is_R_or_C K] (n : ) :
@[simp, norm_cast]
theorem is_R_or_C.nat_cast_im {K : Type u_1} [is_R_or_C K] (n : ) :
@[simp, norm_cast]
theorem is_R_or_C.of_real_int_cast {K : Type u_1} [is_R_or_C K] (n : ) :
@[simp, norm_cast]
theorem is_R_or_C.int_cast_re {K : Type u_1} [is_R_or_C K] (n : ) :
@[simp, norm_cast]
theorem is_R_or_C.int_cast_im {K : Type u_1} [is_R_or_C K] (n : ) :
@[simp, norm_cast]
theorem is_R_or_C.of_real_rat_cast {K : Type u_1} [is_R_or_C K] (n : ) :
@[simp, norm_cast]
theorem is_R_or_C.rat_cast_re {K : Type u_1} [is_R_or_C K] (q : ) :
@[simp, norm_cast]
theorem is_R_or_C.rat_cast_im {K : Type u_1} [is_R_or_C K] (q : ) :

Characteristic zero #

@[protected, instance]
def is_R_or_C.char_zero_R_or_C {K : Type u_1} [is_R_or_C K] :

ℝ and ℂ are both of characteristic zero.

theorem is_R_or_C.re_eq_add_conj {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.im_eq_conj_sub {K : Type u_1} [is_R_or_C K] (z : K) :

Absolute value #

noncomputable def is_R_or_C.abs {K : Type u_1} [is_R_or_C K] (z : K) :

The complex absolute value function, defined as the square root of the norm squared.

Equations
Instances for is_R_or_C.abs
@[simp, norm_cast]
theorem is_R_or_C.abs_of_real {K : Type u_1} [is_R_or_C K] (r : ) :
theorem is_R_or_C.norm_eq_abs {K : Type u_1} [is_R_or_C K] (z : K) :
@[norm_cast]
theorem is_R_or_C.norm_of_real {K : Type u_1} [is_R_or_C K] (z : ) :
theorem is_R_or_C.abs_of_nonneg {K : Type u_1} [is_R_or_C K] {r : } (h : 0 r) :
theorem is_R_or_C.norm_of_nonneg {K : Type u_1} [is_R_or_C K] {r : } (r_nn : 0 r) :
theorem is_R_or_C.abs_of_nat {K : Type u_1} [is_R_or_C K] (n : ) :
@[simp]
theorem is_R_or_C.abs_zero {K : Type u_1} [is_R_or_C K] :
@[simp]
theorem is_R_or_C.abs_one {K : Type u_1} [is_R_or_C K] :
@[simp]
theorem is_R_or_C.abs_two {K : Type u_1} [is_R_or_C K] :
theorem is_R_or_C.abs_nonneg {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.abs_eq_zero {K : Type u_1} [is_R_or_C K] {z : K} :
theorem is_R_or_C.abs_ne_zero {K : Type u_1} [is_R_or_C K] {z : K} :
@[simp]
theorem is_R_or_C.abs_conj {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.abs_mul {K : Type u_1} [is_R_or_C K] (z w : K) :
theorem is_R_or_C.abs_re_le_abs {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.abs_im_le_abs {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.norm_re_le_norm {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.norm_im_le_norm {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.re_le_abs {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.im_le_abs {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.im_eq_zero_of_le {K : Type u_1} [is_R_or_C K] {a : K} (h : is_R_or_C.abs a is_R_or_C.re a) :
theorem is_R_or_C.re_eq_self_of_le {K : Type u_1} [is_R_or_C K] {a : K} (h : is_R_or_C.abs a is_R_or_C.re a) :
theorem is_R_or_C.abs_add {K : Type u_1} [is_R_or_C K] (z w : K) :
@[protected, instance]
@[simp]
theorem is_R_or_C.abs_abs {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.abs_pos {K : Type u_1} [is_R_or_C K] {z : K} :
@[simp]
theorem is_R_or_C.abs_neg {K : Type u_1} [is_R_or_C K] (z : K) :
theorem is_R_or_C.abs_sub {K : Type u_1} [is_R_or_C K] (z w : K) :
theorem is_R_or_C.abs_sub_le {K : Type u_1} [is_R_or_C K] (a b c : K) :
@[simp]
theorem is_R_or_C.abs_inv {K : Type u_1} [is_R_or_C K] (z : K) :
@[simp]
theorem is_R_or_C.abs_div {K : Type u_1} [is_R_or_C K] (z w : K) :
@[simp, norm_cast]
theorem is_R_or_C.abs_cast_nat {K : Type u_1} [is_R_or_C K] (n : ) :
theorem is_R_or_C.norm_sq_eq_abs {K : Type u_1} [is_R_or_C K] (x : K) :
theorem is_R_or_C.abs_sq_re_add_conj {K : Type u_1} [is_R_or_C K] (x : K) :
theorem is_R_or_C.abs_sq_re_add_conj' {K : Type u_1} [is_R_or_C K] (x : K) :

Cauchy sequences #

noncomputable def is_R_or_C.cau_seq_re {K : Type u_1} [is_R_or_C K] (f : cau_seq K is_R_or_C.abs) :

The real part of a K Cauchy sequence, as a real Cauchy sequence.

Equations
noncomputable def is_R_or_C.cau_seq_im {K : Type u_1} [is_R_or_C K] (f : cau_seq K is_R_or_C.abs) :

The imaginary part of a K Cauchy sequence, as a real Cauchy sequence.

Equations
@[simp, norm_cast]
theorem is_R_or_C.of_real_prod {K : Type u_1} [is_R_or_C K] {α : Type u_2} (s : finset α) (f : α → ) :
(s.prod (λ (i : α), f i)) = s.prod (λ (i : α), (f i))
@[simp, norm_cast]
theorem is_R_or_C.of_real_sum {K : Type u_1} [is_R_or_C K] {α : Type u_2} (s : finset α) (f : α → ) :
(s.sum (λ (i : α), f i)) = s.sum (λ (i : α), (f i))
@[simp, norm_cast]
theorem is_R_or_C.of_real_finsupp_sum {K : Type u_1} [is_R_or_C K] {α : Type u_2} {M : Type u_3} [has_zero M] (f : α →₀ M) (g : α → M → ) :
(f.sum (λ (a : α) (b : M), g a b)) = f.sum (λ (a : α) (b : M), (g a b))
@[simp, norm_cast]
theorem is_R_or_C.of_real_finsupp_prod {K : Type u_1} [is_R_or_C K] {α : Type u_2} {M : Type u_3} [has_zero M] (f : α →₀ M) (g : α → M → ) :
(f.prod (λ (a : α) (b : M), g a b)) = f.prod (λ (a : α) (b : M), (g a b))
theorem polynomial.of_real_eval {K : Type u_1} [is_R_or_C K] (p : polynomial ) (x : ) :

This instance generates a type-class problem with a metavariable ?m that should satisfy is_R_or_C ?m. Since this can only be satisfied by or , this does not cause problems.

@[protected, nolint, instance]

An is_R_or_C field is finite-dimensional over , since it is spanned by {1, I}.

A finite dimensional vector space over an is_R_or_C is a proper metric space.

This is not an instance because it would cause a search for finite_dimensional ?x E before is_R_or_C ?x.

@[protected, instance]
@[protected, instance]
noncomputable def real.is_R_or_C  :
Equations
@[simp]
theorem is_R_or_C.re_to_real {x : } :
@[simp]
theorem is_R_or_C.im_to_real {x : } :
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
def is_R_or_C.re_lm {K : Type u_1} [is_R_or_C K] :

The real part in a is_R_or_C field, as a linear map.

Equations
noncomputable def is_R_or_C.re_clm {K : Type u_1} [is_R_or_C K] :

The real part in a is_R_or_C field, as a continuous linear map.

Equations
@[simp]
theorem is_R_or_C.re_clm_norm {K : Type u_1} [is_R_or_C K] :
@[simp, norm_cast]
@[continuity]
def is_R_or_C.im_lm {K : Type u_1} [is_R_or_C K] :

The imaginary part in a is_R_or_C field, as a linear map.

Equations
noncomputable def is_R_or_C.im_clm {K : Type u_1} [is_R_or_C K] :

The imaginary part in a is_R_or_C field, as a continuous linear map.

Equations
@[simp, norm_cast]
@[continuity]
def is_R_or_C.conj_ae {K : Type u_1} [is_R_or_C K] :

Conjugate as an -algebra equivalence

Equations
@[simp]
noncomputable def is_R_or_C.conj_lie {K : Type u_1} [is_R_or_C K] :

Conjugate as a linear isometry

Equations
noncomputable def is_R_or_C.conj_cle {K : Type u_1} [is_R_or_C K] :

Conjugate as a continuous linear equivalence

Equations
@[simp]
@[protected, instance]
@[continuity]
noncomputable def is_R_or_C.of_real_am {K : Type u_1} [is_R_or_C K] :

The ℝ → K coercion, as a linear map

Equations
@[simp]
noncomputable def is_R_or_C.of_real_li {K : Type u_1} [is_R_or_C K] :

The ℝ → K coercion, as a linear isometry

Equations
noncomputable def is_R_or_C.of_real_clm {K : Type u_1} [is_R_or_C K] :

The ℝ → K coercion, as a continuous linear map

Equations
@[simp]
@[continuity]
theorem is_R_or_C.continuous_of_real {K : Type u_1} [is_R_or_C K] :
@[continuity]
@[continuity]