Documentation

CslibFrontier.Foundations.Data.Code.SudanInterpolant

Sudan interpolants, weighted degree, and elimination #

Let w : ι → F be a received word and let α be distinct evaluation points. Sudan's list decoder [Sud97], [GRS19] for polynomials P of degree at most d needs a nonzero bivariate polynomial Q(X, Y) of (1, d)-weighted degree at most D (Cslib.Code.Sudan.WeightedDegreeLE), that is with a + d * b ≤ D for each of its monomials X ^ a * Y ^ b, vanishing at the n points (α i, w i) (Cslib.Code.Sudan.IsInterpolant). Such a Q is a nonzero solution of n linear equations in its coefficients, so it exists as soon as there are more than n monomials of (1, d)-weighted degree at most D (Cslib.Code.Sudan.exists_isInterpolant); for d ≥ 1 there are at least (D + 1) * (D + 2) / (2 * d) of them (Cslib.Code.Sudan.add_one_mul_add_two_le_two_mul_mul_card_monomials). If P has degree at most d, then Q(X, P(X)) has degree at most D (Cslib.Code.Sudan.WeightedDegreeLE.natDegree_eval_le) and vanishes at every point where P agrees with w; when there are more than D of them it is zero, so Y - P(X) divides Q(X, Y) (Cslib.Code.Sudan.IsInterpolant.X_sub_C_dvd): P is a root of Q viewed as a polynomial in Y over F[X].

More generally, for any finite system of homogeneous linear constraints entry : κ → ℕ × ℕ → F on the monomials of (1, d)-weighted degree at most D, this module computes an explicit solution of least Y-degree by Gaussian elimination (Cslib.LinearAlgebra.kernelVec): for j = 0, 1, …, D / d it finds a kernel vector of the constraint matrix restricted to the monomials of Y-degree at most j (Cslib.Code.Sudan.minDegKernelVecUpTo) and selects the first nonzero one (Cslib.Code.Sudan.minDegPoly), returning 0 if every kernel vector vanishes. When d ≥ 1 and a nonzero bounded-weighted-degree solution exists, minDegPoly is a nonzero solution (Cslib.Code.Sudan.minDegPoly_spec) of minimum Y-degree (Cslib.Code.Sudan.natDegree_minDegPoly_le). Specializing to point evaluations yields Sudan's explicit least-Y-degree interpolant (Cslib.Code.Sudan.interpolant, Cslib.Code.Sudan.isInterpolant_interpolant, Cslib.Code.Sudan.natDegree_interpolant_le); CslibFrontier.Foundations.Data.Code.GuruswamiSudan instantiates the same machinery for multiplicity-m shifted-coefficient constraints.

Least Y-degree makes every polynomial P of degree at most d with more than D agreements a simple root of Q, viewed as a polynomial in Y: if (Y - P)² divided Q, then Q / (Y - P) would be an interpolant of smaller Y-degree. On division by Y - P the bound D on the weighted degree drops to D - d (Cslib.Code.Sudan.add_mul_add_one_le_of_mul, derived from Polynomial.Bivariate.weightedDegree_mul and Polynomial.Bivariate.weightedDegree_X_sub_C), so Q = (Y - P) * S where S(X, P(X)) is a nonzero polynomial of degree at most D - d (Cslib.Code.Sudan.exists_eq_mul_eval_ne_zero). Simplicity is what lets the root P be lifted from a single known value by Newton iteration (Cslib.Code.henselValue_eq).

Main definitions #

Main results #

References #

Monomials and weighted degree #

The exponents (a, b) with a, b ≤ D of the monomials X ^ a * Y ^ b of (1, d)-weighted degree a + d * b at most D. For d ≥ 1 the bound b ≤ D holds for all of them.

theorem Cslib.Code.Sudan.mem_monomials {d D : ℕ} {ab : ℕ × ℕ} :
ab ∈ monomials d D ↔ ab.1 ≤ D ∧ ab.2 ≤ D ∧ ab.1 + d * ab.2 ≤ D

(a, b) is in monomials d D exactly when a ≤ D, b ≤ D and a + d * b ≤ D.

