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.

  • re :

    The real part of a complex number.

  • im :

    The imaginary part of a complex number.

Instances For

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

    Equations
    Instances For
      @[simp]

      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
          instance Complex.canLift :
          CanLift Complex.ofReal' fun (z : ) => z.im = 0
          Equations

          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.re_ofReal_mul (r : ) (z : ) :
            (r * z).re = r * z.re
            theorem Complex.im_ofReal_mul (r : ) (z : ) :
            (r * z).im = r * z.im
            theorem Complex.re_mul_ofReal (z : ) (r : ) :
            (z * r).re = z.re * r
            theorem Complex.im_mul_ofReal (z : ) (r : ) :
            (z * r).im = z.im * r
            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

              Commutative ring instance and lemmas #

              instance Complex.instSMulRealComplex {R : Type u_1} [SMul R ] :
              Equations
              • Complex.instSMulRealComplex = { smul := fun (r : 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]
                  theorem Complex.I_pow_bit1 (n : ) :
                  @[simp]
                  theorem Complex.im_ofNat (n : ) [Nat.AtLeastTwo n] :
                  (OfNat.ofNat n).im = 0
                  noncomputable instance Complex.instRatCastComplex :
                  Equations

                  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
                  • One or more equations did not get rendered due to their size.
                  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_nat_cast (n : ) :
                    Complex.normSq n = n * n
                    @[simp]
                    theorem Complex.normSq_int_cast (z : ) :
                    Complex.normSq z = z * z
                    @[simp]
                    theorem Complex.normSq_rat_cast (q : ) :
                    Complex.normSq q = q * q
                    @[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 : } :
                    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]
                      @[simp]
                      theorem Complex.I_sq :
                      @[simp]
                      @[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

                      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 : ) :
                      @[simp]
                      theorem Complex.ofReal_inv (r : ) :
                      r⁻¹ = (r)⁻¹
                      theorem Complex.mul_inv_cancel {z : } (h : z 0) :
                      z * z⁻¹ = 1

                      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.ofReal_rat_cast (q : ) :
                      q = q
                      @[simp]
                      theorem Complex.rat_cast_re (q : ) :
                      (q).re = q
                      @[simp]
                      theorem Complex.rat_cast_im (q : ) :
                      (q).im = 0
                      theorem Complex.ofReal_nsmul (n : ) (r : ) :
                      (n r) = n r
                      theorem Complex.ofReal_zsmul (n : ) (r : ) :
                      (n r) = n r

                      Field instance and lemmas #

                      noncomputable instance Complex.instField :
                      Equations
                      @[simp]
                      theorem Complex.I_zpow_bit0 (n : ) :
                      Complex.I ^ bit0 n = (-1) ^ n
                      @[simp]
                      theorem Complex.I_zpow_bit1 (n : ) :
                      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 : ) :
                      theorem Complex.div_ofReal (z : ) (x : ) :
                      z / x = { re := z.re / x, im := z.im / x }
                      theorem Complex.div_nat_cast (z : ) (n : ) :
                      z / n = { re := z.re / n, im := z.im / n }
                      theorem Complex.div_int_cast (z : ) (n : ) :
                      z / n = { re := z.re / n, im := z.im / n }
                      theorem Complex.div_rat_cast (z : ) (x : ) :
                      z / x = { re := z.re / x, im := z.im / x }
                      theorem Complex.div_ofNat (z : ) (n : ) [Nat.AtLeastTwo n] :
                      z / OfNat.ofNat n = { re := z.re / OfNat.ofNat n, im := z.im / OfNat.ofNat n }
                      @[simp]
                      theorem Complex.div_ofReal_re (z : ) (x : ) :
                      (z / x).re = z.re / x
                      @[simp]
                      theorem Complex.div_ofReal_im (z : ) (x : ) :
                      (z / x).im = z.im / x
                      @[simp]
                      theorem Complex.div_nat_cast_re (z : ) (n : ) :
                      (z / n).re = z.re / n
                      @[simp]
                      theorem Complex.div_nat_cast_im (z : ) (n : ) :
                      (z / n).im = z.im / n
                      @[simp]
                      theorem Complex.div_int_cast_re (z : ) (n : ) :
                      (z / n).re = z.re / n
                      @[simp]
                      theorem Complex.div_int_cast_im (z : ) (n : ) :
                      (z / n).im = z.im / n
                      @[simp]
                      theorem Complex.div_rat_cast_re (z : ) (x : ) :
                      (z / x).re = z.re / x
                      @[simp]
                      theorem Complex.div_rat_cast_im (z : ) (x : ) :
                      (z / x).im = z.im / x
                      @[simp]
                      theorem Complex.div_ofNat_re (z : ) (n : ) [Nat.AtLeastTwo n] :
                      (z / OfNat.ofNat n).re = z.re / OfNat.ofNat n
                      @[simp]
                      theorem Complex.div_ofNat_im (z : ) (n : ) [Nat.AtLeastTwo n] :
                      (z / OfNat.ofNat n).im = z.im / OfNat.ofNat 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.