Skip to content

Commit f5abcb2

Browse files
committed
WIP
1 parent bdceeef commit f5abcb2

2 files changed

Lines changed: 55 additions & 18 deletions

File tree

ArkLib/Data/CodingTheory/GuruswamiSudan/GuruswamiSudan.lean

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import Mathlib.Algebra.Polynomial.Basic
88
import Mathlib.Data.Real.Sqrt
99

1010
import ArkLib.Data.CodingTheory.Basic
11+
import ArkLib.Data.CodingTheory.ReedSolomon
1112
import ArkLib.Data.Polynomial.Bivariate
1213

13-
namespace GuruswamiSudan
14+
namespace GuruswamiSudan
1415

1516
variable {F : Type} [Field F]
1617
variable [DecidableEq F]
@@ -20,55 +21,86 @@ open Polynomial
2021

2122
/--
2223
Guruswami-Sudan conditions for the polynomial searched by the decoder.
23-
As in the Berlekamp-Welch case, this can be shown to be equivalent to a
24+
As in the Berlekamp-Welch case, this can be shown to be equivalent to a
2425
a system of linear equations.
2526
-/
26-
structure GuruswamiSudanCondition (k r D : ℕ) (ωs f : Fin n → F) (Q : Polynomial (Polynomial F)) where
27+
structure Condition
28+
(k r D : ℕ)
29+
(ωs : Fin n ↪ F)
30+
(f : Fin n → F)
31+
(Q : Polynomial (Polynomial F)) where
2732
/-- Q ≠ 0 -/
2833
Q_ne_0 : Q ≠ 0
2934
/-- Degree of the polynomial. -/
30-
Q_deg : Bivariate.weightedDegree Q 1 (k-1) ≤ D
35+
Q_deg : Bivariate.weightedDegree Q 1 (k-1) ≤ D
3136
/-- (ωs i, f i) must be root of the polynomial Q. -/
3237
Q_roots : ∀ i, (Q.eval (C <| f i)).eval (ωs i) = 0
3338
/-- Multiplicity of the roots is at least r. -/
3439
Q_multiplicity : ∀ i, r ≤ Bivariate.rootMultiplicity Q (ωs i) (f i)
3540

3641
/-- Guruswami-Sudan decoder. -/
37-
opaque decoder (k r D e : ℕ) (ωs f : Fin n → F) : List F[X] := sorry
42+
opaque decoder (k r D e : ℕ) (ωs : Fin n ↪ F) (f : Fin n → F) : List F[X] := sorry
3843

3944
/-- Each decoded codeword has to be e-far from the received message. -/
40-
theorem decoder_mem_impl_dist {k r D e : ℕ} {ωs f : Fin n → F} {p : F[X]}
41-
(h_in : p ∈ decoder k r D e ωs f)
45+
theorem decoder_mem_impl_dist
46+
{k r D e : ℕ}
4247
(h_e : e ≤ n - Real.sqrt (k * n))
48+
{ωs : Fin n ↪ F}
49+
{f : Fin n → F}
50+
{p : F[X]}
51+
(h_in : p ∈ decoder k r D e ωs f)
4352
:
4453
Δ₀(f, p.eval ∘ ωs) ≤ e := by sorry
4554

46-
/-- If a codeword is e-far from the received message it appears in the output of
55+
/-- If a codeword is e-far from the received message it appears in the output of
4756
the decoder.
4857
-/
49-
theorem decoder_dist_impl_mem {k r D e : ℕ} {ωs f : Fin n → F} {p : F[X]}
58+
theorem decoder_dist_impl_mem
59+
{k r D e : ℕ}
5060
(h_e : e ≤ n - Real.sqrt (k * n))
61+
{ωs : Fin n ↪ F}
62+
{f : Fin n → F}
63+
{p : F[X]}
5164
(h_dist : Δ₀(f, p.eval ∘ ωs) ≤ e)
5265
:
53-
p ∈ decoder k r D e ωs f := by sorry
66+
p ∈ decoder k r D e ωs f := by sorry
5467