theorem Cslib.Code.Sudan.add_one_mul_add_two_le_two_mul_mul_card_monomials {w : ℕ} (hw : 1 ≤ w) (D : ℕ) :
(D + 1) * (D + 2) ≤ 2 * w * (monomials w D).card

Counting monomials. For w ≥ 1 there are at least (D + 1) * (D + 2) / (2 * w) monomials of (1, w)-weighted degree at most D: for each j ≤ D there are j / w + 1 ≥ (j + 1) / w of weighted degree exactly j.

Q has (1, d)-weighted degree at most D: every nonzero coefficient Q_{a,b} X ^ a Y ^ b has a + d * b ≤ D.

@[simp]

The zero polynomial has (1, d)-weighted degree at most D.

theorem Cslib.Code.Sudan.WeightedDegreeLE.mono {F : Type u_1} [Field F] {d D D' : ℕ} {Q : Polynomial (Polynomial F)} (hQ : WeightedDegreeLE d D Q) (hD : D ≤ D') :

Monotonicity of (1, d)-weighted degree in the bound D.

theorem Cslib.Code.Sudan.WeightedDegreeLE.of_dvd {F : Type u_1} [Field F] {d D : ℕ} {Q S : Polynomial (Polynomial F)} (hQ0 : Q ≠ 0) (hQ : WeightedDegreeLE d D Q) (hdvd : S ∣ Q) :

If Q ≠ 0 has (1, d)-weighted degree at most D and S ∣ Q, then S also has (1, d)-weighted degree at most D.

If Q has (1, d)-weighted degree at most D, its Y-degree satisfies deg_Y Q * d ≤ D.

theorem Polynomial.eval_eval_eq_evalEval {R : Type u_3} [CommSemiring R] (Q : Polynomial (Polynomial R)) (P : Polynomial R) (x : R) :
eval x (eval P Q) = evalEval x (eval x P) Q

Evaluating Q(X, P(X)) at x evaluates Q at (x, P(x)).

Substituting Y = P(X), with P of degree at most d, into a bivariate polynomial of (1, d)-weighted degree at most E gives a polynomial of degree at most E.

Bivariate polynomials from coefficients #

noncomputable def Cslib.Code.Sudan.bivariateOf {F : Type u_1} [Field F] (M : Finset (ℕ × ℕ)) (c : ℕ × ℕ → F) :

The bivariate polynomial with coefficient c m at X ^ m.1 * Y ^ m.2 for m ∈ M.

@[simp]
theorem Cslib.Code.Sudan.coeff_coeff_bivariateOf {F : Type u_1} [Field F] (M : Finset (ℕ × ℕ)) (c : ℕ × ℕ → F) (a b : ℕ) :
((bivariateOf M c).coeff b).coeff a = if (a, b) ∈ M then c (a, b) else 0

The coefficient of X ^ a * Y ^ b in bivariateOf M c is c (a, b) when (a, b) ∈ M, and zero otherwise.

theorem Cslib.Code.Sudan.evalEval_bivariateOf {F : Type u_1} [Field F] (M : Finset (ℕ × ℕ)) (c : ℕ × ℕ → F) (x y : F) :
Polynomial.evalEval x y (bivariateOf M c) = ∑ m ∈ M, c m * x ^ m.1 * y ^ m.2

The value of bivariateOf M c at (x, y) is ∑ m ∈ M, c m * x ^ m.1 * y ^ m.2.

theorem Cslib.Code.Sudan.bivariateOf_congr {F : Type u_1} [Field F] {M : Finset (ℕ × ℕ)} {c c' : ℕ × ℕ → F} (h : ∀ m ∈ M, c m = c' m) :

bivariateOf M c depends only on the values of c on M.

theorem Cslib.Code.Sudan.eq_bivariateOf {F : Type u_1} [Field F] {Q : Polynomial (Polynomial F)} {M : Finset (ℕ × ℕ)} (h : ∀ (a b : ℕ), (Q.coeff b).coeff a ≠ 0 → (a, b) ∈ M) :
Q = bivariateOf M fun (m : ℕ × ℕ) => (Q.coeff m.2).coeff m.1

