AFTD Auto-Formalizing Theoretical Domains

twisted_frobenius_bijective

theoremverified

Let $k$ be a finite field of characteristic 2 and $K$ a degree-3 extension of $k$. Then the twisted Frobenius map $Q(x) = x^{q^2+q}$ is bijective on $K$, where $q = |k|$.

Statement

theorem twisted_frobenius_bijective
    (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) :
    Function.Bijective (twisted_frobenius_map (Fintype.card k) : K → K)
Source
scout/2611-17378-a-19-5-lower-bound-for-the-four-dimensional-erd-h-o-s-box-p.md:125
Verified
23 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • twisted_frobenius_mapThe twisted Frobenius map $Q(x) = x^{q^2+q}$ on a field $K$ for a positive integer $q$.

Read back from the Lean

For any types k and K such that k and K are finite fields, K is an algebra over k, K is finite-dimensional over k, k has characteristic 2, and the degree (dimension) Module.finrank k K equals 3: the map twisted_frobenius_map (Fintype.card k) : K → K is bijective.

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

Because K is a finite field, the twisted Frobenius map Q(x) = x^(q^2+q) is bijective if and only if it is injective. On the zero element, Q(0) = 0 uniquely, while on the multiplicative group Kˣ, Q acts as the power map u ↦ u^(q^2+q). The order of Kˣ is |K| - 1 = q^3 - 1. An integer Bézout-style polynomial identity (q^2+q-1)(q^2+q) - (q+2)(q^3-1) = 2 shows that gcd(q^2+q, q^3-1) divides 2; since the field has characteristic 2, q is even, making q^3 - 1 odd and the gcd equal to 1. Consequently, raising to the power q^2+q is an automorphism of Kˣ, ensuring that Q is injective and therefore bijective on K.

  1. The greatest common divisor gcd(q^2 + q, q^3 - 1) divides 2.

    Since q ≥ 1, we have q^3 ≥ 1 (`Nat.one_le_pow`). In the integers, the Bézout-style polynomial identity (q^2 + q - 1)(q^2 + q) - (q + 2)(q^3 - 1) = 2 holds identically (verified by `ring`). Since gcd(q^2 + q, q^3 - 1) divides both q^2 + q and q^3 - 1 in ℕ (`Nat.gcd_dvd_left` and `Nat.gcd_dvd_right`), casting to ℤ via `Nat.cast_sub` shows that the gcd divides the integer linear combination, and thus divides 2 (`dvd_sub`, `dvd_mul_of_dvd_right`). Casting back to ℕ gives gcd(q^2 + q, q^3 - 1) ∣ 2.

    lines 3–18

    uses Nat.one_le_pow, Nat.gcd_dvd_left, Nat.gcd_dvd_right, Nat.cast_sub, dvd_sub, dvd_mul_of_dvd_right

      have hq3_ge : 1 ≤ q ^ 3 := Nat.one_le_pow 3 q (by omega)
      have hgcd_dvd : (q ^ 2 + q).gcd (q ^ 3 - 1) ∣ 2 := by
        have h1 : ((q ^ 2 + q).gcd (q ^ 3 - 1) : ℤ) ∣ ((q : ℤ) ^ 2 + (q : ℤ)) := by
          have := Nat.gcd_dvd_left (q ^ 2 + q) (q ^ 3 - 1)
          exact_mod_cast this
        have h2 : ((q ^ 2 + q).gcd (q ^ 3 - 1) : ℤ) ∣ ((q : ℤ) ^ 3 - 1) := by
          have := Nat.gcd_dvd_right (q ^ 2 + q) (q ^ 3 - 1)
          have hcast : ((q ^ 3 - 1 : ℕ) : ℤ) = (q : ℤ) ^ 3 - 1 := by
            exact Nat.cast_sub hq3_ge
          rw [← hcast]
          exact_mod_cast this
        have hid : (2 : ℤ) = ((q : ℤ) ^ 2 + (q : ℤ) - 1) * ((q : ℤ) ^ 2 + (q : ℤ)) - ((q : ℤ) + 2) * ((q : ℤ) ^ 3 - 1) := by ring
        have hdvd_int : ((q ^ 2 + q).gcd (q ^ 3 - 1) : ℤ) ∣ 2 := by
          rw [hid]
          exact dvd_sub (dvd_mul_of_dvd_right h1 _) (dvd_mul_of_dvd_right h2 _)
        exact_mod_cast hdvd_int
  2. Neither q^3 - 1 nor gcd(q^2 + q, q^3 - 1) is divisible by 2.

    Because 2 ∣ q, 2 divides q^3 (`dvd_pow`). If 2 also divided q^3 - 1, then 2 would divide their difference q^3 - (q^3 - 1) = 1, which is impossible by parity (`omega`). Since gcd(q^2 + q, q^3 - 1) divides q^3 - 1 (`Nat.gcd_dvd_right`), transitivity of divisibility (`dvd_trans`) ensures that 2 cannot divide the gcd either.

    lines 19–28

    uses dvd_pow, Nat.gcd_dvd_right, dvd_trans

      have hodd : ¬ 2 ∣ (q ^ 3 - 1) := by
        intro hc
        have hq3 : 2 ∣ q ^ 3 := dvd_pow h2 (by decide)
        rcases hq3 with ⟨a, ha⟩
        rcases hc with ⟨b, hb⟩
        have : 2 * a - 2 * b = 1 := by omega
        omega
      have hgcd_odd : ¬ 2 ∣ (q ^ 2 + q).gcd (q ^ 3 - 1) := by
        intro hc
        exact hodd (dvd_trans hc (Nat.gcd_dvd_right _ _))
  3. q^2 + q and q^3 - 1 are coprime.

    Because gcd(q^2 + q, q^3 - 1) divides 2, it is at most 2 (`Nat.le_of_dvd`). Furthermore, because q ≥ 1 is even, q ≥ 2, so q^3 - 1 > 0, which ensures the gcd is strictly positive (`Nat.gcd_pos_of_pos_right`). Since the gcd is a positive integer at most 2 and not divisible by 2, linear integer arithmetic (`omega`) forces it to be 1, completing the proof of coprimality.

    lines 29–33

    uses Nat.le_of_dvd, Nat.gcd_pos_of_pos_right

      have hle : (q ^ 2 + q).gcd (q ^ 3 - 1) ≤ 2 := Nat.le_of_dvd (by decide) hgcd_dvd
      have hpos : 0 < (q ^ 2 + q).gcd (q ^ 3 - 1) := by
        refine Nat.gcd_pos_of_pos_right _ ?_
        omega
      omega
  4. To show that the twisted Frobenius map Q is bijective, it suffices to show it is injective, and the base field cardinality q = |k| is an even natural number with q ≥ 1.

    Since K is a finite field, any self-map of K is bijective if and only if it is injective (`Finite.injective_iff_bijective`). Because the field k is nontrivial, its cardinality q = |k| satisfies q > 1 ≥ 1 (`Fintype.one_lt_card`). Since k has characteristic 2 (`CharP k 2`), the prime 2 (`Nat.prime_two`) divides the ring characteristic (`ringChar.eq`), which in turn implies that 2 divides |k| = q (`prime_dvd_char_iff_dvd_card`).

    lines 40–47

    uses Finite.injective_iff_bijective, Fintype.one_lt_card, Nat.prime_two, prime_dvd_char_iff_dvd_card, ringChar.eq

      rw [← Finite.injective_iff_bijective]
      set q := Fintype.card k
      have hq_pos : 1 ≤ q := by
        have := Fintype.one_lt_card (α := k)
        omega
      have h2 : 2 ∣ q := by
        have : Fact (Nat.Prime 2) := ⟨Nat.prime_two⟩
        rw [← prime_dvd_char_iff_dvd_card 2, ringChar.eq k 2]
  5. The order of the unit group Kˣ is coprime to q^2 + q.

    As K has dimension 3 over k, its cardinality is |K| = |k|^3 = q^3 (`Module.card_eq_pow_finrank`, `Nat.card_eq_fintype_card`). The unit group Kˣ consists of all non-zero elements of K, so |Kˣ| = |K| - 1 = q^3 - 1 (`Nat.card_units`). By the helper lemma (`twisted_frobenius_bijective_coprime`), |Kˣ| = q^3 - 1 is coprime to q^2 + q.

    lines 48–52

    uses Nat.card_units, Nat.card_eq_fintype_card, Module.card_eq_pow_finrank, twisted_frobenius_bijective_coprime

      have hcop : Nat.Coprime (Nat.card Kˣ) (q ^ 2 + q) := by
        have hcard : Nat.card Kˣ = q ^ 3 - 1 := by
          rw [Nat.card_units, Nat.card_eq_fintype_card, @Module.card_eq_pow_finrank k K, hrank]
        rw [hcard]
        exact (twisted_frobenius_bijective_coprime q h2 hq_pos).symm
  6. If x^(q^2+q) = y^(q^2+q) and either x = 0 or y = 0, then x = y.

    Suppose x^(q^2+q) = y^(q^2+q). If x = 0, then since the exponent q^2 + q is non-zero, 0^(q^2+q) = 0 (`zero_pow`), giving y^(q^2+q) = 0. In a field, this implies y = 0 (`eq_zero_of_pow_eq_zero`), so x = y = 0. Symmetrically, if y = 0, the same argument yields x = 0 = y.

    lines 53–62

    uses zero_pow, eq_zero_of_pow_eq_zero

      intro x y hxy
      change x ^ (q ^ 2 + q) = y ^ (q ^ 2 + q) at hxy
      by_cases hx : x = 0
      · subst hx
        rw [zero_pow (by omega)] at hxy
        exact (eq_zero_of_pow_eq_zero hxy.symm).symm
      · by_cases hy : y = 0
        · subst hy
          rw [zero_pow (by omega)] at hxy
          exact eq_zero_of_pow_eq_zero hxy
  7. If non-zero elements x, y ∈ K satisfy x^(q^2+q) = y^(q^2+q), then x = y, completing the proof of bijectivity.

    When x, y ≠ 0, they define units in Kˣ whose (q^2+q)-th powers coincide (`Units.ext`). Because q^2 + q is coprime to the order of Kˣ, the power map u ↦ u^(q^2+q) is an automorphism of the finite group Kˣ (`powCoprime_apply`). Injectivity of this group equivalence forces the two units to be equal, and taking their values (`congr_arg Units.val`) yields x = y.

    lines 63–70

    uses Units.ext, powCoprime_apply, congr_arg, Units.val

        · have hpow : (Units.mk0 x hx) ^ (q ^ 2 + q) = (Units.mk0 y hy) ^ (q ^ 2 + q) := by
            apply Units.ext
            simp [hxy]
          have hinj : (powCoprime hcop) (Units.mk0 x hx) = (powCoprime hcop) (Units.mk0 y hy) := by
            rw [powCoprime_apply, powCoprime_apply]
            exact hpow
          have heq : Units.mk0 x hx = Units.mk0 y hy := (powCoprime hcop).injective hinj
          exact congr_arg Units.val heq
