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

tactic: let L : List (TransvectionStruct (Sum (Fin r) Unit) 𝕜) :=
  List.ofFn fun i : Fin r =>
    ⟨inl i, inr unit, by simp, -M (inl i) (inr unit) / M (inr unit) (inr unit)⟩
state_before: n : Type ?u.218178
p : Type ?u.218181
R : Type u₂
𝕜 : Type u_1
inst✝³ : Field 𝕜
inst✝² : DecidableEq n
inst✝¹ : DecidableEq p
inst✝ : CommRing R
r : ℕ
M : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
hM : M (inr ()) (inr ()) ≠ 0
⊢ ∃ L L', IsTwoBlockDiagonal (List.prod (List.map toMatrix L) ⬝ M ⬝ List.prod (List.map toMatrix L'))

tactic: let L' : List (TransvectionStruct (Sum (Fin r) Unit) 𝕜) :=
  List.ofFn fun i : Fin r =>
    ⟨inr unit, inl i, by simp, -M (inr unit) (inl i) / M (inr unit) (inr unit)⟩
state_before: n : Type ?u.218178
p : Type ?u.218181
R : Type u₂
𝕜 : Type u_1
inst✝³ : Field 𝕜
inst✝² : DecidableEq n
inst✝¹ : DecidableEq p
inst✝ : CommRing R
r : ℕ
M : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
hM : M (inr ()) (inr ()) ≠ 0
L : List (TransvectionStruct (Fin r ⊕ Unit) 𝕜) :=
  List.ofFn fun i =>
    { i := inl i, j := inr (), hij := (_ : ¬inl i = inr ()), c := -M (inl i) (inr ()) / M (inr ()) (inr ()) }
⊢ ∃ L L', IsTwoBlockDiagonal (List.prod (List.map toMatrix L) ⬝ M ⬝ List.prod (List.map toMatrix L'))

tactic: refine' ⟨L, L', _⟩
state_before: n : Type ?u.218178
p : Type ?u.218181
R : Type u₂
𝕜 : Type u_1
inst✝³ : Field 𝕜
inst✝² : DecidableEq n
inst✝¹ : DecidableEq p
inst✝ : CommRing R
r : ℕ
M : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
hM : M (inr ()) (inr ()) ≠ 0
L : List (TransvectionStruct (Fin r ⊕ Unit) 𝕜) :=
  List.ofFn fun i =>
    { i := inl i, j := inr (), hij := (_ : ¬inl i = inr ()), c := -M (inl i) (inr ()) / M (inr ()) (inr ()) }
L' : List (TransvectionStruct (Fin r ⊕ Unit) 𝕜) :=
  List.ofFn fun i =>
    { i := inr (), j := inl i, hij := (_ : ¬inr () = inl i), c := -M (inr ()) (inl i) / M (inr ()) (inr ()) }
⊢ ∃ L L', IsTwoBlockDiagonal (List.prod (List.map toMatrix L) ⬝ M ⬝ List.prod (List.map toMatrix L'))

tactic: rw [A, B]
state_before: n : Type ?u.218178
p : Type ?u.218181
R : Type u₂
𝕜 : Type u_1
inst✝³ : Field 𝕜
inst✝² : DecidableEq n
inst✝¹ : DecidableEq p
inst✝ : CommRing R
r : ℕ
M : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
hM : M (inr ()) (inr ()) ≠ 0
L : List (TransvectionStruct (Fin r ⊕ Unit) 𝕜) :=
  List.ofFn fun i =>
    { i := inl i, j := inr (), hij := (_ : ¬inl i = inr ()), c := -M (inl i) (inr ()) / M (inr ()) (inr ()) }
L' : List (TransvectionStruct (Fin r ⊕ Unit) 𝕜) :=
  List.ofFn fun i =>
    { i := inr (), j := inl i, hij := (_ : ¬inr () = inl i), c := -M (inr ()) (inl i) / M (inr ()) (inr ()) }
A : List.map toMatrix L = listTransvecCol M
B : List.map toMatrix L' = listTransvecRow M
⊢ IsTwoBlockDiagonal (List.prod (List.map toMatrix L) ⬝ M ⬝ List.prod (List.map toMatrix L'))

tactic: exact isTwoBlockDiagonal_listTransvecCol_mul_mul_listTransvecRow M hM
state_before: n : Type ?u.218178
p : Type ?u.218181
R : Type u₂
𝕜 : Type u_1
inst✝³ : Field 𝕜
inst✝² : DecidableEq n
inst✝¹ : DecidableEq p
inst✝ : CommRing R
r : ℕ
M : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
hM : M (inr ()) (inr ()) ≠ 0
L : List (TransvectionStruct (Fin r ⊕ Unit) 𝕜) :=
  List.ofFn fun i =>
    { i := inl i, j := inr (), hij := (_ : ¬inl i = inr ()), c := -M (inl i) (inr ()) / M (inr ()) (inr ()) }
L' : List (TransvectionStruct (Fin r ⊕ Unit) 𝕜) :=
  List.ofFn fun i =>
    { i := inr (), j := inl i, hij := (_ : ¬inr () = inl i), c := -M (inr ()) (inl i) / M (inr ()) (inr ()) }
A : List.map toMatrix L = listTransvecCol M
B : List.map toMatrix L' = listTransvecRow M
⊢ IsTwoBlockDiagonal (List.prod (listTransvecCol M) ⬝ M ⬝ List.prod (listTransvecRow M))

tactic: simp
state_before: n : Type ?u.218178
p : Type ?u.218181
R : Type u₂
𝕜 : Type u_1
inst✝³ : Field 𝕜
inst✝² : DecidableEq n
inst✝¹ : DecidableEq p
inst✝ : CommRing R
r : ℕ
M : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
hM : M (inr ()) (inr ()) ≠ 0
i : Fin r
⊢ inl i ≠ inr ()

tactic: simp
state_before: n : Type ?u.218178
p : Type ?u.218181
R : Type u₂
𝕜 : Type u_1
inst✝³ : Field 𝕜
inst✝² : DecidableEq n
inst✝¹ : DecidableEq p
inst✝ : CommRing R
r : ℕ
M : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜
hM : M (inr ()) (inr ()) ≠ 0
L : List (TransvectionStruct (Fin r ⊕ Unit) 𝕜) :=
  List.ofFn fun i =>
    { i := inl i, j := inr (), hij := (_ : ¬inl i = inr ()), c := -M (inl i) (inr ()) / M (inr ()) (inr ()) }
i : Fin r
⊢ inr () ≠ inl i