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 ℂ.
Possible applications include defining inner products and Hilbert spaces for both the real and complex case. One would produce 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.
- re : K →+ ℝ
- im : K →+ ℝ
- conj : K →+* K
- I : K
- of_real : ℝ → 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), is_R_or_C.of_real (⇑is_R_or_C.re z) + (is_R_or_C.of_real (⇑is_R_or_C.im z)) * is_R_or_C.I = z
- smul_coe_mul_ax : ∀ (z : K) (r : ℝ), r • z = (is_R_or_C.of_real r) * z
- of_real_re_ax : ∀ (r : ℝ), ⇑is_R_or_C.re (is_R_or_C.of_real r) = r
- of_real_im_ax : ∀ (r : ℝ), ⇑is_R_or_C.im (is_R_or_C.of_real 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 (⇑is_R_or_C.conj z) = ⇑is_R_or_C.re z
- conj_im_ax : ∀ (z : K), ⇑is_R_or_C.im (⇑is_R_or_C.conj z) = -⇑is_R_or_C.im z
- conj_I_ax : ⇑is_R_or_C.conj 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
- inv_def_ax : ∀ (z : K), z⁻¹ = (⇑is_R_or_C.conj z) * is_R_or_C.of_real (∥z∥ ^ 2)⁻¹
- div_I_ax : ∀ (z : K), z / is_R_or_C.I = -z * is_R_or_C.I
This typeclass captures properties shared by ℝ and ℂ, with an API that closely matches that of ℂ.
Instances
The imaginary unit, I
The imaginary unit.
The norm squared function.
Equations
- is_R_or_C.norm_sq z = (⇑is_R_or_C.re z) * ⇑is_R_or_C.re z + (⇑is_R_or_C.im z) * ⇑is_R_or_C.im z
The pseudo-coercion of_real
as a ring_hom
.
Equations
- is_R_or_C.of_real_hom = {to_fun := is_R_or_C.of_real _inst_3, map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}
Inversion
Cast lemmas
Characteristic zero
ℝ and ℂ are both of characteristic zero.
Note: This is not registered as an instance to avoid having multiple instances on ℝ and ℂ.
Absolute value
The complex absolute value function, defined as the square root of the norm squared.
Equations
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 = {re := add_monoid_hom.id ℝ (add_group.to_add_monoid ℝ), im := 0, conj := ring_hom.id ℝ ring.to_semiring, I := 0, of_real := id ℝ, 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, smul_coe_mul_ax := real.is_R_or_C._proof_4, of_real_re_ax := real.is_R_or_C._proof_5, of_real_im_ax := real.is_R_or_C._proof_6, mul_re_ax := real.is_R_or_C._proof_7, mul_im_ax := real.is_R_or_C._proof_8, conj_re_ax := real.is_R_or_C._proof_9, conj_im_ax := real.is_R_or_C._proof_10, conj_I_ax := real.is_R_or_C._proof_11, norm_sq_eq_def_ax := real.is_R_or_C._proof_12, mul_im_I_ax := real.is_R_or_C._proof_13, inv_def_ax := real.is_R_or_C._proof_14, div_I_ax := real.is_R_or_C._proof_15}
Equations
- complex.is_R_or_C = {re := {to_fun := complex.re, map_zero' := complex.zero_re, map_add' := complex.add_re}, im := {to_fun := complex.im, map_zero' := complex.zero_im, map_add' := complex.add_im}, conj := complex.conj, I := complex.I, of_real := coe coe_to_lift, I_re_ax := complex.is_R_or_C._proof_1, I_mul_I_ax := complex.is_R_or_C._proof_2, re_add_im_ax := complex.is_R_or_C._proof_3, smul_coe_mul_ax := complex.is_R_or_C._proof_4, of_real_re_ax := complex.is_R_or_C._proof_5, of_real_im_ax := complex.is_R_or_C._proof_6, mul_re_ax := complex.is_R_or_C._proof_7, mul_im_ax := complex.is_R_or_C._proof_8, conj_re_ax := complex.is_R_or_C._proof_9, conj_im_ax := complex.is_R_or_C._proof_10, conj_I_ax := complex.is_R_or_C._proof_11, norm_sq_eq_def_ax := complex.is_R_or_C._proof_12, mul_im_I_ax := complex.is_R_or_C._proof_13, inv_def_ax := complex.is_R_or_C._proof_14, div_I_ax := complex.div_I}