Nat.one_le_pow
For any positive integer m and natural number n, m^n ≥ 1.
Nat.gcd_dvd_left
The greatest common divisor gcd(m, n) divides m.
Nat.gcd_dvd_right
The greatest common divisor gcd(m, n) divides n.
Nat.cast_sub
Natural number subtraction coerces to integer subtraction provided the subtrahend is less than or equal to the minuend: (n - m : ℤ) = (n : ℤ) - (m : ℤ).
dvd_sub
If a divides b and a divides c, then a divides their difference b - c.
dvd_mul_of_dvd_right
If a divides b, then a divides any product c * b.
dvd_pow
If a divides b and n is non-zero, then a divides b^n.
dvd_trans
Divisibility is transitive: if a divides b and b divides c, then a divides c.
Nat.le_of_dvd
If m divides a strictly positive natural number n, then m ≤ n.
Nat.gcd_pos_of_pos_right
If n > 0, then gcd(m, n) is strictly positive.
Finite.injective_iff_bijective
A map from a finite type to itself is injective if and only if it is bijective.
Fintype.one_lt_card
A nontrivial finite type has strictly more than 1 element.
Nat.prime_two
The natural number 2 is prime.
prime_dvd_char_iff_dvd_card
For a prime p and a finite ring R, p divides the characteristic of R if and only if p divides the cardinality of R.
ringChar.eq
In a ring of characteristic p, the ring characteristic is equal to p.
Nat.card_units
In a group with zero (such as a field), the unit group has cardinality |α| - 1.
Nat.card_eq_fintype_card
For a finite type, `Nat.card` equals `Fintype.card`.
Module.card_eq_pow_finrank
A finite-dimensional vector space V over a division ring k has cardinality |k|^(dim_k V).
twisted_frobenius_bijective_coprime
For any even natural number q ≥ 1, q^2 + q is coprime to q^3 - 1.
zero_pow
Zero raised to any non-zero natural power is zero.
eq_zero_of_pow_eq_zero
In a reduced ring (such as a field), if x^n = 0, then x = 0.
Units.ext
Two units in a monoid are equal if and only if their underlying values are equal.
powCoprime_apply
The permutation `powCoprime h` on a finite group raises an element to the power n.
congr_arg
If a₁ = a₂, then f(a₁) = f(a₂).
Units.val
The canonical projection mapping a unit to its underlying value in the monoid.

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

