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

tactic: suffices H :
  ∀ k : ℕ,
    k ≤ r →
      (M ⬝ ((listTransvecRow M).take k).prod) (inr unit) (inl i) =
        if k ≤ i then M (inr unit) (inl i) else 0
state_before: n : Type ?u.187814
p : Type ?u.187817
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
⊢ (M ⬝ List.prod (listTransvecRow M)) (inr ()) (inl i) = 0

tactic: intro k hk
state_before: case H
n : Type ?u.187814
p : Type ?u.187817
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
⊢ ∀ (k : ℕ),
    k ≤ r →
      (M ⬝ List.prod (List.take k (listTransvecRow M))) (inr ()) (inl i) = if k ≤ ↑i then M (inr ()) (inl i) else 0

tactic: induction' k with n IH
state_before: case H
n : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk : k ≤ r
⊢ (M ⬝ List.prod (List.take k (listTransvecRow M))) (inr ()) (inl i) = if k ≤ ↑i then M (inr ()) (inl i) else 0

tactic: have A : (listTransvecRow M).length = r := by simp [listTransvecRow]
state_before: n : Type ?u.187814
p : Type ?u.187817
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
H :
  ∀ (k : ℕ),
    k ≤ r →
      (M ⬝ List.prod (List.take k (listTransvecRow M))) (inr ()) (inl i) = if k ≤ ↑i then M (inr ()) (inl i) else 0
⊢ (M ⬝ List.prod (listTransvecRow M)) (inr ()) (inl i) = 0

tactic: rw [← List.take_length (listTransvecRow M), A]
state_before: n : Type ?u.187814
p : Type ?u.187817
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
H :
  ∀ (k : ℕ),
    k ≤ r →
      (M ⬝ List.prod (List.take k (listTransvecRow M))) (inr ()) (inl i) = if k ≤ ↑i then M (inr ()) (inl i) else 0
A : List.length (listTransvecRow M) = r
⊢ (M ⬝ List.prod (listTransvecRow M)) (inr ()) (inl i) = 0

tactic: have : ¬r ≤ i := by simp
state_before: n : Type ?u.187814
p : Type ?u.187817
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
H :
  ∀ (k : ℕ),
    k ≤ r →
      (M ⬝ List.prod (List.take k (listTransvecRow M))) (inr ()) (inl i) = if k ≤ ↑i then M (inr ()) (inl i) else 0
A : List.length (listTransvecRow M) = r
⊢ (M ⬝ List.prod (List.take r (listTransvecRow M))) (inr ()) (inl i) = 0

tactic: simpa only [this, ite_eq_right_iff] using H r le_rfl
state_before: n : Type ?u.187814
p : Type ?u.187817
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
H :
  ∀ (k : ℕ),
    k ≤ r →
      (M ⬝ List.prod (List.take k (listTransvecRow M))) (inr ()) (inl i) = if k ≤ ↑i then M (inr ()) (inl i) else 0
A : List.length (listTransvecRow M) = r
this : ¬r ≤ ↑i
⊢ (M ⬝ List.prod (List.take r (listTransvecRow M))) (inr ()) (inl i) = 0

tactic: simp [listTransvecRow]
state_before: n : Type ?u.187814
p : Type ?u.187817
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
H :
  ∀ (k : ℕ),
    k ≤ r →
      (M ⬝ List.prod (List.take k (listTransvecRow M))) (inr ()) (inl i) = if k ≤ ↑i then M (inr ()) (inl i) else 0
⊢ List.length (listTransvecRow M) = r

tactic: simp
state_before: n : Type ?u.187814
p : Type ?u.187817
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
H :
  ∀ (k : ℕ),
    k ≤ r →
      (M ⬝ List.prod (List.take k (listTransvecRow M))) (inr ()) (inl i) = if k ≤ ↑i then M (inr ()) (inl i) else 0
A : List.length (listTransvecRow M) = r
⊢ ¬r ≤ ↑i

