Cubics and discriminants #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines cubic polynomials over a semiring and their discriminants over a splitting field.
Main definitions #
cubic
: the structure representing a cubic polynomial.cubic.disc
: the discriminant of a cubic polynomial.
Main statements #
cubic.disc_ne_zero_iff_roots_nodup
: the cubic discriminant is not equal to zero if and only if the cubic has no duplicate roots.
References #
Tags #
cubic, discriminant, polynomial, root
@[ext]
- a : R
- b : R
- c : R
- d : R
The structure representing a cubic polynomial.
Instances for cubic
- cubic.has_sizeof_inst
- cubic.inhabited
- cubic.has_zero
@[protected, instance]
Equations
- cubic.inhabited = {default := {a := inhabited.default _inst_1, b := inhabited.default _inst_1, c := inhabited.default _inst_1, d := inhabited.default _inst_1}}
Convert a cubic polynomial to a polynomial.
Equations
- P.to_poly = ⇑polynomial.C P.a * polynomial.X ^ 3 + ⇑polynomial.C P.b * polynomial.X ^ 2 + ⇑polynomial.C P.c * polynomial.X + ⇑polynomial.C P.d
Coefficients #
theorem
cubic.of_a_eq_zero
{R : Type u_1}
{P : cubic R}
[semiring R]
(ha : P.a = 0) :
P.to_poly = ⇑polynomial.C P.b * polynomial.X ^ 2 + ⇑polynomial.C P.c * polynomial.X + ⇑polynomial.C P.d
theorem
cubic.of_a_eq_zero'
{R : Type u_1}
{b c d : R}
[semiring R] :
{a := 0, b := b, c := c, d := d}.to_poly = ⇑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) :
P.to_poly = ⇑polynomial.C P.c * polynomial.X + ⇑polynomial.C P.d
theorem
cubic.of_b_eq_zero'
{R : Type u_1}
{c d : R}
[semiring R] :
{a := 0, b := 0, c := c, d := d}.to_poly = ⇑polynomial.C c * polynomial.X + ⇑polynomial.C d
Degrees #
The equivalence between cubic polynomials and polynomials of degree at most three.
@[simp]
theorem
cubic.equiv_apply_coe
{R : Type u_1}
[semiring R]
(P : cubic R) :
↑(⇑cubic.equiv P) = P.to_poly
@[simp]
theorem
cubic.nat_degree_of_a_ne_zero
{R : Type u_1}
{P : cubic R}
[semiring R]
(ha : P.a ≠ 0) :
P.to_poly.nat_degree = 3
theorem
cubic.nat_degree_of_a_eq_zero
{R : Type u_1}
{P : cubic R}
[semiring R]
(ha : P.a = 0) :
P.to_poly.nat_degree ≤ 2
@[simp]
Map across a homomorphism #
Roots over an extension #
Roots over a splitting field #
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 : (cubic.map φ P).roots = {x, y, z}) :
(cubic.map φ P).to_poly = ⇑polynomial.C (⇑φ P.a) * (polynomial.X - ⇑polynomial.C x) * (polynomial.X - ⇑polynomial.C y) * (polynomial.X - ⇑polynomial.C z)