Theorem: Vector.eraseIdx_insertNth'
File: Mathlib/Data/Vector/Basic.lean

tactic: dsimp [insertNth, eraseIdx, Fin.succAbove, Fin.predAbove]
state_before: n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
⊢ eraseIdx (⟨j, hj⟩.succAbove ⟨i, hi⟩) (insertNth a ⟨j, hj⟩ v) =
    insertNth a (⟨i, hi⟩.predAbove ⟨j, hj⟩) (eraseIdx ⟨i, hi⟩ v)
state_after: n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
⊢ ⟨(List.insertNth j a ↑v).eraseIdx ↑(if ⟨i, ⋯⟩ < ⟨j, hj⟩ then ⟨i, ⋯⟩ else ⟨i + 1, ⋯⟩), ⋯⟩ =
    ⟨List.insertNth (↑(if h : ⟨i, ⋯⟩ < ⟨j, hj⟩ then ⟨j, hj⟩.pred ⋯ else ⟨j, hj⟩.castPred ⋯)) a
        ↑(match v with
          | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩),
      ⋯⟩

tactic: rw [Subtype.mk_eq_mk]
state_before: n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
⊢ ⟨(List.insertNth j a ↑v).eraseIdx ↑(if ⟨i, ⋯⟩ < ⟨j, hj⟩ then ⟨i, ⋯⟩ else ⟨i + 1, ⋯⟩), ⋯⟩ =
    ⟨List.insertNth (↑(if h : ⟨i, ⋯⟩ < ⟨j, hj⟩ then ⟨j, hj⟩.pred ⋯ else ⟨j, hj⟩.castPred ⋯)) a
        ↑(match v with
          | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩),
      ⋯⟩
state_after: n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
⊢ (List.insertNth j a ↑v).eraseIdx ↑(if ⟨i, ⋯⟩ < ⟨j, hj⟩ then ⟨i, ⋯⟩ else ⟨i + 1, ⋯⟩) =
    List.insertNth (↑(if h : ⟨i, ⋯⟩ < ⟨j, hj⟩ then ⟨j, hj⟩.pred ⋯ else ⟨j, hj⟩.castPred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)

tactic: simp only [Fin.lt_iff_val_lt_val]
state_before: n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
⊢ (List.insertNth j a ↑v).eraseIdx ↑(if ⟨i, ⋯⟩ < ⟨j, hj⟩ then ⟨i, ⋯⟩ else ⟨i + 1, ⋯⟩) =
    List.insertNth (↑(if h : ⟨i, ⋯⟩ < ⟨j, hj⟩ then ⟨j, hj⟩.pred ⋯ else ⟨j, hj⟩.castPred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)
state_after: n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
⊢ (List.insertNth j a ↑v).eraseIdx ↑(if i < j then ⟨i, ⋯⟩ else ⟨i + 1, ⋯⟩) =
    List.insertNth (↑(if h : i < j then ⟨j, hj⟩.pred ⋯ else ⟨j, hj⟩.castPred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)

tactic: split_ifs with hij
state_before: n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
⊢ (List.insertNth j a ↑v).eraseIdx ↑(if i < j then ⟨i, ⋯⟩ else ⟨i + 1, ⋯⟩) =
    List.insertNth (↑(if h : i < j then ⟨j, hj⟩.pred ⋯ else ⟨j, hj⟩.castPred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)
state_after: case pos
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : i < j
⊢ (List.insertNth j a ↑v).eraseIdx ↑⟨i, ⋯⟩ =
    List.insertNth (↑(⟨j, hj⟩.pred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)

case neg
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ (List.insertNth j a ↑v).eraseIdx ↑⟨i + 1, ⋯⟩ =
    List.insertNth (↑(⟨j, hj⟩.castPred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)

tactic: rcases Nat.exists_eq_succ_of_ne_zero
  (Nat.pos_iff_ne_zero.1 (lt_of_le_of_lt (Nat.zero_le _) hij)) with ⟨j, rfl⟩
state_before: case pos
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : i < j
⊢ (List.insertNth j a ↑v).eraseIdx ↑⟨i, ⋯⟩ =
    List.insertNth (↑(⟨j, hj⟩.pred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)
state_after: case pos.intro
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ (List.insertNth j.succ a ↑v).eraseIdx ↑⟨i, ⋯⟩ =
    List.insertNth (↑(⟨j.succ, hj⟩.pred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)

tactic: rw [← List.insertNth_eraseIdx_of_ge]
state_before: case pos.intro
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ (List.insertNth j.succ a ↑v).eraseIdx ↑⟨i, ⋯⟩ =
    List.insertNth (↑(⟨j.succ, hj⟩.pred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)
state_after: case pos.intro
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ List.insertNth j a ((↑v).eraseIdx ↑⟨i, ⋯⟩) =
    List.insertNth (↑(⟨j.succ, hj⟩.pred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)

case pos.intro.a
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ ↑⟨i, ⋯⟩ < (↑v).length

case pos.intro.a
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ ↑⟨i, ⋯⟩ ≤ j

tactic: simp
state_before: case pos.intro
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ List.insertNth j a ((↑v).eraseIdx ↑⟨i, ⋯⟩) =
    List.insertNth (↑(⟨j.succ, hj⟩.pred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)
state_after: case pos.intro
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ List.insertNth j a ((↑v).eraseIdx i) =
    List.insertNth j a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)

tactic: rfl
state_before: case pos.intro
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ List.insertNth j a ((↑v).eraseIdx i) =
    List.insertNth j a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)
state_after: no goals

tactic: simpa
state_before: case pos.intro.a
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ ↑⟨i, ⋯⟩ < (↑v).length
state_after: no goals

tactic: simpa [Nat.lt_succ_iff] using hij
state_before: case pos.intro.a
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j.succ < n + 2
hij : i < j.succ
⊢ ↑⟨i, ⋯⟩ ≤ j
state_after: no goals

tactic: dsimp
state_before: case neg
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ (List.insertNth j a ↑v).eraseIdx ↑⟨i + 1, ⋯⟩ =
    List.insertNth (↑(⟨j, hj⟩.castPred ⋯)) a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)
state_after: case neg
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ (List.insertNth j a ↑v).eraseIdx (i + 1) =
    List.insertNth j a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)

tactic: rw [← List.insertNth_eraseIdx_of_le i j _ _ _]
state_before: case neg
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ (List.insertNth j a ↑v).eraseIdx (i + 1) =
    List.insertNth j a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)
state_after: case neg
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ List.insertNth j a ((↑v).eraseIdx i) =
    List.insertNth j a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)

n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ i < (↑v).length

n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ j ≤ i

tactic: rfl
state_before: case neg
n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ List.insertNth j a ((↑v).eraseIdx i) =
    List.insertNth j a
      ↑(match v with
        | ⟨l, p⟩ => ⟨l.eraseIdx i, ⋯⟩)
state_after: no goals

tactic: simpa
state_before: n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ i < (↑v).length
state_after: no goals

tactic: simpa [not_lt] using hij
state_before: n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
a : α
v : Vector α (n + 1)
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 2
hij : ¬i < j
⊢ j ≤ i
state_after: no goals