Documentation

LeanPool.LeanQuantumAlg.Util.Polynomial

Polynomial helper lemmas (quantum-free) #

Generic ℂ[X] lemmas used by the QSP development, factored out so they carry no dependency on the quantum framework:

These are upstream candidates for Mathlib; nothing here mentions Gate/PureState.

Coefficient-conjugate polynomials #

noncomputable def QuantumAlg.conjP (P : Polynomial ℂ) :

conjP P conjugates every coefficient of P : ℂ[X]; this is the P* of the QSP literature (for real x, (conjP P).eval x = conj (P.eval x)).

Equations
Instances For
    @[simp]
    @[simp]
    @[simp]
    theorem QuantumAlg.conjP_pow (P : Polynomial ℂ) (n : ℕ) :
    conjP (P ^ n) = conjP P ^ n

    Evaluating the coefficient-conjugate at a real point conjugates the value.

    Parity of polynomials #

    HasParity P p says every nonzero coefficient of P sits in a degree congruent to p modulo 2 ("P has parity p mod 2" in [Lin22, hermfunc.tex:1132]). The zero polynomial has every parity.

    All nonzero coefficients of P are in degrees ≡ p (mod 2).

    Equations
    Instances For
      theorem QuantumAlg.HasParity.coeff_eq_zero {P : Polynomial ℂ} {p : ℕ} (h : HasParity P p) {k : ℕ} (hk : k % 2 ≠ p % 2) :
      P.coeff k = 0
      theorem QuantumAlg.hasParity_C (c : ℂ) {p : ℕ} (hp : p % 2 = 0) :
      theorem QuantumAlg.HasParity.add {P Q : Polynomial ℂ} {p : ℕ} (hP : HasParity P p) (hQ : HasParity Q p) :
      HasParity (P + Q) p
      theorem QuantumAlg.HasParity.sub {P Q : Polynomial ℂ} {p : ℕ} (hP : HasParity P p) (hQ : HasParity Q p) :
      HasParity (P - Q) p
      theorem QuantumAlg.HasParity.congr {P : Polynomial ℂ} {p q : ℕ} (hP : HasParity P p) (hpq : p % 2 = q % 2) :

      Parity only depends on p modulo 2.

      theorem QuantumAlg.coeff_X_mul' (P : Polynomial ℂ) (n : ℕ) :
      (Polynomial.X * P).coeff n = if n = 0 then 0 else P.coeff (n - 1)

      Total coefficient formula for X * P.

      theorem QuantumAlg.coeff_X_sq_mul (P : Polynomial ℂ) (n : ℕ) :
      (Polynomial.X ^ 2 * P).coeff n = if n < 2 then 0 else P.coeff (n - 2)

      Total coefficient formula for X^2 * P.

      Bounded product coefficients #

      theorem QuantumAlg.coeff_mul_at_bound_add {P Q : Polynomial ℂ} {a b n : ℕ} (hn : n = a + b) (hP : ∀ (m : ℕ), a < m → P.coeff m = 0) (hQ : ∀ (m : ℕ), b < m → Q.coeff m = 0) :
      (P * Q).coeff n = P.coeff a * Q.coeff b

      Product coefficient at the sum of two coefficient bounds: only the top-times-top term survives.

      theorem QuantumAlg.coeff_mul_eq_zero_of_bound_add {P Q : Polynomial ℂ} {a b n : ℕ} (hn : a + b < n) (hP : ∀ (m : ℕ), a < m → P.coeff m = 0) (hQ : ∀ (m : ℕ), b < m → Q.coeff m = 0) :
      (P * Q).coeff n = 0

      Product coefficient above the sum of two coefficient bounds vanishes.

      Reflection of coefficients #

      theorem QuantumAlg.coeff_reflect_of_le {F : Polynomial ℂ} {N m : ℕ} (hm : m ≤ N) :
      (Polynomial.reflect N F).coeff m = F.coeff (N - m)
      theorem QuantumAlg.coeff_reflect_eq_zero {F : Polynomial ℂ} {N m : ℕ} (hF : F.natDegree ≤ N) (hm : N < m) :

      reflect (L+1) F = X · reflect L F for natDegree F ≤ L.

      reflect (L+1) (X·F) = reflect L F for natDegree F ≤ L.

      theorem QuantumAlg.eval_reflect {F : Polynomial ℂ} {L : ℕ} (hF : F.natDegree ≤ L) {z : ℂ} (hz : z ≠ 0) :

      Evaluation of a reflection: (reflect L F)(z) = z^L · F(z⁻¹).

      Evaluation on the unit circle #

      Two polynomials agreeing on the unit circle are equal (the circle is an infinite evaluation set).