Documentation

Mathlib.Algebra.CubicDiscriminant

Cubics and discriminants #

This file defines cubic polynomials over a semiring and their discriminants over a splitting field.

Main definitions #

Main statements #

References #

Tags #

cubic, discriminant, polynomial, root

structure Cubic (R : Type u_1) :
Type u_1

The structure representing a cubic polynomial.

  • a : R

    The degree-3 coefficient

  • b : R

    The degree-2 coefficient

  • c : R

    The degree-1 coefficient

  • d : R

    The degree-0 coefficient

Instances For
    theorem Cubic.ext {R : Type u_1} {x y : Cubic R} (a : x.a = y.a) (b : x.b = y.b) (c : x.c = y.c) (d : x.d = y.d) :
    x = y
    theorem Cubic.ext_iff {R : Type u_1} {x y : Cubic R} :
    x = y x.a = y.a x.b = y.b x.c = y.c x.d = y.d
    instance Cubic.instZero {R : Type u_1} [Zero R] :
    Equations
      def Cubic.toPoly {R : Type u_1} [Semiring R] (P : Cubic R) :

      Convert a cubic polynomial to a polynomial.

      Equations
        Instances For
          theorem Cubic.C_mul_prod_X_sub_C_eq {S : Type u_2} [CommRing S] {w x y z : S} :
          Polynomial.C w * (Polynomial.X - Polynomial.C x) * (Polynomial.X - Polynomial.C y) * (Polynomial.X - Polynomial.C z) = { a := w, b := w * -(x + y + z), c := w * (x * y + x * z + y * z), d := w * -(x * y * z) }.toPoly
          theorem Cubic.prod_X_sub_C_eq {S : Type u_2} [CommRing S] {x y z : S} :
          (Polynomial.X - Polynomial.C x) * (Polynomial.X - Polynomial.C y) * (Polynomial.X - Polynomial.C z) = { a := 1, b := -(x + y + z), c := x * y + x * z + y * z, d := -(x * y * z) }.toPoly

          Coefficients #

          @[simp]
          theorem Cubic.coeff_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] {n : } (hn : 3 < n) :
          P.toPoly.coeff n = 0
          @[simp]
          theorem Cubic.coeff_eq_a {R : Type u_1} {P : Cubic R} [Semiring R] :
          P.toPoly.coeff 3 = P.a
          @[simp]
          theorem Cubic.coeff_eq_b {R : Type u_1} {P : Cubic R} [Semiring R] :
          P.toPoly.coeff 2 = P.b
          @[simp]
          theorem Cubic.coeff_eq_c {R : Type u_1} {P : Cubic R} [Semiring R] :
          P.toPoly.coeff 1 = P.c
          @[simp]
          theorem Cubic.coeff_eq_d {R : Type u_1} {P : Cubic R} [Semiring R] :
          P.toPoly.coeff 0 = P.d
          theorem Cubic.a_of_eq {R : Type u_1} {P Q : Cubic R} [Semiring R] (h : P.toPoly = Q.toPoly) :
          P.a = Q.a
          theorem Cubic.b_of_eq {R : Type u_1} {P Q : Cubic R} [Semiring R] (h : P.toPoly = Q.toPoly) :
          P.b = Q.b
          theorem Cubic.c_of_eq {R : Type u_1} {P Q : Cubic R} [Semiring R] (h : P.toPoly = Q.toPoly) :
          P.c = Q.c
          theorem Cubic.d_of_eq {R : Type u_1} {P Q : Cubic R} [Semiring R] (h : P.toPoly = Q.toPoly) :
          P.d = Q.d
          theorem Cubic.toPoly_injective {R : Type u_1} [Semiring R] (P Q : Cubic R) :
          P.toPoly = Q.toPoly P = Q
          theorem Cubic.of_a_eq_zero' {R : Type u_1} {b c d : R} [Semiring R] :
          { a := 0, b := b, c := c, d := d }.toPoly = Polynomial.C b * Polynomial.X ^ 2 + Polynomial.C c * Polynomial.X + Polynomial.C d
          theorem Cubic.of_b_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) :
          theorem Cubic.of_b_eq_zero' {R : Type u_1} {c d : R} [Semiring R] :
          { a := 0, b := 0, c := c, d := d }.toPoly = Polynomial.C c * Polynomial.X + Polynomial.C d
          theorem Cubic.of_c_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) :
          theorem Cubic.of_c_eq_zero' {R : Type u_1} {d : R} [Semiring R] :
          { a := 0, b := 0, c := 0, d := d }.toPoly = Polynomial.C d
          theorem Cubic.of_d_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) (hd : P.d = 0) :
          P.toPoly = 0
          theorem Cubic.of_d_eq_zero' {R : Type u_1} [Semiring R] :
          { a := 0, b := 0, c := 0, d := 0 }.toPoly = 0
          theorem Cubic.zero {R : Type u_1} [Semiring R] :
          toPoly 0 = 0
          theorem Cubic.toPoly_eq_zero_iff {R : Type u_1} [Semiring R] (P : Cubic R) :
          P.toPoly = 0 P = 0
          theorem Cubic.ne_zero_of_a_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a 0) :
          theorem Cubic.ne_zero_of_b_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (hb : P.b 0) :
          theorem Cubic.ne_zero_of_c_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (hc : P.c 0) :
          theorem Cubic.ne_zero_of_d_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (hd : P.d 0) :
          @[simp]
          theorem Cubic.leadingCoeff_of_a_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a 0) :
          theorem Cubic.leadingCoeff_of_a_ne_zero' {R : Type u_1} {a b c d : R} [Semiring R] (ha : a 0) :
          { a := a, b := b, c := c, d := d }.toPoly.leadingCoeff = a
          @[simp]
          theorem Cubic.leadingCoeff_of_b_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b 0) :
          theorem Cubic.leadingCoeff_of_b_ne_zero' {R : Type u_1} {b c d : R} [Semiring R] (hb : b 0) :
          { a := 0, b := b, c := c, d := d }.toPoly.leadingCoeff = b
          @[simp]
          theorem Cubic.leadingCoeff_of_c_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c 0) :
          theorem Cubic.leadingCoeff_of_c_ne_zero' {R : Type u_1} {c d : R} [Semiring R] (hc : c 0) :
          { a := 0, b := 0, c := c, d := d }.toPoly.leadingCoeff = c
          @[simp]
          theorem Cubic.leadingCoeff_of_c_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) :
          theorem Cubic.leadingCoeff_of_c_eq_zero' {R : Type u_1} {d : R} [Semiring R] :
          { a := 0, b := 0, c := 0, d := d }.toPoly.leadingCoeff = d
          theorem Cubic.monic_of_a_eq_one {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 1) :
          theorem Cubic.monic_of_a_eq_one' {R : Type u_1} {b c d : R} [Semiring R] :
          { a := 1, b := b, c := c, d := d }.toPoly.Monic
          theorem Cubic.monic_of_b_eq_one {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 1) :
          theorem Cubic.monic_of_b_eq_one' {R : Type u_1} {c d : R} [Semiring R] :
          { a := 0, b := 1, c := c, d := d }.toPoly.Monic
          theorem Cubic.monic_of_c_eq_one {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 1) :
          theorem Cubic.monic_of_c_eq_one' {R : Type u_1} {d : R} [Semiring R] :
          { a := 0, b := 0, c := 1, d := d }.toPoly.Monic
          theorem Cubic.monic_of_d_eq_one {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) (hd : P.d = 1) :
          theorem Cubic.monic_of_d_eq_one' :
          { a := 0, b := 0, c := 0, d := 1 }.toPoly.Monic

          Degrees #

          def Cubic.equiv {R : Type u_1} [Semiring R] :

          The equivalence between cubic polynomials and polynomials of degree at most three.

          Equations
            Instances For
              @[simp]
              theorem Cubic.equiv_symm_apply_b {R : Type u_1} [Semiring R] (f : { p : Polynomial R // p.degree 3 }) :
              (equiv.symm f).b = (↑f).coeff 2
              @[simp]
              theorem Cubic.equiv_symm_apply_d {R : Type u_1} [Semiring R] (f : { p : Polynomial R // p.degree 3 }) :
              (equiv.symm f).d = (↑f).coeff 0
              @[simp]
              theorem Cubic.equiv_apply_coe {R : Type u_1} [Semiring R] (P : Cubic R) :
              (equiv P) = P.toPoly
              @[simp]
              theorem Cubic.equiv_symm_apply_c {R : Type u_1} [Semiring R] (f : { p : Polynomial R // p.degree 3 }) :
              (equiv.symm f).c = (↑f).coeff 1
              @[simp]
              theorem Cubic.equiv_symm_apply_a {R : Type u_1} [Semiring R] (f : { p : Polynomial R // p.degree 3 }) :
              (equiv.symm f).a = (↑f).coeff 3
              @[simp]
              theorem Cubic.degree_of_a_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a 0) :
              theorem Cubic.degree_of_a_ne_zero' {R : Type u_1} {a b c d : R} [Semiring R] (ha : a 0) :
              { a := a, b := b, c := c, d := d }.toPoly.degree = 3
              theorem Cubic.degree_of_a_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) :
              theorem Cubic.degree_of_a_eq_zero' {R : Type u_1} {b c d : R} [Semiring R] :
              { a := 0, b := b, c := c, d := d }.toPoly.degree 2
              @[simp]
              theorem Cubic.degree_of_b_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b 0) :
              theorem Cubic.degree_of_b_ne_zero' {R : Type u_1} {b c d : R} [Semiring R] (hb : b 0) :
              { a := 0, b := b, c := c, d := d }.toPoly.degree = 2
              theorem Cubic.degree_of_b_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) :
              theorem Cubic.degree_of_b_eq_zero' {R : Type u_1} {c d : R} [Semiring R] :
              { a := 0, b := 0, c := c, d := d }.toPoly.degree 1
              @[simp]
              theorem Cubic.degree_of_c_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c 0) :
              theorem Cubic.degree_of_c_ne_zero' {R : Type u_1} {c d : R} [Semiring R] (hc : c 0) :
              { a := 0, b := 0, c := c, d := d }.toPoly.degree = 1
              theorem Cubic.degree_of_c_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) :
              theorem Cubic.degree_of_c_eq_zero' {R : Type u_1} {d : R} [Semiring R] :
              { a := 0, b := 0, c := 0, d := d }.toPoly.degree 0
              @[simp]
              theorem Cubic.degree_of_d_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) (hd : P.d 0) :
              theorem Cubic.degree_of_d_ne_zero' {R : Type u_1} {d : R} [Semiring R] (hd : d 0) :
              { a := 0, b := 0, c := 0, d := d }.toPoly.degree = 0
              @[simp]
              theorem Cubic.degree_of_d_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) (hd : P.d = 0) :
              theorem Cubic.degree_of_d_eq_zero' {R : Type u_1} [Semiring R] :
              { a := 0, b := 0, c := 0, d := 0 }.toPoly.degree =
              @[simp]
              theorem Cubic.natDegree_of_a_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a 0) :
              theorem Cubic.natDegree_of_a_ne_zero' {R : Type u_1} {a b c d : R} [Semiring R] (ha : a 0) :
              { a := a, b := b, c := c, d := d }.toPoly.natDegree = 3
              theorem Cubic.natDegree_of_a_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) :
              theorem Cubic.natDegree_of_a_eq_zero' {R : Type u_1} {b c d : R} [Semiring R] :
              { a := 0, b := b, c := c, d := d }.toPoly.natDegree 2
              @[simp]
              theorem Cubic.natDegree_of_b_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b 0) :
              theorem Cubic.natDegree_of_b_ne_zero' {R : Type u_1} {b c d : R} [Semiring R] (hb : b 0) :
              { a := 0, b := b, c := c, d := d }.toPoly.natDegree = 2
              theorem Cubic.natDegree_of_b_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) :
              theorem Cubic.natDegree_of_b_eq_zero' {R : Type u_1} {c d : R} [Semiring R] :
              { a := 0, b := 0, c := c, d := d }.toPoly.natDegree 1
              @[simp]
              theorem Cubic.natDegree_of_c_ne_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c 0) :
              theorem Cubic.natDegree_of_c_ne_zero' {R : Type u_1} {c d : R} [Semiring R] (hc : c 0) :
              { a := 0, b := 0, c := c, d := d }.toPoly.natDegree = 1
              @[simp]
              theorem Cubic.natDegree_of_c_eq_zero {R : Type u_1} {P : Cubic R} [Semiring R] (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) :
              theorem Cubic.natDegree_of_c_eq_zero' {R : Type u_1} {d : R} [Semiring R] :
              { a := 0, b := 0, c := 0, d := d }.toPoly.natDegree = 0

              Map across a homomorphism #

              def Cubic.map {R : Type u_1} {S : Type u_2} [Semiring R] [Semiring S] (φ : R →+* S) (P : Cubic R) :

              Map a cubic polynomial across a semiring homomorphism.

              Equations
                Instances For
                  theorem Cubic.map_toPoly {R : Type u_1} {S : Type u_2} {P : Cubic R} [Semiring R] [Semiring S] {φ : R →+* S} :

                  Roots over an extension #

                  def Cubic.roots {R : Type u_1} [CommRing R] [IsDomain R] (P : Cubic R) :

                  The roots of a cubic polynomial.

                  Equations
                    Instances For
                      theorem Cubic.map_roots {R : Type u_1} {S : Type u_2} {P : Cubic R} [CommRing R] [CommRing S] {φ : R →+* S} [IsDomain S] :
                      theorem Cubic.mem_roots_iff {R : Type u_1} {P : Cubic R} [CommRing R] [IsDomain R] (h0 : P.toPoly 0) (x : R) :
                      x P.roots P.a * x ^ 3 + P.b * x ^ 2 + P.c * x + P.d = 0

                      Roots over a splitting field #

                      theorem Cubic.splits_iff_card_roots {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} (ha : P.a 0) :
                      theorem Cubic.splits_iff_roots_eq_three {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} (ha : P.a 0) :
                      (Polynomial.map φ P.toPoly).Splits ∃ (x : K) (y : K) (z : K), (map φ P).roots = {x, y, z}
                      theorem Cubic.eq_prod_three_roots {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} {x y z : K} (ha : P.a 0) (h3 : (map φ P).roots = {x, y, z}) :
                      theorem Cubic.eq_sum_three_roots {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} {x y z : K} (ha : P.a 0) (h3 : (map φ P).roots = {x, y, z}) :
                      map φ P = { a := φ P.a, b := φ P.a * -(x + y + z), c := φ P.a * (x * y + x * z + y * z), d := φ P.a * -(x * y * z) }
                      theorem Cubic.b_eq_three_roots {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} {x y z : K} (ha : P.a 0) (h3 : (map φ P).roots = {x, y, z}) :
                      φ P.b = φ P.a * -(x + y + z)
                      theorem Cubic.c_eq_three_roots {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} {x y z : K} (ha : P.a 0) (h3 : (map φ P).roots = {x, y, z}) :
                      φ P.c = φ P.a * (x * y + x * z + y * z)
                      theorem Cubic.d_eq_three_roots {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} {x y z : K} (ha : P.a 0) (h3 : (map φ P).roots = {x, y, z}) :
                      φ P.d = φ P.a * -(x * y * z)

                      Discriminant over a splitting field #

                      def Cubic.discr {R : Type u_5} [Ring R] (P : Cubic R) :
                      R

                      The discriminant of a cubic polynomial.

                      Equations
                        Instances For
                          theorem Cubic.discr_eq_prod_three_roots {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} {x y z : K} (ha : P.a 0) (h3 : (map φ P).roots = {x, y, z}) :
                          φ P.discr = (φ P.a * φ P.a * (x - y) * (x - z) * (y - z)) ^ 2
                          theorem Cubic.discr_ne_zero_iff_roots_ne {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} {x y z : K} (ha : P.a 0) (h3 : (map φ P).roots = {x, y, z}) :
                          P.discr 0 x y x z y z
                          theorem Cubic.discr_ne_zero_iff_roots_nodup {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} (ha : P.a 0) (hP : (Polynomial.map φ P.toPoly).Splits) :
                          P.discr 0 (map φ P).roots.Nodup
                          theorem Cubic.card_roots_of_discr_ne_zero {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} [DecidableEq K] (ha : P.a 0) (h3 : (Polynomial.map φ P.toPoly).Splits) (hd : P.discr 0) :
                          @[deprecated Cubic.discr (since := "2025-10-20")]
                          def Cubic.disc {R : Type u_5} [Ring R] (P : Cubic R) :
                          R

                          Alias of Cubic.discr.


                          The discriminant of a cubic polynomial.

                          Equations
                            Instances For
                              @[deprecated Cubic.discr_eq_prod_three_roots (since := "2025-10-20")]
                              theorem Cubic.disc_eq_prod_three_roots {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} {x y z : K} (ha : P.a 0) (h3 : (map φ P).roots = {x, y, z}) :
                              φ P.discr = (φ P.a * φ P.a * (x - y) * (x - z) * (y - z)) ^ 2

                              Alias of Cubic.discr_eq_prod_three_roots.

                              @[deprecated Cubic.discr_ne_zero_iff_roots_ne (since := "2025-10-20")]
                              theorem Cubic.disc_ne_zero_iff_roots_ne {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} {x y z : K} (ha : P.a 0) (h3 : (map φ P).roots = {x, y, z}) :
                              P.discr 0 x y x z y z

                              Alias of Cubic.discr_ne_zero_iff_roots_ne.

                              @[deprecated Cubic.discr_ne_zero_iff_roots_nodup (since := "2025-10-20")]
                              theorem Cubic.disc_ne_zero_iff_roots_nodup {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} (ha : P.a 0) (hP : (Polynomial.map φ P.toPoly).Splits) :
                              P.discr 0 (map φ P).roots.Nodup

                              Alias of Cubic.discr_ne_zero_iff_roots_nodup.

                              @[deprecated Cubic.card_roots_of_discr_ne_zero (since := "2025-10-20")]
                              theorem Cubic.card_roots_of_disc_ne_zero {F : Type u_3} {K : Type u_4} {P : Cubic F} [Field F] [Field K] {φ : F →+* K} [DecidableEq K] (ha : P.a 0) (h3 : (Polynomial.map φ P.toPoly).Splits) (hd : P.discr 0) :

                              Alias of Cubic.card_roots_of_discr_ne_zero.