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.SemiringInverse

61 declarations. Mathlib docs · Source

Nonsingular inverses over semirings

This file proves A * B = 1 ↔ B * A = 1 for square matrices over a commutative semiring.

theorem Matrix.IsDetpBalanced.congr_simp E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] {inst_1 : DecidableEq n} [inst_2 : DecidableEq n]
  [inst_3 : CommSemiring R] (A A_1 : Matrix n n R),
  A = A_1 → ∀ (a a_1 : R), a = a_1 → ∀ (b b_1 : R), b = b_1 → A.IsDetpBalanced a b = A_1.IsDetpBalanced a_1 b_1

theorem Matrix.adjp.congr_simp E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] {inst_1 : DecidableEq n} [inst_2 : DecidableEq n]
  [inst_3 : CommSemiring R] (s s_1 : ℤˣ),
  s = s_1 →
    ∀ (A A_1 : Matrix n n R),
      A = A_1 →
        ∀ (a a_1 : n), a = a_1 → ∀ (a_2 a_3 : n), a_2 = a_3 → Matrix.adjp s A a a_2 = Matrix.adjp s_1 A_1 a_1 a_3

theorem Matrix.detp.congr_simp E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] {inst_1 : DecidableEq n} [inst_2 : DecidableEq n]
  [inst_3 : CommSemiring R] (s s_1 : ℤˣ),
  s = s_1 → ∀ (A A_1 : Matrix n n R), A = A_1 → Matrix.detp s A = Matrix.detp s_1 A_1

def Matrix.detp E1 #

{n : Type u_1} → {R : Type u_3} → [Fintype n] → [DecidableEq n] → [CommSemiring R] → ℤˣ → Matrix n n R → R

The determinant, but only the terms of a given sign. A.detp 1 is written |A|⁺ in the literature and A.detp (-1) is written |A|⁻.

theorem Matrix.detp_transpose E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  (A : Matrix n n R), Matrix.detp s A.transpose = Matrix.detp s A

theorem Matrix.detp_zero E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  [Nonempty n], Matrix.detp s 0 = 0

theorem Matrix.detp_one_diagonal E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (d : n → R),
  Matrix.detp 1 (Matrix.diagonal d) = ∏ i, d i

theorem Matrix.detp_one_one E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R],
  Matrix.detp 1 1 = 1

theorem Matrix.detp_neg_one_diagonal E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (d : n → R),
  Matrix.detp (-1) (Matrix.diagonal d) = 0

theorem Matrix.detp_neg_one_one E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R],
  Matrix.detp (-1) 1 = 0

theorem Matrix.detp_one_of_isEmpty E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (A : Matrix n n R)
  [IsEmpty n], Matrix.detp 1 A = 1

theorem Matrix.detp_neg_one_of_isEmpty E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (A : Matrix n n R)
  [IsEmpty n], Matrix.detp (-1) A = 0

theorem Matrix.detp_submatrix_equiv_equiv E0 #

∀ {n : Type u_1} {m : Type u_2} {R : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommSemiring R] (s : ℤˣ) (A : Matrix n n R) (f g : m ≃ n),
  Matrix.detp s (A.submatrix ⇑f ⇑g) = Matrix.detp (s * Equiv.Perm.sign (f.symm.trans g)) A

theorem Matrix.detp_submatrix_equiv_self E1 #

∀ {n : Type u_1} {m : Type u_2} {R : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommSemiring R] (s : ℤˣ) (A : Matrix n n R) (e : m ≃ n),
  Matrix.detp s (A.submatrix ⇑e ⇑e) = Matrix.detp s A

theorem Matrix.detp_smul E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  (A : Matrix n n R) (c : R), Matrix.detp s (c • A) = c ^ Fintype.card n * Matrix.detp s A

theorem Matrix.detp_map E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  (A : Matrix n n R) {S : Type u_4} [inst_3 : CommSemiring S] (f : R →+* S),
  Matrix.detp s (A.map ⇑f) = f (Matrix.detp s A)

def Matrix.IsDetpBalanced E1 #

{n : Type u_1} → {R : Type u_3} → [Fintype n] → [DecidableEq n] → [CommSemiring R] → Matrix n n R → R → R → Prop

A square matrix A over a commutative semiring R is "determinant balanced" with respect to a b : R if a|A|⁺ + b|A|⁻ = b|A|⁺ + a|A|⁻. Over a commutative ring, this is equivalent to (a - b)|A| = 0, see Matrix.isDetpBalanced_iff_sub_mul_det_eq_zero.

theorem Matrix.IsDetpBalanced.refl E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (A : Matrix n n R)
  (a : R), A.IsDetpBalanced a a

theorem Matrix.IsDetpBalanced.of_eq E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {a b : R}, Matrix.detp 1 A = Matrix.detp (-1) A → A.IsDetpBalanced a b

theorem Matrix.IsDetpBalanced.symm E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {a b : R}, A.IsDetpBalanced a b → A.IsDetpBalanced b a

