AFTD Auto-Formalizing Theoretical Domains

self_orthogonal_mds_card3_nonexistence

theoremverifiedformalization

For any finite field F with decidable equality of cardinality 3, there does not exist any subspace C of (Fin 4 → F) that is a self-orthogonal MDS code of length 4 and dimension 1.

Statement

theorem self_orthogonal_mds_card3_nonexistence
    (F : Type*) [Field F] [Fintype F] [DecidableEq F]
    (hF : Fintype.card F = 3) :
    ¬ ∃ C : Subspace F (Fin 4 → F),
      is_self_orthogonal_mds_code 4 1 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$ that is finite and has decidable equality, if the cardinality of $F$ is 3, then there does not exist an $F$-subspace $C$ of $\mathrm{Fin}\;4 \to F$ that is a self-orthogonal MDS code of length $n = 4$ and dimension $k = 1$.

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

The proof proceeds by contradiction. An MDS code of length 4 and dimension 1 must have minimum distance 4, so any non-zero codeword has all four coordinates non-zero. Since the field has size 3, its unit group has order 2, forcing the square of every coordinate to equal 1. The self-orthogonality condition then requires the sum of these four squares to vanish, yielding 4 = 0 in F. Since F has characteristic 3, this implies 3 divides 4, an impossibility.

  1. Assuming for contradiction that such a code C exists, there is a non-zero codeword v ∈ C.

    Unpack the definition of a self-orthogonal MDS code C of length 4 and dimension 1. Because dim C = 1 > 0, the subspace C is nontrivial (Module.nontrivial_of_finrank_pos, Nat.zero_lt_one), and therefore there exists a codeword v ∈ C with v ≠ 0 (exists_ne, Subtype.ext).

    lines 7–12

    uses Module.nontrivial_of_finrank_pos, Nat.zero_lt_one, exists_ne, Subtype.ext

      rintro ⟨C, h_ortho, h_dim, h_dist⟩
      have h_nontriv : Nontrivial C := Module.nontrivial_of_finrank_pos (h_dim.symm ▸ Nat.zero_lt_one)
      obtain ⟨⟨v, hv⟩, hvnz⟩ := exists_ne (0 : C)
      have hv_ne_zero : v ≠ 0 := by
        rintro rfl
        exact hvnz (Subtype.ext rfl)
  2. The Hamming norm of v is at least 4.

    By the MDS code property, any non-zero codeword has Hamming norm at least n - k + 1 = 4 - 1 + 1 = 4. Linear arithmetic over ℕ (omega) simplifies this bound to 4 ≤ hammingNorm(v).

    lines 13–15

      have h_norm : 4 ≤ hammingNorm v := by
        have := h_dist v hv hv_ne_zero
        omega
  3. Every coordinate of v is non-zero (v i ≠ 0 for all i ∈ Fin 4).

    The support of v (indices where v j ≠ 0) is a subset of Fin 4 whose size is the Hamming norm of v, at least 4. Since Fin 4 has size 4, the support must be all of Fin 4 (Finset.eq_of_subset_of_card_le, Finset.filter_subset). Thus every index i belongs to the support, meaning v i ≠ 0 (Finset.mem_univ, Finset.mem_filter.mp).

    lines 16–23

    uses Finset.eq_of_subset_of_card_le, Finset.filter_subset, Finset.mem_univ, Finset.mem_filter.mp

      have hv_all_nz : ∀ i : Fin 4, v i ≠ 0 := by
        intro i
        have h_eq : (Finset.univ.filter (fun j => v j ≠ 0)) = Finset.univ := by
          apply Finset.eq_of_subset_of_card_le (Finset.filter_subset _ _)
          simpa [hammingNorm] using h_norm
        have : i ∈ Finset.univ := Finset.mem_univ i
        rw [← h_eq] at this
        exact (Finset.mem_filter.mp this).2
  4. For every coordinate i ∈ Fin 4, (v i)^2 = 1 in F.

    Since v i ≠ 0, it defines a unit u ∈ Fˣ (Units.mk0). The unit group of a field of cardinality 3 has order 3 - 1 = 2 (Fintype.card_units). By Lagrange's theorem (pow_card_eq_one), u^2 = 1, which in the field F means (v i)^2 = 1 (Units.val_pow_eq_pow_val, Units.val_one, Units.val_mk0, sq).

    lines 24–35

    uses Units.mk0, pow_card_eq_one, Fintype.card_units, Units.val_pow_eq_pow_val, Units.val_one, Units.val_mk0, sq

      have h_sq : ∀ i : Fin 4, v i * v i = 1 := by
        intro i
        let u : Fˣ := Units.mk0 (v i) (hv_all_nz i)
        have hu : u ^ (Fintype.card Fˣ) = 1 := pow_card_eq_one
        have h_card : Fintype.card Fˣ = 2 := by
          rw [Fintype.card_units, hF]
        rw [h_card] at hu
        have hu2 : (u : F) ^ 2 = (1 : F) := by
          rw [← Units.val_pow_eq_pow_val, hu, Units.val_one]
        have h_val : (u : F) = v i := Units.val_mk0 (hv_all_nz i)
        rw [h_val, sq] at hu2
        exact hu2
  5. Self-orthogonality forces 4 = 0 in F.

    Self-orthogonality requires the standard inner product ∑ v i * v i to equal 0. Since each term v i * v i equals 1 (Finset.sum_congr), the sum over the 4 coordinates simplifies to 4 • 1 = 4 in F (Finset.sum_const, Finset.card_univ, Fintype.card_fin). Substituting this into the inner product equation gives 4 = 0 in F.

    lines 36–41

    uses Finset.sum_congr, Finset.sum_const, Finset.card_univ, Fintype.card_fin

      have h_sum := h_ortho v hv v hv
      have h_sum_ones : (∑ i : Fin 4, v i * v i) = (4 : F) := by
        calc ∑ i : Fin 4, v i * v i = ∑ i : Fin 4, (1 : F) := Finset.sum_congr rfl (fun i _ => h_sq i)
        _ = 4 • (1 : F) := by rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin]
        _ = (4 : F) := by simp
      rw [h_sum_ones] at h_sum
  6. The condition 4 = 0 in F implies 3 ∣ 4, yielding a contradiction.

    Because |F| = 3 is prime, F has characteristic 3 (charP_of_card_eq_prime). In characteristic 3, an integer m vanishes in F if and only if 3 ∣ m (CharP.cast_eq_zero_iff). Thus 4 = 0 implies 3 ∣ 4. But 3 does not divide 4, which is disproved by decidable computation (decide).

    lines 42–46

    uses charP_of_card_eq_prime, CharP.cast_eq_zero_iff

      have : Fact (Nat.Prime 3) := ⟨by norm_num⟩
      have : CharP F 3 := charP_of_card_eq_prime hF
      have h_div : 3 ∣ 4 := (CharP.cast_eq_zero_iff F 3 4).mp h_sum
      revert h_div
      decide
