Skip to content

Commit 62d0ca5

Browse files
authored
ReedSolomon.lean improvements (#663)
* Preliminary cleanup of RS * Some improvement to RS code file
1 parent 65f01ff commit 62d0ca5

4 files changed

Lines changed: 141 additions & 171 deletions

File tree

ArkLib/Data/CodingTheory/ProximityGap/BCIKS20/AffineLines/BWMatrix.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,15 +583,15 @@ theorem RS_BW_bound_of_le_relUDR {deg : ℕ} {domain : ι ↪ F} {δ : ℝ≥0}
583583
have hdist_ne : (‖(ReedSolomon.code domain deg : Set (ι → F))‖₀) ≠ 0 := by
584584
have hdist_eq : ‖(ReedSolomon.code domain deg : Set (ι → F))‖₀ = n - deg + 1 := by
585585
simpa [n] using
586-
(ReedSolomon.dist_eq' (ι := ι) (F := F) (α := domain) (n := deg) hdeg)
586+
(ReedSolomon.dist_eq_of_le (ι := ι) (F := F) (α := domain) (n := deg) hdeg)
587587
simp [hdist_eq]
588588
haveI : NeZero (‖(ReedSolomon.code domain deg : Set (ι → F))‖₀) := ⟨hdist_ne⟩
589589
have htwo : 2 * e < ‖(ReedSolomon.code domain deg : Set (ι → F))‖₀ := by
590590
exact (Code.UDRClose_iff_two_mul_proximity_lt_d_UDR
591591
(C := (ReedSolomon.code domain deg : Set (ι → F))) (e := e)).1 he_le_UDR
592592
have hdist_eq : ‖(ReedSolomon.code domain deg : Set (ι → F))‖₀ = n - deg + 1 := by
593593
simpa [n] using
594-
(ReedSolomon.dist_eq' (ι := ι) (F := F) (α := domain) (n := deg) hdeg)
594+
(ReedSolomon.dist_eq_of_le (ι := ι) (F := F) (α := domain) (n := deg) hdeg)
595595
simpa [n, e, hdist_eq] using htwo
596596

597597
open Matrix in

ArkLib/Data/CodingTheory/ProximityGap/BCIKS20/AffineSpaces.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ lemma exists_gs_multiplicity {deg : ℕ} {domain : ι ↪ F} {δ : ℝ≥0}
14881488
rw [Real.coe_sqrt]
14891489
congr 1
14901490
haveI : NeZero deg := ⟨by omega⟩
1491-
have hdim := ReedSolomon.dim_eq_deg_of_le' (α := domain) (n := deg)
1491+
have hdim := ReedSolomon.dim_eq_deg_of_le (α := domain) (n := deg)
14921492
(by omega : deg ≤ Fintype.card ι)
14931493
rw [LinearCode.rate, hdim]
14941494
simp [LinearCode.length]
@@ -1523,7 +1523,7 @@ lemma exists_gs_multiplicity {deg : ℕ} {domain : ι ↪ F} {δ : ℝ≥0}
15231523
simp only [s, hs_def, ReedSolomon.sqrtRate]
15241524
rw [Real.coe_sqrt]; congr 1
15251525
haveI : NeZero deg := ⟨by omega⟩
1526-
have hdim := ReedSolomon.dim_eq_deg_of_le' (α := domain) (n := deg)
1526+
have hdim := ReedSolomon.dim_eq_deg_of_le (α := domain) (n := deg)
15271527
(by omega : deg ≤ Fintype.card ι)
15281528
rw [LinearCode.rate, hdim]; simp [LinearCode.length]
15291529
have hs_pos : 0 < s := by
@@ -1646,7 +1646,7 @@ lemma exists_gs_multiplicity {deg : ℕ} {domain : ι ↪ F} {δ : ℝ≥0}
16461646
have hs_eq : s = Real.sqrt ((1 : ℝ) / Fintype.card ι) := by
16471647
simp only [s, hs_def, ReedSolomon.sqrtRate]; rw [Real.coe_sqrt]; congr 1
16481648
haveI : NeZero (1 : ℕ) := ⟨by omega⟩
1649-
have hdim := ReedSolomon.dim_eq_deg_of_le' (α := domain) (n := 1)
1649+
have hdim := ReedSolomon.dim_eq_deg_of_le (α := domain) (n := 1)
16501650
(by omega : 1 ≤ Fintype.card ι)
16511651
rw [LinearCode.rate, hdim]; simp [LinearCode.length]
16521652
have hgs_eq : gs_johnson 1 (Fintype.card ι) m = 1 - s - s / (2 * m) := by
@@ -1975,10 +1975,10 @@ theorem rs_listDecoding_card_lt_field {deg : ℕ} {domain : ι ↪ F} {δ : ℝ
19751975
have hrelUDR : Code.relativeUniqueDecodingRadius (ι := ι) (F := F)
19761976
(C := (ReedSolomon.code domain deg : Set (ι → F))) =
19771977
((1 : ℝ≥0) - ↑deg / ↑(Fintype.card ι)) / 2 :=
1978-
ReedSolomon.relativeUniqueDecodingRadius_RS_eq' (by omega)
1978+
ReedSolomon.relativeUniqueDecodingRadius_RS_eq (by omega)
19791979
have hrate_eq : (LinearCode.rate (ReedSolomon.code domain deg) : ℝ≥0) =
19801980
(↑deg : ℝ≥0) / ↑(Fintype.card ι) := by
1981-
have hdim := ReedSolomon.dim_eq_deg_of_le' (α := domain) (n := deg) (by omega)
1981+
have hdim := ReedSolomon.dim_eq_deg_of_le (α := domain) (n := deg) (by omega)
19821982
simp [LinearCode.rate, hdim, LinearCode.length]
19831983
rw [hrate_eq] at hJ
19841984
rw [← hrelUDR] at hJ

ArkLib/Data/CodingTheory/ProximityGap/DG25/ReedSolomon.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ theorem ReedSolomon_ProximityGapAffineLines_UniqueDecoding [Nontrivial (ReedSolo
5252
not_false_eq_true]), div_one]
5353
simp only [Nat.floor_natCast]
5454
set CRS := ReedSolomon.code α k
55-
have h_dist_RS := ReedSolomon.dist_eq' (F := A) (α := α)
55+
have h_dist_RS := ReedSolomon.dist_eq_of_le (F := A) (α := α)
5656
(n := k) (ι := ι) (h := hk)
5757
have h_dist_CRS : ‖(CRS : Set (ι → A))‖₀ = n - k + 1 := h_dist_RS
5858
have he_le_NNReal : (e : ℝ≥0)
@@ -86,9 +86,9 @@ theorem ReedSolomon_ProximityGapAffineLines_UniqueDecoding [Nontrivial (ReedSolo
8686
unfold errorBound
8787
have h_δ_mem : δ ∈ Set.Icc 0 (((1 : ℝ≥0) - (rate (ReedSolomon.code α k))) / 2) := by
8888
simp only [Set.mem_Icc, zero_le, true_and]
89-
rw [rateOfLinearCode_eq_div' (h := by omega)]
89+
rw [rateOfLinearCode_eq_div (h := by omega)]
9090
simp only [NNRat.cast_div, NNRat.cast_natCast]
91-
rw [←ReedSolomon.relativeUniqueDecodingRadius_RS_eq' (F := A)
91+
rw [←ReedSolomon.relativeUniqueDecodingRadius_RS_eq (F := A)
9292
(ι := ι) (h := by omega)]
9393
rw [dist_le_UDR_iff_relDist_le_relUDR] at he_unique_decoding_radius
9494
exact he_unique_decoding_radius
@@ -127,7 +127,7 @@ theorem reedSolomon_multilinearCorrelatedAgreement_Nat [Nontrivial (ReedSolomon.
127127
set n := Fintype.card ι
128128
intro ϑ hϑ_gt_0 u h_prob_tensor_gt
129129
set C_RS: ModuleCode ι A A := ReedSolomon.code α k
130-
have h_dist_RS := ReedSolomon.dist_eq' (F := A) (α := α)
130+
have h_dist_RS := ReedSolomon.dist_eq_of_le (F := A) (α := α)
131131
(n := k) (ι := ι) (h := hk)
132132
have h_dist_CRS : ‖(C_RS : Set (ι → A))‖₀ = n - k + 1 := h_dist_RS
133133
-- 1. Apply ReedSolomon_ProximityGapAffineLines_UniqueDecoding (BCIKS20 Thm 4.1)

0 commit comments

Comments
 (0)