tactic: simp only [if_true, Matrix.mul_one, List.take_zero, zero_le', List.prod_nil, Nat.zero_eq]
state_before: case H.zero
n : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
hk : Nat.zero ≤ r
⊢ (M ⬝ List.prod (List.take Nat.zero (listTransvecRow M))) (inr ()) (inl i) =
    if Nat.zero ≤ ↑i then M (inr ()) (inl i) else 0

tactic: have hnr : n < r := hk
state_before: case H.succ
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
⊢ (M ⬝ List.prod (List.take (Nat.succ n) (listTransvecRow M))) (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: let n' : Fin r := ⟨n, hnr⟩
state_before: case H.succ
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
⊢ (M ⬝ List.prod (List.take (Nat.succ n) (listTransvecRow M))) (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: have A :
  (listTransvecRow M).get? n =
    ↑(transvection (inr unit) (inl n')
    (-M (inr unit) (inl n') / M (inr unit) (inr unit))) := by
  simp only [listTransvecRow, List.ofFnNthVal, hnr, dif_pos, List.get?_ofFn]
state_before: case H.succ
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
⊢ (M ⬝ List.prod (List.take (Nat.succ n) (listTransvecRow M))) (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: simp only [List.take_succ, A, ← Matrix.mul_assoc, List.prod_append, Matrix.mul_one,
  Matrix.mul_eq_mul, List.prod_cons, List.prod_nil, Option.to_list_some]
state_before: case H.succ
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
⊢ (M ⬝ List.prod (List.take (Nat.succ n) (listTransvecRow M))) (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: by_cases h : n' = i
state_before: case H.succ
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
⊢ (M ⬝ List.prod (List.take n (listTransvecRow M)) ⬝
        transvection (inr ()) (inl { val := n, isLt := hnr })
          (-M (inr ()) (inl { val := n, isLt := hnr }) / M (inr ()) (inr ())))
      (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: simp only [listTransvecRow, List.ofFnNthVal, hnr, dif_pos, List.get?_ofFn]
state_before: n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
⊢ List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))

tactic: have hni : n = i := by
  cases i
  simp only [Fin.mk_eq_mk] at h
  simp only [h]
state_before: case pos
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : n' = i
⊢ (M ⬝ List.prod (List.take n (listTransvecRow M)) ⬝
        transvection (inr ()) (inl { val := n, isLt := hnr })
          (-M (inr ()) (inl { val := n, isLt := hnr }) / M (inr ()) (inr ())))
      (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: have : ¬n.succ ≤ i := by simp only [← hni, n.lt_succ_self, not_le]
state_before: case pos
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : n' = i
hni : n = ↑i
⊢ (M ⬝ List.prod (List.take n (listTransvecRow M)) ⬝
        transvection (inr ()) (inl { val := n, isLt := hnr })
          (-M (inr ()) (inl { val := n, isLt := hnr }) / M (inr ()) (inr ())))
      (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: simp only [h, mul_transvection_apply_same, List.take, if_false,
  mul_listTransvecRow_last_col_take _ _ hnr.le, hni.le, this, if_true, IH hnr.le]
state_before: case pos
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : n' = i
hni : n = ↑i
this : ¬Nat.succ n ≤ ↑i
⊢ (M ⬝ List.prod (List.take n (listTransvecRow M)) ⬝
        transvection (inr ()) (inl { val := n, isLt := hnr })
          (-M (inr ()) (inl { val := n, isLt := hnr }) / M (inr ()) (inr ())))
      (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: field_simp [hM]
state_before: case pos
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : n' = i
hni : n = ↑i
this : ¬Nat.succ n ≤ ↑i
⊢ M (inr ()) (inl i) + -M (inr ()) (inl i) / M (inr ()) (inr ()) * M (inr ()) (inr ()) = 0

tactic: cases i
state_before: n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : n' = i
⊢ n = ↑i

tactic: simp only [Fin.mk_eq_mk] at h
state_before: case mk
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
val✝ : ℕ
isLt✝ : val✝ < r
IH :
  n ≤ r →
    (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl { val := val✝, isLt := isLt✝ }) =
      if n ≤ ↑{ val := val✝, isLt := isLt✝ } then M (inr ()) (inl { val := val✝, isLt := isLt✝ }) else 0
h : n' = { val := val✝, isLt := isLt✝ }
⊢ n = ↑{ val := val✝, isLt := isLt✝ }

tactic: simp only [h]
state_before: case mk
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
val✝ : ℕ
isLt✝ : val✝ < r
IH :
  n ≤ r →
    (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl { val := val✝, isLt := isLt✝ }) =
      if n ≤ ↑{ val := val✝, isLt := isLt✝ } then M (inr ()) (inl { val := val✝, isLt := isLt✝ }) else 0
h : n = val✝
⊢ n = ↑{ val := val✝, isLt := isLt✝ }

tactic: simp only [← hni, n.lt_succ_self, not_le]
state_before: n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : n' = i
hni : n = ↑i
⊢ ¬Nat.succ n ≤ ↑i

tactic: have hni : n ≠ i := by
  rintro rfl
  cases i
  tauto
state_before: case neg
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = i
⊢ (M ⬝ List.prod (List.take n (listTransvecRow M)) ⬝
        transvection (inr ()) (inl { val := n, isLt := hnr })
          (-M (inr ()) (inl { val := n, isLt := hnr }) / M (inr ()) (inr ())))
      (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: simp only [IH hnr.le, Ne.def, mul_transvection_apply_of_ne, Ne.symm h, inl.injEq]
state_before: case neg
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = i
hni : n ≠ ↑i
⊢ (M ⬝ List.prod (List.take n (listTransvecRow M)) ⬝
        transvection (inr ()) (inl { val := n, isLt := hnr })
          (-M (inr ()) (inl { val := n, isLt := hnr }) / M (inr ()) (inr ())))
      (inr ()) (inl i) =
    if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: rcases le_or_lt (n + 1) i with (hi | hi)
state_before: case neg
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = i
hni : n ≠ ↑i
⊢ (if n ≤ ↑i then M (inr ()) (inl i) else 0) = if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: rintro rfl
state_before: n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = i
⊢ n ≠ ↑i

tactic: cases i
state_before: n : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
IH :
  ↑i ≤ r →
    (M ⬝ List.prod (List.take (↑i) (listTransvecRow M))) (inr ()) (inl i) = if ↑i ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ ↑i ≤ r
hnr : ↑i < r
n' : Fin r := { val := ↑i, isLt := hnr }
A :
  List.get? (listTransvecRow M) ↑i = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = i
⊢ False

tactic: tauto
state_before: case mk
n : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
val✝ : ℕ
isLt✝ : val✝ < r
IH :
  ↑{ val := val✝, isLt := isLt✝ } ≤ r →
    (M ⬝ List.prod (List.take (↑{ val := val✝, isLt := isLt✝ }) (listTransvecRow M))) (inr ())
        (inl { val := val✝, isLt := isLt✝ }) =
      if ↑{ val := val✝, isLt := isLt✝ } ≤ ↑{ val := val✝, isLt := isLt✝ } then
        M (inr ()) (inl { val := val✝, isLt := isLt✝ })
      else 0
hk : Nat.succ ↑{ val := val✝, isLt := isLt✝ } ≤ r
hnr : ↑{ val := val✝, isLt := isLt✝ } < r
n' : Fin r := { val := ↑{ val := val✝, isLt := isLt✝ }, isLt := hnr }
A :
  List.get? (listTransvecRow M) ↑{ val := val✝, isLt := isLt✝ } =
    some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = { val := val✝, isLt := isLt✝ }
⊢ False

tactic: simp [hi, n.le_succ.trans hi, if_true]
state_before: case neg.inl
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = i
hni : n ≠ ↑i
hi : n + 1 ≤ ↑i
⊢ (if n ≤ ↑i then M (inr ()) (inl i) else 0) = if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: rw [if_neg, if_neg]
state_before: case neg.inr
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = i
hni : n ≠ ↑i
hi : ↑i < n + 1
⊢ (if n ≤ ↑i then M (inr ()) (inl i) else 0) = if Nat.succ n ≤ ↑i then M (inr ()) (inl i) else 0

tactic: simpa only [not_le] using hi
state_before: case neg.inr.hnc
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = i
hni : n ≠ ↑i
hi : ↑i < n + 1
⊢ ¬Nat.succ n ≤ ↑i

tactic: simpa only [hni.symm, not_le, or_false_iff] using Nat.lt_succ_iff_lt_or_eq.1 hi
state_before: case neg.inr.hnc
n✝ : Type ?u.187814
p : Type ?u.187817
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
k : ℕ
hk✝ : k ≤ r
n : ℕ
IH :
  n ≤ r → (M ⬝ List.prod (List.take n (listTransvecRow M))) (inr ()) (inl i) = if n ≤ ↑i then M (inr ()) (inl i) else 0
hk : Nat.succ n ≤ r
hnr : n < r
n' : Fin r := { val := n, isLt := hnr }
A : List.get? (listTransvecRow M) n = some (transvection (inr ()) (inl n') (-M (inr ()) (inl n') / M (inr ()) (inr ())))
h : ¬n' = i
hni : n ≠ ↑i
hi : ↑i < n + 1
⊢ ¬n ≤ ↑i