Documentation

Mathlib.Algebra.Polynomial.Homogenize

Homogenize a univariate polynomial #

In this file we define a function Polynomial.homogenize p n that takes a polynomial p and a natural number n and returns a homogeneous bivariate polynomial of degree n.

If n is at least the degree of p, then (homogenize p n).eval ![x, 1] = p.eval x.

We use MvPolynomial (Fin 2) R to represent bivariate polynomials instead of R[X][Y] (i.e., Polynomial (Polynomial R)), because Mathlib has a theory about homogeneous multivariate polynomials, but not about homogeneous bivariate polynomials encoded as R[X][Y].

noncomputable def Polynomial.homogenize {R : Type u_1} [CommSemiring R] (p : Polynomial R) (n : β„•) :
MvPolynomial (Fin 2) R

Given a polynomial p and a number n β‰₯ natDegree p, returns a homogeneous bivariate polynomial q of degree n such that q(x, 1) = p(x).

It is defined as βˆ‘ k + l = n, a_k X_0^k X_1^l, where a_k is the kth coefficient of p.

Instances For
    @[simp]
    theorem Polynomial.homogenize_zero {R : Type u_1} [CommSemiring R] (n : β„•) :
    homogenize 0 n = 0
    @[simp]
    theorem Polynomial.homogenize_add {R : Type u_1} [CommSemiring R] (p q : Polynomial R) (n : β„•) :
    (p + q).homogenize n = p.homogenize n + q.homogenize n
    @[simp]
    theorem Polynomial.homogenize_smul {R : Type u_1} [CommSemiring R] {S : Type u_2} [Semiring S] [Module S R] (c : S) (p : Polynomial R) (n : β„•) :
    (c β€’ p).homogenize n = c β€’ p.homogenize n
    noncomputable def Polynomial.homogenizeLM {R : Type u_1} [CommSemiring R] (n : β„•) :

    homogenize as a bundled linear map.

    Instances For
      @[simp]
      theorem Polynomial.homogenizeLM_apply {R : Type u_1} [CommSemiring R] (n : β„•) (p : Polynomial R) :
      @[simp]
      theorem Polynomial.homogenize_finsetSum {R : Type u_1} [CommSemiring R] {ΞΉ : Type u_2} (s : Finset ΞΉ) (p : ΞΉ β†’ Polynomial R) (n : β„•) :
      (βˆ‘ i ∈ s, p i).homogenize n = βˆ‘ i ∈ s, (p i).homogenize n
      theorem Polynomial.homogenize_map {R : Type u_1} [CommSemiring R] {S : Type u_2} [CommSemiring S] (f : R β†’+* S) (p : Polynomial R) (n : β„•) :
      @[simp]
      theorem Polynomial.homogenize_C_mul {R : Type u_1} [CommSemiring R] (c : R) (p : Polynomial R) (n : β„•) :
      @[simp]
      theorem Polynomial.homogenize_monomial {R : Type u_1} [CommSemiring R] {m n : β„•} (h : m ≀ n) (r : R) :
      theorem Polynomial.homogenize_monomial_of_lt {R : Type u_1} [CommSemiring R] {m n : β„•} (h : n < m) (r : R) :
      ((monomial m) r).homogenize n = 0
      @[simp]
      theorem Polynomial.homogenize_X_pow {R : Type u_1} [CommSemiring R] {m n : β„•} (h : m ≀ n) :
      (X ^ m).homogenize n = MvPolynomial.X 0 ^ m * MvPolynomial.X 1 ^ (n - m)
      @[simp]
      theorem Polynomial.homogenize_X {R : Type u_1} [CommSemiring R] {n : β„•} (hn : n β‰  0) :
      @[simp]
      theorem Polynomial.homogenize_C {R : Type u_1} [CommSemiring R] (c : R) (n : β„•) :
      @[simp]
      theorem Polynomial.homogenize_one {R : Type u_1} [CommSemiring R] (n : β„•) :
      theorem Polynomial.coeff_homogenize {R : Type u_1} [CommSemiring R] (p : Polynomial R) (n : β„•) (m : Fin 2 β†’β‚€ β„•) :
      MvPolynomial.coeff m (p.homogenize n) = if m 0 + m 1 = n then p.coeff (m 0) else 0
      theorem Polynomial.eq_zero_of_homogenize_eq_zero {R : Type u_1} [CommSemiring R] {p : Polynomial R} {n : β„•} (hn : p.natDegree ≀ n) (h : p.homogenize n = 0) :
      p = 0
      theorem Polynomial.homogenize_eq_zero_iff {R : Type u_1} [CommSemiring R] {p : Polynomial R} {n : β„•} (hn : p.natDegree ≀ n) :
      p.homogenize n = 0 ↔ p = 0
      theorem Polynomial.evalβ‚‚_homogenize_of_eq_one {R : Type u_1} [CommSemiring R] {S : Type u_2} [CommSemiring S] {p : Polynomial R} {n : β„•} (hn : p.natDegree ≀ n) (f : R β†’+* S) (g : Fin 2 β†’ S) (hg : g 1 = 1) :
      theorem Polynomial.aeval_homogenize_of_eq_one {R : Type u_1} [CommSemiring R] {A : Type u_2} [CommSemiring A] [Algebra R A] {p : Polynomial R} {n : β„•} (hn : p.natDegree ≀ n) (g : Fin 2 β†’ A) (hg : g 1 = 1) :
      (MvPolynomial.aeval g) (p.homogenize n) = (aeval (g 0)) p
      @[simp]
      theorem Polynomial.aeval_homogenize_X_one {R : Type u_1} [CommSemiring R] (p : Polynomial R) {n : β„•} (hn : p.natDegree ≀ n) :

      If deg p ≀ n, then homogenize p n (x, 1) = p x.

      theorem Polynomial.homogenize_eq_of_isHomogeneous {R : Type u_1} [CommSemiring R] {p : Polynomial R} {n : β„•} {q : MvPolynomial (Fin 2) R} (hq : q.IsHomogeneous n) (hpq : (MvPolynomial.aeval ![X, 1]) q = p) :
      p.homogenize n = q
      theorem Polynomial.homogenize_mul {R : Type u_1} [CommSemiring R] (p q : Polynomial R) {m n : β„•} (hm : p.natDegree ≀ m) (hn : q.natDegree ≀ n) :
      (p * q).homogenize (m + n) = p.homogenize m * q.homogenize n
      theorem Polynomial.homogenize_finsetProd {R : Type u_1} [CommSemiring R] {ΞΉ : Type u_2} {s : Finset ΞΉ} {p : ΞΉ β†’ Polynomial R} {n : ΞΉ β†’ β„•} (h : βˆ€ i ∈ s, (p i).natDegree ≀ n i) :
      (∏ i ∈ s, p i).homogenize (βˆ‘ i ∈ s, n i) = ∏ i ∈ s, (p i).homogenize (n i)
      @[simp]
      theorem Polynomial.homogenize_neg {R : Type u_1} [CommRing R] (p : Polynomial R) (n : β„•) :
      @[simp]
      theorem Polynomial.homogenize_sub {R : Type u_1} [CommRing R] (p q : Polynomial R) (n : β„•) :
      (p - q).homogenize n = p.homogenize n - q.homogenize n
      theorem Polynomial.eval_homogenize {K : Type u_1} [Semifield K] {p : Polynomial K} {n : β„•} (hn : p.natDegree ≀ n) (x : Fin 2 β†’ K) (hx : x 1 β‰  0) :
      (MvPolynomial.eval x) (p.homogenize n) = eval (x 0 / x 1) p * x 1 ^ n
      noncomputable def Polynomial.toTupleMvPolynomial {R : Type u_1} [CommSemiring R] (p : Polynomial R) :
      Fin 2 β†’ MvPolynomial (Fin 2) R

      Given a polynomial p : R[X], this is the vector ![pβ‚€, p₁] of homogeneous bivariate polynomials of degree p.natDegree such that p(x) = pβ‚€(x,1)/p₁(x,1) and p₁ is a monomial.

      Instances For
        theorem Polynomial.finsuppSum_homogenize_eq {R : Type u_1} [CommSemiring R] {M : Type u_2} [AddCommMonoid M] (p : Polynomial R) {f : R β†’ M} :
        (Finsupp.sum (p.homogenize p.natDegree) fun (x : Fin 2 β†’β‚€ β„•) (c : R) => f c) = p.sum fun (x : β„•) (c : R) => f c

        Summing a function over the coefficients of the homogenization of a polynomial p (of degree p.natDegree) gives the same result as summing over the coefficients of p.