AFTD Auto-Formalizing Theoretical Domains

finite_field_rectangle_twisted_frobenius_degenerate

theoremverified

Let $k$ be a finite field of characteristic 2 and $K$ a degree-3 field extension of $k$. Let $q = |k|$ and $A_{ij} = Q^{-1}(u_i + v_j)$. If $u_0 = u_1$ or $v_0 = v_1$, then $\sum_{i,j} A_{ij} = 0$ and $\sum_{i,j} \operatorname{Tr}(u_i A_{ij}) = 0$.

Statement

theorem finite_field_rectangle_twisted_frobenius_degenerate
    (k K : Type*) [Field k] [Fintype k] [Field K] [Fintype K] [Algebra k K] [FiniteDimensional k K] [CharP k 2]
    (hrank : Module.finrank k K = 3)
    (u v : Fin 2 → K)
    (hdeg : u 0 = u 1 ∨ v 0 = v 1) :
    let q := Fintype.card k
    let A : Fin 2 → Fin 2 → K := fun i j => twisted_frobenius_inv q (u i + v j)
    (∑ i, ∑ j, A i j) = 0 ∧ (∑ i, ∑ j, Algebra.trace k K (u i * A i j)) = 0
Source
scout/2611-17378-a-19-5-lower-bound-for-the-four-dimensional-erd-h-o-s-box-p.md:154
Verified
23 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2

Read back from the Lean

For any finite fields $k$ and $K$ such that $K$ is a finite-dimensional $k$-algebra of degree $[K : k] = 3$, with $k$ of characteristic 2, and for any two sequences (or pairs) $u, v : \mathrm{Fin}\ 2 \to K$: If $u(0) = u(1)$ or $v(0) = v(1)$, then setting $q = |k|$ and defining the $2 \times 2$ matrix $A : \mathrm{Fin}\ 2 \to \mathrm{Fin}\ 2 \to K$ by $$A(i, j) = \mathrm{twisted\_frobenius\_inv}(q, u(i) + v(j)),$$ both of the following hold: 1. $\sum_{i=0}^1 \sum_{j=0}^1 A(i, j) = 0$ (in $K$), and 2. $\sum_{i=0}^1 \sum_{j=0}^1 \operatorname{Tr}_{K/k}(u(i) \cdot A(i, j)) = 0$ (in $k$).

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 case analysis on whether $u_0 = u_1$ or $v_0 = v_1$. Because $k$ has characteristic 2, the field extension $K$ also has characteristic 2, meaning that $x + x = 0$ for all elements. When $u_0 = u_1$, the rows of $A$ coincide ($A_{0j} = A_{1j}$), so both sums split into two identical halves that cancel out. When $v_0 = v_1$, the columns of $A$ coincide ($A_{i0} = A_{i1}$), so adjacent terms in each row pair up and cancel directly.

  1. The field extension $K$ has characteristic 2.

    We introduce the let-bound definitions $q$ and $A$. Because $K$ is an algebra over $k$ and $k$ has characteristic 2, `Algebra.charP_iff` implies that $K$ also has characteristic 2.

    lines 10–11

    uses Algebra.charP_iff

      intro q A
      have : CharP K 2 := (Algebra.charP_iff k K 2).mp ‹CharP k 2›
  2. Both double sums over $\mathrm{Fin}\ 2 \times \mathrm{Fin}\ 2$ expand into explicit sums of four terms: $\sum_{i,j} A_{ij} = A_{00} + A_{01} + (A_{10} + A_{11})$ and $\sum_{i,j} \operatorname{Tr}(u_i A_{ij}) = \operatorname{Tr}(u_0 A_{00}) + \operatorname{Tr}(u_0 A_{01}) + (\operatorname{Tr}(u_1 A_{10}) + \operatorname{Tr}(u_1 A_{11}))$.

    Applying `Fin.sum_univ_two` to expand the summations over the two-element domain $\{0, 1\}$ twice rewrites each double sum as an explicit four-term addition.

    lines 12–17

    uses Fin.sum_univ_two

      have hsum_A : (∑ i, ∑ j, A i j) = A 0 0 + A 0 1 + (A 1 0 + A 1 1) := by
        simp only [Fin.sum_univ_two]
      have hsum_tr : (∑ i, ∑ j, Algebra.trace k K (u i * A i j)) =
          Algebra.trace k K (u 0 * A 0 0) + Algebra.trace k K (u 0 * A 0 1) +
          (Algebra.trace k K (u 1 * A 1 0) + Algebra.trace k K (u 1 * A 1 1)) := by
        simp only [Fin.sum_univ_two]
  3. If $u_0 = u_1$, then both $\sum_{i,j} A_{ij} = 0$ and $\sum_{i,j} \operatorname{Tr}(u_i A_{ij}) = 0$.

    In the first branch of the case split on $h_{\mathrm{deg}}$, we assume $u_0 = u_1$. From the definition $A_{ij} = Q^{-1}(u_i + v_j)$, identical inputs give equal rows: $A_{00} = A_{10}$ and $A_{01} = A_{11}$. Substituting these into the expanded sum for $A$ gives $(A_{10} + A_{11}) + (A_{10} + A_{11})$, which vanishes in characteristic 2 by `CharTwo.add_self_eq_zero`. Similarly, substituting $u_0 = u_1$ and the row equalities into the trace sum yields $(\operatorname{Tr}(u_1 A_{10}) + \operatorname{Tr}(u_1 A_{11})) + (\operatorname{Tr}(u_1 A_{10}) + \operatorname{Tr}(u_1 A_{11}))$, which also vanishes by `CharTwo.add_self_eq_zero`.

    lines 18–25

    uses CharTwo.add_self_eq_zero

      rcases hdeg with hu | hv
      · have h0 : A 0 0 = A 1 0 := by dsimp [A]; rw [hu]
        have h1 : A 0 1 = A 1 1 := by dsimp [A]; rw [hu]
        constructor
        · rw [hsum_A, h0, h1]
          exact CharTwo.add_self_eq_zero (A 1 0 + A 1 1)
        · rw [hsum_tr, hu, h0, h1]
          exact CharTwo.add_self_eq_zero (Algebra.trace k K (u 1 * A 1 0) + Algebra.trace k K (u 1 * A 1 1))
  4. If $v_0 = v_1$, then both $\sum_{i,j} A_{ij} = 0$ and $\sum_{i,j} \operatorname{Tr}(u_i A_{ij}) = 0$.

    In the second branch, we assume $v_0 = v_1$, which makes the columns equal: $A_{00} = A_{01}$ and $A_{10} = A_{11}$. Rewriting $\sum A_{ij}$ produces $(A_{01} + A_{01}) + (A_{11} + A_{11})$; each pair is zero by `CharTwo.add_self_eq_zero`, and $0 + 0 = 0$ by `add_zero`. The trace sum similarly groups into $(\operatorname{Tr}(u_0 A_{01}) + \operatorname{Tr}(u_0 A_{01})) + (\operatorname{Tr}(u_1 A_{11}) + \operatorname{Tr}(u_1 A_{11}))$, which reduces to $0 + 0 = 0$ by two applications of `CharTwo.add_self_eq_zero` and `add_zero`.

    lines 26–32

    uses CharTwo.add_self_eq_zero, add_zero

      · have h0 : A 0 0 = A 0 1 := by dsimp [A]; rw [hv]
        have h1 : A 1 0 = A 1 1 := by dsimp [A]; rw [hv]
        constructor
        · rw [hsum_A, h0, h1]
          rw [CharTwo.add_self_eq_zero, CharTwo.add_self_eq_zero, add_zero]
        · rw [hsum_tr, h0, h1]
          rw [CharTwo.add_self_eq_zero, CharTwo.add_self_eq_zero, add_zero]
