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 < mP.coeff m = 0) (hQ : ∀ (m : ), b < mQ.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 < mP.coeff m = 0) (hQ : ∀ (m : ), b < mQ.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).