CharP.cast_eq_zero_iff
In a ring of characteristic p, the coercion of a natural number x is zero if and only if p divides x.
Finset.card_univ
The cardinality of the universal finset of a type equals the cardinality of the type.
Finset.eq_of_subset_of_card_le
If s is a subset of t and the cardinality of t is at most that of s, then s = t.
Finset.filter_subset
The elements of a finset satisfying a predicate form a subset of the original finset.
Finset.mem_filter.mp
An element belongs to a filtered finset only if it belongs to the original finset and satisfies the predicate.
Finset.mem_univ
Every element of a finite type belongs to its universal finset.
Finset.sum_congr
Two sums over finite sets are equal if the sets are equal and the summands agree on every element.
Finset.sum_const
Summing a constant value over a finite set equals the cardinality of the set multiplied by the constant.
Fintype.card_fin
The cardinality of the finite type Fin n is n.
Fintype.card_units
In a finite group with zero (such as a finite field), the number of units is the cardinality of the type minus 1.
Module.nontrivial_of_finrank_pos
A finite module with strictly positive dimension is nontrivial (contains at least two distinct elements).
Nat.zero_lt_one
The natural number 0 is strictly less than 1.
Subtype.ext
Two elements of a subtype are equal if their underlying values are equal.
Units.mk0
Constructs a unit of a group with zero from a non-zero element.
Units.val_one
The coercion of the unit 1 to the ambient monoid is 1.
Units.val_mk0
The underlying element of the unit constructed by Units.mk0 a h is a.
Units.val_pow_eq_pow_val
Coercing a unit raised to a power yields the power of the coerced unit in the ambient monoid.
charP_of_card_eq_prime
A finite ring whose cardinality is a prime p has characteristic p.
exists_ne
In any nontrivial type, for any element x, there exists an element distinct from x.
pow_card_eq_one
In a finite group, raising any element to the power of the group's order yields the identity element (Lagrange's theorem).
sq
Squaring an element a ^ 2 equals a * a.

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