Algebra.charP_iff
An algebra extension $L$ over a field $K$ has characteristic $p$ if and only if $K$ has characteristic $p$.
Fin.sum_univ_two
The sum of a function over the two-element finite type $\mathrm{Fin}\ 2$ equals the sum of its values at $0$ and $1$.
CharTwo.add_self_eq_zero
In any semiring of characteristic 2, adding any element to itself yields zero ($x + x = 0$).
add_zero
Adding zero to any element leaves it unchanged ($a + 0 = 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

/-- Degenerate case of Lemma 2: if u0 = u1 or v0 = v1, both sums vanish. -/theorem finite_field_rectangle_twisted_frobenius_degenerate    (k K : Type*) [Field k] [Fintype k] [Field K] [Fintype K] [Algebra k K] [FiniteDimensional k K] [CharP k 2]    (hrank : Module.finrank k K = 3)    (u v : Fin 2 → K)    (hdeg : u 0 = u 1 ∨ v 0 = v 1) :    let q := Fintype.card k    let A : Fin 2 → Fin 2 → K := fun i j => twisted_frobenius_inv q (u i + v j)    (∑ i, ∑ j, A i j) = 0 ∧ (∑ i, ∑ j, Algebra.trace k K (u i * A i j)) = 0 := by  intro q A  have : CharP K 2 := (Algebra.charP_iff k K 2).mp ‹CharP k 2›  have hsum_A : (∑ i, ∑ j, A i j) = A 0 0 + A 0 1 + (A 1 0 + A 1 1) := by    simp only [Fin.sum_univ_two]  have hsum_tr : (∑ i, ∑ j, Algebra.trace k K (u i * A i j)) =      Algebra.trace k K (u 0 * A 0 0) + Algebra.trace k K (u 0 * A 0 1) +      (Algebra.trace k K (u 1 * A 1 0) + Algebra.trace k K (u 1 * A 1 1)) := by    simp only [Fin.sum_univ_two]  rcases hdeg with hu | hv  · have h0 : A 0 0 = A 1 0 := by dsimp [A]; rw [hu]    have h1 : A 0 1 = A 1 1 := by dsimp [A]; rw [hu]    constructor    · rw [hsum_A, h0, h1]      exact CharTwo.add_self_eq_zero (A 1 0 + A 1 1)    · rw [hsum_tr, hu, h0, h1]      exact CharTwo.add_self_eq_zero (Algebra.trace k K (u 1 * A 1 0) + Algebra.trace k K (u 1 * A 1 1))  · have h0 : A 0 0 = A 0 1 := by dsimp [A]; rw [hv]    have h1 : A 1 0 = A 1 1 := by dsimp [A]; rw [hv]    constructor    · rw [hsum_A, h0, h1]      rw [CharTwo.add_self_eq_zero, CharTwo.add_self_eq_zero, add_zero]    · rw [hsum_tr, h0, h1]      rw [CharTwo.add_self_eq_zero, CharTwo.add_self_eq_zero, add_zero]
See it in the graphDiscuss this resultChallenge it