Theorem: Matrix.Pivot.exists_list_transvec_mul_diagonal_mul_list_transvec
File: Mathlib/LinearAlgebra/Matrix/Transvection.lean

tactic: rcases exists_list_transvec_mul_mul_list_transvec_eq_diagonal M with ⟨L, L', D, h⟩
state_before: n : Type u_1
p : Type ?u.321806
R : Type u₂
𝕜 : Type u_2
inst✝⁵ : Field 𝕜
inst✝⁴ : DecidableEq n
inst✝³ : DecidableEq p
inst✝² : CommRing R
r : ℕ
M✝ : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
inst✝¹ : Fintype n
inst✝ : Fintype p
M : Matrix n n 𝕜
⊢ ∃ L L' D, M = List.prod (List.map toMatrix L) ⬝ diagonal D ⬝ List.prod (List.map toMatrix L')

tactic: refine' ⟨L.reverse.map TransvectionStruct.inv, L'.reverse.map TransvectionStruct.inv, D, _⟩
state_before: case intro.intro.intro
n : Type u_1
p : Type ?u.321806
R : Type u₂
𝕜 : Type u_2
inst✝⁵ : Field 𝕜
inst✝⁴ : DecidableEq n
inst✝³ : DecidableEq p
inst✝² : CommRing R
r : ℕ
M✝ : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
inst✝¹ : Fintype n
inst✝ : Fintype p
M : Matrix n n 𝕜
L L' : List (TransvectionStruct n 𝕜)
D : n → 𝕜
h : List.prod (List.map toMatrix L) ⬝ M ⬝ List.prod (List.map toMatrix L') = diagonal D
⊢ ∃ L L' D, M = List.prod (List.map toMatrix L) ⬝ diagonal D ⬝ List.prod (List.map toMatrix L')

tactic: suffices
  M =
    (L.reverse.map (toMatrix ∘ TransvectionStruct.inv)).prod ⬝ (L.map toMatrix).prod ⬝ M ⬝
      ((L'.map toMatrix).prod ⬝ (L'.reverse.map (toMatrix ∘ TransvectionStruct.inv)).prod)
  by simpa [← h, Matrix.mul_assoc]
state_before: case intro.intro.intro
n : Type u_1
p : Type ?u.321806
R : Type u₂
𝕜 : Type u_2
inst✝⁵ : Field 𝕜
inst✝⁴ : DecidableEq n
inst✝³ : DecidableEq p
inst✝² : CommRing R
r : ℕ
M✝ : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
inst✝¹ : Fintype n
inst✝ : Fintype p
M : Matrix n n 𝕜
L L' : List (TransvectionStruct n 𝕜)
D : n → 𝕜
h : List.prod (List.map toMatrix L) ⬝ M ⬝ List.prod (List.map toMatrix L') = diagonal D
⊢ M =
    List.prod (List.map toMatrix (List.map TransvectionStruct.inv (List.reverse L))) ⬝ diagonal D ⬝
      List.prod (List.map toMatrix (List.map TransvectionStruct.inv (List.reverse L')))

tactic: rw [reverse_inv_prod_mul_prod, prod_mul_reverse_inv_prod, Matrix.one_mul, Matrix.mul_one]
state_before: case intro.intro.intro
n : Type u_1
p : Type ?u.321806
R : Type u₂
𝕜 : Type u_2
inst✝⁵ : Field 𝕜
inst✝⁴ : DecidableEq n
inst✝³ : DecidableEq p
inst✝² : CommRing R
r : ℕ
M✝ : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
inst✝¹ : Fintype n
inst✝ : Fintype p
M : Matrix n n 𝕜
L L' : List (TransvectionStruct n 𝕜)
D : n → 𝕜
h : List.prod (List.map toMatrix L) ⬝ M ⬝ List.prod (List.map toMatrix L') = diagonal D
⊢ M =
    List.prod (List.map (toMatrix ∘ TransvectionStruct.inv) (List.reverse L)) ⬝ List.prod (List.map toMatrix L) ⬝ M ⬝
      (List.prod (List.map toMatrix L') ⬝ List.prod (List.map (toMatrix ∘ TransvectionStruct.inv) (List.reverse L')))

tactic: simpa [← h, Matrix.mul_assoc]
state_before: n : Type u_1
p : Type ?u.321806
R : Type u₂
𝕜 : Type u_2
inst✝⁵ : Field 𝕜
inst✝⁴ : DecidableEq n
inst✝³ : DecidableEq p
inst✝² : CommRing R
r : ℕ
M✝ : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
inst✝¹ : Fintype n
inst✝ : Fintype p
M : Matrix n n 𝕜
L L' : List (TransvectionStruct n 𝕜)
D : n → 𝕜
h : List.prod (List.map toMatrix L) ⬝ M ⬝ List.prod (List.map toMatrix L') = diagonal D
this :
  M =
    List.prod (List.map (toMatrix ∘ TransvectionStruct.inv) (List.reverse L)) ⬝ List.prod (List.map toMatrix L) ⬝ M ⬝
      (List.prod (List.map toMatrix L') ⬝ List.prod (List.map (toMatrix ∘ TransvectionStruct.inv) (List.reverse L')))
⊢ M =
    List.prod (List.map toMatrix (List.map TransvectionStruct.inv (List.reverse L))) ⬝ diagonal D ⬝
      List.prod (List.map toMatrix (List.map TransvectionStruct.inv (List.reverse L')))