/-- Nonexistence of 3-ary [4, 1] self-orthogonal MDS codes (Proposition 4.9 of arXiv:2611.30048). -/theorem self_orthogonal_mds_card3_nonexistence    (F : Type*) [Field F] [Fintype F] [DecidableEq F]    (hF : Fintype.card F = 3) :    ¬ ∃ C : Subspace F (Fin 4 → F),      is_self_orthogonal_mds_code 4 1 C := by  rintro ⟨C, h_ortho, h_dim, h_dist⟩  have h_nontriv : Nontrivial C := Module.nontrivial_of_finrank_pos (h_dim.symm ▸ Nat.zero_lt_one)  obtain ⟨⟨v, hv⟩, hvnz⟩ := exists_ne (0 : C)  have hv_ne_zero : v ≠ 0 := by    rintro rfl    exact hvnz (Subtype.ext rfl)  have h_norm : 4 ≤ hammingNorm v := by    have := h_dist v hv hv_ne_zero    omega  have hv_all_nz : ∀ i : Fin 4, v i ≠ 0 := by    intro i    have h_eq : (Finset.univ.filter (fun j => v j ≠ 0)) = Finset.univ := by      apply Finset.eq_of_subset_of_card_le (Finset.filter_subset _ _)      simpa [hammingNorm] using h_norm    have : i ∈ Finset.univ := Finset.mem_univ i    rw [← h_eq] at this    exact (Finset.mem_filter.mp this).2  have h_sq : ∀ i : Fin 4, v i * v i = 1 := by    intro i    let u : Fˣ := Units.mk0 (v i) (hv_all_nz i)    have hu : u ^ (Fintype.card Fˣ) = 1 := pow_card_eq_one    have h_card : Fintype.card Fˣ = 2 := by      rw [Fintype.card_units, hF]    rw [h_card] at hu    have hu2 : (u : F) ^ 2 = (1 : F) := by      rw [← Units.val_pow_eq_pow_val, hu, Units.val_one]    have h_val : (u : F) = v i := Units.val_mk0 (hv_all_nz i)    rw [h_val, sq] at hu2    exact hu2  have h_sum := h_ortho v hv v hv  have h_sum_ones : (∑ i : Fin 4, v i * v i) = (4 : F) := by    calc ∑ i : Fin 4, v i * v i = ∑ i : Fin 4, (1 : F) := Finset.sum_congr rfl (fun i _ => h_sq i)    _ = 4 • (1 : F) := by rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin]    _ = (4 : F) := by simp  rw [h_sum_ones] at h_sum  have : Fact (Nat.Prime 3) := ⟨by norm_num⟩  have : CharP F 3 := charP_of_card_eq_prime hF  have h_div : 3 ∣ 4 := (CharP.cast_eq_zero_iff F 3 4).mp h_sum  revert h_div  decide
See it in the graphDiscuss this resultChallenge it