AFTD Auto-Formalizing Theoretical Domains

op_2178_order_two_ternary_det_sq_le

theoremverifiedformalization

Every 2 by 2 matrix M with entries in the complex third roots of unity satisfies Complex.normSq M.det ≤ 3.

Statement

theorem op_2178_order_two_ternary_det_sq_le
    (M : Matrix (Fin 2) (Fin 2) ℂ)
    (hM : ∀ i j, ∃ u : rootsOfUnity 3 ℂ, ((u : ℂˣ) : ℂ) = M i j) :
    Complex.normSq M.det ≤ 3
Formalizes
arXiv:2611.27591: Determinantal upper bounds for ternary matrices, Theorem 2 and Table 1
Verified
23 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

Read back from the Lean

For every 2 × 2 matrix M with entries in ℂ, if for all row indices i and column indices j (in Fin 2) there exists a third root of unity u : rootsOfUnity 3 ℂ such that M i j = (u : ℂ), then the squared norm of the determinant of M is at most 3 (i.e., Complex.normSq (Matrix.det M) ≤ 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

The determinant of a 2 by 2 matrix M is ad - bc. Since all entries are complex third roots of unity, the diagonal product z1 = ad and off-diagonal product z2 = bc are also third roots of unity. The theorem reduces to showing |z1 - z2|² ≤ 3 for any two third roots of unity z1, z2. By setting w = z1 * conj(z2), w is also a third root of unity, which implies |w| = 1 and w³ = 1; analyzing the real part of w³ yields (Re w - 1)(2 Re w + 1)² = 0, so Re w ≥ -1/2. Expanding |z1 - z2|² as |z1|² + |z2|² - 2 Re w = 2 - 2 Re w then bounds the squared difference by 2 - 2(-1/2) = 3.

  1. The squared absolute values |z1|² and |z2|² both equal 1

    Because z1³ = 1 and z2³ = 1 with 3 ≠ 0, both numbers have modulus 1 by norm_eq_one_of_pow_eq_one. Since the squared norm equals the square of the modulus (normSq_eq_norm_sq), evaluating 1² via one_pow gives normSq z1 = 1 and normSq z2 = 1.

    lines 3–11

    uses norm_eq_one_of_pow_eq_one, normSq_eq_norm_sq, one_pow

      open Complex in
      have h_norm1 : normSq z1 = 1 := by
        have h := norm_eq_one_of_pow_eq_one h1 (by decide)
        have hsq : normSq z1 = ‖z1‖ ^ 2 := normSq_eq_norm_sq z1
        rw [hsq, h, one_pow]
      have h_norm2 : normSq z2 = 1 := by
        have h := norm_eq_one_of_pow_eq_one h2 (by decide)
        have hsq : normSq z2 = ‖z2‖ ^ 2 := normSq_eq_norm_sq z2
        rw [hsq, h, one_pow]
  2. The product w = z1 * conj(z2) is a third root of unity (w³ = 1)

    Complex conjugation preserves powers (map_pow) and fixes 1 (map_one), so conj(z2)³ = conj(z2³) = conj(1) = 1. The cube of w = z1 * conj(z2) factors as z1³ * conj(z2)³ by mul_pow, which evaluates to 1 * 1 = 1 by mul_one.

    lines 12–19

    uses map_pow, map_one, mul_pow, mul_one

      let w : ℂ := z1 * starRingEnd ℂ z2
      have hw3 : w ^ 3 = 1 := by
        have h_star : (starRingEnd ℂ z2) ^ 3 = 1 := by
          have : (starRingEnd ℂ z2) ^ 3 = starRingEnd ℂ (z2 ^ 3) := (map_pow (starRingEnd ℂ) z2 3).symm
          rw [this, h2, map_one]
        calc w ^ 3 = z1 ^ 3 * (starRingEnd ℂ z2) ^ 3 := mul_pow z1 _ 3
        _ = 1 * 1 := by rw [h1, h_star]
        _ = 1 := mul_one 1
  3. The real and imaginary parts of w satisfy (Re w)² + (Im w)² = 1

    Because w³ = 1, w has modulus 1 by Complex.norm_eq_one_of_pow_eq_one, so normSq w = 1 via Complex.normSq_eq_norm_sq and one_pow. Rewriting the squared norm as the sum of squares of real and imaginary parts (Complex.normSq_apply) yields (Re w)² + (Im w)² = 1.

    lines 20–26

    uses Complex.norm_eq_one_of_pow_eq_one, Complex.normSq_eq_norm_sq, one_pow, Complex.normSq_apply

      have hw_norm : Complex.normSq w = 1 := by
        have h := Complex.norm_eq_one_of_pow_eq_one hw3 (by decide)
        have hsq : Complex.normSq w = ‖w‖ ^ 2 := Complex.normSq_eq_norm_sq w
        rw [hsq, h, one_pow]
      have hw_norm' : w.re ^ 2 + w.im ^ 2 = 1 := by
        rw [Complex.normSq_apply] at hw_norm
        linear_combination hw_norm
  4. The real part of w³ satisfies (Re w)³ - 3 * (Re w) * (Im w)² = 1

    Expressing w as (Re w) + (Im w) * I (Complex.re_add_im) and cubing it using I² = -1 (Complex.I_sq) gives an explicit algebraic decomposition into real and imaginary parts, verified by simplification with arithmetic component lemmas (Complex.add_re, Complex.mul_re, Complex.ofReal_re, etc.). Taking the real part of w³ = 1 then gives (Re w)³ - 3 * (Re w) * (Im w)² = 1 using Complex.one_re.

    lines 27–42

    uses Complex.I_sq, Complex.re_add_im, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im, Complex.I_re, Complex.I_im, mul_zero, sub_zero, add_zero, zero_mul, Complex.one_re

      have hw_cube_re : (w ^ 3).re = w.re ^ 3 - 3 * w.re * w.im ^ 2 := by
        let A : ℝ := w.re ^ 3 - 3 * w.re * w.im ^ 2
        let B : ℝ := 3 * w.re ^ 2 * w.im - w.im ^ 3
        have hI : Complex.I ^ 2 = -1 := Complex.I_sq
        have h_cube : ((w.re : ℂ) + (w.im : ℂ) * Complex.I) ^ 3 = (A : ℂ) + (B : ℂ) * Complex.I := by
          dsimp [A, B]
          push_cast
          linear_combination (↑w.re * ↑w.im ^ 2 * 3 + ↑w.im ^ 3 * Complex.I) * hI
        have hw' : w = (w.re : ℂ) + (w.im : ℂ) * Complex.I := (Complex.re_add_im w).symm
        nth_rw 1 [hw']
        rw [h_cube]
        simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im,
          Complex.I_re, Complex.I_im, mul_zero, sub_zero, add_zero, zero_mul]
        rfl
      have hw_re : w.re ^ 3 - 3 * w.re * w.im ^ 2 = 1 := by
        rw [← hw_cube_re, hw3, Complex.one_re]
  5. The real part of w is at least -1/2 (Re w ≥ -1/2)

    Adding 3 * (Re w) * ((Re w)² + (Im w)² - 1) = 0 to the cube relation (Re w)³ - 3 * (Re w) * (Im w)² - 1 = 0 cancels the imaginary terms and factors as (Re w - 1) * (2 * Re w + 1)² = 0. By mul_eq_zero.mp, either Re w - 1 = 0 (so Re w = 1 ≥ -1/2) or (2 * Re w + 1)² = 0, which implies 2 * Re w + 1 = 0 by sq_eq_zero_iff.mp (so Re w = -1/2). In both branches, Re w ≥ -1/2.

    lines 43–50

    uses mul_eq_zero.mp, sq_eq_zero_iff.mp

      have hw_poly : (w.re - 1) * (2 * w.re + 1)^2 = 0 := by
        linear_combination hw_re + 3 * w.re * hw_norm'
      have hw_cases : w.re - 1 = 0 ∨ (2 * w.re + 1)^2 = 0 := mul_eq_zero.mp hw_poly
      have hw_re_ge : - (1 : ℝ) / 2 ≤ w.re := by
        rcases hw_cases with h | h
        · linarith
        · have h' : 2 * w.re + 1 = 0 := sq_eq_zero_iff.mp h
          linarith
  6. The squared difference satisfies normSq(z1 - z2) ≤ 3

    By Complex.normSq_sub, normSq(z1 - z2) expands as normSq z1 + normSq z2 - 2 * Re(z1 * conj(z2)) = 1 + 1 - 2 * Re w. Since Re w ≥ -1/2, linear arithmetic gives 2 - 2 * Re w ≤ 2 - 2 * (-1/2) = 3.

    lines 51–53

    uses Complex.normSq_sub

      rw [Complex.normSq_sub, h_norm1, h_norm2]
      show 1 + 1 - 2 * w.re ≤ 3
      linarith
  7. The determinant of M is M 0 0 * M 1 1 - M 0 1 * M 1 0, and each matrix entry satisfies (M i j)³ = 1

    Expanding the 2 by 2 determinant gives M 0 0 * M 1 1 - M 0 1 * M 1 0 by Matrix.det_fin_two. By assumption, each entry M i j is the coercion of an element u in the group of third roots of unity rootsOfUnity 3 ℂ; by mem_rootsOfUnity', every such element satisfies u³ = 1.

    lines 60–66

    uses Matrix.det_fin_two, mem_rootsOfUnity'

      rw [Matrix.det_fin_two]
      have h_cube (i j : Fin 2) : (M i j) ^ 3 = 1 := by
        obtain ⟨u, hu⟩ := hM i j
        rw [← hu]
        have := u.2
        rw [mem_rootsOfUnity'] at this
        exact this
  8. The squared determinant of M satisfies normSq(M.det) ≤ 3

    The products of third roots of unity M 0 0 * M 1 1 and M 0 1 * M 1 0 are themselves third roots of unity by mul_pow and mul_one. Applying the auxiliary lemma op_2178_order_two_ternary_det_sq_le_sub_normSq to these two products immediately yields normSq(M.det) ≤ 3.

    lines 67–71

    uses mul_pow, mul_one, op_2178_order_two_ternary_det_sq_le_sub_normSq

      have h1 : (M 0 0 * M 1 1) ^ 3 = 1 := by
        rw [mul_pow, h_cube 0 0, h_cube 1 1, mul_one]
      have h2 : (M 0 1 * M 1 0) ^ 3 = 1 := by
        rw [mul_pow, h_cube 0 1, h_cube 1 0, mul_one]
      exact op_2178_order_two_ternary_det_sq_le_sub_normSq h1 h2
norm_eq_one_of_pow_eq_one
If a complex number raised to a nonzero power equals 1, its modulus is 1.
normSq_eq_norm_sq
The squared norm of a complex number is the square of its modulus.
one_pow
Any natural power of 1 is 1.
map_pow
A monoid homomorphism preserves natural powers: f(a^n) = f(a)^n.
map_one
A unital map sends 1 to 1: f(1) = 1.
mul_pow
In a commutative monoid, the power of a product is the product of the powers: (a * b)^n = a^n * b^n.
mul_one
Multiplying any element by 1 leaves it unchanged: a * 1 = a.
Complex.norm_eq_one_of_pow_eq_one
If a complex number raised to a nonzero power equals 1, its modulus is 1.
Complex.normSq_eq_norm_sq
The squared norm of a complex number is the square of its modulus: normSq z = ‖z‖^2.
Complex.normSq_apply
The squared norm of a complex number equals the sum of the squares of its real and imaginary parts: normSq z = z.re^2 + z.im^2.
Complex.I_sq
The imaginary unit squared equals -1: I^2 = -1.
Complex.re_add_im
Every complex number equals its real part plus its imaginary part times I: z = z.re + z.im * I.
Complex.add_re
The real part of a sum of complex numbers is the sum of their real parts: (z + w).re = z.re + w.re.
Complex.ofReal_re
The real part of a real number embedded in the complex numbers is the number itself: (↑r).re = r.
Complex.mul_re
The real part of a product of complex numbers is (z * w).re = z.re * w.re - z.im * w.im.
Complex.ofReal_im
The imaginary part of a real number embedded in the complex numbers is 0: (↑r).im = 0.
Complex.I_re
The real part of the imaginary unit I is 0: I.re = 0.
Complex.I_im
The imaginary part of the imaginary unit I is 1: I.im = 1.
mul_zero
Multiplying any element by 0 gives 0: a * 0 = 0.
sub_zero
Subtracting 0 leaves an element unchanged: a - 0 = a.
add_zero
Adding 0 leaves an element unchanged: a + 0 = a.
zero_mul
Multiplying 0 by any element gives 0: 0 * a = 0.
Complex.one_re
The real part of 1 is 1: (1 : ℂ).re = 1.
mul_eq_zero.mp
If a product of two numbers is 0, at least one factor is 0: a * b = 0 → a = 0 ∨ b = 0.
sq_eq_zero_iff.mp
If the square of a number is 0, the number is 0: a^2 = 0 → a = 0.
Complex.normSq_sub
The squared norm of a difference expands as normSq(z - w) = normSq z + normSq w - 2 * Re(z * conj(w)).
Matrix.det_fin_two
The determinant of a 2 by 2 matrix is A 0 0 * A 1 1 - A 0 1 * A 1 0.
mem_rootsOfUnity'
An element belongs to the k-th roots of unity if and only if its k-th power is 1: ζ ∈ rootsOfUnity k M ↔ ↑ζ ^ k = 1.
op_2178_order_two_ternary_det_sq_le_sub_normSq
For any two complex third roots of unity z1 and z2, the squared difference normSq(z1 - z2) ≤ 3.

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 op_2178_order_two_ternary_det_sq_le_sub_normSq {z1 z2 : ℂ} (h1 : z1 ^ 3 = 1) (h2 : z2 ^ 3 = 1) :    Complex.normSq (z1 - z2) ≤ 3 := by  open Complex in  have h_norm1 : normSq z1 = 1 := by    have h := norm_eq_one_of_pow_eq_one h1 (by decide)    have hsq : normSq z1 = ‖z1‖ ^ 2 := normSq_eq_norm_sq z1    rw [hsq, h, one_pow]  have h_norm2 : normSq z2 = 1 := by    have h := norm_eq_one_of_pow_eq_one h2 (by decide)    have hsq : normSq z2 = ‖z2‖ ^ 2 := normSq_eq_norm_sq z2    rw [hsq, h, one_pow]  let w : ℂ := z1 * starRingEnd ℂ z2  have hw3 : w ^ 3 = 1 := by    have h_star : (starRingEnd ℂ z2) ^ 3 = 1 := by      have : (starRingEnd ℂ z2) ^ 3 = starRingEnd ℂ (z2 ^ 3) := (map_pow (starRingEnd ℂ) z2 3).symm      rw [this, h2, map_one]    calc w ^ 3 = z1 ^ 3 * (starRingEnd ℂ z2) ^ 3 := mul_pow z1 _ 3    _ = 1 * 1 := by rw [h1, h_star]    _ = 1 := mul_one 1  have hw_norm : Complex.normSq w = 1 := by    have h := Complex.norm_eq_one_of_pow_eq_one hw3 (by decide)    have hsq : Complex.normSq w = ‖w‖ ^ 2 := Complex.normSq_eq_norm_sq w    rw [hsq, h, one_pow]  have hw_norm' : w.re ^ 2 + w.im ^ 2 = 1 := by    rw [Complex.normSq_apply] at hw_norm    linear_combination hw_norm  have hw_cube_re : (w ^ 3).re = w.re ^ 3 - 3 * w.re * w.im ^ 2 := by    let A : ℝ := w.re ^ 3 - 3 * w.re * w.im ^ 2    let B : ℝ := 3 * w.re ^ 2 * w.im - w.im ^ 3    have hI : Complex.I ^ 2 = -1 := Complex.I_sq    have h_cube : ((w.re : ℂ) + (w.im : ℂ) * Complex.I) ^ 3 = (A : ℂ) + (B : ℂ) * Complex.I := by      dsimp [A, B]      push_cast      linear_combination (↑w.re * ↑w.im ^ 2 * 3 + ↑w.im ^ 3 * Complex.I) * hI    have hw' : w = (w.re : ℂ) + (w.im : ℂ) * Complex.I := (Complex.re_add_im w).symm    nth_rw 1 [hw']    rw [h_cube]    simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im,      Complex.I_re, Complex.I_im, mul_zero, sub_zero, add_zero, zero_mul]    rfl  have hw_re : w.re ^ 3 - 3 * w.re * w.im ^ 2 = 1 := by    rw [← hw_cube_re, hw3, Complex.one_re]  have hw_poly : (w.re - 1) * (2 * w.re + 1)^2 = 0 := by    linear_combination hw_re + 3 * w.re * hw_norm'  have hw_cases : w.re - 1 = 0 ∨ (2 * w.re + 1)^2 = 0 := mul_eq_zero.mp hw_poly  have hw_re_ge : - (1 : ℝ) / 2 ≤ w.re := by    rcases hw_cases with h | h    · linarith    · have h' : 2 * w.re + 1 = 0 := sq_eq_zero_iff.mp h      linarith  rw [Complex.normSq_sub, h_norm1, h_norm2]  show 1 + 1 - 2 * w.re ≤ 3  linarith/-- Every 2 by 2 matrix with entries in the complex third roots of unity has squared determinant at most 3. -/theorem op_2178_order_two_ternary_det_sq_le    (M : Matrix (Fin 2) (Fin 2) ℂ)    (hM : ∀ i j, ∃ u : rootsOfUnity 3 ℂ, ((u : ℂˣ) : ℂ) = M i j) :    Complex.normSq M.det ≤ 3 := by  rw [Matrix.det_fin_two]  have h_cube (i j : Fin 2) : (M i j) ^ 3 = 1 := by    obtain ⟨u, hu⟩ := hM i j    rw [← hu]    have := u.2    rw [mem_rootsOfUnity'] at this    exact this  have h1 : (M 0 0 * M 1 1) ^ 3 = 1 := by    rw [mul_pow, h_cube 0 0, h_cube 1 1, mul_one]  have h2 : (M 0 1 * M 1 0) ^ 3 = 1 := by    rw [mul_pow, h_cube 0 1, h_cube 1 0, mul_one]  exact op_2178_order_two_ternary_det_sq_le_sub_normSq h1 h2
See it in the graphDiscuss this resultChallenge it