self_orthogonal_mds_card5_nonexistence
For any finite field F with decidable equality of cardinality 5, there does not exist any subspace C of (Fin 6 → F) that is a self-orthogonal MDS code of length 6 and dimension 2.
Statement
theorem self_orthogonal_mds_card5_nonexistence (F : Type*) [Field F] [Fintype F] [DecidableEq F] (hF : Fintype.card F = 5) : ¬ ∃ C : Subspace F (Fin 6 → F), is_self_orthogonal_mds_code 6 2 C
- Formalizes
- arXiv:2611.30048 Proposition 4.9
- 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 field $F$ equipped with a finite instance and decidable equality such that the cardinality of $F$ is 5, there does not exist an $F$-subspace $C \subseteq (\mathrm{Fin}\;6 \to F)$ such that $C$ is a self-orthogonal MDS code with length $n = 6$ and dimension $k = 2$ (meaning: every pair of vectors in $C$ has zero standard dot product, the dimension of $C$ over $F$ is 2, and every non-zero vector in $C$ has Hamming norm at least $6 - 2 + 1 = 5$).
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
Assuming for contradiction that a 5-ary [6, 2] self-orthogonal MDS code C exists, any nonzero codeword has at most one zero coordinate. For a basis {U, V}, the coordinate-wise ratio g = V / U is injective on the 5-element support T of U, so g maps T bijectively onto the field, making ∑_{i ∈ T} g(i)^2 = 0. Self-orthogonality and a sign-sum property force U(i)^2 to be constant on T, which implies ∑_{i ∈ T} V(i)^2 = 0. But U must vanish at the single coordinate i0 outside T, where V(i0) must be nonzero, contradicting the self-orthogonality equation V(i0)^2 + ∑_{i ∈ T} V(i)^2 = 0.
The field F has characteristic 5.
Since |F| = 5, the cast of 5 is zero in F by FiniteField.cast_card_eq_zero. Thus ringChar F divides 5 by ringChar.spec. Since 5 is prime (Nat.dvd_prime, Nat.prime_five) and the characteristic cannot be 1 (CharP.ringChar_ne_one), ringChar F = 5, establishing CharP F 5 via ringChar.of_eq.
uses
FiniteField.cast_card_eq_zero,ringChar.spec,CharP.ringChar_ne_one,Nat.dvd_prime,Nat.prime_five,ringChar.of_eqhaveI : Finite F := inferInstance have h5 : ((5 : F)) = 0 := by have h := FiniteField.cast_card_eq_zero F rwa [hF] at h have hdvd : ringChar F ∣ 5 := (ringChar.spec F 5).mp h5 have hne : ringChar F ≠ 1 := CharP.ringChar_ne_one have hrc : ringChar F = 5 := by rcases (Nat.dvd_prime Nat.prime_five).mp hdvd with h | h · exact absurd h hne · exact h exact ringChar.of_eq hrc
Every nonzero element x in F satisfies x^2 = 1 or x^2 = -1.
By Fermat's Little Theorem for finite fields, x^4 = 1 (FiniteField.pow_card_sub_one_eq_one). Factoring yields (x^2 - 1) * (x^2 + 1) = 0. Since F is a field with no zero divisors (mul_eq_zero.mp), either x^2 - 1 = 0, giving x^2 = 1, or x^2 + 1 = 0, giving x^2 = -1.
uses
FiniteField.pow_card_sub_one_eq_one,mul_eq_zero.mphave h4 : x ^ 4 = 1 := by have h := FiniteField.pow_card_sub_one_eq_one x hx rwa [show Fintype.card F - 1 = 4 by omega] at h have hfac : (x ^ 2 - 1) * (x ^ 2 + 1) = 0 := by have hh : (x ^ 2 - 1) * (x ^ 2 + 1) = x ^ 4 - 1 := by ring rw [hh, h4]; ring rcases mul_eq_zero.mp hfac with h | h · left; linear_combination h · right; linear_combination h
The 5-element set s partitions into A = {x ∈ s | mu x = 1} and Bc = {x ∈ s | mu x ≠ 1}, with |A| + |Bc| = 5.
The subsets A and Bc partition s into disjoint sets by Finset.disjoint_filter_filter_not, and their union is s. By Finset.card_union_of_disjoint, |A| + |Bc| = 5.
uses
Finset.filter_subset,Finset.disjoint_filter_filter_not,Finset.card_union_of_disjointclassical set A := s.filter (fun x => mu x = 1) with hAdef set Bc := s.filter (fun x => ¬ mu x = 1) with hBdef have hAsub : A ⊆ s := by rw [hAdef]; exact Finset.filter_subset _ _ have hBsub : Bc ⊆ s := by rw [hBdef]; exact Finset.filter_subset _ _ have hdisj : Disjoint A Bc := by rw [hAdef, hBdef] exact Finset.disjoint_filter_filter_not s s _ have hAunion : A ∪ Bc = s := by ext x rw [hAdef, hBdef, Finset.mem_union, Finset.mem_filter, Finset.mem_filter] tauto have hcards : A.card + Bc.card = 5 := by rw [← Finset.card_union_of_disjoint hdisj, hAunion, hs]
The sum condition forces |A| = |Bc| when evaluated in F.
Summing mu over A gives |A| • 1 by Finset.sum_const, while summing over Bc gives -|Bc| by Finset.sum_const because mu takes only values in {1, -1}. Splitting the total sum by Finset.sum_filter_add_sum_filter_not gives |A| + (-|Bc|) = 0, which implies |A| = |Bc| in F by add_neg_eq_zero.
uses
Finset.sum_congr,Finset.sum_const,Finset.sum_filter_add_sum_filter_not,add_neg_eq_zero,FiniteField.cast_card_eq_zerohave hAsum : ∑ x ∈ A, mu x = (A.card : F) := by have h1 : ∑ x ∈ A, mu x = ∑ x ∈ A, (1 : F) := by apply Finset.sum_congr rfl intro x hx rw [hAdef] at hx exact (Finset.mem_filter.mp hx).2 rw [h1, Finset.sum_const] simp have hBsum : ∑ x ∈ Bc, mu x = -((Bc.card : F)) := by have h1 : ∑ x ∈ Bc, mu x = ∑ x ∈ Bc, (-1 : F) := by apply Finset.sum_congr rfl intro x hx have hxs : x ∈ s := hBsub hx rw [hBdef] at hx have hnx : ¬ mu x = 1 := (Finset.mem_filter.mp hx).2 rcases hmu x hxs with h | h · exact absurd h hnx · exact h rw [h1, Finset.sum_const] simp have hsplit : ∑ x ∈ A, mu x + ∑ x ∈ Bc, mu x = 0 := by have hv := Finset.sum_filter_add_sum_filter_not s (fun x => mu x = 1) mu rw [← hAdef, ← hBdef] at hv rw [hv, hsum] rw [hAsum, hBsum] at hsplit have hAB : (A.card : F) = (Bc.card : F) := by have h := hsplit; rw [add_neg_eq_zero] at h; exact h have h5 : (5 : F) = 0 := by have hh := FiniteField.cast_card_eq_zero F; rwa [hF] at hh
The cardinality of A is divisible by 5, so |A| = 0 or |A| = 5.
In F, |A| + |Bc| = 5 = 0, so substituting |A| = |Bc| gives 2 * |A| = 0 in F. By CharP.cast_eq_zero_iff, 5 divides 2 * |A|, and since 5 is prime (Nat.Prime.dvd_mul, Nat.prime_five), 5 must divide |A|. Since A ⊆ s, Finset.card_le_card gives |A| ≤ 5, leaving only |A| = 0 or |A| = 5.
uses
Nat.cast_add,CharP.cast_eq_zero_iff,Nat.Prime.dvd_mul,Nat.prime_five,Finset.card_le_cardhave h2 : ((2 * A.card : ℕ) : F) = 0 := by have hc0 : (A.card : F) + (Bc.card : F) = 0 := by rw [← Nat.cast_add, hcards]; exact h5 rw [hAB] at hc0 rw [show ((2 * A.card : ℕ) : F) = (Bc.card : F) + (Bc.card : F) by push_cast; rw [hAB]; ring] exact hc0 have hdiv : 5 ∣ A.card := by have h2d : 5 ∣ 2 * A.card := by rw [← CharP.cast_eq_zero_iff F 5 (2 * A.card)] exact h2 rcases (Nat.Prime.dvd_mul Nat.prime_five).mp h2d with h | h · exact absurd h (by norm_num) · exact h have hAle : A.card ≤ 5 := by rw [← hs]; exact Finset.card_le_card hAsub rcases (by omega : A.card = 0 ∨ A.card = 5) with h0 | h5c
Either mu is identically 1 on s, or mu is identically -1 on s.
If |A| = 0, then A is empty (Finset.card_eq_zero.mp), so mu x ≠ 1 for all x in s, forcing mu x = -1 for all x in s. If |A| = 5, then A = s (Finset.eq_of_subset_of_card_le), so mu x = 1 for all x in s.
uses
Finset.card_eq_zero.mp,Finset.eq_of_subset_of_card_le· right have hAempty : A = ∅ := Finset.card_eq_zero.mp h0 intro x hx rcases hmu x hx with h | h · exfalso have hxA : x ∈ A := by rw [hAdef, Finset.mem_filter]; exact ⟨hx, h⟩ rw [hAempty] at hxA; exact absurd hxA (by simp) · exact h · left intro x hx have hAs : A = s := by apply Finset.eq_of_subset_of_card_le hAsub rw [hs, h5c] have : x ∈ A := by rw [hAs]; exact hx rw [hAdef, Finset.mem_filter] at this exact this.2
Assume for contradiction C exists, and choose a basis {U, V} for C.
Assume C is a self-orthogonal MDS code of dimension 2. Using the characteristic 5 lemma, C is a free module of rank 2 (Module.Free.of_divisionRing), so Module.finBasisOfFinrankEq provides a basis {U, V}. By linear independence (Fintype.linearIndependent_iff, Fin.sum_univ_two), a linear combination c U + d V is zero if and only if c = d = 0.
uses
self_orthogonal_mds_card5_nonexistence_charP,Module.Free.of_divisionRing,Module.finBasisOfFinrankEq,Fintype.linearIndependent_iff,Fin.sum_univ_tworintro ⟨C, hSO, hMDS⟩ obtain ⟨hdim, hmin⟩ := hMDS haveI hCh : CharP F 5 := self_orthogonal_mds_card5_nonexistence_charP F hF haveI hFree : Module.Free F C := Module.Free.of_divisionRing F C haveI hFin : Module.Finite F C := inferInstance let B : Module.Basis (Fin 2) F C := Module.finBasisOfFinrankEq F C hdim let U : Fin 6 → F := (B 0 : C).1 let V : Fin 6 → F := (B 1 : C).1 let pair : F → F → (Fin 2 → F) := fun c d j => if j = 0 then c else d have pair_zero : ∀ c d, pair c d 0 = c := by intro c d; simp [pair] have pair_one : ∀ c d, pair c d 1 = d := by intro c d; simp [pair] have wcoord : ∀ (c d : F) (i : Fin 6), (((c • B 0 + d • B 1 : C)) : Fin 6 → F) i = c * U i + d * V i := by intro c d i simp only [U, V, Submodule.coe_add, Submodule.coe_smul, Pi.add_apply, Pi.smul_apply, smul_eq_mul] have wzero : ∀ (c d : F), ((c • B 0 + d • B 1 : C)) = 0 ↔ c = 0 ∧ d = 0 := by intro c d constructor · intro h have hli := B.linearIndependent rw [Fintype.linearIndependent_iff] at hli have hsum : ∑ i : Fin 2, pair c d i • (B i) = 0 := by rw [Fin.sum_univ_two, pair_zero, pair_one]; exact h have hz := hli (pair c d) hsum exact ⟨by rw [← pair_zero c d]; exact hz 0, by rw [← pair_one c d]; exact hz 1⟩ · rintro ⟨rfl, rfl⟩; simp
No nonzero codeword in C can vanish at two distinct coordinates; hence U has at most one zero coordinate.
The MDS property demands that every nonzero codeword has Hamming weight at least 6 - 2 + 1 = 5. A codeword vanishing at two coordinates would have weight at most 4, which is impossible. Thus, no nonzero linear combination c U + d V can vanish at two distinct coordinates, and in particular U has at most one zero.
uses
Subtype.val_injective,congr_funhave hmin' : ∀ v ∈ C, v ≠ 0 → 5 ≤ hammingNorm v := by intro v hv hv0 have := hmin v hv hv0 simpa using this have hUmem : U ∈ C := (B 0).2 have hUne : U ≠ 0 := by intro h have hB0 : (B 0 : C) ≠ 0 := B.ne_zero 0 exact hB0 (Subtype.val_injective (by funext k; exact congr_fun h k)) have hweight4 : ∀ (v : Fin 6 → F) (i l : Fin 6), i ≠ l → v i = 0 → v l = 0 → hammingNorm v ≤ 4 := by intro v i l hne hi hl rw [hammingNorm] have hsub : Finset.univ.filter (fun j => v j ≠ 0) ⊆ Finset.univ \ ({i, l} : Finset (Fin 6)) := by intro j hj simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hj simp only [Finset.mem_sdiff, Finset.mem_univ, Finset.mem_insert, Finset.mem_singleton, true_and] rintro (rfl | rfl) · exact hj hi · exact hj hl have hcard : (Finset.univ \ ({i, l} : Finset (Fin 6))).card = 4 := by rw [Finset.card_sdiff]; simp [hne] calc (Finset.univ.filter (fun j => v j ≠ 0)).card ≤ (Finset.univ \ ({i, l} : Finset (Fin 6))).card := Finset.card_le_card hsub _ = 4 := hcard have no_two_zeros : ∀ (c d : F), ¬ (c = 0 ∧ d = 0) → ∀ i j : Fin 6, i ≠ j → c * U i + d * V i = 0 → c * U j + d * V j = 0 → False := by intro c d hcd i j hij hi hj have hvm : (fun k => c * U k + d * V k) ∈ C := by have he : (fun k => c * U k + d * V k) = ((c • B 0 + d • B 1 : C) : Fin 6 → F) := by funext k; exact (wcoord c d k).symm rw [he]; exact (c • B 0 + d • B 1).2 have hv0 : (fun k => c * U k + d * V k) ≠ 0 := by intro h have hc : (c • B 0 + d • B 1 : C) = 0 := by apply Subtype.val_injective funext k have hk := congr_fun h k rw [wcoord c d k] simpa using hk exact hcd ((wzero c d).mp hc) have hge := hmin' _ hvm hv0 have hle := hweight4 (fun k => c * U k + d * V k) i j hij hi hj omega have hzeroAtMostOne : ∀ i j : Fin 6, U i = 0 → U j = 0 → i = j := by intro i j hi hj by_contra hij have hge := hmin' U hUmem hUne have hle := hweight4 U i j hij hi hj omega
The support T of U has size 5, and the ratio function g = V / U is injective on T.
On the support T = {i | U i ≠ 0}, define g(i) = V(i) / U(i) via div_mul_cancel₀. If g(i) = g(j) for distinct i, j in T, the codeword g(j) U - V would vanish at both i and j, contradicting the no-two-zeros property (one_ne_zero). Injectivity of g implies |T| ≤ |F| = 5 (Fintype.card_le_of_injective). Since U has at most one zero, |T| ≥ 6 - 1 = 5 (Finset.card_le_one), so |T| = 5.
uses
div_mul_cancel₀,one_ne_zero,Fintype.card_le_of_injective,Finset.card_le_onelet T : Finset (Fin 6) := Finset.univ.filter (fun i => U i ≠ 0) have hTmem : ∀ i, i ∈ T ↔ U i ≠ 0 := by intro i; simp [T] let g : Fin 6 → F := fun i => V i / U i have hgT : ∀ i ∈ T, V i = g i * U i := by intro i hi have hUi : U i ≠ 0 := (hTmem i).mp hi simp only [g] exact (div_mul_cancel₀ (V i) hUi).symm have hinjOn : Set.InjOn g ↑T := by intro i hi j hj hEq by_contra hne refine no_two_zeros (g j) (-1) (fun h => ?_) i j hne (by rw [hgT i hi, hEq]; ring) (by rw [hgT j hj]; ring) have h2 : (-1 : F) = 0 := h.2 exact one_ne_zero (neg_eq_zero.mp h2) have hcardTle : T.card ≤ 5 := by have hinj' : Function.Injective (fun i : T => g i) := fun a b hab => Subtype.ext (hinjOn a.2 b.2 hab) have hle := Fintype.card_le_of_injective (fun i : T => g i) hinj' rw [hF] at hle simpa using hle have hcardTge : 5 ≤ T.card := by have hcomp : (Finset.univ \ T).card ≤ 1 := by rw [Finset.card_le_one] intro a ha b hb simp only [Finset.mem_sdiff, Finset.mem_univ, true_and] at ha hb rw [hTmem] at ha hb push Not at ha hb exact hzeroAtMostOne a b ha hb have hsplit : (Finset.univ \ T).card = 6 - T.card := by rw [Finset.card_sdiff] simp omega have hcardT : T.card = 5 := by omega
The sum of squares of g on T is zero, and U^2 is identically 1 or identically -1 on T.
Since g is injective on the 5-element set T, its image is all of F (Finset.card_image_of_injOn, Finset.eq_univ_of_card). The sum of squares ∑_{i ∈ T} g(i)^2 equals the sum of squares over all of F, which vanishes by FiniteField.sum_pow_lt_card_sub_one. By self-orthogonality, ∑_{i ∈ T} U(i)^2 = ∑_i U(i)^2 = 0 (Finset.sum_subset). Since each U(i)^2 ∈ {1, -1} (self_orthogonal_mds_card5_nonexistence_sq), the sign lemma (self_orthogonal_mds_card5_nonexistence_sign) forces U^2 to be identically 1 or identically -1 on T.
uses
Finset.card_image_of_injOn,Finset.eq_univ_of_card,FiniteField.sum_pow_lt_card_sub_one,Finset.sum_subset,self_orthogonal_mds_card5_nonexistence_sq,self_orthogonal_mds_card5_nonexistence_signhave himage : (Finset.image g T).card = 5 := by rw [Finset.card_image_of_injOn hinjOn, hcardT] have huniv : Finset.image g T = Finset.univ := by apply Finset.eq_univ_of_card rw [himage, hF] have hsumsq : ∑ i ∈ T, (g i) ^ 2 = 0 := by rw [← Finset.sum_image (f := fun x : F => x ^ 2) hinjOn] rw [huniv] simpa using FiniteField.sum_pow_lt_card_sub_one F 2 (by omega) have hsumU : ∑ i ∈ T, U i ^ 2 = 0 := by rw [Finset.sum_subset (Finset.subset_univ T)] · have := hSO U hUmem U hUmem simpa [sq] using this · intro i _ hi have h0 : U i = 0 := by by_contra h exact hi ((hTmem i).mpr h) rw [h0]; ring have hsign : (∀ i ∈ T, U i ^ 2 = 1) ∨ (∀ i ∈ T, U i ^ 2 = -1) := by apply self_orthogonal_mds_card5_nonexistence_sign F hF T (fun i => U i ^ 2) hcardT · intro i hi rcases self_orthogonal_mds_card5_nonexistence_sq F hF (U i) ((hTmem i).mp hi) with h | h · exact Or.inl h · exact Or.inr h · exact hsumU
The sum of squares of V on T is zero: ∑_{i ∈ T} V(i)^2 = 0.
Since V(i) = g(i) * U(i), we have V(i)^2 = g(i)^2 * U(i)^2. Factoring the constant sign U(i)^2 = ±1 out of the sum using Finset.sum_congr and Finset.sum_neg_distrib gives ∑_{i ∈ T} V(i)^2 = ± ∑_{i ∈ T} g(i)^2 = ± 0 = 0.
uses
Finset.sum_congr,Finset.sum_neg_distribhave hVsq : ∑ i ∈ T, V i ^ 2 = 0 := by have hstep : ∑ i ∈ T, V i ^ 2 = ∑ i ∈ T, (g i) ^ 2 * U i ^ 2 := by apply Finset.sum_congr rfl intro i hi rw [hgT i hi]; ring rw [hstep] rcases hsign with h | h · have h1 : ∑ i ∈ T, (g i) ^ 2 * U i ^ 2 = ∑ i ∈ T, (g i) ^ 2 := by apply Finset.sum_congr rfl intro i hi rw [h i hi]; ring rw [h1, hsumsq] · have h1 : ∑ i ∈ T, (g i) ^ 2 * U i ^ 2 = -(∑ i ∈ T, (g i) ^ 2) := by rw [← Finset.sum_neg_distrib] apply Finset.sum_congr rfl intro i hi rw [h i hi]; ring rw [h1, hsumsq]; ring
There is a unique index i0 ∉ T where U(i0) = 0, and at this coordinate V(i0) ≠ 0.
Since |T| = 5 < 6, there exists an index i0 with U(i0) = 0. If V(i0) were also zero, then for any j ∈ T, the linear combination V(j) U - U(j) V would be nonzero (since U(j) ≠ 0) and vanish at both i0 and j, which violates the no-two-zeros property. Hence V(i0) ≠ 0.
uses
Finset.card_pos.mphave hex : ∃ i0, U i0 = 0 := by by_contra h have hall : ∀ i, U i ≠ 0 := by intro i hi; exact h ⟨i, hi⟩ have hTuniv : T = Finset.univ := Finset.eq_univ_of_forall (fun i => (hTmem i).mpr (hall i)) rw [hTuniv] at hcardT simp at hcardT obtain ⟨i0, hi0⟩ := hex have hi0notT : i0 ∉ T := by rw [hTmem]; exact fun h => h hi0 have hVi0 : V i0 ≠ 0 := by intro hV obtain ⟨j, hjT⟩ := Finset.card_pos.mp (by omega : 0 < T.card) have hUj : U j ≠ 0 := (hTmem j).mp hjT have hji : i0 ≠ j := by rintro rfl; exact hUj hi0 exact no_two_zeros (V j) (-U j) (fun h => hUj (neg_eq_zero.mp h.2)) i0 j hji (by rw [hi0, hV]; ring) (by ring)
Contradiction obtained from self-orthogonality of V, showing no such code exists.
Self-orthogonality gives ∑_i V(i)^2 = 0. Splitting off the coordinate i0 (Finset.sum_insert, Finset.card_erase_of_mem) gives V(i0)^2 + ∑_{i ∈ T} V(i)^2 = 0. Since the sum over T is zero, V(i0)^2 = 0. In a field, this implies V(i0) = 0 (mul_self_eq_zero.mp), contradicting V(i0) ≠ 0. Thus no such self-orthogonal MDS code exists.
uses
Finset.sum_insert,Finset.card_erase_of_mem,mul_self_eq_zero.mphave htot : ∑ i, V i ^ 2 = 0 := by have := hSO V (B 1).2 V (B 1).2 simpa [sq] using this have hsumuniv : V i0 ^ 2 + ∑ i ∈ Finset.univ.erase i0, V i ^ 2 = 0 := by have h := Finset.sum_insert (Finset.notMem_erase i0 Finset.univ) (f := fun i => V i ^ 2) rw [Finset.insert_erase (Finset.mem_univ i0)] at h rw [← h]; exact htot have heq : T = Finset.univ.erase i0 := by apply Finset.eq_of_subset_of_card_le · intro i hi rw [Finset.mem_erase] exact ⟨fun h => hi0notT (h ▸ hi), Finset.mem_univ i⟩ · rw [Finset.card_erase_of_mem (Finset.mem_univ i0), Finset.card_univ, hcardT] simp have hVsqT : ∑ i ∈ T, V i ^ 2 = -(V i0 ^ 2) := by rw [heq] linear_combination hsumuniv have h1 : -V i0 ^ 2 = 0 := by rw [← hVsqT, hVsq] have hfinal : V i0 ^ 2 = 0 := neg_eq_zero.mp h1 rw [sq] at hfinal exact hVi0 (mul_self_eq_zero.mp hfinal)
FiniteField.cast_card_eq_zero- The canonical image of the cardinality of a finite field in that field is zero.
ringChar.spec- An integer's image in a semiring is zero if and only if the ring characteristic divides that integer.
CharP.ringChar_ne_one- In any nontrivial semiring, the characteristic is not equal to 1.
Nat.dvd_prime- A natural number m divides a prime p if and only if m = 1 or m = p.
Nat.prime_five- The number 5 is prime.
ringChar.of_eq- If the characteristic of R equals p, then R has characteristic p.
FiniteField.pow_card_sub_one_eq_one- In a finite field, every nonzero element raised to the cardinality minus 1 equals 1.
mul_eq_zero.mp- If a product in a domain is zero, then at least one of the factors is zero.
Finset.filter_subset- Filtering a finset by a predicate yields a subset of the original finset.
Finset.disjoint_filter_filter_not- The sub-finset satisfying a predicate and the sub-finset satisfying its negation are disjoint.
Finset.card_union_of_disjoint- The cardinality of the union of two disjoint finsets is the sum of their cardinalities.
Finset.sum_congr- Sums of pointwise equal functions over the same finset are equal.
Finset.sum_const- The sum of a constant value over a finset is the cardinality times that constant.
Finset.sum_filter_add_sum_filter_not- The sum over a finset equals the sum over elements satisfying a predicate plus the sum over those that do not.
add_neg_eq_zero- In an additive group, a + (-b) = 0 if and only if a = b.
Nat.cast_add- The natural cast distributes over addition.
CharP.cast_eq_zero_iff- In a ring of characteristic p, the cast of a natural number x is zero if and only if p divides x.
Nat.Prime.dvd_mul- If a prime divides a product of natural numbers, it divides at least one of the factors.
Finset.card_le_card- If one finset is a subset of another, its cardinality is less than or equal to the other's.
Finset.card_eq_zero.mp- A finset has cardinality zero if and only if it is empty.
Finset.eq_of_subset_of_card_le- A subset of a finset with at least as many elements as the superset is equal to the superset.
self_orthogonal_mds_card5_nonexistence_charP- A finite field of cardinality 5 has characteristic 5.
Module.Free.of_divisionRing- Every vector space over a division ring is a free module.
Module.finBasisOfFinrankEq- Constructs a basis of Fin n for a free module whose rank equals n.
Fintype.linearIndependent_iff- A family is linearly independent if and only if any linear combination summing to zero has all zero coefficients.
Fin.sum_univ_two- The sum of a function over Fin 2 is the sum of its values at 0 and 1.
Subtype.val_injective- The subtype coercion embedding is injective.
congr_fun- Equal functions take equal values at any argument.
div_mul_cancel₀- Dividing a by nonzero b and then multiplying by b gives a.
one_ne_zero- In a nontrivial semiring, 1 is not equal to 0.
Fintype.card_le_of_injective- An injective map between finite types implies the domain's cardinality is at most the codomain's.
Finset.card_le_one- A finset has cardinality at most 1 if and only if any two elements in it are equal.
Finset.card_image_of_injOn- The image of a finset under an injective-on-subset function has the same cardinality as the finset.
Finset.eq_univ_of_card- A subset of a finite type with cardinality equal to the type's cardinality is the universal set.
FiniteField.sum_pow_lt_card_sub_one- The sum of powers x^i over all elements of a finite field is zero whenever 0 < i < |K| - 1.
Finset.sum_subset- Summing over a subset is equal to summing over the whole set if the function is zero on the complement.
self_orthogonal_mds_card5_nonexistence_sq- In a field of cardinality 5, every nonzero element satisfies x^2 = 1 or x^2 = -1.
self_orthogonal_mds_card5_nonexistence_sign- A sum of signs {1, -1} over 5 elements vanishes only if all elements are 1 or all are -1.
Finset.sum_neg_distrib- Sum of negatives over a finset is the negative of the sum.
Finset.card_pos.mp- A finset has strictly positive cardinality if and only if it is nonempty.
Finset.sum_insert- Splitting off an element from a sum over an inserted finset.
Finset.card_erase_of_mem- The cardinality of a finset after erasing a member is its cardinality minus 1.
mul_self_eq_zero.mp- If x^2 = 0 in a semiring with no zero divisors, then x = 0.
- The proof relies on three private helper lemmas: the characteristic of a 5-element field is 5, every nonzero element of F has square in {1, -1}, and any {1, -1}-valued function on a 5-element set with zero sum must be constant.
- An MDS code of length 6 and dimension 2 has minimum Hamming distance 6 - 2 + 1 = 5, which means every nonzero codeword has at most one zero coordinate.
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.
private lemma self_orthogonal_mds_card5_nonexistence_charP (F : Type*) [Field F] [Fintype F] (hF : Fintype.card F = 5) : CharP F 5 := by haveI : Finite F := inferInstance have h5 : ((5 : F)) = 0 := by have h := FiniteField.cast_card_eq_zero F rwa [hF] at h have hdvd : ringChar F ∣ 5 := (ringChar.spec F 5).mp h5 have hne : ringChar F ≠ 1 := CharP.ringChar_ne_one have hrc : ringChar F = 5 := by rcases (Nat.dvd_prime Nat.prime_five).mp hdvd with h | h · exact absurd h hne · exact h exact ringChar.of_eq hrcprivate lemma self_orthogonal_mds_card5_nonexistence_sq (F : Type*) [Field F] [Fintype F] (hF : Fintype.card F = 5) (x : F) (hx : x ≠ 0) : x ^ 2 = 1 ∨ x ^ 2 = -1 := by have h4 : x ^ 4 = 1 := by have h := FiniteField.pow_card_sub_one_eq_one x hx rwa [show Fintype.card F - 1 = 4 by omega] at h have hfac : (x ^ 2 - 1) * (x ^ 2 + 1) = 0 := by have hh : (x ^ 2 - 1) * (x ^ 2 + 1) = x ^ 4 - 1 := by ring rw [hh, h4]; ring rcases mul_eq_zero.mp hfac with h | h · left; linear_combination h · right; linear_combination hprivate lemma self_orthogonal_mds_card5_nonexistence_sign (F : Type*) [Field F] [Fintype F] [DecidableEq F] (hF : Fintype.card F = 5) [CharP F 5] {α : Type*} [DecidableEq α] (s : Finset α) (mu : α → F) (hs : s.card = 5) (hmu : ∀ x ∈ s, mu x = 1 ∨ mu x = -1) (hsum : ∑ x ∈ s, mu x = 0) : (∀ x ∈ s, mu x = 1) ∨ (∀ x ∈ s, mu x = -1) := by classical set A := s.filter (fun x => mu x = 1) with hAdef set Bc := s.filter (fun x => ¬ mu x = 1) with hBdef have hAsub : A ⊆ s := by rw [hAdef]; exact Finset.filter_subset _ _ have hBsub : Bc ⊆ s := by rw [hBdef]; exact Finset.filter_subset _ _ have hdisj : Disjoint A Bc := by rw [hAdef, hBdef] exact Finset.disjoint_filter_filter_not s s _ have hAunion : A ∪ Bc = s := by ext x rw [hAdef, hBdef, Finset.mem_union, Finset.mem_filter, Finset.mem_filter] tauto have hcards : A.card + Bc.card = 5 := by rw [← Finset.card_union_of_disjoint hdisj, hAunion, hs] have hAsum : ∑ x ∈ A, mu x = (A.card : F) := by have h1 : ∑ x ∈ A, mu x = ∑ x ∈ A, (1 : F) := by apply Finset.sum_congr rfl intro x hx rw [hAdef] at hx exact (Finset.mem_filter.mp hx).2 rw [h1, Finset.sum_const] simp have hBsum : ∑ x ∈ Bc, mu x = -((Bc.card : F)) := by have h1 : ∑ x ∈ Bc, mu x = ∑ x ∈ Bc, (-1 : F) := by apply Finset.sum_congr rfl intro x hx have hxs : x ∈ s := hBsub hx rw [hBdef] at hx have hnx : ¬ mu x = 1 := (Finset.mem_filter.mp hx).2 rcases hmu x hxs with h | h · exact absurd h hnx · exact h rw [h1, Finset.sum_const] simp have hsplit : ∑ x ∈ A, mu x + ∑ x ∈ Bc, mu x = 0 := by have hv := Finset.sum_filter_add_sum_filter_not s (fun x => mu x = 1) mu rw [← hAdef, ← hBdef] at hv rw [hv, hsum] rw [hAsum, hBsum] at hsplit have hAB : (A.card : F) = (Bc.card : F) := by have h := hsplit; rw [add_neg_eq_zero] at h; exact h have h5 : (5 : F) = 0 := by have hh := FiniteField.cast_card_eq_zero F; rwa [hF] at hh have h2 : ((2 * A.card : ℕ) : F) = 0 := by have hc0 : (A.card : F) + (Bc.card : F) = 0 := by rw [← Nat.cast_add, hcards]; exact h5 rw [hAB] at hc0 rw [show ((2 * A.card : ℕ) : F) = (Bc.card : F) + (Bc.card : F) by push_cast; rw [hAB]; ring] exact hc0 have hdiv : 5 ∣ A.card := by have h2d : 5 ∣ 2 * A.card := by rw [← CharP.cast_eq_zero_iff F 5 (2 * A.card)] exact h2 rcases (Nat.Prime.dvd_mul Nat.prime_five).mp h2d with h | h · exact absurd h (by norm_num) · exact h have hAle : A.card ≤ 5 := by rw [← hs]; exact Finset.card_le_card hAsub rcases (by omega : A.card = 0 ∨ A.card = 5) with h0 | h5c · right have hAempty : A = ∅ := Finset.card_eq_zero.mp h0 intro x hx rcases hmu x hx with h | h · exfalso have hxA : x ∈ A := by rw [hAdef, Finset.mem_filter]; exact ⟨hx, h⟩ rw [hAempty] at hxA; exact absurd hxA (by simp) · exact h · left intro x hx have hAs : A = s := by apply Finset.eq_of_subset_of_card_le hAsub rw [hs, h5c] have : x ∈ A := by rw [hAs]; exact hx rw [hAdef, Finset.mem_filter] at this exact this.2/-- Nonexistence of 5-ary [6, 2] self-orthogonal MDS codes (Proposition 4.9 of arXiv:2611.30048). -/theorem self_orthogonal_mds_card5_nonexistence (F : Type*) [Field F] [Fintype F] [DecidableEq F] (hF : Fintype.card F = 5) : ¬ ∃ C : Subspace F (Fin 6 → F), is_self_orthogonal_mds_code 6 2 C := by rintro ⟨C, hSO, hMDS⟩ obtain ⟨hdim, hmin⟩ := hMDS haveI hCh : CharP F 5 := self_orthogonal_mds_card5_nonexistence_charP F hF haveI hFree : Module.Free F C := Module.Free.of_divisionRing F C haveI hFin : Module.Finite F C := inferInstance let B : Module.Basis (Fin 2) F C := Module.finBasisOfFinrankEq F C hdim let U : Fin 6 → F := (B 0 : C).1 let V : Fin 6 → F := (B 1 : C).1 let pair : F → F → (Fin 2 → F) := fun c d j => if j = 0 then c else d have pair_zero : ∀ c d, pair c d 0 = c := by intro c d; simp [pair] have pair_one : ∀ c d, pair c d 1 = d := by intro c d; simp [pair] have wcoord : ∀ (c d : F) (i : Fin 6), (((c • B 0 + d • B 1 : C)) : Fin 6 → F) i = c * U i + d * V i := by intro c d i simp only [U, V, Submodule.coe_add, Submodule.coe_smul, Pi.add_apply, Pi.smul_apply, smul_eq_mul] have wzero : ∀ (c d : F), ((c • B 0 + d • B 1 : C)) = 0 ↔ c = 0 ∧ d = 0 := by intro c d constructor · intro h have hli := B.linearIndependent rw [Fintype.linearIndependent_iff] at hli have hsum : ∑ i : Fin 2, pair c d i • (B i) = 0 := by rw [Fin.sum_univ_two, pair_zero, pair_one]; exact h have hz := hli (pair c d) hsum exact ⟨by rw [← pair_zero c d]; exact hz 0, by rw [← pair_one c d]; exact hz 1⟩ · rintro ⟨rfl, rfl⟩; simp have hmin' : ∀ v ∈ C, v ≠ 0 → 5 ≤ hammingNorm v := by intro v hv hv0 have := hmin v hv hv0 simpa using this have hUmem : U ∈ C := (B 0).2 have hUne : U ≠ 0 := by intro h have hB0 : (B 0 : C) ≠ 0 := B.ne_zero 0 exact hB0 (Subtype.val_injective (by funext k; exact congr_fun h k)) have hweight4 : ∀ (v : Fin 6 → F) (i l : Fin 6), i ≠ l → v i = 0 → v l = 0 → hammingNorm v ≤ 4 := by intro v i l hne hi hl rw [hammingNorm] have hsub : Finset.univ.filter (fun j => v j ≠ 0) ⊆ Finset.univ \ ({i, l} : Finset (Fin 6)) := by intro j hj simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hj simp only [Finset.mem_sdiff, Finset.mem_univ, Finset.mem_insert, Finset.mem_singleton, true_and] rintro (rfl | rfl) · exact hj hi · exact hj hl have hcard : (Finset.univ \ ({i, l} : Finset (Fin 6))).card = 4 := by rw [Finset.card_sdiff]; simp [hne] calc (Finset.univ.filter (fun j => v j ≠ 0)).card ≤ (Finset.univ \ ({i, l} : Finset (Fin 6))).card := Finset.card_le_card hsub _ = 4 := hcard have no_two_zeros : ∀ (c d : F), ¬ (c = 0 ∧ d = 0) → ∀ i j : Fin 6, i ≠ j → c * U i + d * V i = 0 → c * U j + d * V j = 0 → False := by intro c d hcd i j hij hi hj have hvm : (fun k => c * U k + d * V k) ∈ C := by have he : (fun k => c * U k + d * V k) = ((c • B 0 + d • B 1 : C) : Fin 6 → F) := by funext k; exact (wcoord c d k).symm rw [he]; exact (c • B 0 + d • B 1).2 have hv0 : (fun k => c * U k + d * V k) ≠ 0 := by intro h have hc : (c • B 0 + d • B 1 : C) = 0 := by apply Subtype.val_injective funext k have hk := congr_fun h k rw [wcoord c d k] simpa using hk exact hcd ((wzero c d).mp hc) have hge := hmin' _ hvm hv0 have hle := hweight4 (fun k => c * U k + d * V k) i j hij hi hj omega have hzeroAtMostOne : ∀ i j : Fin 6, U i = 0 → U j = 0 → i = j := by intro i j hi hj by_contra hij have hge := hmin' U hUmem hUne have hle := hweight4 U i j hij hi hj omega let T : Finset (Fin 6) := Finset.univ.filter (fun i => U i ≠ 0) have hTmem : ∀ i, i ∈ T ↔ U i ≠ 0 := by intro i; simp [T] let g : Fin 6 → F := fun i => V i / U i have hgT : ∀ i ∈ T, V i = g i * U i := by intro i hi have hUi : U i ≠ 0 := (hTmem i).mp hi simp only [g] exact (div_mul_cancel₀ (V i) hUi).symm have hinjOn : Set.InjOn g ↑T := by intro i hi j hj hEq by_contra hne refine no_two_zeros (g j) (-1) (fun h => ?_) i j hne (by rw [hgT i hi, hEq]; ring) (by rw [hgT j hj]; ring) have h2 : (-1 : F) = 0 := h.2 exact one_ne_zero (neg_eq_zero.mp h2) have hcardTle : T.card ≤ 5 := by have hinj' : Function.Injective (fun i : T => g i) := fun a b hab => Subtype.ext (hinjOn a.2 b.2 hab) have hle := Fintype.card_le_of_injective (fun i : T => g i) hinj' rw [hF] at hle simpa using hle have hcardTge : 5 ≤ T.card := by have hcomp : (Finset.univ \ T).card ≤ 1 := by rw [Finset.card_le_one] intro a ha b hb simp only [Finset.mem_sdiff, Finset.mem_univ, true_and] at ha hb rw [hTmem] at ha hb push Not at ha hb exact hzeroAtMostOne a b ha hb have hsplit : (Finset.univ \ T).card = 6 - T.card := by rw [Finset.card_sdiff] simp omega have hcardT : T.card = 5 := by omega have himage : (Finset.image g T).card = 5 := by rw [Finset.card_image_of_injOn hinjOn, hcardT] have huniv : Finset.image g T = Finset.univ := by apply Finset.eq_univ_of_card rw [himage, hF] have hsumsq : ∑ i ∈ T, (g i) ^ 2 = 0 := by rw [← Finset.sum_image (f := fun x : F => x ^ 2) hinjOn] rw [huniv] simpa using FiniteField.sum_pow_lt_card_sub_one F 2 (by omega) have hsumU : ∑ i ∈ T, U i ^ 2 = 0 := by rw [Finset.sum_subset (Finset.subset_univ T)] · have := hSO U hUmem U hUmem simpa [sq] using this · intro i _ hi have h0 : U i = 0 := by by_contra h exact hi ((hTmem i).mpr h) rw [h0]; ring have hsign : (∀ i ∈ T, U i ^ 2 = 1) ∨ (∀ i ∈ T, U i ^ 2 = -1) := by apply self_orthogonal_mds_card5_nonexistence_sign F hF T (fun i => U i ^ 2) hcardT · intro i hi rcases self_orthogonal_mds_card5_nonexistence_sq F hF (U i) ((hTmem i).mp hi) with h | h · exact Or.inl h · exact Or.inr h · exact hsumU have hVsq : ∑ i ∈ T, V i ^ 2 = 0 := by have hstep : ∑ i ∈ T, V i ^ 2 = ∑ i ∈ T, (g i) ^ 2 * U i ^ 2 := by apply Finset.sum_congr rfl intro i hi rw [hgT i hi]; ring rw [hstep] rcases hsign with h | h · have h1 : ∑ i ∈ T, (g i) ^ 2 * U i ^ 2 = ∑ i ∈ T, (g i) ^ 2 := by apply Finset.sum_congr rfl intro i hi rw [h i hi]; ring rw [h1, hsumsq] · have h1 : ∑ i ∈ T, (g i) ^ 2 * U i ^ 2 = -(∑ i ∈ T, (g i) ^ 2) := by rw [← Finset.sum_neg_distrib] apply Finset.sum_congr rfl intro i hi rw [h i hi]; ring rw [h1, hsumsq]; ring have hex : ∃ i0, U i0 = 0 := by by_contra h have hall : ∀ i, U i ≠ 0 := by intro i hi; exact h ⟨i, hi⟩ have hTuniv : T = Finset.univ := Finset.eq_univ_of_forall (fun i => (hTmem i).mpr (hall i)) rw [hTuniv] at hcardT simp at hcardT obtain ⟨i0, hi0⟩ := hex have hi0notT : i0 ∉ T := by rw [hTmem]; exact fun h => h hi0 have hVi0 : V i0 ≠ 0 := by intro hV obtain ⟨j, hjT⟩ := Finset.card_pos.mp (by omega : 0 < T.card) have hUj : U j ≠ 0 := (hTmem j).mp hjT have hji : i0 ≠ j := by rintro rfl; exact hUj hi0 exact no_two_zeros (V j) (-U j) (fun h => hUj (neg_eq_zero.mp h.2)) i0 j hji (by rw [hi0, hV]; ring) (by ring) have htot : ∑ i, V i ^ 2 = 0 := by have := hSO V (B 1).2 V (B 1).2 simpa [sq] using this have hsumuniv : V i0 ^ 2 + ∑ i ∈ Finset.univ.erase i0, V i ^ 2 = 0 := by have h := Finset.sum_insert (Finset.notMem_erase i0 Finset.univ) (f := fun i => V i ^ 2) rw [Finset.insert_erase (Finset.mem_univ i0)] at h rw [← h]; exact htot have heq : T = Finset.univ.erase i0 := by apply Finset.eq_of_subset_of_card_le · intro i hi rw [Finset.mem_erase] exact ⟨fun h => hi0notT (h ▸ hi), Finset.mem_univ i⟩ · rw [Finset.card_erase_of_mem (Finset.mem_univ i0), Finset.card_univ, hcardT] simp have hVsqT : ∑ i ∈ T, V i ^ 2 = -(V i0 ^ 2) := by rw [heq] linear_combination hsumuniv have h1 : -V i0 ^ 2 = 0 := by rw [← hVsqT, hVsq] have hfinal : V i0 ^ 2 = 0 := neg_eq_zero.mp h1 rw [sq] at hfinal exact hVi0 (mul_self_eq_zero.mp hfinal)