Documentation

CslibFrontier.Foundations.Data.Code.SelfCorrection

Self-correction of Reed–Muller codes by interpolation along lines #

A received word w that differs from a Reed–Muller codeword p of degree d on few points can be corrected by reading w at d + 1 points x + ν i • v of a line through x, for fixed distinct nonzero nodes ν i, and interpolating: p x = ∑ i, λ i * p (x + ν i • v) for the Lagrange weights λ i of the nodes at 0 (Cslib.Code.lagrangeDecode_eq_of_mem_reedMuller). Each queried point is uniformly distributed over the directions v, so at every point x at most (d + 1) * Δ(w, p) directions make the step err (Cslib.Code.card_lagrangeDecode_ne_le) Arora and Barak, Chapter 19. Combined with ternary majority trees (Cslib.majTree, Cslib.exists_forall_majTree_eq), this corrects w everywhere on a bounded set with fixed directions.

Main definitions #

Main results #

References #

def Cslib.Code.affineLineEquiv {F : Type u_1} [Field F] {V : Type u_2} [AddCommGroup V] [Module F V] (x : V) {c : F} (hc : c ≠ 0) :
V ≃ V

For a nonzero scalar c : F and base point x : V in a module over F, the affine map v ↦ x + c • v is a bijection on V.

@[simp]
theorem Cslib.Code.affineLineEquiv_apply {F : Type u_1} [Field F] {V : Type u_2} [AddCommGroup V] [Module F V] (x : V) {c : F} (hc : c ≠ 0) (v : V) :
(affineLineEquiv x hc) v = x + c • v
theorem Cslib.Code.exists_nonzero_nodes_of_le_card {F : Type u_1} [Field F] [Fintype F] {d : ℕ} (hcard : d + 2 ≤ Fintype.card F) :
∃ (ν : Fin (d + 1) ↪ F), ∀ (i : Fin (d + 1)), ν i ≠ 0

Whenever d + 2 ≤ Fintype.card F, there exist d + 1 distinct nonzero elements in F.

noncomputable def Cslib.Code.nonzeroNodes {F : Type u_1} [Field F] [Fintype F] {d : ℕ} (hcard : d + 2 ≤ Fintype.card F) :
Fin (d + 1) ↪ F

Canonical choice of d + 1 distinct nonzero evaluation nodes in F when d + 2 ≤ Fintype.card F.

theorem Cslib.Code.nonzeroNodes_ne_zero {F : Type u_1} [Field F] [Fintype F] {d : ℕ} (hcard : d + 2 ≤ Fintype.card F) (i : Fin (d + 1)) :
(nonzeroNodes hcard) i ≠ 0
noncomputable def Cslib.Code.lagrangeWeight {F : Type u_1} [Field F] {d : ℕ} (ν : Fin (d + 1) ↪ F) (i : Fin (d + 1)) :
F

The Lagrange weight of the node ν i at 0.

theorem Cslib.Code.eval_zero_eq_sum_lagrangeWeight {F : Type u_1} [Field F] {d : ℕ} (ν : Fin (d + 1) ↪ F) {P : Polynomial F} (hP : P.natDegree ≤ d) :
Polynomial.eval 0 P = ∑ i : Fin (d + 1), lagrangeWeight ν i * Polynomial.eval (ν i) P

A polynomial of degree at most d is determined at 0 by its values at d + 1 nodes.

noncomputable def Cslib.Code.lagrangeDecode {F : Type u_1} [Field F] {d : ℕ} {V : Type u_2} [AddCommGroup V] [Module F V] (ν : Fin (d + 1) ↪ F) (w : V → F) (x v : V) :
F

Interpolation along a line: the combination of the values of w at the points x + ν i • v with the Lagrange weights at 0.

theorem Cslib.Code.lagrangeDecode_eq_of_exists_natDegree_le {F : Type u_1} [Field F] {d : ℕ} {V : Type u_2} [AddCommGroup V] [Module F V] (ν : Fin (d + 1) ↪ F) {p : V → F} {x v : V} (h : ∃ (P : Polynomial F), P.natDegree ≤ d ∧ ∀ (t : F), Polynomial.eval t P = p (x + t • v)) :
lagrangeDecode ν p x v = p x

Interpolation along a line is exact whenever the restriction of p to the line t ↦ p (x + t • v) agrees with a polynomial of degree at most d.

theorem Cslib.Code.card_lagrangeDecode_ne_le_of_forall_eq {F : Type u_1} [Field F] [DecidableEq F] {d : ℕ} {V : Type u_2} [AddCommGroup V] [Module F V] [Fintype V] (ν : Fin (d + 1) ↪ F) (hν : ∀ (i : Fin (d + 1)), ν i ≠ 0) {p : V → F} {x : V} (hp : ∀ (v : V), lagrangeDecode ν p x v = p x) (w : V → F) :
{v : V | lagrangeDecode ν w x v ≠ p x}.card ≤ (d + 1) * {y : V | w y ≠ p y}.card

Few directions err along lines. Over any finite vector space V over F, if p is reconstructed along every line through x, at most (d + 1) * Δ(w, p) directions v make interpolation along the line through x in direction v err when the nodes are nonzero.

theorem Cslib.Code.lagrangeDecode_eq_of_mem_reedMuller {F : Type u_1} [Field F] {m d : ℕ} (ν : Fin (d + 1) ↪ F) {p : (Fin m → F) → F} (hp : p ∈ reedMuller F m d) (x v : Fin m → F) :
lagrangeDecode ν p x v = p x

Interpolation is exact on codewords of the Reed–Muller code of degree d, for every direction.

theorem Cslib.Code.card_lagrangeDecode_ne_le {F : Type u_1} [Field F] [Fintype F] [DecidableEq F] {m d : ℕ} (ν : Fin (d + 1) ↪ F) (hν : ∀ (i : Fin (d + 1)), ν i ≠ 0) {p : (Fin m → F) → F} (hp : p ∈ reedMuller F m d) (w : (Fin m → F) → F) (x : Fin m → F) :
{v : Fin m → F | lagrangeDecode ν w x v ≠ p x}.card ≤ (d + 1) * {y : Fin m → F | w y ≠ p y}.card

Few directions err. At every point x, at most (d + 1) * Δ(w, p) directions v make interpolation along the line through x in the direction v err, when the nodes are nonzero.

theorem Cslib.Code.card_false_line_claim_le {F : Type u_1} [Field F] [Fintype F] [DecidableEq F] {m d : ℕ} (ν : Fin (d + 1) ↪ F) (hν : ∀ (i : Fin (d + 1)), ν i ≠ 0) {p : (Fin m → F) → F} (hp : p ∈ reedMuller F m d) (w : (Fin m → F) → F) (x : Fin m → F) (claim : (Fin m → F) → Polynomial F) :
{v : Fin m → F | (claim v).natDegree ≤ d ∧ (∀ (i : Fin (d + 1)), Polynomial.eval (ν i) (claim v) = w (x + ν i • v)) ∧ Polynomial.eval 0 (claim v) ≠ p x}.card ≤ (d + 1) * {y : Fin m → F | w y ≠ p y}.card

A prover can supply a univariate polynomial for each direction instead of the verifier computing Lagrange coefficients. Even when the claim depends on the direction, at most (d + 1) * Δ(w, p) directions pass all node checks and give an incorrect value at zero.