AFTD Auto-Formalizing Theoretical Domains

op_2178_order_14_ternary_det_sq_attained

theoremverifiedformalization

There exists a 14 by 14 matrix M with entries in the complex third roots of unity whose squared determinant Complex.normSq M.det equals 2^24 * 3^13 * 223, attained by the balanced normal matrix M_14.

Statement

theorem op_2178_order_14_ternary_det_sq_attained :
    ∃ (M : Matrix (Fin 14) (Fin 14) ℂ),
      (∀ i j, ∃ u : rootsOfUnity 3 ℂ, ((u : ℂˣ) : ℂ) = M i j) ∧
      Complex.normSq M.det = (2 : ℝ) ^ 24 * (3 : ℝ) ^ 13 * 223
Formalizes
arXiv:2611.27591: Determinantal upper bounds for ternary matrices, Section 4, lines 1269-1284
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

Read back from the Lean

There exists a 14 × 14 complex matrix $M$ such that: 1. Every entry of $M$ is a third root of unity in $\mathbb{C}$ (that is, for all $i, j \in \text{Fin } 14$, there exists $u \in \text{rootsOfUnity } 3\ \mathbb{C}$ whose coercion to $\mathbb{C}$ equals $M_{i,j}$); and 2. The squared complex norm of the determinant of $M$ equals $2^{24} \cdot 3^{13} \cdot 223$ (as a real number).

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 constructs an explicit 14 by 14 ternary matrix M whose entries are powers ζ^(E i j) of a primitive cube root of unity ζ = exp(2πi/3). The exponent matrix E is partitioned into three row blocks of sizes 6, 5, and 3 satisfying a combinatorial balance property: for any pair of rows, residue frequencies 1 and 2 mod 3 occur equally often, ensuring all off-diagonal inner products are real integers. As a result, the Gram matrix factors as M * M* = 12 I₁₄ + P * C * Pᵀ, where P is the 14 by 3 block indicator matrix and C is a 3 by 3 coupling matrix. Sylvester's determinant identity det(I₁₄ + A B) = det(I₃ + B A) reduces the determinant of M * M* to that of an explicit 3 by 3 matrix, yielding det(M * M*) = 2^24 * 3^13 * 223, which equals |det M|².

  1. For every pair of rows, exponent differences take residues 1 and 2 equally often, and the difference c₀ - c₂ depends only on row equality and block membership. automation

    The function `op2178_cnt i j r` counts the column indices k where E i k + 2 * E j k ≡ r mod 3. Since there are only 14 rows, this property across all 196 row pairs is verified by finite exhaustive computation (`decide`).

    lines 22–26

    theorem op2178_cnt_facts : ∀ i j : Fin 14,
        op2178_cnt i j 1 = op2178_cnt i j 2 ∧
        (op2178_cnt i j 0 : ℤ) - op2178_cnt i j 2 =
          (if i = j then 12 else 0) + (if op2178_blk i = op2178_blk j then 2 else -1) := by
      decide
  2. Any sum of powers ∑_k ζ^(d k) with d k ∈ Fin 3 can be grouped by residue into c₀ + c₁ ζ + c₂ ζ², where c_r counts indices with d k = r.

    We decompose the sum over ι into fibers of d via `Finset.sum_fiberwise` and expand the outer sum over Fin 3 with `Fin.sum_univ_three`. On each fiber, the summand is constant and equals ζ^r (using `Finset.sum_congr` and `Finset.mem_filter`), so the sum over the fiber simplifies to the cardinality times ζ^r via `Finset.sum_const` and `nsmul_eq_mul`.

    lines 28–42

    uses Finset.sum_fiberwise, Fin.sum_univ_three, Finset.sum_congr, Finset.mem_filter, Finset.sum_const, nsmul_eq_mul

    theorem op2178_sum_fin3 {ι : Type*} [Fintype ι] (d : ι → Fin 3) (ζ : ℂ) :
        ∑ k, ζ ^ (d k).val =
          ((Finset.univ.filter fun k => d k = 0).card : ℂ) +
          ((Finset.univ.filter fun k => d k = 1).card : ℂ) * ζ +
          ((Finset.univ.filter fun k => d k = 2).card : ℂ) * ζ ^ 2 := by
      classical
      rw [← Finset.sum_fiberwise Finset.univ d (fun k => ζ ^ (d k).val), Fin.sum_univ_three]
      have h : ∀ r : Fin 3, ∑ k ∈ Finset.univ.filter (fun k => d k = r), ζ ^ (d k).val =
          ((Finset.univ.filter fun k => d k = r).card : ℂ) * ζ ^ r.val := by
        intro r
        rw [Finset.sum_congr rfl (fun k hk => by rw [(Finset.mem_filter.1 hk).2]), Finset.sum_const,
          nsmul_eq_mul]
      rw [h 0, h 1, h 2]
      simp
    
  3. The complex number ζ = exp(2πi/3) is a primitive cube root of unity satisfying ζ³ = 1, 1 + ζ + ζ² = 0, ‖ζ‖ = 1, and star ζ = ζ².

    By `Complex.isPrimitiveRoot_exp`, ζ is a primitive third root of unity. Summing its geometric series gives 1 + ζ + ζ² = 0 (via `Finset.sum_range_succ`), and ‖ζ‖ = 1. Since ζ ≠ 0 and ζ * star ζ = ‖ζ‖² = 1 = ζ * ζ² (using `Complex.star_def`, `Complex.mul_conj`, `Complex.normSq_eq_norm_sq`, and `pow_succ'`), cancelling ζ via `mul_left_cancel₀` shows that star ζ = ζ².

    lines 48–60

    uses Complex.isPrimitiveRoot_exp, Finset.sum_range_succ, Complex.star_def, Complex.mul_conj, Complex.normSq_eq_norm_sq, pow_succ', mul_left_cancel₀

      set ζ : ℂ := Complex.exp (2 * Real.pi * Complex.I / (3 : ℕ)) with hζdef
      have hζ : IsPrimitiveRoot ζ 3 := Complex.isPrimitiveRoot_exp 3 (by norm_num)
      have h3 : ζ ^ 3 = 1 := hζ.pow_eq_one
      have hsum : 1 + ζ + ζ ^ 2 = 0 := by
        have := hζ.geom_sum_eq_zero (by norm_num)
        simpa [Finset.sum_range_succ] using this
      have hnorm : ‖ζ‖ = 1 := hζ.norm'_eq_one (by norm_num)
      have hstar : star ζ = ζ ^ 2 := by
        have hne : ζ ≠ 0 := hζ.ne_zero (by norm_num)
        have hmul : ζ * star ζ = 1 := by
          rw [Complex.star_def, Complex.mul_conj, Complex.normSq_eq_norm_sq, hnorm]; simp
        have : ζ * ζ ^ 2 = 1 := by rw [← pow_succ']; exact h3
        exact mul_left_cancel₀ hne (hmul.trans this.symm)
  4. The 14 by 14 matrix M defined by M i j = ζ^(E i j) has entries in the complex third roots of unity.

    We define M via `Matrix.of` with entries ζ^(E i j). For each entry, (ζ^(E i j))³ = (ζ³)^(E i j) = 1^(E i j) = 1 by `pow_mul`, `mul_comm`, and `one_pow`. Constructing the root of unity using `rootsOfUnity.mkOfPowEq` and checking its value with `rootsOfUnity.coe_mkOfPowEq` verifies that every entry is a third root of unity.

    lines 61–67

    uses Matrix.of, rootsOfUnity.mkOfPowEq, pow_mul, mul_comm, one_pow, rootsOfUnity.coe_mkOfPowEq

      let M : Matrix (Fin 14) (Fin 14) ℂ := Matrix.of fun i j => ζ ^ (op2178_m14_exp i j).val
      refine ⟨M, ?_, ?_⟩
      · intro i j
        refine ⟨rootsOfUnity.mkOfPowEq (ζ ^ (op2178_m14_exp i j).val) ?_, ?_⟩
        · rw [← pow_mul, mul_comm, pow_mul, h3, one_pow]
        · rw [rootsOfUnity.coe_mkOfPowEq]; rfl
      · -- Gram matrix
  5. Define block projection matrix P and coupling matrix C, and establish that ζ^x * star(ζ^y) = ζ^(x + 2y) for all x, y ∈ Fin 3.

    We define the 14 by 3 block indicator matrix P and the 3 by 3 coupling matrix C = 3 I₃ - J₃ using `Matrix.of`. Since star(ζ^y) = (ζ²) ^ y = ζ^(2y) by `star_pow` and `pow_mul`, the product is ζ^(x + 2y) by `pow_add`. Using Euclidean division by 3 (`Nat.div_add_mod`, `one_pow`, `one_mul`), powers of ζ depend only on the exponent modulo 3, and exhausting all pairs x, y ∈ Fin 3 confirms the identity.

    lines 68–77

    uses Matrix.of, star_pow, pow_mul, pow_add, Nat.div_add_mod, one_pow, one_mul

        let P : Matrix (Fin 14) (Fin 3) ℂ := Matrix.of fun i b => if op2178_blk i = b then 1 else 0
        let C : Matrix (Fin 3) (Fin 3) ℂ := Matrix.of fun a b => if a = b then 2 else -1
        have hpow : ∀ x y : Fin 3, ζ ^ x.val * star (ζ ^ y.val) = ζ ^ (x + 2 * y).val := by
          intro x y
          rw [star_pow, hstar, ← pow_mul, ← pow_add]
          have : ∀ m : ℕ, ζ ^ m = ζ ^ (m % 3) := by
            intro m; conv_lhs => rw [← Nat.div_add_mod m 3, pow_add, pow_mul, h3, one_pow, one_mul]
          rw [this, this ((x + 2 * y).val)]
          congr 1
          fin_cases x <;> fin_cases y <;> rfl
  6. The Gram matrix M * M.conjTranspose equals 12 • I₁₄ + P * C * P.transpose.

    Entry (i, j) of M * M.conjTranspose is ∑_k ζ^(E i k + 2 * E j k) by `Matrix.mul_apply`, `Matrix.conjTranspose_apply`, and `Finset.sum_congr`. By `op2178_sum_fin3`, this sum equals c₀ + c₁ ζ + c₂ ζ². By `op2178_cnt_facts`, c₁ = c₂, so c₁ ζ + c₂ ζ² = c₂ (ζ + ζ²) = -c₂, reducing the entry to the integer c₀ - c₂. Applying the formula for c₀ - c₂ from `op2178_cnt_facts` matches entry (i, j) of 12 • 1 + P * C * P.transpose (expanded via `Matrix.add_apply`, `Matrix.smul_apply`, `Matrix.one_apply`, `Matrix.transpose_apply`, and `Fin.sum_univ_three`).

    lines 78–103

    uses Matrix.mul_apply, Matrix.conjTranspose_apply, Matrix.of_apply, Finset.sum_congr, Matrix.add_apply, Matrix.smul_apply, Matrix.one_apply, Matrix.transpose_apply, Fin.sum_univ_three, op2178_sum_fin3, op2178_cnt_facts, op2178_cnt

        have hgram : M * M.conjTranspose = (12 : ℂ) • (1 : Matrix (Fin 14) (Fin 14) ℂ) + P * C * P.transpose := by
          ext i j
          have hl : (M * M.conjTranspose) i j =
              ∑ k, ζ ^ (op2178_m14_exp i k + 2 * op2178_m14_exp j k).val := by
            simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, M, Matrix.of_apply]
            exact Finset.sum_congr rfl (fun k _ => hpow _ _)
          have hr : ((12 : ℂ) • (1 : Matrix (Fin 14) (Fin 14) ℂ) + P * C * P.transpose : Matrix (Fin 14) (Fin 14) ℂ) i j =
              (if i = j then 12 else 0) + (if op2178_blk i = op2178_blk j then 2 else -1) := by
            simp only [Matrix.add_apply, Matrix.smul_apply, Matrix.one_apply, Matrix.mul_apply,
              Matrix.transpose_apply, P, C, Matrix.of_apply, Fin.sum_univ_three]
            generalize op2178_blk i = bi
            generalize op2178_blk j = bj
            fin_cases bi <;> fin_cases bj <;> by_cases hij : i = j <;> simp [hij] <;> norm_num
          rw [hl, hr, op2178_sum_fin3]
          obtain ⟨h12, h02⟩ := op2178_cnt_facts i j
          simp only [op2178_cnt] at h12 h02
          rw [h12]
          have h02' : ((Finset.univ.filter fun k => op2178_m14_exp i k + 2 * op2178_m14_exp j k = 0).card : ℂ)
              = ((Finset.univ.filter fun k => op2178_m14_exp i k + 2 * op2178_m14_exp j k = 2).card : ℂ) +
                ((if i = j then 12 else 0) + (if op2178_blk i = op2178_blk j then 2 else -1) : ℤ) := by
            rw [← h02]; push_cast; ring
          rw [h02']
          have hz2 : ζ ^ 2 = -1 - ζ := by linear_combination hsum
          rw [hz2]
          push_cast
          split_ifs <;> ring
  7. The determinant of the Gram matrix M * M.conjTranspose equals 2^24 * 3^13 * 223.

    Factoring 12 from 12 • I₁₄ + P * C * P.transpose using `smul_add`, `Matrix.smul_mul`, `smul_smul`, and `Matrix.det_smul` gives 12¹⁴ det(I₁₄ + (1/12 • (P * C)) * P.transpose). Sylvester's determinant identity (`Matrix.det_one_add_mul_comm`) reduces this to 12¹⁴ det(I₃ + P.transpose * (1/12 • (P * C))). The resulting 3 by 3 matrix is computed entry-by-entry (`Fin.sum_univ_succ`, `Matrix.one_apply`, `Matrix.mul_apply`), and evaluating its determinant via `Matrix.det_fin_three` gives 223 / 48. Multiplying by 12¹⁴ yields 2^24 * 3^13 * 223.

    lines 104–119

    uses smul_add, Matrix.smul_mul, smul_smul, Matrix.det_smul, Matrix.det_one_add_mul_comm, Fin.sum_univ_succ, Matrix.one_apply, Matrix.mul_apply, Matrix.det_fin_three

        have hdetG : (M * M.conjTranspose).det = (2 : ℂ) ^ 24 * 3 ^ 13 * 223 := by
          rw [hgram]
          have hfac : ((12 : ℂ) • (1 : Matrix (Fin 14) (Fin 14) ℂ) + P * C * P.transpose) =
              (12 : ℂ) • (1 + ((1 / 12 : ℂ) • (P * C)) * P.transpose) := by
            rw [smul_add, Matrix.smul_mul, smul_smul]
            norm_num
          rw [hfac, Matrix.det_smul, Matrix.det_one_add_mul_comm]
          have h3x3 : (1 : Matrix (Fin 3) (Fin 3) ℂ) + P.transpose * ((1 / 12 : ℂ) • (P * C)) =
              !![2, -1/2, -1/2; -5/12, 22/12, -5/12; -1/4, -1/4, 3/2] := by
            ext a b
            fin_cases a <;> fin_cases b <;>
              simp [Matrix.mul_apply, Fin.sum_univ_succ, P, C, op2178_blk, Matrix.one_apply] <;>
              norm_num
          rw [h3x3, Matrix.det_fin_three]
          simp
          norm_num
  8. The squared determinant Complex.normSq M.det equals 2^24 * 3^13 * 223.

    The squared complex determinant Complex.normSq M.det = M.det * star M.det equals det(M * M.conjTranspose) by `Matrix.det_mul`, `Matrix.det_conjTranspose`, `Complex.star_def`, and `Complex.mul_conj`. Equating this with the evaluated determinant of the Gram matrix proves the theorem.

    lines 120–123

    uses Matrix.det_mul, Matrix.det_conjTranspose, Complex.star_def, Complex.mul_conj

        have hdet : (Complex.normSq M.det : ℂ) = (M * M.conjTranspose).det := by
          rw [Matrix.det_mul, Matrix.det_conjTranspose, Complex.star_def, Complex.mul_conj]
        have := hdet.trans hdetG
        exact_mod_cast this
Finset.sum_fiberwise
splits a sum over a finite type into fibers of a projection map
Fin.sum_univ_three
expands a sum over Fin 3 into the sum of its terms at 0, 1, and 2
Finset.sum_congr
sums of pointwise equal functions over the same finite set are equal
Finset.mem_filter
membership in a filtered set requires satisfying the predicate
Finset.sum_const
summing a constant value over a finite set equals the cardinality times that value
nsmul_eq_mul
natural number scalar multiplication coincides with ring multiplication
Complex.isPrimitiveRoot_exp
the exponential exp(2πi/n) is a primitive n-th root of unity for n ≠ 0
Finset.sum_range_succ
splits the sum over range (n + 1) into the sum over range n plus the term at n
Complex.star_def
the star operation on the complex field is complex conjugation
Complex.mul_conj
the product of a complex number and its conjugate is its squared norm
Complex.normSq_eq_norm_sq
the algebraic squared norm Complex.normSq z equals the real norm squared ‖z‖²
pow_succ'
a^(n+1) = a * a^n
mul_left_cancel₀
left multiplication by a non-zero element in a domain is injective
Matrix.of
constructs a matrix from a function on row and column indices
rootsOfUnity.mkOfPowEq
constructs a root of unity from an element whose n-th power is 1
pow_mul
(a^m)^n = a^(m * n)
mul_comm
multiplication in a commutative magma is commutative
one_pow
1^n = 1
rootsOfUnity.coe_mkOfPowEq
coercion of mkOfPowEq to the base ring recovers the original element
star_pow
star(x^n) = (star x)^n
pow_add
a^(m + n) = a^m * a^n
Nat.div_add_mod
division theorem: n * (m / n) + m % n = m
one_mul
1 * a = a
Matrix.mul_apply
entry (i, j) of the product of two matrices is the dot product of row i and column j
Matrix.conjTranspose_apply
entry (i, j) of the conjugate transpose is the complex conjugate of entry (j, i)
Matrix.of_apply
evaluating Matrix.of f at (i, j) gives f i j
Matrix.add_apply
entry (i, j) of A + B is A i j + B i j
Matrix.smul_apply
entry (i, j) of c • A is c * A i j
Matrix.one_apply
entry (i, j) of the identity matrix is 1 if i = j and 0 otherwise
Matrix.transpose_apply
entry (i, j) of the transpose of A is A j i
op2178_sum_fin3
a sum of powers of a root of unity over Fin 3 equals the weighted sum of counts for residues 0, 1, and 2
op2178_cnt_facts
combinatorial balance: residues 1 and 2 occur equally often, and the count difference c₀ - c₂ is determined by row equality and block equality
op2178_cnt
counts the number of columns where row exponent combinations equal a given residue modulo 3
smul_add
scalar multiplication distributes over matrix addition: c • (A + B) = c • A + c • B
Matrix.smul_mul
associativity of scalar multiplication with matrix multiplication: (c • A) * B = c • (A * B)
smul_smul
associativity of scalar multiplications: a • b • x = (a * b) • x
Matrix.det_smul
determinant of a scalar multiple: det(c • A) = c^n * det(A) for an n by n matrix
Matrix.det_one_add_mul_comm
Sylvester's determinant identity: det(I + A * B) = det(I + B * A)
Fin.sum_univ_succ
splits a sum over Fin (n + 1) into the term at 0 and the sum of subsequent terms
Matrix.det_fin_three
formula for the determinant of a 3 by 3 matrix in terms of its entries
Matrix.det_mul
multiplicativity of the determinant: det(A * B) = det(A) * det(B)
Matrix.det_conjTranspose
the determinant of the conjugate transpose is the complex conjugate of the determinant

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

def op2178_m14_exp : Fin 14 → Fin 14 → Fin 3 :=  ![![0,0,0,1,0,0, 2,2,0,1,1, 1,1,0],    ![0,0,1,0,0,0, 2,1,1,0,2, 1,0,1],    ![0,1,0,0,0,0, 1,2,1,2,0, 0,1,1],    ![1,0,0,2,0,0, 1,1,2,2,2, 1,1,2],    ![0,0,0,0,1,2, 1,2,2,1,2, 1,2,1],    ![0,0,0,0,2,1, 2,1,2,2,1, 2,1,1],    ![2,2,1,1,1,2, 0,1,0,2,0, 1,1,1],    ![2,1,2,1,2,1, 1,0,0,0,2, 1,1,1],    ![0,1,1,2,2,2, 0,0,2,0,0, 1,1,0],    ![1,0,2,2,1,2, 2,0,0,0,0, 0,1,1],    ![1,2,0,2,2,1, 0,2,0,0,0, 1,0,1],    ![1,1,0,1,1,2, 1,1,1,0,1, 2,0,0],    ![1,0,1,1,2,1, 1,1,1,1,0, 0,2,0],    ![0,1,1,2,1,1, 1,1,0,1,1, 0,0,2]]def op2178_blk (i : Fin 14) : Fin 3 := if i.val < 6 then 0 else if i.val < 11 then 1 else 2def op2178_cnt (i j : Fin 14) (r : Fin 3) : ℕ :=  (Finset.univ.filter fun k => op2178_m14_exp i k + 2 * op2178_m14_exp j k = r).cardtheorem op2178_cnt_facts : ∀ i j : Fin 14,    op2178_cnt i j 1 = op2178_cnt i j 2 ∧    (op2178_cnt i j 0 : ℤ) - op2178_cnt i j 2 =      (if i = j then 12 else 0) + (if op2178_blk i = op2178_blk j then 2 else -1) := by  decidetheorem op2178_sum_fin3 {ι : Type*} [Fintype ι] (d : ι → Fin 3) (ζ : ℂ) :    ∑ k, ζ ^ (d k).val =      ((Finset.univ.filter fun k => d k = 0).card : ℂ) +      ((Finset.univ.filter fun k => d k = 1).card : ℂ) * ζ +      ((Finset.univ.filter fun k => d k = 2).card : ℂ) * ζ ^ 2 := by  classical  rw [← Finset.sum_fiberwise Finset.univ d (fun k => ζ ^ (d k).val), Fin.sum_univ_three]  have h : ∀ r : Fin 3, ∑ k ∈ Finset.univ.filter (fun k => d k = r), ζ ^ (d k).val =      ((Finset.univ.filter fun k => d k = r).card : ℂ) * ζ ^ r.val := by    intro r    rw [Finset.sum_congr rfl (fun k hk => by rw [(Finset.mem_filter.1 hk).2]), Finset.sum_const,      nsmul_eq_mul]  rw [h 0, h 1, h 2]  simp/-- There exists an order-14 ternary matrix whose squared determinant equals 2^24 * 3^13 * 223. -/theorem op_2178_order_14_ternary_det_sq_attained :    ∃ (M : Matrix (Fin 14) (Fin 14) ℂ),      (∀ i j, ∃ u : rootsOfUnity 3 ℂ, ((u : ℂˣ) : ℂ) = M i j) ∧      Complex.normSq M.det = (2 : ℝ) ^ 24 * (3 : ℝ) ^ 13 * 223 := by  set ζ : ℂ := Complex.exp (2 * Real.pi * Complex.I / (3 : ℕ)) with hζdef  have hζ : IsPrimitiveRoot ζ 3 := Complex.isPrimitiveRoot_exp 3 (by norm_num)  have h3 : ζ ^ 3 = 1 := hζ.pow_eq_one  have hsum : 1 + ζ + ζ ^ 2 = 0 := by    have := hζ.geom_sum_eq_zero (by norm_num)    simpa [Finset.sum_range_succ] using this  have hnorm : ‖ζ‖ = 1 := hζ.norm'_eq_one (by norm_num)  have hstar : star ζ = ζ ^ 2 := by    have hne : ζ ≠ 0 := hζ.ne_zero (by norm_num)    have hmul : ζ * star ζ = 1 := by      rw [Complex.star_def, Complex.mul_conj, Complex.normSq_eq_norm_sq, hnorm]; simp    have : ζ * ζ ^ 2 = 1 := by rw [← pow_succ']; exact h3    exact mul_left_cancel₀ hne (hmul.trans this.symm)  let M : Matrix (Fin 14) (Fin 14) ℂ := Matrix.of fun i j => ζ ^ (op2178_m14_exp i j).val  refine ⟨M, ?_, ?_⟩  · intro i j    refine ⟨rootsOfUnity.mkOfPowEq (ζ ^ (op2178_m14_exp i j).val) ?_, ?_⟩    · rw [← pow_mul, mul_comm, pow_mul, h3, one_pow]    · rw [rootsOfUnity.coe_mkOfPowEq]; rfl  · -- Gram matrix    let P : Matrix (Fin 14) (Fin 3) ℂ := Matrix.of fun i b => if op2178_blk i = b then 1 else 0    let C : Matrix (Fin 3) (Fin 3) ℂ := Matrix.of fun a b => if a = b then 2 else -1    have hpow : ∀ x y : Fin 3, ζ ^ x.val * star (ζ ^ y.val) = ζ ^ (x + 2 * y).val := by      intro x y      rw [star_pow, hstar, ← pow_mul, ← pow_add]      have : ∀ m : ℕ, ζ ^ m = ζ ^ (m % 3) := by        intro m; conv_lhs => rw [← Nat.div_add_mod m 3, pow_add, pow_mul, h3, one_pow, one_mul]      rw [this, this ((x + 2 * y).val)]      congr 1      fin_cases x <;> fin_cases y <;> rfl    have hgram : M * M.conjTranspose = (12 : ℂ) • (1 : Matrix (Fin 14) (Fin 14) ℂ) + P * C * P.transpose := by      ext i j      have hl : (M * M.conjTranspose) i j =          ∑ k, ζ ^ (op2178_m14_exp i k + 2 * op2178_m14_exp j k).val := by        simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, M, Matrix.of_apply]        exact Finset.sum_congr rfl (fun k _ => hpow _ _)      have hr : ((12 : ℂ) • (1 : Matrix (Fin 14) (Fin 14) ℂ) + P * C * P.transpose : Matrix (Fin 14) (Fin 14) ℂ) i j =          (if i = j then 12 else 0) + (if op2178_blk i = op2178_blk j then 2 else -1) := by        simp only [Matrix.add_apply, Matrix.smul_apply, Matrix.one_apply, Matrix.mul_apply,          Matrix.transpose_apply, P, C, Matrix.of_apply, Fin.sum_univ_three]        generalize op2178_blk i = bi        generalize op2178_blk j = bj        fin_cases bi <;> fin_cases bj <;> by_cases hij : i = j <;> simp [hij] <;> norm_num      rw [hl, hr, op2178_sum_fin3]      obtain ⟨h12, h02⟩ := op2178_cnt_facts i j      simp only [op2178_cnt] at h12 h02      rw [h12]      have h02' : ((Finset.univ.filter fun k => op2178_m14_exp i k + 2 * op2178_m14_exp j k = 0).card : ℂ)          = ((Finset.univ.filter fun k => op2178_m14_exp i k + 2 * op2178_m14_exp j k = 2).card : ℂ) +            ((if i = j then 12 else 0) + (if op2178_blk i = op2178_blk j then 2 else -1) : ℤ) := by        rw [← h02]; push_cast; ring      rw [h02']      have hz2 : ζ ^ 2 = -1 - ζ := by linear_combination hsum      rw [hz2]      push_cast      split_ifs <;> ring    have hdetG : (M * M.conjTranspose).det = (2 : ℂ) ^ 24 * 3 ^ 13 * 223 := by      rw [hgram]      have hfac : ((12 : ℂ) • (1 : Matrix (Fin 14) (Fin 14) ℂ) + P * C * P.transpose) =          (12 : ℂ) • (1 + ((1 / 12 : ℂ) • (P * C)) * P.transpose) := by        rw [smul_add, Matrix.smul_mul, smul_smul]        norm_num      rw [hfac, Matrix.det_smul, Matrix.det_one_add_mul_comm]      have h3x3 : (1 : Matrix (Fin 3) (Fin 3) ℂ) + P.transpose * ((1 / 12 : ℂ) • (P * C)) =          !![2, -1/2, -1/2; -5/12, 22/12, -5/12; -1/4, -1/4, 3/2] := by        ext a b        fin_cases a <;> fin_cases b <;>          simp [Matrix.mul_apply, Fin.sum_univ_succ, P, C, op2178_blk, Matrix.one_apply] <;>          norm_num      rw [h3x3, Matrix.det_fin_three]      simp      norm_num    have hdet : (Complex.normSq M.det : ℂ) = (M * M.conjTranspose).det := by      rw [Matrix.det_mul, Matrix.det_conjTranspose, Complex.star_def, Complex.mul_conj]    have := hdet.trans hdetG    exact_mod_cast this
See it in the graphDiscuss this resultChallenge it