Skip to content

Commit

Permalink
refactor(LinearAlgebra/Matrix/Adjugate): shorten proof of adjugate_fi…
Browse files Browse the repository at this point in the history
…n_two (#11051)
  • Loading branch information
Bergschaf committed Feb 28, 2024
1 parent dce7630 commit aa178a8
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions Mathlib/LinearAlgebra/Matrix/Adjugate.lean
Expand Up @@ -399,31 +399,25 @@ theorem adjugate_fin_one (A : Matrix (Fin 1) (Fin 1) α) : adjugate A = 1 :=
adjugate_subsingleton A
#align matrix.adjugate_fin_one Matrix.adjugate_fin_one

theorem adjugate_fin_succ_eq_det_submatrix {n : ℕ} (A : Matrix (Fin n.succ) (Fin n.succ) α) (i j) :
adjugate A i j = (-1) ^ (j + i : ℕ) * det (A.submatrix j.succAbove i.succAbove) := by
simp_rw [adjugate_apply, det_succ_row _ j, updateRow_self, submatrix_updateRow_succAbove]
rw [Fintype.sum_eq_single i fun h hjk => ?_, Pi.single_eq_same, mul_one]
rw [Pi.single_eq_of_ne hjk, mul_zero, zero_mul]
#align matrix.adjugate_fin_succ_eq_det_submatrix Matrix.adjugate_fin_succ_eq_det_submatrix

theorem adjugate_fin_two (A : Matrix (Fin 2) (Fin 2) α) :
adjugate A = !![A 1 1, -A 0 1; -A 1 0, A 0 0] := by
ext i j
rw [adjugate_apply, det_fin_two]
fin_cases i <;> fin_cases j <;>
simp [one_mul, Fin.one_eq_zero_iff, Pi.single_eq_same, mul_zero, sub_zero,
Pi.single_eq_of_ne, Ne.def, not_false_iff, updateRow_self, updateRow_ne, cons_val_zero,
of_apply, Nat.succ_succ_ne_one, Pi.single_eq_of_ne, updateRow_self, Pi.single_eq_of_ne,
Ne.def, Fin.zero_eq_one_iff, Nat.succ_succ_ne_one, not_false_iff, updateRow_ne,
Fin.one_eq_zero_iff, zero_mul, Pi.single_eq_same, one_mul, zero_sub, of_apply,
cons_val', cons_val_fin_one, cons_val_one, head_fin_const, neg_inj, eq_self_iff_true,
cons_val_zero, head_cons, mul_one]
rw [adjugate_fin_succ_eq_det_submatrix]
fin_cases i <;> fin_cases j <;> simp
#align matrix.adjugate_fin_two Matrix.adjugate_fin_two

@[simp]
theorem adjugate_fin_two_of (a b c d : α) : adjugate !![a, b; c, d] = !![d, -b; -c, a] :=
adjugate_fin_two _
#align matrix.adjugate_fin_two_of Matrix.adjugate_fin_two_of

theorem adjugate_fin_succ_eq_det_submatrix {n : ℕ} (A : Matrix (Fin n.succ) (Fin n.succ) α) (i j) :
adjugate A i j = (-1) ^ (j + i : ℕ) * det (A.submatrix j.succAbove i.succAbove) := by
simp_rw [adjugate_apply, det_succ_row _ j, updateRow_self, submatrix_updateRow_succAbove]
rw [Fintype.sum_eq_single i fun h hjk => ?_, Pi.single_eq_same, mul_one]
rw [Pi.single_eq_of_ne hjk, mul_zero, zero_mul]
#align matrix.adjugate_fin_succ_eq_det_submatrix Matrix.adjugate_fin_succ_eq_det_submatrix

theorem det_eq_sum_mul_adjugate_row (A : Matrix n n α) (i : n) :
det A = ∑ j : n, A i j * adjugate A j i := by
Expand Down

0 comments on commit aa178a8

Please sign in to comment.