The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V07. Linear algebra

Mathlib.LinearAlgebra.Matrix.HadamardMatrix

26 declarations. Mathlib docs · Source

Hadamard matrices

This file defines Matrix.IsHadamard, a unified notion that specializes to the classical real Hadamard matrices over ℝ/ℤ (where star is trivial and entries are ±1) and to the complex Hadamard matrices over ℂ (where entries have unit norm). Basic results: conjugate-transpose closure, the order identity n = s * star s from constant row or column sums, the Sylvester (Kronecker) construction, and the divisibility obstruction 4 ∣ n.

References

  • [W. de Launey and D. L. Flannery, Algebraic Design Theory][deLauneyFlannery2011]

theorem Matrix.IsHadamard.congr_simp E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] {inst_1 : DecidableEq n} [inst_2 : DecidableEq n]
  [inst_3 : Semiring R] [inst_4 : StarRing R] (A A_1 : Matrix n n R), A = A_1 → A.IsHadamard = A_1.IsHadamard

structure Matrix.IsHadamard E1 #

{n : Type u_2} →
  {R : Type u_3} → [Fintype n] → [DecidableEq n] → [inst : Semiring R] → [StarRing R] → Matrix n n R → Prop

A square matrix over a *-semiring whose entries are unitary and whose rows and columns are orthogonal with respect to the conjugate transpose: A * Aᴴ = n • 1 and Aᴴ * A = n • 1.

Over a commutative ring in which the order is regular, the one-sided condition from [Definition 2.3.1][deLauneyFlannery2011] implies this predicate by IsHadamard.of_mul_conjTranspose; over a ring with trivial star (e.g. ℝ, ℤ), the entry condition becomes A i j = 1 ∨ A i j = -1. Over ℂ, the entry condition becomes ‖A i j‖ = 1, generalizing the fourth-root complex Hadamard matrices of [Definition 2.7.1][deLauneyFlannery2011].

ctor Matrix.IsHadamard.mk E0 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  {A : Matrix n n R},
  (∀ (i j : n), A i j ∈ unitary R) →
    A * A.conjTranspose = ↑(Fintype.card n) • 1 → A.conjTranspose * A = ↑(Fintype.card n) • 1 → A.IsHadamard

theorem Matrix.isHadamard_iff E0 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  (A : Matrix n n R),
  A.IsHadamard ↔
    (∀ (i j : n), A i j ∈ unitary R) ∧
      A * A.conjTranspose = ↑(Fintype.card n) • 1 ∧ A.conjTranspose * A = ↑(Fintype.card n) • 1

theorem Matrix.IsHadamard.apply_mem E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.IsHadamard → ∀ (i j : n), A i j ∈ unitary R

theorem Matrix.IsHadamard.mul_conjTranspose E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.IsHadamard → A * A.conjTranspose = ↑(Fintype.card n) • 1

theorem Matrix.IsHadamard.conjTranspose_mul E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.IsHadamard → A.conjTranspose * A = ↑(Fintype.card n) • 1

theorem Matrix.IsHadamard.isStarNormal E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.IsHadamard → IsStarNormal A

theorem Matrix.IsHadamard.conjTranspose E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.IsHadamard → A.conjTranspose.IsHadamard

The conjugate transpose of a Hadamard matrix is Hadamard.

theorem Matrix.isHadamard_conjTranspose_iff E0 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.conjTranspose.IsHadamard ↔ A.IsHadamard

theorem Matrix.IsHadamard.reindex E1 #

∀ {m : Type u_1} {n : Type u_2} {R : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : Semiring R] [inst_5 : StarRing R] {A : Matrix n n R} (e₁ e₂ : n ≃ m),
  A.IsHadamard → ((Matrix.reindex e₁ e₂) A).IsHadamard

Permuting the rows and columns of a Hadamard matrix gives a Hadamard matrix.

theorem Matrix.isHadamard_submatrix_equiv_iff E0 #

∀ {m : Type u_1} {n : Type u_2} {R : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : Semiring R] [inst_5 : StarRing R] {A : Matrix n n R} (e₁ e₂ : m ≃ n),
  (A.submatrix ⇑e₁ ⇑e₂).IsHadamard ↔ A.IsHadamard

theorem Matrix.IsHadamard.kronecker E1 #

∀ {m : Type u_1} {n : Type u_2} {R : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : Semiring R] [inst_5 : StarRing R] {A : Matrix m m R} {B : Matrix n n R},
  A.IsHadamard → B.IsHadamard → (Matrix.kroneckerMap (fun x1 x2 ↦ x1 * x2) A B).IsHadamard

The Kronecker product of two Hadamard matrices is Hadamard.

