@@ -10,6 +10,7 @@ import Mathlib.LinearAlgebra.AffineSpace.Pointwise
1010import Mathlib.LinearAlgebra.AffineSpace.Combination
1111import Mathlib.RingTheory.Henselian
1212
13+
1314/-! # Coding-Theory Preliminaries -/
1415
1516section TensorCombination
@@ -34,6 +35,7 @@ def multilinearCombine {ϑ : ℕ} {ι : Type*}
3435 (u : (Fin (2 ^ ϑ)) → ι → A) (r : Fin ϑ → F) : (ι → A) :=
3536 fun colIdx => ∑ rowIdx : Fin (2 ^ϑ), ((multilinearWeight r rowIdx) : F) • ((u rowIdx colIdx) : A)
3637notation :20 r " |⨂| " u => multilinearCombine (u := u) (r := r)
38+
3739end TensorCombination
3840noncomputable section
3941
@@ -297,6 +299,29 @@ instance instNonemptyAffineSubspace_mk' {V : Type*} [AddCommGroup V] [Module F V
297299 (p : V) (direction : Submodule F V) : Nonempty (AffineSubspace.mk' p direction) :=
298300 nonempty_subtype.mpr ⟨p, AffineSubspace.self_mem_mk' p direction⟩
299301
302+ /-- The affine-space combination of codewords `U` at seed `x`:
303+ `U 0 + ∑ i, x i • U (i+1)`, i.e. `vecMul (1, x) U`. -/
304+ abbrev affineComb {s : ℕ} (U : Fin (s + 1 ) → (ι → F)) (x : Fin s → F) : ι → F :=
305+ Matrix.vecMul (Fin.cons 1 x) U
306+
307+ /-- The linear combination `∑ i, l i • U (i+1)` of the "direction" codewords. -/
308+ abbrev linComb {s : ℕ} (U : Fin (s + 1 ) → (ι → F)) (l : Fin s → F) : ι → F :=
309+ fun k => ∑ i, l i * U i.succ k
310+
311+ omit [Fintype ι] [DecidableEq F] [Fintype F] in
312+ /-- The affine combination along the line `x ↦ v + t • lam` in seed space. -/
313+ lemma affineComb_line {s : ℕ} (U : Fin (s + 1 ) → (ι → F)) (v lam : Fin s → F) (t : F) :
314+ affineComb U (v + t • lam) = affineComb U v + t • (linComb U lam) := by
315+ have hsplit : (Fin.cons 1 (v + t • lam) : Fin (s + 1 ) → F) =
316+ Fin.cons 1 v + t • (Fin.cons (0 : F) lam : Fin (s + 1 ) → F) := by
317+ ext i
318+ refine Fin.cases ?_ ?_ i <;> simp
319+ have hlin : Matrix.vecMul (Fin.cons (0 : F) lam : Fin (s + 1 ) → F) U = linComb U lam := by
320+ ext k
321+ simp [Matrix.vecMul, dotProduct, Fin.sum_univ_succ, linComb]
322+ change Matrix.vecMul (Fin.cons 1 (v + t • lam) : Fin (s + 1 ) → F) U = _
323+ rw [hsplit, Matrix.add_vecMul, Matrix.smul_vecMul, hlin]
324+
300325end
301326end Affine
302327
0 commit comments