AFTD Auto-Formalizing Theoretical Domains

not_is_hadamard_matrix_all_ones_two

theoremverified

The 2 × 2 all-ones matrix is not a Hadamard matrix.

Statement

theorem not_is_hadamard_matrix_all_ones_two :
    ¬ IsHadamardMatrix (Matrix.of fun (_ _ : Fin 2) => (1 : ℤ))
Source
sanity lemma for IsHadamardMatrix
Verified
22 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • IsHadamardMatrixA square integer matrix H indexed by a finite type of size n is a Hadamard matrix when every entry is 1 or -1 and H Hᵀ = n I.

The proof, explained

The proof proceeds by contradiction. If the 2 × 2 all-ones matrix J were a Hadamard matrix, it would satisfy the orthogonality relation J * Jᵀ = 2 • I. However, evaluating the off-diagonal entry at row 0 and column 1 gives 1 · 1 + 1 · 1 = 2 on the left-hand side and 0 on the right-hand side, yielding the contradiction 2 = 0.

  1. Assume for contradiction that the 2 × 2 all-ones matrix is Hadamard, yielding J * Jᵀ = 2 • I.

    A Hadamard matrix H is defined to have all entries in {1, -1} and to satisfy the orthogonality relation H * Hᵀ = n • I. Assuming for contradiction that the 2 × 2 all-ones matrix J is Hadamard, we unpack this definition and retain the matrix equation h : J * Jᵀ = 2 • I, discarding the condition on the entries.

    line 3

      rintro ⟨-, h⟩
  2. Evaluating the off-diagonal entry at (0, 1) on both sides of J * Jᵀ = 2 • I yields a contradiction.

    Applying congrFun twice to the matrix equality h isolates the entry at row 0 and column 1, yielding (J * Jᵀ) 0 1 = (2 • I) 0 1. Unfolding matrix multiplication with Matrix.mul_apply calculates the left-hand side as the sum 1 · 1 + 1 · 1 = 2, whereas the right-hand side is the off-diagonal entry of the scaled identity matrix, 2 · 0 = 0. Simplifying this equation yields the contradiction 2 = 0, which discharges the goal False.

    lines 4–5

    uses congrFun, Matrix.mul_apply

      have := congrFun (congrFun h 0) 1
      simp [Matrix.mul_apply] at this
congrFun
If two functions f and g are equal, then f(a) = g(a) for any argument a.
Matrix.mul_apply
The (i, k)-th entry of the matrix product M * N is the sum ∑ j, M i j * N j k.

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

theorem not_is_hadamard_matrix_all_ones_two :    ¬ IsHadamardMatrix (Matrix.of fun (_ _ : Fin 2) => (1 : ℤ)) := by  rintro ⟨-, h⟩  have := congrFun (congrFun h 0) 1  simp [Matrix.mul_apply] at this
See it in the graphDiscuss this resultChallenge it