theorem Matrix.IsHadamard.card_eq_mul_star_of_const_col_sum E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  {A : Matrix n n R} {s : R},
  A.IsHadamard → IsRegular ↑(Fintype.card n) → (∀ (j : n), ∑ i, A i j = s) → ↑(Fintype.card n) = s * star s

A Hadamard matrix with constant column sum s has order s * star s, provided the order is regular in R.

The row-sum form is IsHadamard.card_eq_star_mul_of_const_row_sum; over a ring with trivial star the conclusion becomes (Fintype.card n : R) = s ^ 2, a slightly stronger form of [Theorem 2.3.7][deLauneyFlannery2011]: only a constant sum hypothesis on one side is needed under the two-sided orthogonality condition.

theorem Matrix.IsHadamard.card_eq_star_mul_of_const_row_sum E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Semiring R] [inst_3 : StarRing R]
  {A : Matrix n n R} {s : R},
  A.IsHadamard → IsRegular ↑(Fintype.card n) → (∀ (i : n), ∑ j, A i j = s) → ↑(Fintype.card n) = star s * s

A Hadamard matrix with constant row sum s has order star s * s, provided the order is regular in R. This generalizes [Theorem 2.3.7][deLauneyFlannery2011].

theorem Matrix.IsHadamard.transpose E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  [inst_3 : StarRing R] {A : Matrix n n R}, A.IsHadamard → A.transpose.IsHadamard

The transpose of a Hadamard matrix is Hadamard.

Unlike IsHadamard.conjTranspose this requires commutativity: over a noncommutative ring the transpose of a Hadamard matrix need not be Hadamard.

theorem Matrix.isHadamard_transpose_iff E0 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  [inst_3 : StarRing R] {A : Matrix n n R}, A.transpose.IsHadamard ↔ A.IsHadamard

theorem Matrix.IsHadamard.neg E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Ring R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.IsHadamard → (-A).IsHadamard

Negating a Hadamard matrix gives a Hadamard matrix.

theorem Matrix.IsHadamard.neg_iff E0 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : Ring R] [inst_3 : StarRing R]
  {A : Matrix n n R}, (-A).IsHadamard ↔ A.IsHadamard

A matrix is Hadamard iff its negation is.

theorem Matrix.IsHadamard.det_mul_star_det E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommRing R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.IsHadamard → A.det * star A.det = ↑(Fintype.card n) ^ Fintype.card n

The Hadamard determinant identity: det A * star (det A) = (card n)^(card n).

theorem Matrix.IsHadamard.star_det_mul_det E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommRing R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.IsHadamard → star A.det * A.det = ↑(Fintype.card n) ^ Fintype.card n

The Hadamard determinant identity: star (det A) * det A = (card n)^(card n).

theorem Matrix.IsHadamard.det_ne_zero E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommRing R] [inst_3 : StarRing R]
  {A : Matrix n n R} [IsReduced R], A.IsHadamard → ↑(Fintype.card n) ≠ 0 → A.det ≠ 0

A Hadamard matrix over a reduced commutative ring has nonzero determinant, provided the order is nonzero in R.

theorem Matrix.IsHadamard.isRegular_det E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommRing R] [inst_3 : StarRing R]
  {A : Matrix n n R}, A.IsHadamard → IsRegular ↑(Fintype.card n) → IsRegular A.det

The determinant of a Hadamard matrix is regular, provided the order is regular in R.

theorem Matrix.IsHadamard.of_mul_conjTranspose E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommRing R] [inst_3 : StarRing R]
  {A : Matrix n n R},
  (∀ (i j : n), A i j ∈ unitary R) →
    A * A.conjTranspose = ↑(Fintype.card n) • 1 → IsRegular ↑(Fintype.card n) → A.IsHadamard

Build a Hadamard matrix from the one-sided row-orthogonality condition, provided the order is regular in R.

This is the matrix form of [Theorem 2.3.6][deLauneyFlannery2011].

theorem Matrix.isHadamard_iff_mul_conjTranspose E1 #

∀ {n : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommRing R] [inst_3 : StarRing R]
  {A : Matrix n n R},
  IsRegular ↑(Fintype.card n) →
    (A.IsHadamard ↔ (∀ (i j : n), A i j ∈ unitary R) ∧ A * A.conjTranspose = ↑(Fintype.card n) • 1)

theorem Matrix.IsHadamard.four_dvd_card E1 #

∀ {n : Type u_2} [inst : Fintype n] [inst_1 : DecidableEq n] {A : Matrix n n ℤ},
  A.IsHadamard → 2 < Fintype.card n → 4 ∣ Fintype.card n

An integer Hadamard matrix of order greater than two has order divisible by four.

This is the standard divisibility obstruction in [Section 2.3][deLauneyFlannery2011].