theorem Matrix.IsDetpBalanced_comm E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {a b : R}, A.IsDetpBalanced a b ↔ A.IsDetpBalanced b a

theorem Matrix.IsDetpBalanced.trans E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {a b c : R} [IsCancelAdd R], A.IsDetpBalanced a b → A.IsDetpBalanced b c → A.IsDetpBalanced a c

theorem Matrix.IsDetpBalanced.mul_add_mul_eq E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {a b : R},
  A.IsDetpBalanced a b →
    ∀ (s t : ℤˣ), a * Matrix.detp s A + b * Matrix.detp t A = b * Matrix.detp s A + a * Matrix.detp t A

theorem Matrix.isDetpBalanced_transpose_iff E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {a b : R}, A.transpose.IsDetpBalanced a b ↔ A.IsDetpBalanced a b

theorem Matrix.IsDetpBalanced.transpose E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {a b : R}, A.IsDetpBalanced a b → A.transpose.IsDetpBalanced a b

Alias of the reverse direction of Matrix.isDetpBalanced_transpose_iff.

theorem Matrix.IsDetpBalanced.of_transpose E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {a b : R}, A.transpose.IsDetpBalanced a b → A.IsDetpBalanced a b

Alias of the forward direction of Matrix.isDetpBalanced_transpose_iff.

theorem Matrix.IsDetpBalanced.submatrix_equiv E1 #

∀ {n : Type u_1} {m : Type u_2} {R : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommSemiring R] {A : Matrix n n R} {a b : R} (e₁ e₂ : m ≃ n),
  A.IsDetpBalanced a b → (A.submatrix ⇑e₁ ⇑e₂).IsDetpBalanced a b

theorem Matrix.isDetpBalanced_submatrix_equiv_iff E0 #

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

theorem Matrix.IsDetpBalanced.smul E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {a b : R}, A.IsDetpBalanced a b → ∀ (c : R), (c • A).IsDetpBalanced a b

def Matrix.Nonsingular E1 #

{n : Type u_1} → {R : Type u_3} → [Fintype n] → [DecidableEq n] → [CommSemiring R] → Matrix n n R → Prop

A square matrix A over a commutative semiring R is called nonsingular if it is only determinant balanced with respect to equal elements.

See also See also Matrix.Nondegenerate.

theorem Matrix.nonsingular_one E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R],
  Matrix.Nonsingular 1

theorem Matrix.Nonsingular.of_isEmpty E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (A : Matrix n n R)
  [IsEmpty n], A.Nonsingular

theorem Matrix.nonsingular_transpose_iff E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  {A : Matrix n n R}, A.transpose.Nonsingular ↔ A.Nonsingular

theorem Matrix.Nonsingular.transpose E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  {A : Matrix n n R}, A.Nonsingular → A.transpose.Nonsingular

Alias of the reverse direction of Matrix.nonsingular_transpose_iff.

theorem Matrix.Nonsingular.of_transpose E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  {A : Matrix n n R}, A.transpose.Nonsingular → A.Nonsingular

Alias of the forward direction of Matrix.nonsingular_transpose_iff.

theorem Matrix.nonsingular_submatrix_equiv_iff E0 #

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

theorem Matrix.Nonsingular.submatrix_equiv E1 #

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

Alias of the reverse direction of Matrix.nonsingular_submatrix_equiv_iff.

theorem Matrix.detp_eq_of_row_eq E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {p q : n}, p ≠ q → A.row p = A.row q → ∀ (s : optParam ℤˣ 1) (t : optParam ℤˣ (-1)), Matrix.detp s A = Matrix.detp t A

theorem Matrix.detp_eq_of_col_eq E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] {A : Matrix n n R}
  {p q : n}, p ≠ q → A.col p = A.col q → ∀ (s : optParam ℤˣ 1) (t : optParam ℤˣ (-1)), Matrix.detp s A = Matrix.detp t A

theorem Matrix.detp_eq_of_row_eq_zero E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  {A : Matrix n n R} {p : n}, A.row p = 0 → Matrix.detp s A = 0

theorem Matrix.detp_eq_of_col_eq_zero E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  {A : Matrix n n R} {p : n}, A.col p = 0 → Matrix.detp s A = 0

theorem Matrix.IsDetpBalanced.submatrix_of_card_le E1 #

∀ {n : Type u_1} {m : Type u_2} {R : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommSemiring R] {A : Matrix n n R} {a b : R},
  A.IsDetpBalanced a b → Fintype.card n ≤ Fintype.card m → ∀ (f g : m → n), (A.submatrix f g).IsDetpBalanced a b

If A is determinant balanced with respect to a and b, any submatrix of the same or bigger size (possibly with repeated rows or columns) is also.

def Matrix.adjp E1 #

{n : Type u_1} → {R : Type u_3} → [Fintype n] → [DecidableEq n] → [CommSemiring R] → ℤˣ → Matrix n n R → Matrix n n R