A bivariate polynomial whose monomials lie in M is bivariateOf M of its coefficients.

theorem Cslib.Code.Sudan.weightedDegreeLE_bivariateOf {F : Type u_1} [Field F] {M : Finset (ℕ × ℕ)} {d D : ℕ} (hM : M ⊆ monomials d D) (c : ℕ × ℕ → F) :

bivariateOf M c has (1, d)-weighted degree at most D when M ⊆ monomials d D.

The monomials of (1, d)-weighted degree at most D and Y-degree at most j.

noncomputable def Cslib.Code.Sudan.coeffsOf {F : Type u_1} [Field F] (M : Finset (ℕ × ℕ)) (u : Fin M.card → F) (m : ℕ × ℕ) :
F

The coefficients on M given by a vector indexed by the enumeration of M, and zero elsewhere.

Generic linear-constraint interpolation of least Y-degree #

@[reducible, inline]
noncomputable abbrev Cslib.Code.Sudan.monomialMatrix {F : Type u_1} {κ : Type u_3} [Fintype κ] (entry : κ → ℕ × ℕ → F) (M : Finset (ℕ × ℕ)) :
Fin (Fintype.card κ) → Fin M.card → F

The linear-constraint matrix for a family of row functionals entry : κ → ℕ × ℕ → F on a monomial set M: rows index constraints k : κ (enumerated by Fintype.equivFin κ), columns index monomials m ∈ M (enumerated by M.equivFin), and entry (t, col) is entry k m.

theorem Cslib.Code.Sudan.monomialMatrix_dotProduct {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] (entry : κ → ℕ × ℕ → F) (M : Finset (ℕ × ℕ)) (u : Fin M.card → F) (k : κ) :
monomialMatrix entry M ((Fintype.equivFin κ) k) ⬝ᵥ u = ∑ m ∈ M, coeffsOf M u m * entry k m

The dot product of row k of monomialMatrix entry M with u equals ∑ m ∈ M, coeffsOf M u m * entry k m.

theorem Cslib.Code.Sudan.exists_weightedDegreeLE_eq_zero {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] (entry : κ → ℕ × ℕ → F) (L : κ → Polynomial (Polynomial F) → F) (hL : ∀ (M : Finset (ℕ × ℕ)) (c : ℕ × ℕ → F) (k : κ), L k (bivariateOf M c) = ∑ m ∈ M, c m * entry k m) {d D : ℕ} (hn : Fintype.card κ < (monomials d D).card) :
∃ (Q : Polynomial (Polynomial F)), Q ≠ 0 ∧ WeightedDegreeLE d D Q ∧ ∀ (k : κ), L k Q = 0

Existence of a nonzero bounded-weighted-degree solution. Whenever |κ| < #(monomials d D) and the homogeneous linear functionals L : κ → F[X][Y] → F act on bivariateOf via entry : κ → ℕ × ℕ → F, there exists a nonzero polynomial Q of (1, d)-weighted degree at most D satisfying L k Q = 0 for all k.

@[reducible, inline]
noncomputable abbrev Cslib.Code.Sudan.minDegKernelVecUpTo {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] [DecidableEq F] (entry : κ → ℕ × ℕ → F) (d D j : ℕ) :
Fin (monomialsUpTo d D j).card → F

The kernel vector of monomialMatrix entry on the monomials of (1, d)-weighted degree at most D and Y-degree at most j.

@[reducible, inline]
noncomputable abbrev Cslib.Code.Sudan.minDegCoeffs {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] [DecidableEq F] (entry : κ → ℕ × ℕ → F) (d D : ℕ) :
ℕ × ℕ → F

The coefficients of the least-Y-degree solution for entry: those of the first nonzero kernel vector among j = 0, 1, …, D / d, or zero if every kernel vector vanishes.

noncomputable def Cslib.Code.Sudan.minDegPoly {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] [DecidableEq F] (entry : κ → ℕ × ℕ → F) (d D : ℕ) :

Least-Y-degree elimination polynomial for a linear constraint family entry on monomials d D: reconstructs the bivariate polynomial from the first nonzero kernel vector among Y-degree bounds j = 0, 1, …, D / d, and returns 0 if every kernel vector vanishes.

