Documentation

Mathlib.Data.Complex.Basic

The complex numbers #

The complex numbers are modelled as ℝ^2 in the obvious way and it is shown that they form a field of characteristic zero. The result that the complex numbers are algebraically closed, see FieldTheory.AlgebraicClosure.

Definition and basic arithmetic #

structure Complex :

Complex numbers consist of two Reals: a real part re and an imaginary part im.

Instances For
    @[simp]
    theorem Complex.equivRealProd_apply (z : ) :
    Complex.equivRealProd z = (z.re, z.im)

    The equivalence between the complex numbers and ℝ × ℝ.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[simp]
      theorem Complex.eta (z : ) :
      { re := z.re, im := z.im } = z
      theorem Complex.ext {z : } {w : } :
      z.re = w.rez.im = w.imz = w
      theorem Complex.ext_iff {z : } {w : } :
      z = w z.re = w.re z.im = w.im
      @[simp]
      @[simp]

      The natural inclusion of the real numbers into the complex numbers. The name Complex.ofReal is reserved for the bundled homomorphism.

      Equations
      • r = { re := r, im := 0 }
      Instances For
        @[simp]
        theorem Complex.ofReal_re (r : ) :
        (r).re = r
        @[simp]
        theorem Complex.ofReal_im (r : ) :
        (r).im = 0
        theorem Complex.ofReal_def (r : ) :
        r = { re := r, im := 0 }
        @[simp]
        theorem Complex.ofReal_inj {z : } {w : } :
        z = w z = w

        The product of a set on the real axis and a set on the imaginary axis of the complex plane, denoted by s ×ℂ t.

        Equations
        Instances For
          theorem Complex.mem_reProdIm {z : } {s : Set } {t : Set } :
          z s ×ℂ t z.re s z.im t
          @[simp]
          theorem Complex.zero_re :
          0.re = 0
          @[simp]
          theorem Complex.zero_im :
          0.im = 0
          @[simp]
          theorem Complex.ofReal_zero :
          0 = 0
          @[simp]
          theorem Complex.ofReal_eq_zero {z : } :
          z = 0 z = 0
          theorem Complex.ofReal_ne_zero {z : } :
          z 0 z 0
          Equations
          @[simp]
          theorem Complex.one_re :
          1.re = 1
          @[simp]
          theorem Complex.one_im :
          1.im = 0
          @[simp]
          theorem Complex.ofReal_one :
          1 = 1
          @[simp]
          theorem Complex.ofReal_eq_one {z : } :
          z = 1 z = 1
          theorem Complex.ofReal_ne_one {z : } :
          z 1 z 1
          Equations
          @[simp]
          theorem Complex.add_re (z : ) (w : ) :
          (z + w).re = z.re + w.re
          @[simp]
          theorem Complex.add_im (z : ) (w : ) :
          (z + w).im = z.im + w.im
          @[simp]
          theorem Complex.bit0_re (z : ) :
          (bit0 z).re = bit0 z.re
          @[simp]
          theorem Complex.bit1_re (z : ) :
          (bit1 z).re = bit1 z.re
          @[simp]
          theorem Complex.bit0_im (z : ) :
          (bit0 z).im = bit0 z.im
          @[simp]
          theorem Complex.bit1_im (z : ) :
          (bit1 z).im = bit0 z.im
          @[simp]
          theorem Complex.ofReal_add (r : ) (s : ) :
          ↑(r + s) = r + s
          @[simp]
          theorem Complex.ofReal_bit0 (r : ) :
          ↑(bit0 r) = bit0 r
          @[simp]
          theorem Complex.ofReal_bit1 (r : ) :
          ↑(bit1 r) = bit1 r
          Equations
          @[simp]
          theorem Complex.neg_re (z : ) :
          (-z).re = -z.re
          @[simp]
          theorem Complex.neg_im (z : ) :
          (-z).im = -z.im
          @[simp]
          theorem Complex.ofReal_neg (r : ) :
          ↑(-r) = -r
          Equations
          Equations
          @[simp]
          theorem Complex.mul_re (z : ) (w : ) :
          (z * w).re = z.re * w.re - z.im * w.im
          @[simp]
          theorem Complex.mul_im (z : ) (w : ) :
          (z * w).im = z.re * w.im + z.im * w.re
          @[simp]
          theorem Complex.ofReal_mul (r : ) (s : ) :
          ↑(r * s) = r * s
          theorem Complex.ofReal_mul_re (r : ) (z : ) :
          (r * z).re = r * z.re
          theorem Complex.ofReal_mul_im (r : ) (z : ) :
          (r * z).im = r * z.im
          theorem Complex.ofReal_mul' (r : ) (z : ) :
          r * z = { re := r * z.re, im := r * z.im }

          The imaginary unit, I #

          The imaginary unit.

          Equations
          Instances For
            @[simp]
            theorem Complex.I_re :
            @[simp]
            theorem Complex.I_im :
            theorem Complex.I_mul (z : ) :
            Complex.I * z = { re := -z.im, im := z.re }
            theorem Complex.mk_eq_add_mul_I (a : ) (b : ) :
            { re := a, im := b } = a + b * Complex.I
            @[simp]
            theorem Complex.re_add_im (z : ) :
            z.re + z.im * Complex.I = z
            theorem Complex.mul_I_re (z : ) :
            (z * Complex.I).re = -z.im
            theorem Complex.mul_I_im (z : ) :
            (z * Complex.I).im = z.re
            theorem Complex.I_mul_re (z : ) :
            (Complex.I * z).re = -z.im
            theorem Complex.I_mul_im (z : ) :
            (Complex.I * z).im = z.re
            @[simp]
            theorem Complex.equivRealProd_symm_apply (p : × ) :
            Complex.equivRealProd.symm p = p.fst + p.snd * Complex.I

            Commutative ring instance and lemmas #

            instance Complex.instSMulRealComplex {R : Type u_1} [SMul R ] :
            Equations
            • Complex.instSMulRealComplex = { smul := fun r x => { re := r x.re - 0 * x.im, im := r x.im + 0 * x.re } }
            theorem Complex.smul_re {R : Type u_1} [SMul R ] (r : R) (z : ) :
            (r z).re = r z.re
            theorem Complex.smul_im {R : Type u_1} [SMul R ] (r : R) (z : ) :
            (r z).im = r z.im
            @[simp]
            theorem Complex.real_smul {x : } {z : } :
            x z = x * z

            This shortcut instance ensures we do not find Ring via the noncomputable Complex.field instance.

            Equations

            This shortcut instance ensures we do not find CommSemiring via the noncomputable Complex.field instance.

            Equations

            This shortcut instance ensures we do not find Semiring via the noncomputable Complex.field instance.

            Equations

            The "real part" map, considered as an additive group homomorphism.

            Equations
            Instances For

              The "imaginary part" map, considered as an additive group homomorphism.

              Equations
              Instances For
                @[simp]
                theorem Complex.I_pow_bit0 (n : ) :
                Complex.I ^ bit0 n = (-1) ^ n
                @[simp]
                @[simp]
                theorem Complex.im_ofNat (n : ) [Nat.AtLeastTwo n] :
                (OfNat.ofNat n).im = 0

                Complex conjugation #

                This defines the complex conjugate as the star operation of the StarRing. It is recommended to use the ring endomorphism version starRingEnd, available under the notation conj in the locale ComplexConjugate.

                Equations
                • One or more equations did not get rendered due to their size.
                @[simp]
                theorem Complex.conj_re (z : ) :
                (↑(starRingEnd ) z).re = z.re
                @[simp]
                theorem Complex.conj_im (z : ) :
                (↑(starRingEnd ) z).im = -z.im
                theorem Complex.conj_ofReal (r : ) :
                ↑(starRingEnd ) r = r
                theorem Complex.conj_eq_iff_real {z : } :
                ↑(starRingEnd ) z = z r, z = r
                theorem Complex.conj_eq_iff_re {z : } :
                ↑(starRingEnd ) z = z z.re = z
                theorem Complex.conj_eq_iff_im {z : } :
                ↑(starRingEnd ) z = z z.im = 0
                @[simp]
                theorem Complex.star_def :
                star = ↑(starRingEnd )

                Norm squared #

                The norm squared function.

                Equations
                Instances For
                  theorem Complex.normSq_apply (z : ) :
                  Complex.normSq z = z.re * z.re + z.im * z.im
                  @[simp]
                  theorem Complex.normSq_ofReal (r : ) :
                  Complex.normSq r = r * r
                  @[simp]
                  theorem Complex.normSq_mk (x : ) (y : ) :
                  Complex.normSq { re := x, im := y } = x * x + y * y
                  theorem Complex.normSq_add_mul_I (x : ) (y : ) :
                  Complex.normSq (x + y * Complex.I) = x ^ 2 + y ^ 2
                  @[simp]
                  theorem Complex.normSq_pos {z : } :
                  0 < Complex.normSq z z 0
                  @[simp]
                  theorem Complex.normSq_add (z : ) (w : ) :
                  Complex.normSq (z + w) = Complex.normSq z + Complex.normSq w + 2 * (z * ↑(starRingEnd ) w).re
                  theorem Complex.re_sq_le_normSq (z : ) :
                  z.re * z.re Complex.normSq z
                  theorem Complex.im_sq_le_normSq (z : ) :
                  z.im * z.im Complex.normSq z
                  theorem Complex.mul_conj (z : ) :
                  z * ↑(starRingEnd ) z = ↑(Complex.normSq z)
                  theorem Complex.add_conj (z : ) :
                  z + ↑(starRingEnd ) z = ↑(2 * z.re)

                  The coercion ℝ → ℂ as a RingHom.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[simp]
                    theorem Complex.ofReal_eq_coe (r : ) :
                    Complex.ofReal r = r
                    @[simp]
                    theorem Complex.I_sq :
                    @[simp]
                    theorem Complex.sub_re (z : ) (w : ) :
                    (z - w).re = z.re - w.re
                    @[simp]
                    theorem Complex.sub_im (z : ) (w : ) :
                    (z - w).im = z.im - w.im
                    @[simp]
                    theorem Complex.ofReal_sub (r : ) (s : ) :
                    ↑(r - s) = r - s
                    @[simp]
                    theorem Complex.ofReal_pow (r : ) (n : ) :
                    ↑(r ^ n) = r ^ n
                    theorem Complex.sub_conj (z : ) :
                    z - ↑(starRingEnd ) z = ↑(2 * z.im) * Complex.I
                    theorem Complex.normSq_sub (z : ) (w : ) :
                    Complex.normSq (z - w) = Complex.normSq z + Complex.normSq w - 2 * (z * ↑(starRingEnd ) w).re

                    Inversion #

                    noncomputable instance Complex.instInvComplex :
                    Equations
                    @[simp]
                    theorem Complex.inv_re (z : ) :
                    z⁻¹.re = z.re / Complex.normSq z
                    @[simp]
                    theorem Complex.inv_im (z : ) :
                    z⁻¹.im = -z.im / Complex.normSq z
                    @[simp]
                    theorem Complex.ofReal_inv (r : ) :
                    r⁻¹ = (r)⁻¹
                    theorem Complex.mul_inv_cancel {z : } (h : z 0) :
                    z * z⁻¹ = 1
                    noncomputable instance Complex.instRatCastComplex :
                    Equations

                    Cast lemmas #

                    @[simp]
                    theorem Complex.ofReal_nat_cast (n : ) :
                    n = n
                    @[simp]
                    theorem Complex.nat_cast_re (n : ) :
                    (n).re = n
                    @[simp]
                    theorem Complex.nat_cast_im (n : ) :
                    (n).im = 0
                    @[simp]
                    theorem Complex.ofReal_int_cast (n : ) :
                    n = n
                    @[simp]
                    theorem Complex.int_cast_re (n : ) :
                    (n).re = n
                    @[simp]
                    theorem Complex.int_cast_im (n : ) :
                    (n).im = 0
                    @[simp]
                    theorem Complex.rat_cast_im (q : ) :
                    (q).im = 0
                    @[simp]
                    theorem Complex.rat_cast_re (q : ) :
                    (q).re = q

                    Field instance and lemmas #

                    @[simp]
                    theorem Complex.I_zpow_bit0 (n : ) :
                    Complex.I ^ bit0 n = (-1) ^ n
                    @[simp]
                    theorem Complex.div_re (z : ) (w : ) :
                    (z / w).re = z.re * w.re / Complex.normSq w + z.im * w.im / Complex.normSq w
                    theorem Complex.div_im (z : ) (w : ) :
                    (z / w).im = z.im * w.re / Complex.normSq w - z.re * w.im / Complex.normSq w
                    @[simp]
                    theorem Complex.ofReal_div (r : ) (s : ) :
                    ↑(r / s) = r / s
                    @[simp]
                    theorem Complex.ofReal_zpow (r : ) (n : ) :
                    ↑(r ^ n) = r ^ n
                    @[simp]
                    theorem Complex.div_I (z : ) :
                    @[simp]
                    theorem Complex.ofReal_rat_cast (n : ) :
                    n = n

                    Characteristic zero #

                    theorem Complex.re_eq_add_conj (z : ) :
                    z.re = (z + ↑(starRingEnd ) z) / 2

                    A complex number z plus its conjugate conj z is 2 times its real part.

                    theorem Complex.im_eq_sub_conj (z : ) :
                    z.im = (z - ↑(starRingEnd ) z) / (2 * Complex.I)

                    A complex number z minus its conjugate conj z is 2i times its imaginary part.

                    Absolute value #

                    noncomputable def Complex.abs :

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

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      @[simp]
                      theorem Complex.abs_ofReal (r : ) :
                      Complex.abs r = |r|
                      theorem Complex.abs_of_nonneg {r : } (h : 0 r) :
                      Complex.abs r = r
                      theorem Complex.abs_of_nat (n : ) :
                      Complex.abs n = n
                      @[simp]
                      theorem Complex.sq_abs_sub_sq_re (z : ) :
                      Complex.abs z ^ 2 - z.re ^ 2 = z.im ^ 2
                      @[simp]
                      theorem Complex.sq_abs_sub_sq_im (z : ) :
                      Complex.abs z ^ 2 - z.im ^ 2 = z.re ^ 2
                      @[simp]
                      theorem Complex.abs_two :
                      Complex.abs 2 = 2
                      @[simp]
                      theorem Complex.abs_conj (z : ) :
                      @[simp]
                      theorem Complex.abs_prod {ι : Type u_1} (s : Finset ι) (f : ι) :
                      Complex.abs (Finset.prod s f) = Finset.prod s fun I => Complex.abs (f I)
                      theorem Complex.abs_pow (z : ) (n : ) :
                      Complex.abs (z ^ n) = Complex.abs z ^ n
                      theorem Complex.abs_zpow (z : ) (n : ) :
                      Complex.abs (z ^ n) = Complex.abs z ^ n
                      theorem Complex.abs_re_le_abs (z : ) :
                      |z.re| Complex.abs z
                      theorem Complex.abs_im_le_abs (z : ) :
                      |z.im| Complex.abs z
                      theorem Complex.re_le_abs (z : ) :
                      z.re Complex.abs z
                      theorem Complex.im_le_abs (z : ) :
                      z.im Complex.abs z
                      @[simp]
                      theorem Complex.abs_re_lt_abs {z : } :
                      |z.re| < Complex.abs z z.im 0
                      @[simp]
                      theorem Complex.abs_im_lt_abs {z : } :
                      |z.im| < Complex.abs z z.re 0
                      @[simp]
                      theorem Complex.abs_abs (z : ) :
                      theorem Complex.abs_le_abs_re_add_abs_im (z : ) :
                      Complex.abs z |z.re| + |z.im|
                      @[simp]
                      theorem Complex.abs_cast_nat (n : ) :
                      Complex.abs n = n
                      @[simp]
                      theorem Complex.int_cast_abs (n : ) :
                      |n| = Complex.abs n

                      Cauchy sequences #

                      theorem Complex.isCauSeq_re (f : CauSeq Complex.abs) :
                      IsCauSeq abs fun n => (f n).re
                      theorem Complex.isCauSeq_im (f : CauSeq Complex.abs) :
                      IsCauSeq abs fun n => (f n).im
                      noncomputable def Complex.cauSeqRe (f : CauSeq Complex.abs) :

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

                      Equations
                      Instances For
                        noncomputable def Complex.cauSeqIm (f : CauSeq Complex.abs) :

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

                        Equations
                        Instances For
                          theorem Complex.isCauSeq_abs {f : } (hf : IsCauSeq (Complex.abs) f) :
                          noncomputable def Complex.limAux (f : CauSeq Complex.abs) :

                          The limit of a Cauchy sequence of complex numbers.

                          Equations
                          Instances For

                            The complex conjugate of a complex Cauchy sequence, as a complex Cauchy sequence.

                            Equations
                            Instances For
                              noncomputable def Complex.cauSeqAbs (f : CauSeq Complex.abs) :

                              The absolute value of a complex Cauchy sequence, as a real Cauchy sequence.

                              Equations
                              Instances For
                                @[simp]
                                theorem Complex.ofReal_prod {α : Type u_1} (s : Finset α) (f : α) :
                                ↑(Finset.prod s fun i => f i) = Finset.prod s fun i => ↑(f i)
                                @[simp]
                                theorem Complex.ofReal_sum {α : Type u_1} (s : Finset α) (f : α) :
                                ↑(Finset.sum s fun i => f i) = Finset.sum s fun i => ↑(f i)
                                @[simp]
                                theorem Complex.re_sum {α : Type u_1} (s : Finset α) (f : α) :
                                (Finset.sum s fun i => f i).re = Finset.sum s fun i => (f i).re
                                @[simp]
                                theorem Complex.im_sum {α : Type u_1} (s : Finset α) (f : α) :
                                (Finset.sum s fun i => f i).im = Finset.sum s fun i => (f i).im