lemma twisted_frobenius_bijective_coprime (q : ℕ) (h2 : 2 ∣ q) (hq : 1 ≤ q) :    Nat.Coprime (q ^ 2 + q) (q ^ 3 - 1) := by  have hq3_ge : 1 ≤ q ^ 3 := Nat.one_le_pow 3 q (by omega)  have hgcd_dvd : (q ^ 2 + q).gcd (q ^ 3 - 1) ∣ 2 := by    have h1 : ((q ^ 2 + q).gcd (q ^ 3 - 1) : ℤ) ∣ ((q : ℤ) ^ 2 + (q : ℤ)) := by      have := Nat.gcd_dvd_left (q ^ 2 + q) (q ^ 3 - 1)      exact_mod_cast this    have h2 : ((q ^ 2 + q).gcd (q ^ 3 - 1) : ℤ) ∣ ((q : ℤ) ^ 3 - 1) := by      have := Nat.gcd_dvd_right (q ^ 2 + q) (q ^ 3 - 1)      have hcast : ((q ^ 3 - 1 : ℕ) : ℤ) = (q : ℤ) ^ 3 - 1 := by        exact Nat.cast_sub hq3_ge      rw [← hcast]      exact_mod_cast this    have hid : (2 : ℤ) = ((q : ℤ) ^ 2 + (q : ℤ) - 1) * ((q : ℤ) ^ 2 + (q : ℤ)) - ((q : ℤ) + 2) * ((q : ℤ) ^ 3 - 1) := by ring    have hdvd_int : ((q ^ 2 + q).gcd (q ^ 3 - 1) : ℤ) ∣ 2 := by      rw [hid]      exact dvd_sub (dvd_mul_of_dvd_right h1 _) (dvd_mul_of_dvd_right h2 _)    exact_mod_cast hdvd_int  have hodd : ¬ 2 ∣ (q ^ 3 - 1) := by    intro hc    have hq3 : 2 ∣ q ^ 3 := dvd_pow h2 (by decide)    rcases hq3 with ⟨a, ha⟩    rcases hc with ⟨b, hb⟩    have : 2 * a - 2 * b = 1 := by omega    omega  have hgcd_odd : ¬ 2 ∣ (q ^ 2 + q).gcd (q ^ 3 - 1) := by    intro hc    exact hodd (dvd_trans hc (Nat.gcd_dvd_right _ _))  have hle : (q ^ 2 + q).gcd (q ^ 3 - 1) ≤ 2 := Nat.le_of_dvd (by decide) hgcd_dvd  have hpos : 0 < (q ^ 2 + q).gcd (q ^ 3 - 1) := by    refine Nat.gcd_pos_of_pos_right _ ?_    omega  omega/-- The twisted Frobenius map Q permutes K = GF(q^3). -/theorem twisted_frobenius_bijective    (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) :    Function.Bijective (twisted_frobenius_map (Fintype.card k) : K → K) := by  rw [← Finite.injective_iff_bijective]  set q := Fintype.card k  have hq_pos : 1 ≤ q := by    have := Fintype.one_lt_card (α := k)    omega  have h2 : 2 ∣ q := by    have : Fact (Nat.Prime 2) := ⟨Nat.prime_two⟩    rw [← prime_dvd_char_iff_dvd_card 2, ringChar.eq k 2]  have hcop : Nat.Coprime (Nat.card Kˣ) (q ^ 2 + q) := by    have hcard : Nat.card Kˣ = q ^ 3 - 1 := by      rw [Nat.card_units, Nat.card_eq_fintype_card, @Module.card_eq_pow_finrank k K, hrank]    rw [hcard]    exact (twisted_frobenius_bijective_coprime q h2 hq_pos).symm  intro x y hxy  change x ^ (q ^ 2 + q) = y ^ (q ^ 2 + q) at hxy  by_cases hx : x = 0  · subst hx    rw [zero_pow (by omega)] at hxy    exact (eq_zero_of_pow_eq_zero hxy.symm).symm  · by_cases hy : y = 0    · subst hy      rw [zero_pow (by omega)] at hxy      exact eq_zero_of_pow_eq_zero hxy    · have hpow : (Units.mk0 x hx) ^ (q ^ 2 + q) = (Units.mk0 y hy) ^ (q ^ 2 + q) := by        apply Units.ext        simp [hxy]      have hinj : (powCoprime hcop) (Units.mk0 x hx) = (powCoprime hcop) (Units.mk0 y hy) := by        rw [powCoprime_apply, powCoprime_apply]        exact hpow      have heq : Units.mk0 x hx = Units.mk0 y hy := (powCoprime hcop).injective hinj      exact congr_arg Units.val heq
See it in the graphDiscuss this resultChallenge it