theorem Cslib.Code.Sudan.weightedDegreeLE_minDegPoly {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] [DecidableEq F] (entry : κ → ℕ × ℕ → F) (d D : ℕ) :

minDegPoly always has (1, d)-weighted degree at most D.

theorem Cslib.Code.Sudan.natDegree_minDegPoly_le_bound {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] [DecidableEq F] (entry : κ → ℕ × ℕ → F) (d D : ℕ) :
(minDegPoly entry d D).natDegree ≤ D

minDegPoly always has Y-degree at most D (for all d, including d = 0).

theorem Cslib.Code.Sudan.minDegPoly_eq_zero_of_forall_eq_zero {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] [DecidableEq F] (entry : κ → ℕ × ℕ → F) (d D : ℕ) (h0 : ∀ (j : Fin (D / d + 1)), minDegKernelVecUpTo entry d D ↑j = 0) :
minDegPoly entry d D = 0

If every bounded-Y-degree kernel vector vanishes, minDegPoly is the zero polynomial.

theorem Cslib.Code.Sudan.apply_minDegPoly_eq_zero {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] [DecidableEq F] (entry : κ → ℕ × ℕ → F) (L : κ → Polynomial (Polynomial F) → F) (hL : ∀ (M : Finset (ℕ × ℕ)) (c : ℕ × ℕ → F) (k : κ), L k (bivariateOf M c) = ∑ m ∈ M, c m * entry k m) (d D : ℕ) (k : κ) :
L k (minDegPoly entry d D) = 0

minDegPoly always satisfies every linear constraint L k _ = 0 (for all d, D, including when minDegPoly = 0 or d = 0).

theorem Cslib.Code.Sudan.minDegPoly_spec {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] [DecidableEq F] (entry : κ → ℕ × ℕ → F) (L : κ → Polynomial (Polynomial F) → F) (hL : ∀ (M : Finset (ℕ × ℕ)) (c : ℕ × ℕ → F) (k : κ), L k (bivariateOf M c) = ∑ m ∈ M, c m * entry k m) {d D : ℕ} (hd : 1 ≤ d) (hex : ∃ (Q₀ : Polynomial (Polynomial F)), Q₀ ≠ 0 ∧ WeightedDegreeLE d D Q₀ ∧ ∀ (k : κ), L k Q₀ = 0) :
minDegPoly entry d D ≠ 0 ∧ WeightedDegreeLE d D (minDegPoly entry d D) ∧ ∀ (k : κ), L k (minDegPoly entry d D) = 0

Nonzero correctness of minDegPoly. When d ≥ 1 and there exists a nonzero solution of (1, d)-weighted degree at most D, minDegPoly entry d D is nonzero, has (1, d)-weighted degree at most D, and satisfies every constraint L k _ = 0.

theorem Cslib.Code.Sudan.natDegree_minDegPoly_le {F : Type u_1} [Field F] {κ : Type u_3} [Fintype κ] [DecidableEq F] (entry : κ → ℕ × ℕ → F) (L : κ → Polynomial (Polynomial F) → F) (hL : ∀ (M : Finset (ℕ × ℕ)) (c : ℕ × ℕ → F) (k : κ), L k (bivariateOf M c) = ∑ m ∈ M, c m * entry k m) {d D : ℕ} (hd : 1 ≤ d) {Q : Polynomial (Polynomial F)} (hQ0 : Q ≠ 0) (hQwd : WeightedDegreeLE d D Q) (hQL : ∀ (k : κ), L k Q = 0) :

Least Y-degree minimality of minDegPoly. When d ≥ 1, minDegPoly entry d D has Y-degree at most that of every nonzero solution Q of (1, d)-weighted degree at most D.

Sudan interpolants #

structure Cslib.Code.Sudan.IsInterpolant {F : Type u_1} {ι : Type u_2} [Field F] (α w : ι → F) (d D : ℕ) (Q : Polynomial (Polynomial F)) :