68+
/-- The degree bound (a.k.a. `D_X`) for instantiation of Guruswami-Sudan
69+
in lemma 5.3 of the Proximity Gap paper.
70+
D_X(m) = (m + 1/2)√ρn.
71+
-/
5572
noncomputable def proximity_gap_degree_bound (k m : ℕ) : ℕ :=
5673
let rho := (k + 1 : ℚ) / n
5774
Nat.floor ((((m : ℚ) + (1 : ℚ)/2)*(Real.sqrt rho))*n)
5875

76+
/-- The ball radius from lemma 5.3 of the Proximity Gap paper,
77+
which follows from the Johnson bound.
78+
δ₀(ρ, m) = 1 - √ρ - √ρ/2m.
79+
-/
5980
noncomputable def proximity_gap_johnson (k m : ℕ) : ℕ :=
6081
let rho := (k + 1 : ℚ) / n
6182
Nat.floor ((1 : ℝ) - Real.sqrt rho - Real.sqrt rho / (2 * m))
6283

63-
/-- Lemma 5.3 from the Proximity gap paper -/
64-
lemma guruswami_sudan_for_proximity_gap_existence {k m : ℕ} {ωs f : Fin n → F} :
65-
∃ Q, GuruswamiSudanCondition k m (proximity_gap_degree_bound (n := n) k m) ωs f Q := by
84+
/-- The first part of lemma 5.3 from the Proximity gap paper.
85+
Given the D_X (`proximity_gap_degree_bound`) and δ₀ (`proximity_gap_johnson`),
86+
a solution to Guruswami-Sudan system exists.
87+
-/
88+
lemma guruswami_sudan_for_proximity_gap_existence {k m : ℕ} {ωs : Fin n ↪ F} {f : Fin n → F}:
89+
∃ Q, Condition k m (proximity_gap_degree_bound (n := n) k m) ωs f Q := by
6690
sorry
6791

68-
lemma guruswami_sudan_for_proximity_gap_property {k m : ℕ} {ωs f : Fin n → F}
69-
{Q : F[X][X]} {p : F[X]}
70-
(h : Δ₀(f, p.eval ∘ f) ≤ proximity_gap_johnson (n := n) k m)
92+
/-- The second part of lemma 5.3 from the Proximity gap paper.
93+
For any solution Q of the Guruswami-Sudan system, and for any
94+
polynomial P ∈ RS[n, k, ρ] such that Δ(w, P) ≤ δ₀(ρ, m),
95+
we have that Y - P(X) divides Q(X, Y) in the polynomial ring
96+
F[X][Y].
97+
-/
98+
lemma guruswami_sudan_for_proximity_gap_property {k m : ℕ} {ωs : Fin n ↪ F}
99+
{f : Fin n → F}
100+
{Q : F[X][X]}
101+
{p : ReedSolomon.code ωs n}
102+
(h : Δ₀(f, (ReedSolomon.codeWordToPoly p).eval ∘ f) ≤ proximity_gap_johnson (n := n) k m)
71103
:
72-
((X : F[X][X]) - C p) ∣ Q := by sorry
104+
((X : F[X][X]) - C (ReedSolomon.codeWordToPoly p)) ∣ Q := by sorry
73105

74-
end GuruswamiSudan
106+
end GuruswamiSudan

ArkLib/Data/CodingTheory/ReedSolomon.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ def evalOnPoints : F[X] →ₗ[F] (ι → F) where
3939
def code (deg : ℕ) : Submodule F (ι → F) :=
4040
(Polynomial.degreeLT F deg).map (evalOnPoints domain)
4141

42+
def codeWordToPoly
43+
[Fintype ι] [Field F] [DecidableEq ι]
44+
{deg : ℕ} {domain : ι ↪ F} (f : code domain deg) : F[X] :=
45+
sorry
46+
4247
/-- The generator matrix of the Reed-Solomon code of degree `deg` and evaluation points `domain`. -/
4348
def genMatrix (deg : ℕ) : Matrix (Fin deg) ι F :=
4449
.of fun i j => domain j ^ (i : ℕ)

0 commit comments

Comments
 (0)