Skip to content

Commit 0ec1f6e

Browse files
feat(ReedSolomon): decode-outcome iff for Gao decoding (#268)
Combine `decode_eq_none` and `decode_none_farness` into a single outcome characterization `decode_eq_none_iff`: the decoder returns `none` iff the received word is beyond the guaranteed radius ⌊(n-k)/2⌋ of every codeword. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 95569c0 commit 0ec1f6e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

CompPoly/Univariate/ReedSolomon/GaoCorrectness.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,16 @@ theorem decode_none_farness [Field F]
310310
rw [Gao.decode_eq_some k D r hkn msg (Nat.le_of_not_lt hle)] at hnone
311311
exact Option.some_ne_none _ hnone
312312

313+
/-- Outcome characterization: `Gao.decode` returns `none` iff the received word is beyond
314+
the guaranteed radius `⌊(n-k)/2⌋` of every codeword (combines `decode_eq_none` and
315+
`decode_none_farness`). -/
316+
theorem decode_eq_none_iff [Field F]
317+
(k : ℕ) (D : Domain F) (r : Vector F D.n) (hkn : k < D.n) :
318+
Gao.decode k D r = none ↔
319+
∀ msg : Vector F k, D.n - k < 2 * hammingDist r.get (encode D msg).get :=
320+
⟨decode_none_farness k D r hkn,
321+
fun h => decode_eq_none k D r hkn fun msg => by have := h msg; omega⟩
322+
313323
/-- Uniqueness: within the guaranteed-decoding radius `⌊(D.n-k)/2⌋`, two messages
314324
whose codewords lie within that radius of `r` decode to the same polynomial. -/
315325
theorem decode_unique [Field F] (k : ℕ) (D : Domain F) (r : Vector F D.n)

0 commit comments

Comments
 (0)