Q is a Sudan interpolant for the received word w with evaluation points α, weight d and weighted degree D: a nonzero bivariate polynomial of (1, d)-weighted degree at most D that vanishes at the points (α i, w i).

  • ne_zero : Q ≠ 0

    The interpolant is nonzero.

  • weightedDegree_le : WeightedDegreeLE d D Q

    Every monomial X ^ a * Y ^ b of Q has (1, d)-weighted degree a + d * b at most D.

  • evalEval_eq_zero (i : ι) : Polynomial.evalEval (α i) (w i) Q = 0

    The interpolant vanishes at the points (α i, w i).

theorem Cslib.Code.Sudan.IsInterpolant.natDegree_mul_le {F : Type u_1} {ι : Type u_2} [Field F] {α w : ι → F} {d D : ℕ} {Q : Polynomial (Polynomial F)} (hQ : IsInterpolant α w d D Q) :

The Y-degree of a Sudan interpolant: deg_Y Q * d ≤ D.

theorem Cslib.Code.Sudan.exists_isInterpolant {F : Type u_1} {ι : Type u_2} [Field F] {d D : ℕ} [Fintype ι] (α w : ι → F) (hn : Fintype.card ι < (monomials d D).card) :
∃ (Q : Polynomial (Polynomial F)), IsInterpolant α w d D Q

Interpolation. If there are more than n monomials of (1, d)-weighted degree at most D, every received word has a Sudan interpolant: the n conditions Q (α i, w i) = 0 are linear in the coefficients of Q.

theorem Cslib.Code.Sudan.IsInterpolant.eval_eq_zero {F : Type u_1} {ι : Type u_2} [Field F] {α w : ι → F} {d D : ℕ} {Q : Polynomial (Polynomial F)} [Fintype ι] [DecidableEq F] (hα : Function.Injective α) (hQ : IsInterpolant α w d D Q) {P : Polynomial F} (hP : P.natDegree ≤ d) (hagree : D < {i : ι | Polynomial.eval (α i) P = w i}.card) :

Root containment. With distinct points, if P has degree at most d and agrees with the received word at more than D points, then Q(X, P(X)) = 0 for every Sudan interpolant Q.

theorem Cslib.Code.Sudan.IsInterpolant.X_sub_C_dvd {F : Type u_1} {ι : Type u_2} [Field F] {α w : ι → F} {d D : ℕ} {Q : Polynomial (Polynomial F)} [Fintype ι] [DecidableEq F] (hα : Function.Injective α) (hQ : IsInterpolant α w d D Q) {P : Polynomial F} (hP : P.natDegree ≤ d) (hagree : D < {i : ι | Polynomial.eval (α i) P = w i}.card) :

Root containment. With distinct points, if P has degree at most d and agrees with the received word at more than D points, then Y - P(X) divides every Sudan interpolant Q(X, Y).

theorem Cslib.Code.Sudan.IsInterpolant.mem_roots {F : Type u_1} {ι : Type u_2} [Field F] {α w : ι → F} {d D : ℕ} {Q : Polynomial (Polynomial F)} [Fintype ι] [DecidableEq F] (hα : Function.Injective α) (hQ : IsInterpolant α w d D Q) {P : Polynomial F} (hP : P.natDegree ≤ d) (hagree : D < {i : ι | Polynomial.eval (α i) P = w i}.card) :

With distinct points, a polynomial of degree at most d that agrees with the received word at more than D points is a root of every Sudan interpolant, as a polynomial in Y.

The interpolation matrix and interpolant of least Y-degree #

noncomputable def Cslib.Code.Sudan.interpMatrix {F : Type u_1} {ι : Type u_2} [Field F] [Fintype ι] (α w : ι → F) (M : Finset (ℕ × ℕ)) :
Fin (Fintype.card ι) → Fin M.card → F

The interpolation matrix: its rows are the points (α i, w i) (enumerated by Fintype.equivFin ι), its columns the monomials of M (enumerated by M.equivFin), and its entries the values of the monomials at the points.

theorem Cslib.Code.Sudan.interpMatrix_dotProduct {F : Type u_1} {ι : Type u_2} [Field F] [Fintype ι] (α w : ι → F) (M : Finset (ℕ × ℕ)) (u : Fin M.card → F) (i : ι) :

