self_orthogonal_mds_card7_nonexistence
For any finite field F with decidable equality of cardinality 7, there does not exist any subspace C of (Fin 8 → F) that is a self-orthogonal MDS code of length 8 and dimension 3.
Statement
theorem self_orthogonal_mds_card7_nonexistence (F : Type*) [Field F] [Fintype F] [DecidableEq F] (hF : Fintype.card F = 7) : ¬ ∃ C : Subspace F (Fin 8 → F), is_self_orthogonal_mds_code 8 3 C
- Related work
- arXiv:2611.30048 Conjecture 2
- Verified
- 29 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- is_self_orthogonal_mds_codeFor a finite field F with decidable equality, natural numbers n and k, and an F-subspace C of (Fin n → F),…
- is_mds_codeFor a finite field F, natural numbers n and k, a subspace C of Fin n → F has dimension k (Module.finrank F C = k) and is an MDS code if…
Read back from the Lean
For any finite field $F$ with decidable equality such that $|F| = 7$, there does not exist an $F$-subspace $C$ of $\text{Fin } 8 \to F$ that is a self-orthogonal MDS code of length 8 and dimension 3.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
An [8, 3] MDS code has minimum distance 6, so no non-zero codeword has 3 zero coordinates; hence projection onto the first 3 coordinates is an isomorphism, giving a systematic generator [I_3 | R] with R a 3x5 matrix. Self-orthogonality and the MDS property force R to have rows with sum of squares -1, pairwise orthogonal rows, no zero entries, and no vanishing 2x2 minors. Multiplying rows and columns by signs normalizes entries of row 1 and column 1 into {1, 2, 3}, and an exhaustive search certified by the Lean kernel confirms that no such normalized 3x5 matrix exists over ZMod 7.
Inversion in ZMod 7: for every non-zero x, x * inv7 x = 1 automation
Verified by kernel computation on all elements of ZMod 7.
def inv7 : ZMod 7 → ZMod 7 := fun x => x ^ 5 theorem inv7_spec : ∀ x : ZMod 7, x ≠ 0 → x * inv7 x = 1 := by decide +kernel
Exhaustive computational verification: checkAll evaluates to true automation
The kernel evaluates checkAll by exhaustively searching over all candidates for row 1, row 2, and row 3.
uses
check_alldef low (x : ZMod 7) : Bool := x.val ≤ 3 && x ≠ 0 def nz5 (a b c d e : ZMod 7) : Bool := a ≠ 0 && b ≠ 0 && c ≠ 0 && d ≠ 0 && e ≠ 0 def sq5 (a b c d e : ZMod 7) : ZMod 7 := a*a + b*b + c*c + d*d + e*e def mn (a b c d : ZMod 7) : Bool := a * d - b * c ≠ 0 def minors (x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 : ZMod 7) : Bool := mn x1 x2 y1 y2 && mn x1 x3 y1 y3 && mn x1 x4 y1 y4 && mn x1 x5 y1 y5 && mn x2 x3 y2 y3 && mn x2 x4 y2 y4 && mn x2 x5 y2 y5 && mn x3 x4 y3 y4 && mn x3 x5 y3 y5 && mn x4 x5 y4 y5 def y5f (x1 x2 x3 x4 x5 y1 y2 y3 y4 : ZMod 7) : ZMod 7 := -(x1*y1 + x2*y2 + x3*y3 + x4*y4) * inv7 x5 def z4f (x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 : ZMod 7) : ZMod 7 := (-(x1*z1 + x2*z2 + x3*z3) * y5 - -(y1*z1 + y2*z2 + y3*z3) * x5) * inv7 (x4*y5 - x5*y4) def z5f (x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 : ZMod 7) : ZMod 7 := (x4 * -(y1*z1 + y2*z2 + y3*z3) - y4 * -(x1*z1 + x2*z2 + x3*z3)) * inv7 (x4*y5 - x5*y4) def third (x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 : ZMod 7) : Bool := let z4 := z4f x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 let z5 := z5f x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 nz5 z1 z2 z3 z4 z5 && sq5 z1 z2 z3 z4 z5 = 6 && minors x1 x2 x3 x4 x5 z1 z2 z3 z4 z5 && minors y1 y2 y3 y4 y5 z1 z2 z3 z4 z5 def checkX (x1 x2 x3 x4 x5 : ZMod 7) : Bool := (List.finRange 7).all fun y1 => (List.finRange 7).all fun y2 => (List.finRange 7).all fun y3 => (List.finRange 7).all fun y4 => let y1 : ZMod 7 := y1; let y2 : ZMod 7 := y2; let y3 : ZMod 7 := y3; let y4 : ZMod 7 := y4 let y5 := y5f x1 x2 x3 x4 x5 y1 y2 y3 y4 !(low y1 && nz5 y1 y2 y3 y4 y5 && sq5 y1 y2 y3 y4 y5 = 6 && minors x1 x2 x3 x4 x5 y1 y2 y3 y4 y5) || ((List.finRange 7).all fun z1 => (List.finRange 7).all fun z2 => (List.finRange 7).all fun z3 => !(low (z1 : ZMod 7) && third x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3)) def checkAll : Bool := (List.finRange 7).all fun x1 => (List.finRange 7).all fun x2 => (List.finRange 7).all fun x3 => (List.finRange 7).all fun x4 => (List.finRange 7).all fun x5 => !(low (x1 : ZMod 7) && low (x2 : ZMod 7) && low (x3 : ZMod 7) && low (x4 : ZMod 7) && low (x5 : ZMod 7) && sq5 x1 x2 x3 x4 x5 = 6) || checkX x1 x2 x3 x4 x5 set_option maxRecDepth 100000 in theorem check_all : checkAll = true := by decide +kernel
Sign normalisation and boolean reflection helpers
Elementary properties of the sign map and bridging boolean functions to propositional equality.
uses
imp_oftheorem sgn_sq (x : ZMod 7) : (if x.val ≤ 3 then (1 : ZMod 7) else -1) * (if x.val ≤ 3 then (1 : ZMod 7) else -1) = 1 := by split_ifs <;> decide theorem sgn_ne (x : ZMod 7) : (if x.val ≤ 3 then (1 : ZMod 7) else -1) ≠ 0 := by split_ifs <;> decide theorem sgn_low : ∀ x : ZMod 7, x ≠ 0 → low ((if x.val ≤ 3 then (1 : ZMod 7) else -1) * x) = true := by decide theorem imp_of {A B : Bool} (h : (!A || B) = true) (hA : A = true) : B = true := by cases A <;> cases B <;> simp_all theorem nz5_true {a b c d e : ZMod 7} (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0) (hd : d ≠ 0) (he : e ≠ 0) : nz5 a b c d e = true := by simp [nz5, ha, hb, hc, hd, he] theorem sq5_true {a b c d e : ZMod 7} (h : a*a + b*b + c*c + d*d + e*e = -1) : decide (sq5 a b c d e = 6) = true := by simp only [sq5, h, decide_eq_true_eq]; decide theorem minors_true (x y : Fin 5 → ZMod 7) (h : ∀ a b : Fin 5, a ≠ b → x a * y b - x b * y a ≠ 0) : minors (x 0) (x 1) (x 2) (x 3) (x 4) (y 0) (y 1) (y 2) (y 3) (y 4) = true := by simp only [minors, mn, Bool.and_eq_true, decide_eq_true_eq, ne_eq] exact ⟨⟨⟨⟨⟨⟨⟨⟨⟨h 0 1 (by decide), h 0 2 (by decide)⟩, h 0 3 (by decide)⟩, h 0 4 (by decide)⟩, h 1 2 (by decide)⟩, h 1 3 (by decide)⟩, h 1 4 (by decide)⟩, h 2 3 (by decide)⟩, h 2 4 (by decide)⟩, h 3 4 (by decide)⟩ theorem low_true_and {a : ZMod 7} {B : Bool} (ha : low a = true) (hB : B = true) : (low a && B) = true := by simp [ha, hB]
No normalized systematic 3x5 block exists over ZMod 7
Using the boolean certificate check_all, any hypothetical normalized block leads to a contradiction.
uses
check_all,imp_oftheorem no_rows_normal (q : Fin 3 → Fin 5 → ZMod 7) (qnz : ∀ i a, q i a ≠ 0) (qnorm : ∀ i, ∑ a, q i a * q i a = -1) (qorth : ∀ i j, i ≠ j → ∑ a, q i a * q j a = 0) (qmin : ∀ i j, i ≠ j → ∀ a b, a ≠ b → q i a * q j b - q i b * q j a ≠ 0) (qlow0 : ∀ a, low (q 0 a) = true) (qlowi : ∀ i, i ≠ 0 → low (q i 0) = true) : False := by -- read the certificate have hc := check_all simp only [checkAll, List.all_eq_true, List.mem_finRange, forall_true_left] at hc have h1 := hc (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) have hx : (low (q 0 0) && low (q 0 1) && low (q 0 2) && low (q 0 3) && low (q 0 4) && decide (sq5 (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) = 6)) = true := by have := qnorm 0 simp only [Fin.sum_univ_five] at this simp [qlow0, sq5_true this] have h2 := imp_of h1 hx simp only [checkX, List.all_eq_true, List.mem_finRange, forall_true_left] at h2 -- the second row have hy5 : q 1 4 = y5f (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) := by have ho := qorth 0 1 (by decide) simp only [Fin.sum_univ_five] at ho have hi := inv7_spec (q 0 4) (qnz 0 4) simp only [y5f] linear_combination (inv7 (q 0 4)) * ho - (q 1 4) * hi have h3 := h2 (q 1 0) (q 1 1) (q 1 2) (q 1 3) rw [← hy5] at h3 have hy : (low (q 1 0) && nz5 (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) && decide (sq5 (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) = 6) && minors (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4)) = true := by have hn := qnorm 1 simp only [Fin.sum_univ_five] at hn simp only [Bool.and_eq_true] exact ⟨⟨⟨qlowi 1 (by decide), nz5_true (qnz 1 0) (qnz 1 1) (qnz 1 2) (qnz 1 3) (qnz 1 4)⟩, sq5_true hn⟩, minors_true (q 0) (q 1) (qmin 0 1 (by decide))⟩ have h4 := imp_of h3 hy simp only [List.all_eq_true, List.mem_finRange, forall_true_left] at h4 have h5 := h4 (q 2 0) (q 2 1) (q 2 2) -- the third row have hd : q 0 3 * q 1 4 - q 0 4 * q 1 3 ≠ 0 := qmin 0 1 (by decide) 3 4 (by decide) have hdi := inv7_spec _ hd have ho1 := qorth 0 2 (by decide) have ho2 := qorth 1 2 (by decide) simp only [Fin.sum_univ_five] at ho1 ho2 have hz4 : q 2 3 = z4f (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) (q 2 0) (q 2 1) (q 2 2) := by simp only [z4f] linear_combination (-(q 2 3)) * hdi + (inv7 (q 0 3 * q 1 4 - q 0 4 * q 1 3)) * ((q 1 4) * ho1 - (q 0 4) * ho2) have hz5 : q 2 4 = z5f (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) (q 2 0) (q 2 1) (q 2 2) := by simp only [z5f] linear_combination (-(q 2 4)) * hdi + (inv7 (q 0 3 * q 1 4 - q 0 4 * q 1 3)) * ((q 0 3) * ho2 - (q 1 3) * ho1) have hz : (low (q 2 0) && third (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) (q 2 0) (q 2 1) (q 2 2)) = true := by simp only [third, ← hz4, ← hz5] have hn := qnorm 2 simp only [Fin.sum_univ_five] at hn simp only [Bool.and_eq_true] exact ⟨qlowi 2 (by decide), ⟨⟨nz5_true (qnz 2 0) (qnz 2 1) (qnz 2 2) (qnz 2 3) (qnz 2 4), sq5_true hn⟩, minors_true (q 0) (q 2) (qmin 0 2 (by decide))⟩, minors_true (q 1) (q 2) (qmin 1 2 (by decide))⟩ rw [hz] at h5 exact absurd h5 (by decide)
No systematic 3x5 block exists over ZMod 7
Any valid matrix can be normalized by row and column signs in {-1, 1}, reducing to the normalized case.
uses
no_rows_normaltheorem no_rows (r : Fin 3 → Fin 5 → ZMod 7) (hnz : ∀ i a, r i a ≠ 0) (hnorm : ∀ i, ∑ a, r i a * r i a = -1) (horth : ∀ i j, i ≠ j → ∑ a, r i a * r j a = 0) (hmin : ∀ i j, i ≠ j → ∀ a b, a ≠ b → r i a * r j b - r i b * r j a ≠ 0) : False := by have : Fact (Nat.Prime 7) := ⟨by norm_num⟩ -- sign normalisation let s : Fin 5 → ZMod 7 := fun a => if (r 0 a).val ≤ 3 then 1 else -1 let t : Fin 3 → ZMod 7 := fun i => if i = 0 then 1 else if (s 0 * r i 0).val ≤ 3 then 1 else -1 have hs2 : ∀ a, s a * s a = 1 := fun a => sgn_sq _ have ht2 : ∀ i, t i * t i = 1 := by intro i; simp only [t]; split_ifs <;> first | norm_num | exact neg_ne_zero.mpr one_ne_zero have hs0 : ∀ a, s a ≠ 0 := fun a => sgn_ne _ have ht0 : ∀ i, t i ≠ 0 := by intro i; simp only [t]; split_ifs <;> first | norm_num | exact neg_ne_zero.mpr one_ne_zero let q : Fin 3 → Fin 5 → ZMod 7 := fun i a => t i * s a * r i a have qnz : ∀ i a, q i a ≠ 0 := fun i a => mul_ne_zero (mul_ne_zero (ht0 i) (hs0 a)) (hnz i a) have qnorm : ∀ i, ∑ a, q i a * q i a = -1 := by intro i rw [← hnorm i] refine Finset.sum_congr rfl (fun a _ => ?_) have e : q i a * q i a = (t i * t i) * (s a * s a) * (r i a * r i a) := by simp only [q]; ring rw [e, ht2, hs2]; ring have qorth : ∀ i j, i ≠ j → ∑ a, q i a * q j a = 0 := by intro i j hij have e : ∑ a, q i a * q j a = t i * t j * ∑ a, r i a * r j a := by rw [Finset.mul_sum] refine Finset.sum_congr rfl (fun a _ => ?_) have e' : q i a * q j a = t i * t j * (s a * s a) * (r i a * r j a) := by simp only [q]; ring rw [e', hs2]; ring rw [e, horth i j hij, mul_zero] have qmin : ∀ i j, i ≠ j → ∀ a b, a ≠ b → q i a * q j b - q i b * q j a ≠ 0 := by intro i j hij a b hab have e : q i a * q j b - q i b * q j a = (t i * t j * s a * s b) * (r i a * r j b - r i b * r j a) := by simp only [q]; ring rw [e] exact mul_ne_zero (mul_ne_zero (mul_ne_zero (mul_ne_zero (ht0 i) (ht0 j)) (hs0 a)) (hs0 b)) (hmin i j hij a b hab) have qlow0 : ∀ a, low (q 0 a) = true := by intro a have e : q 0 a = s a * r 0 a := by simp [q, t] rw [e]; exact sgn_low _ (hnz 0 a) have qlowi : ∀ i, i ≠ 0 → low (q i 0) = true := by intro i hi have e : q i 0 = (if (s 0 * r i 0).val ≤ 3 then (1 : ZMod 7) else -1) * (s 0 * r i 0) := by simp only [q, t, if_neg hi]; ring rw [e]; exact sgn_low _ (mul_ne_zero (hs0 0) (hnz i 0)) exact no_rows_normal q qnz qnorm qorth qmin qlow0 qlowi
The projection of C onto the first 3 coordinates is an isomorphism
By the MDS minimum distance property (d = 6), no non-zero codeword can vanish on 3 coordinates.
theorem so_rows_of_code (F : Type*) [Field F] [Fintype F] [DecidableEq F] (C : Subspace F (Fin 8 → F)) (hC : is_self_orthogonal_mds_code 8 3 C) : ∃ r : Fin 3 → Fin 5 → F, (∀ i a, r i a ≠ 0) ∧ (∀ i, ∑ a, r i a * r i a = -1) ∧ (∀ i j, i ≠ j → ∑ a, r i a * r j a = 0) ∧ (∀ i j, i ≠ j → ∀ a b, a ≠ b → r i a * r j b - r i b * r j a ≠ 0) := by obtain ⟨horth, hdim, hdist⟩ := hC have hZ : ∀ v ∈ C, ∀ i j k : Fin 8, i ≠ j → i ≠ k → j ≠ k → v i = 0 → v j = 0 → v k = 0 → v = 0 := by intro v hv i j k hij hik hjk hi hj hk by_contra h0 have h6 := hdist v hv h0 have hsub : Finset.univ.filter (fun l => v l ≠ 0) ⊆ ({i, j, k} : Finset (Fin 8))ᶜ := by intro l hl simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hl simp only [Finset.mem_compl, Finset.mem_insert, Finset.mem_singleton] rintro (rfl | rfl | rfl) <;> contradiction have hc := Finset.card_le_card hsub rw [Finset.card_compl, Fintype.card_fin, Finset.card_insert_of_notMem (by simp [hij, hik]), Finset.card_pair hjk] at hc have : hammingNorm v = (Finset.univ.filter (fun l => v l ≠ 0)).card := rfl omega let π : C →ₗ[F] (Fin 3 → F) := (LinearMap.funLeft F F (Fin.castAdd 5)).comp C.subtype have hπ : ∀ (v : C) (t : Fin 3), π v t = v.1 (Fin.castAdd 5 t) := fun _ _ => rfl have hinj : Function.Injective π := by rw [← LinearMap.ker_eq_bot, LinearMap.ker_eq_bot'] intro v hv have h0 := congrFun hv 0 have h1 := congrFun hv 1 have h2 := congrFun hv 2 rw [hπ] at h0 h1 h2 apply Subtype.ext exact hZ v.1 v.2 (Fin.castAdd 5 0) (Fin.castAdd 5 1) (Fin.castAdd 5 2) (by decide) (by decide) (by decide) h0 h1 h2 have hsurj : Function.Surjective π := (LinearMap.injective_iff_surjective_of_finrank_eq_finrank (by rw [hdim, Module.finrank_fin_fun])).mp hinj
The systematic block satisfies unit norm and mutual orthogonality
Self-orthogonality of the code translates to row sum of squares -1 and pairwise row dot product 0 for the 3x5 block.
let c : Fin 3 → C := fun i => Classical.choose (hsurj ((Pi.single i (1 : F) : Fin 3 → F))) have hc : ∀ i t, (c i).1 (Fin.castAdd 5 t) = (Pi.single i (1 : F) : Fin 3 → F) t := by intro i t rw [← hπ] exact congrFun (Classical.choose_spec (hsurj ((Pi.single i (1 : F) : Fin 3 → F)))) t let r : Fin 3 → Fin 5 → F := fun i a => (c i).1 (Fin.natAdd 3 a) have hsplit : ∀ u w : Fin 8 → F, ∑ l, u l * w l = ∑ t : Fin 3, u (Fin.castAdd 5 t) * w (Fin.castAdd 5 t) + ∑ a : Fin 5, u (Fin.natAdd 3 a) * w (Fin.natAdd 3 a) := fun u w => Fin.sum_univ_add (a := 3) (b := 5) (fun l => u l * w l) have hfirst : ∀ i j, ∑ t : Fin 3, (c i).1 (Fin.castAdd 5 t) * (c j).1 (Fin.castAdd 5 t) = if i = j then 1 else 0 := by intro i j simp only [hc] fin_cases i <;> fin_cases j <;> simp [Fin.sum_univ_three, Pi.single_apply] have hdot : ∀ i j, (if i = j then (1 : F) else 0) + ∑ a, r i a * r j a = 0 := by intro i j rw [← hfirst i j] have := horth (c i).1 (c i).2 (c j).1 (c j).2 rw [hsplit] at this exact this have hne8 : ∀ (t : Fin 3) (a : Fin 5), (Fin.castAdd 5 t : Fin 8) ≠ Fin.natAdd 3 a := by intro t a h have := congrArg Fin.val h simp only [Fin.val_castAdd, Fin.val_natAdd] at this omega have hne3 : ∀ t t' : Fin 3, t ≠ t' → (Fin.castAdd 5 t : Fin 8) ≠ Fin.castAdd 5 t' := fun t t' h h' => h (Fin.castAdd_injective _ _ h') have hne5 : ∀ a b : Fin 5, a ≠ b → (Fin.natAdd 3 a : Fin 8) ≠ Fin.natAdd 3 b := fun a b h h' => h (Fin.natAdd_injective _ _ h')
The systematic block has non-zero entries and non-zero 2x2 minors
A vanishing entry or a vanishing 2x2 minor would yield a non-zero codeword with at least 3 zeros, contradicting the MDS property.
have hnz : ∀ i a, r i a ≠ 0 := by intro i a h obtain ⟨j, k, hji, hki, hjk⟩ : ∃ j k : Fin 3, j ≠ i ∧ k ≠ i ∧ j ≠ k := by fin_cases i <;> decide have h0 := hZ (c i).1 (c i).2 _ _ _ (hne3 j k hjk) (hne8 j a) (hne8 k a) (by rw [hc]; simp [Pi.single_apply, hji]) (by rw [hc]; simp [Pi.single_apply, hki]) h have h1 := hc i i rw [h0] at h1 simp at h1 refine ⟨r, hnz, ?_, ?_, ?_⟩ · intro i have := hdot i i rw [if_pos rfl] at this linear_combination this · intro i j hij have := hdot i j rw [if_neg hij, zero_add] at this exact this · intro i j hij a b hab hm obtain ⟨k, hki, hkj⟩ : ∃ k : Fin 3, k ≠ i ∧ k ≠ j := by fin_cases i <;> fin_cases j <;> first | exact absurd rfl hij | decide let w : C := r j a • c i - r i a • c j have hw : ∀ l, w.1 l = r j a * (c i).1 l - r i a * (c j).1 l := fun l => rfl have h0 := hZ w.1 w.2 (Fin.castAdd 5 k) (Fin.natAdd 3 a) (Fin.natAdd 3 b) (hne8 k a) (hne8 k b) (hne5 a b hab) (by rw [hw, hc, hc]; simp [Pi.single_apply, hki, hkj]) (by rw [hw]; simp only [r]; ring) (by rw [hw]; simp only [r] at hm ⊢; linear_combination -hm) have h1 := hw (Fin.castAdd 5 i) rw [h0, hc, hc] at h1 simp [Pi.single_apply, Ne.symm hij] at h1 exact hnz j a h1.symm
Nonexistence of self-orthogonal [8, 3] MDS codes over fields of order 7
Any such code over F induces a systematic 3x5 block; mapping to ZMod 7 via the field isomorphism yields a contradiction with no_rows.
uses
charP_of_card_eq_prime,SoMds7.no_rows,SoMds7.so_rows_of_code/-- Nonexistence of 7-ary [8, 3] self-orthogonal MDS codes (first open case of arXiv:2611.30048 Conjecture 2). -/ theorem self_orthogonal_mds_card7_nonexistence (F : Type*) [Field F] [Fintype F] [DecidableEq F] (hF : Fintype.card F = 7) : ¬ ∃ C : Subspace F (Fin 8 → F), is_self_orthogonal_mds_code 8 3 C := by rintro ⟨C, hC⟩ obtain ⟨r, hnz, hnorm, horth, hmin⟩ := SoMds7.so_rows_of_code F C hC have : Fact (Nat.Prime 7) := ⟨by norm_num⟩ have : CharP F 7 := charP_of_card_eq_prime hF let e : F ≃+* ZMod 7 := (ZMod.ringEquiv F hF).symm apply SoMds7.no_rows (fun i a => e (r i a)) · intro i a h exact hnz i a (e.map_eq_zero_iff.mp h) · intro i have := congrArg e (hnorm i) simpa [map_sum, map_mul, map_neg, map_one] using this · intro i j hij have := congrArg e (horth i j hij) simpa [map_sum, map_mul, map_zero] using this · intro i j hij a b hab h apply hmin i j hij a b hab apply e.injective simpa [map_sub, map_mul] using h
imp_of- A boolean implication (!A || B) = true and hypothesis A = true imply B = true
check_all- Certificate that the exhaustive search over normalized configurations checkAll evaluates to true
no_rows_normal- No normalized 3x5 matrix over ZMod 7 satisfies the MDS self-orthogonality conditions
no_rows- No 3x5 matrix over ZMod 7 satisfies the MDS self-orthogonality conditions
SoMds7.so_rows_of_code- Extracts a 3x5 systematic block from a self-orthogonal MDS code with the specified norm, orthogonality, and minor conditions
charP_of_card_eq_prime- Any field of prime cardinality p has characteristic p
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
namespace SoMds7def inv7 : ZMod 7 → ZMod 7 := fun x => x ^ 5theorem inv7_spec : ∀ x : ZMod 7, x ≠ 0 → x * inv7 x = 1 := by decide +kerneldef low (x : ZMod 7) : Bool := x.val ≤ 3 && x ≠ 0def nz5 (a b c d e : ZMod 7) : Bool := a ≠ 0 && b ≠ 0 && c ≠ 0 && d ≠ 0 && e ≠ 0def sq5 (a b c d e : ZMod 7) : ZMod 7 := a*a + b*b + c*c + d*d + e*edef mn (a b c d : ZMod 7) : Bool := a * d - b * c ≠ 0def minors (x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 : ZMod 7) : Bool := mn x1 x2 y1 y2 && mn x1 x3 y1 y3 && mn x1 x4 y1 y4 && mn x1 x5 y1 y5 && mn x2 x3 y2 y3 && mn x2 x4 y2 y4 && mn x2 x5 y2 y5 && mn x3 x4 y3 y4 && mn x3 x5 y3 y5 && mn x4 x5 y4 y5def y5f (x1 x2 x3 x4 x5 y1 y2 y3 y4 : ZMod 7) : ZMod 7 := -(x1*y1 + x2*y2 + x3*y3 + x4*y4) * inv7 x5def z4f (x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 : ZMod 7) : ZMod 7 := (-(x1*z1 + x2*z2 + x3*z3) * y5 - -(y1*z1 + y2*z2 + y3*z3) * x5) * inv7 (x4*y5 - x5*y4)def z5f (x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 : ZMod 7) : ZMod 7 := (x4 * -(y1*z1 + y2*z2 + y3*z3) - y4 * -(x1*z1 + x2*z2 + x3*z3)) * inv7 (x4*y5 - x5*y4)def third (x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 : ZMod 7) : Bool := let z4 := z4f x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 let z5 := z5f x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3 nz5 z1 z2 z3 z4 z5 && sq5 z1 z2 z3 z4 z5 = 6 && minors x1 x2 x3 x4 x5 z1 z2 z3 z4 z5 && minors y1 y2 y3 y4 y5 z1 z2 z3 z4 z5def checkX (x1 x2 x3 x4 x5 : ZMod 7) : Bool := (List.finRange 7).all fun y1 => (List.finRange 7).all fun y2 => (List.finRange 7).all fun y3 => (List.finRange 7).all fun y4 => let y1 : ZMod 7 := y1; let y2 : ZMod 7 := y2; let y3 : ZMod 7 := y3; let y4 : ZMod 7 := y4 let y5 := y5f x1 x2 x3 x4 x5 y1 y2 y3 y4 !(low y1 && nz5 y1 y2 y3 y4 y5 && sq5 y1 y2 y3 y4 y5 = 6 && minors x1 x2 x3 x4 x5 y1 y2 y3 y4 y5) || ((List.finRange 7).all fun z1 => (List.finRange 7).all fun z2 => (List.finRange 7).all fun z3 => !(low (z1 : ZMod 7) && third x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 z1 z2 z3))def checkAll : Bool := (List.finRange 7).all fun x1 => (List.finRange 7).all fun x2 => (List.finRange 7).all fun x3 => (List.finRange 7).all fun x4 => (List.finRange 7).all fun x5 => !(low (x1 : ZMod 7) && low (x2 : ZMod 7) && low (x3 : ZMod 7) && low (x4 : ZMod 7) && low (x5 : ZMod 7) && sq5 x1 x2 x3 x4 x5 = 6) || checkX x1 x2 x3 x4 x5set_option maxRecDepth 100000 intheorem check_all : checkAll = true := by decide +kerneltheorem sgn_sq (x : ZMod 7) : (if x.val ≤ 3 then (1 : ZMod 7) else -1) * (if x.val ≤ 3 then (1 : ZMod 7) else -1) = 1 := by split_ifs <;> decidetheorem sgn_ne (x : ZMod 7) : (if x.val ≤ 3 then (1 : ZMod 7) else -1) ≠ 0 := by split_ifs <;> decidetheorem sgn_low : ∀ x : ZMod 7, x ≠ 0 → low ((if x.val ≤ 3 then (1 : ZMod 7) else -1) * x) = true := by decidetheorem imp_of {A B : Bool} (h : (!A || B) = true) (hA : A = true) : B = true := by cases A <;> cases B <;> simp_alltheorem nz5_true {a b c d e : ZMod 7} (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0) (hd : d ≠ 0) (he : e ≠ 0) : nz5 a b c d e = true := by simp [nz5, ha, hb, hc, hd, he]theorem sq5_true {a b c d e : ZMod 7} (h : a*a + b*b + c*c + d*d + e*e = -1) : decide (sq5 a b c d e = 6) = true := by simp only [sq5, h, decide_eq_true_eq]; decidetheorem minors_true (x y : Fin 5 → ZMod 7) (h : ∀ a b : Fin 5, a ≠ b → x a * y b - x b * y a ≠ 0) : minors (x 0) (x 1) (x 2) (x 3) (x 4) (y 0) (y 1) (y 2) (y 3) (y 4) = true := by simp only [minors, mn, Bool.and_eq_true, decide_eq_true_eq, ne_eq] exact ⟨⟨⟨⟨⟨⟨⟨⟨⟨h 0 1 (by decide), h 0 2 (by decide)⟩, h 0 3 (by decide)⟩, h 0 4 (by decide)⟩, h 1 2 (by decide)⟩, h 1 3 (by decide)⟩, h 1 4 (by decide)⟩, h 2 3 (by decide)⟩, h 2 4 (by decide)⟩, h 3 4 (by decide)⟩theorem low_true_and {a : ZMod 7} {B : Bool} (ha : low a = true) (hB : B = true) : (low a && B) = true := by simp [ha, hB]theorem no_rows_normal (q : Fin 3 → Fin 5 → ZMod 7) (qnz : ∀ i a, q i a ≠ 0) (qnorm : ∀ i, ∑ a, q i a * q i a = -1) (qorth : ∀ i j, i ≠ j → ∑ a, q i a * q j a = 0) (qmin : ∀ i j, i ≠ j → ∀ a b, a ≠ b → q i a * q j b - q i b * q j a ≠ 0) (qlow0 : ∀ a, low (q 0 a) = true) (qlowi : ∀ i, i ≠ 0 → low (q i 0) = true) : False := by -- read the certificate have hc := check_all simp only [checkAll, List.all_eq_true, List.mem_finRange, forall_true_left] at hc have h1 := hc (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) have hx : (low (q 0 0) && low (q 0 1) && low (q 0 2) && low (q 0 3) && low (q 0 4) && decide (sq5 (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) = 6)) = true := by have := qnorm 0 simp only [Fin.sum_univ_five] at this simp [qlow0, sq5_true this] have h2 := imp_of h1 hx simp only [checkX, List.all_eq_true, List.mem_finRange, forall_true_left] at h2 -- the second row have hy5 : q 1 4 = y5f (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) := by have ho := qorth 0 1 (by decide) simp only [Fin.sum_univ_five] at ho have hi := inv7_spec (q 0 4) (qnz 0 4) simp only [y5f] linear_combination (inv7 (q 0 4)) * ho - (q 1 4) * hi have h3 := h2 (q 1 0) (q 1 1) (q 1 2) (q 1 3) rw [← hy5] at h3 have hy : (low (q 1 0) && nz5 (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) && decide (sq5 (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) = 6) && minors (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4)) = true := by have hn := qnorm 1 simp only [Fin.sum_univ_five] at hn simp only [Bool.and_eq_true] exact ⟨⟨⟨qlowi 1 (by decide), nz5_true (qnz 1 0) (qnz 1 1) (qnz 1 2) (qnz 1 3) (qnz 1 4)⟩, sq5_true hn⟩, minors_true (q 0) (q 1) (qmin 0 1 (by decide))⟩ have h4 := imp_of h3 hy simp only [List.all_eq_true, List.mem_finRange, forall_true_left] at h4 have h5 := h4 (q 2 0) (q 2 1) (q 2 2) -- the third row have hd : q 0 3 * q 1 4 - q 0 4 * q 1 3 ≠ 0 := qmin 0 1 (by decide) 3 4 (by decide) have hdi := inv7_spec _ hd have ho1 := qorth 0 2 (by decide) have ho2 := qorth 1 2 (by decide) simp only [Fin.sum_univ_five] at ho1 ho2 have hz4 : q 2 3 = z4f (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) (q 2 0) (q 2 1) (q 2 2) := by simp only [z4f] linear_combination (-(q 2 3)) * hdi + (inv7 (q 0 3 * q 1 4 - q 0 4 * q 1 3)) * ((q 1 4) * ho1 - (q 0 4) * ho2) have hz5 : q 2 4 = z5f (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) (q 2 0) (q 2 1) (q 2 2) := by simp only [z5f] linear_combination (-(q 2 4)) * hdi + (inv7 (q 0 3 * q 1 4 - q 0 4 * q 1 3)) * ((q 0 3) * ho2 - (q 1 3) * ho1) have hz : (low (q 2 0) && third (q 0 0) (q 0 1) (q 0 2) (q 0 3) (q 0 4) (q 1 0) (q 1 1) (q 1 2) (q 1 3) (q 1 4) (q 2 0) (q 2 1) (q 2 2)) = true := by simp only [third, ← hz4, ← hz5] have hn := qnorm 2 simp only [Fin.sum_univ_five] at hn simp only [Bool.and_eq_true] exact ⟨qlowi 2 (by decide), ⟨⟨nz5_true (qnz 2 0) (qnz 2 1) (qnz 2 2) (qnz 2 3) (qnz 2 4), sq5_true hn⟩, minors_true (q 0) (q 2) (qmin 0 2 (by decide))⟩, minors_true (q 1) (q 2) (qmin 1 2 (by decide))⟩ rw [hz] at h5 exact absurd h5 (by decide)/-- The finite core: no three rows of a systematic generator. -/theorem no_rows (r : Fin 3 → Fin 5 → ZMod 7) (hnz : ∀ i a, r i a ≠ 0) (hnorm : ∀ i, ∑ a, r i a * r i a = -1) (horth : ∀ i j, i ≠ j → ∑ a, r i a * r j a = 0) (hmin : ∀ i j, i ≠ j → ∀ a b, a ≠ b → r i a * r j b - r i b * r j a ≠ 0) : False := by have : Fact (Nat.Prime 7) := ⟨by norm_num⟩ -- sign normalisation let s : Fin 5 → ZMod 7 := fun a => if (r 0 a).val ≤ 3 then 1 else -1 let t : Fin 3 → ZMod 7 := fun i => if i = 0 then 1 else if (s 0 * r i 0).val ≤ 3 then 1 else -1 have hs2 : ∀ a, s a * s a = 1 := fun a => sgn_sq _ have ht2 : ∀ i, t i * t i = 1 := by intro i; simp only [t]; split_ifs <;> first | norm_num | exact neg_ne_zero.mpr one_ne_zero have hs0 : ∀ a, s a ≠ 0 := fun a => sgn_ne _ have ht0 : ∀ i, t i ≠ 0 := by intro i; simp only [t]; split_ifs <;> first | norm_num | exact neg_ne_zero.mpr one_ne_zero let q : Fin 3 → Fin 5 → ZMod 7 := fun i a => t i * s a * r i a have qnz : ∀ i a, q i a ≠ 0 := fun i a => mul_ne_zero (mul_ne_zero (ht0 i) (hs0 a)) (hnz i a) have qnorm : ∀ i, ∑ a, q i a * q i a = -1 := by intro i rw [← hnorm i] refine Finset.sum_congr rfl (fun a _ => ?_) have e : q i a * q i a = (t i * t i) * (s a * s a) * (r i a * r i a) := by simp only [q]; ring rw [e, ht2, hs2]; ring have qorth : ∀ i j, i ≠ j → ∑ a, q i a * q j a = 0 := by intro i j hij have e : ∑ a, q i a * q j a = t i * t j * ∑ a, r i a * r j a := by rw [Finset.mul_sum] refine Finset.sum_congr rfl (fun a _ => ?_) have e' : q i a * q j a = t i * t j * (s a * s a) * (r i a * r j a) := by simp only [q]; ring rw [e', hs2]; ring rw [e, horth i j hij, mul_zero] have qmin : ∀ i j, i ≠ j → ∀ a b, a ≠ b → q i a * q j b - q i b * q j a ≠ 0 := by intro i j hij a b hab have e : q i a * q j b - q i b * q j a = (t i * t j * s a * s b) * (r i a * r j b - r i b * r j a) := by simp only [q]; ring rw [e] exact mul_ne_zero (mul_ne_zero (mul_ne_zero (mul_ne_zero (ht0 i) (ht0 j)) (hs0 a)) (hs0 b)) (hmin i j hij a b hab) have qlow0 : ∀ a, low (q 0 a) = true := by intro a have e : q 0 a = s a * r 0 a := by simp [q, t] rw [e]; exact sgn_low _ (hnz 0 a) have qlowi : ∀ i, i ≠ 0 → low (q i 0) = true := by intro i hi have e : q i 0 = (if (s 0 * r i 0).val ≤ 3 then (1 : ZMod 7) else -1) * (s 0 * r i 0) := by simp only [q, t, if_neg hi]; ring rw [e]; exact sgn_low _ (mul_ne_zero (hs0 0) (hnz i 0)) exact no_rows_normal q qnz qnorm qorth qmin qlow0 qlowitheorem so_rows_of_code (F : Type*) [Field F] [Fintype F] [DecidableEq F] (C : Subspace F (Fin 8 → F)) (hC : is_self_orthogonal_mds_code 8 3 C) : ∃ r : Fin 3 → Fin 5 → F, (∀ i a, r i a ≠ 0) ∧ (∀ i, ∑ a, r i a * r i a = -1) ∧ (∀ i j, i ≠ j → ∑ a, r i a * r j a = 0) ∧ (∀ i j, i ≠ j → ∀ a b, a ≠ b → r i a * r j b - r i b * r j a ≠ 0) := by obtain ⟨horth, hdim, hdist⟩ := hC have hZ : ∀ v ∈ C, ∀ i j k : Fin 8, i ≠ j → i ≠ k → j ≠ k → v i = 0 → v j = 0 → v k = 0 → v = 0 := by intro v hv i j k hij hik hjk hi hj hk by_contra h0 have h6 := hdist v hv h0 have hsub : Finset.univ.filter (fun l => v l ≠ 0) ⊆ ({i, j, k} : Finset (Fin 8))ᶜ := by intro l hl simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hl simp only [Finset.mem_compl, Finset.mem_insert, Finset.mem_singleton] rintro (rfl | rfl | rfl) <;> contradiction have hc := Finset.card_le_card hsub rw [Finset.card_compl, Fintype.card_fin, Finset.card_insert_of_notMem (by simp [hij, hik]), Finset.card_pair hjk] at hc have : hammingNorm v = (Finset.univ.filter (fun l => v l ≠ 0)).card := rfl omega let π : C →ₗ[F] (Fin 3 → F) := (LinearMap.funLeft F F (Fin.castAdd 5)).comp C.subtype have hπ : ∀ (v : C) (t : Fin 3), π v t = v.1 (Fin.castAdd 5 t) := fun _ _ => rfl have hinj : Function.Injective π := by rw [← LinearMap.ker_eq_bot, LinearMap.ker_eq_bot'] intro v hv have h0 := congrFun hv 0 have h1 := congrFun hv 1 have h2 := congrFun hv 2 rw [hπ] at h0 h1 h2 apply Subtype.ext exact hZ v.1 v.2 (Fin.castAdd 5 0) (Fin.castAdd 5 1) (Fin.castAdd 5 2) (by decide) (by decide) (by decide) h0 h1 h2 have hsurj : Function.Surjective π := (LinearMap.injective_iff_surjective_of_finrank_eq_finrank (by rw [hdim, Module.finrank_fin_fun])).mp hinj let c : Fin 3 → C := fun i => Classical.choose (hsurj ((Pi.single i (1 : F) : Fin 3 → F))) have hc : ∀ i t, (c i).1 (Fin.castAdd 5 t) = (Pi.single i (1 : F) : Fin 3 → F) t := by intro i t rw [← hπ] exact congrFun (Classical.choose_spec (hsurj ((Pi.single i (1 : F) : Fin 3 → F)))) t let r : Fin 3 → Fin 5 → F := fun i a => (c i).1 (Fin.natAdd 3 a) have hsplit : ∀ u w : Fin 8 → F, ∑ l, u l * w l = ∑ t : Fin 3, u (Fin.castAdd 5 t) * w (Fin.castAdd 5 t) + ∑ a : Fin 5, u (Fin.natAdd 3 a) * w (Fin.natAdd 3 a) := fun u w => Fin.sum_univ_add (a := 3) (b := 5) (fun l => u l * w l) have hfirst : ∀ i j, ∑ t : Fin 3, (c i).1 (Fin.castAdd 5 t) * (c j).1 (Fin.castAdd 5 t) = if i = j then 1 else 0 := by intro i j simp only [hc] fin_cases i <;> fin_cases j <;> simp [Fin.sum_univ_three, Pi.single_apply] have hdot : ∀ i j, (if i = j then (1 : F) else 0) + ∑ a, r i a * r j a = 0 := by intro i j rw [← hfirst i j] have := horth (c i).1 (c i).2 (c j).1 (c j).2 rw [hsplit] at this exact this have hne8 : ∀ (t : Fin 3) (a : Fin 5), (Fin.castAdd 5 t : Fin 8) ≠ Fin.natAdd 3 a := by intro t a h have := congrArg Fin.val h simp only [Fin.val_castAdd, Fin.val_natAdd] at this omega have hne3 : ∀ t t' : Fin 3, t ≠ t' → (Fin.castAdd 5 t : Fin 8) ≠ Fin.castAdd 5 t' := fun t t' h h' => h (Fin.castAdd_injective _ _ h') have hne5 : ∀ a b : Fin 5, a ≠ b → (Fin.natAdd 3 a : Fin 8) ≠ Fin.natAdd 3 b := fun a b h h' => h (Fin.natAdd_injective _ _ h') have hnz : ∀ i a, r i a ≠ 0 := by intro i a h obtain ⟨j, k, hji, hki, hjk⟩ : ∃ j k : Fin 3, j ≠ i ∧ k ≠ i ∧ j ≠ k := by fin_cases i <;> decide have h0 := hZ (c i).1 (c i).2 _ _ _ (hne3 j k hjk) (hne8 j a) (hne8 k a) (by rw [hc]; simp [Pi.single_apply, hji]) (by rw [hc]; simp [Pi.single_apply, hki]) h have h1 := hc i i rw [h0] at h1 simp at h1 refine ⟨r, hnz, ?_, ?_, ?_⟩ · intro i have := hdot i i rw [if_pos rfl] at this linear_combination this · intro i j hij have := hdot i j rw [if_neg hij, zero_add] at this exact this · intro i j hij a b hab hm obtain ⟨k, hki, hkj⟩ : ∃ k : Fin 3, k ≠ i ∧ k ≠ j := by fin_cases i <;> fin_cases j <;> first | exact absurd rfl hij | decide let w : C := r j a • c i - r i a • c j have hw : ∀ l, w.1 l = r j a * (c i).1 l - r i a * (c j).1 l := fun l => rfl have h0 := hZ w.1 w.2 (Fin.castAdd 5 k) (Fin.natAdd 3 a) (Fin.natAdd 3 b) (hne8 k a) (hne8 k b) (hne5 a b hab) (by rw [hw, hc, hc]; simp [Pi.single_apply, hki, hkj]) (by rw [hw]; simp only [r]; ring) (by rw [hw]; simp only [r] at hm ⊢; linear_combination -hm) have h1 := hw (Fin.castAdd 5 i) rw [h0, hc, hc] at h1 simp [Pi.single_apply, Ne.symm hij] at h1 exact hnz j a h1.symmend SoMds7/-- Nonexistence of 7-ary [8, 3] self-orthogonal MDS codes (first open case of arXiv:2611.30048 Conjecture 2). -/theorem self_orthogonal_mds_card7_nonexistence (F : Type*) [Field F] [Fintype F] [DecidableEq F] (hF : Fintype.card F = 7) : ¬ ∃ C : Subspace F (Fin 8 → F), is_self_orthogonal_mds_code 8 3 C := by rintro ⟨C, hC⟩ obtain ⟨r, hnz, hnorm, horth, hmin⟩ := SoMds7.so_rows_of_code F C hC have : Fact (Nat.Prime 7) := ⟨by norm_num⟩ have : CharP F 7 := charP_of_card_eq_prime hF let e : F ≃+* ZMod 7 := (ZMod.ringEquiv F hF).symm apply SoMds7.no_rows (fun i a => e (r i a)) · intro i a h exact hnz i a (e.map_eq_zero_iff.mp h) · intro i have := congrArg e (hnorm i) simpa [map_sum, map_mul, map_neg, map_one] using this · intro i j hij have := congrArg e (horth i j hij) simpa [map_sum, map_mul, map_zero] using this · intro i j hij a b hab h apply hmin i j hij a b hab apply e.injective simpa [map_sub, map_mul] using h