The adjugate matrix, but only the terms of a given sign.

theorem Matrix.adjp_apply E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  (A : Matrix n n R) (i j : n), Matrix.adjp s A i j = ∑ σ ∈ Equiv.Perm.ofSign s with σ j = i, ∏ k ∈ {j}ᶜ, A k (σ k)

theorem Matrix.adjp_transpose E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  (A : Matrix n n R), Matrix.adjp s A.transpose = (Matrix.adjp s A).transpose

theorem Matrix.adjp_none_none E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  (A : Matrix (Option n) (Option n) R), Matrix.adjp s A none none = Matrix.detp s (A.submatrix some some)

theorem Matrix.adjp_some_none E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ) (i : n)
  (A : Matrix (Option n) (Option n) R),
  Matrix.adjp s A (some i) none = Matrix.detp (-s) (A.submatrix some (Function.update some i none))

theorem Matrix.adjp_none_some E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ) (i : n)
  (A : Matrix (Option n) (Option n) R),
  Matrix.adjp s A none (some i) = Matrix.detp (-s) (A.submatrix (Function.update some i none) some)

theorem Matrix.detp_mul E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  (A B : Matrix n n R),
  Matrix.detp 1 (A * B) + (Matrix.detp 1 A * Matrix.detp (-1) B + Matrix.detp (-1) A * Matrix.detp 1 B) =
    Matrix.detp (-1) (A * B) + (Matrix.detp 1 A * Matrix.detp 1 B + Matrix.detp (-1) A * Matrix.detp (-1) B)

theorem Matrix.mul_adjp_apply_eq E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  (A : Matrix n n R) (i : n), (A * Matrix.adjp s A) i i = Matrix.detp s A

theorem Matrix.mul_adjp_apply_ne E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (A : Matrix n n R)
  (i j : n), i ≠ j → (A * Matrix.adjp 1 A) i j = (A * Matrix.adjp (-1) A) i j

theorem Matrix.adjp_mul_apply_eq E0 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  (A : Matrix n n R) (i : n), (Matrix.adjp s A * A) i i = Matrix.detp s A

theorem Matrix.adjp_mul_apply_ne E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (A : Matrix n n R)
  (i j : n), i ≠ j → (Matrix.adjp 1 A * A) i j = (Matrix.adjp (-1) A * A) i j

theorem Matrix.mul_adjp_add_detp E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  (A : Matrix n n R), A * Matrix.adjp 1 A + Matrix.detp (-1) A • 1 = A * Matrix.adjp (-1) A + Matrix.detp 1 A • 1

theorem Matrix.detp_option_expand_row_none E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R] (s : ℤˣ)
  (A : Matrix (Option n) (Option n) R),
  Matrix.detp s A =
    A none none * Matrix.detp s (A.submatrix some some) +
      ∑ k, A none (some k) * Matrix.detp (-s) (A.submatrix some (Function.update some k none))

Laplace expansion of detp along the none row of an Option-indexed matrix.

theorem Matrix.isAddUnit_mul E1 #

∀ {n : Type u_1} {m : Type u_2} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq m] [inst_2 : CommSemiring R]
  {A : Matrix m n R} {B : Matrix n m R} {d : m → R},
  A * B = Matrix.diagonal d → ∀ (i j : m) (k : n), i ≠ j → IsAddUnit (A i k * B k j)

theorem Matrix.isAddUnit_detp_mul_detp E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  {A B : Matrix n n R} {d : n → R},
  A * B = Matrix.diagonal d → IsAddUnit (Matrix.detp 1 A * Matrix.detp (-1) B + Matrix.detp (-1) A * Matrix.detp 1 B)

theorem Matrix.isAddUnit_detp_smul_mul_adjp E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  {A B : Matrix n n R} {d : n → R},
  A * B = Matrix.diagonal d →
    IsAddUnit (Matrix.detp 1 A • (B * Matrix.adjp (-1) B) + Matrix.detp (-1) A • (B * Matrix.adjp 1 B))

theorem Matrix.detp_smul_add_adjp E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  {A B : Matrix n n R}, A * B = 1 → Matrix.detp 1 B • A + Matrix.adjp (-1) B = Matrix.detp (-1) B • A + Matrix.adjp 1 B

theorem Matrix.detp_smul_adjp E1 #

∀ {n : Type u_1} {R : Type u_3} [inst : Fintype n] [inst_1 : DecidableEq n] [inst_2 : CommSemiring R]
  {A B : Matrix n n R},
  A * B = 1 →
    A + (Matrix.detp 1 A • Matrix.adjp (-1) B + Matrix.detp (-1) A • Matrix.adjp 1 B) =
      Matrix.detp 1 A • Matrix.adjp 1 B + Matrix.detp (-1) A • Matrix.adjp (-1) B

instance Matrix.instIsStablyFiniteRingOfCommSemiring E0 #

∀ {R : Type u_3} [inst : CommSemiring R], IsStablyFiniteRing R