The product of a row of the interpolation matrix with a vector u is the value at the row's point of the polynomial with coefficients u.

noncomputable def Cslib.Code.Sudan.kernelVecUpTo {F : Type u_1} {ι : Type u_2} [Field F] [Fintype ι] [DecidableEq F] (α w : ι → F) (d D j : ℕ) :
Fin (monomialsUpTo d D j).card → F

The kernel vector of the interpolation matrix on the monomials of Y-degree at most j.

noncomputable def Cslib.Code.Sudan.interpolantCoeffs {F : Type u_1} {ι : Type u_2} [Field F] [Fintype ι] [DecidableEq F] (α w : ι → F) (d D : ℕ) :
ℕ × ℕ → F

The coefficients of the interpolant: those of the first nonzero kernel vector among j = 0, 1, …, D / d.

noncomputable def Cslib.Code.Sudan.interpolant {F : Type u_1} {ι : Type u_2} [Field F] [Fintype ι] [DecidableEq F] (α w : ι → F) (d D : ℕ) :

An interpolant of least Y-degree, computed by elimination.

theorem Cslib.Code.Sudan.weightedDegreeLE_interpolant {F : Type u_1} {ι : Type u_2} [Field F] [Fintype ι] [DecidableEq F] (α w : ι → F) (d D : ℕ) :

The elimination interpolant always has (1, d)-weighted degree at most D.

theorem Cslib.Code.Sudan.isInterpolant_interpolant {F : Type u_1} {ι : Type u_2} [Field F] [Fintype ι] [DecidableEq F] (α w : ι → F) {d D : ℕ} (hd : 1 ≤ d) (hn : Fintype.card ι < (monomials d D).card) :
IsInterpolant α w d D (interpolant α w d D)

The elimination interpolant is an interpolant. With d ≥ 1 and more monomials of (1, d)-weighted degree at most D than points, interpolant α w d D is a Sudan interpolant of weight d and weighted degree D.

theorem Cslib.Code.Sudan.natDegree_interpolant_le {F : Type u_1} {ι : Type u_2} [Field F] [Fintype ι] [DecidableEq F] (α w : ι → F) {d D : ℕ} (hd : 1 ≤ d) (_hn : Fintype.card ι < (monomials d D).card) {Q : Polynomial (Polynomial F)} (hQ : IsInterpolant α w d D Q) :

The elimination interpolant has least Y-degree among all Sudan interpolants.

Simplicity of the roots #

theorem Cslib.Code.Sudan.add_mul_add_one_le_of_mul {F : Type u_1} [Field F] {d D : ℕ} {P : Polynomial F} (hP : P.natDegree ≤ d) {S : Polynomial (Polynomial F)} (h : WeightedDegreeLE d D ((Polynomial.X - Polynomial.C P) * S)) (a b : ℕ) :
(S.coeff b).coeff a ≠ 0 → a + d * (b + 1) ≤ D

Division by Y - P lowers the weighted degree bound by d. If P has degree at most d and (Y - P) * S has (1, d)-weighted degree at most D, then every monomial X ^ a * Y ^ b of S has a + d * (b + 1) ≤ D.

theorem Cslib.Code.Sudan.exists_eq_mul_eval_ne_zero {F : Type u_1} {ι : Type u_2} [Field F] [Fintype ι] [DecidableEq F] {α w : ι → F} {d D : ℕ} (hα : Function.Injective α) {Q : Polynomial (Polynomial F)} (hQ : IsInterpolant α w d D Q) (hmin : ∀ (Q' : Polynomial (Polynomial F)), IsInterpolant α w d D Q' → Q.natDegree ≤ Q'.natDegree) {P : Polynomial F} (hP : P.natDegree ≤ d) (hagree : D < {i : ι | Polynomial.eval (α i) P = w i}.card) :

Large agreement gives simple roots. Let Q be a Sudan interpolant of least Y-degree for weight d and weighted degree D, with distinct points. If P has degree at most d and agrees with the received word at more than D points, then Q = (Y - P) * S where S(X, P(X)) is a nonzero polynomial of degree at most D - d.