Theorem: List.erase_comm
File: Std/Data/List/Lemmas.lean

tactic: if ab : a = b then rw [ab] else ?_
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
⊢ List.erase (List.erase l a) b = List.erase (List.erase l b) a

tactic: if ha : a ∈ l then ?_ else
  simp only [erase_of_not_mem ha, erase_of_not_mem (mt mem_of_mem_erase ha)]
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
ab : ¬a = b
⊢ List.erase (List.erase l a) b = List.erase (List.erase l b) a

tactic: if hb : b ∈ l then ?_ else
  simp only [erase_of_not_mem hb, erase_of_not_mem (mt mem_of_mem_erase hb)]
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
ab : ¬a = b
ha : a ∈ l
⊢ List.erase (List.erase l a) b = List.erase (List.erase l b) a

tactic: match l, l.erase a, exists_erase_eq ha with
| _, _, ⟨l₁, l₂, ha', rfl, rfl⟩ =>
  if h₁ : b ∈ l₁ then
    rw [erase_append_left _ h₁, erase_append_left _ h₁,
        erase_append_right _ (mt mem_of_mem_erase ha'), erase_cons_head]
  else
    rw [erase_append_right _ h₁, erase_append_right _ h₁, erase_append_right _ ha',
        erase_cons_tail _ ab, erase_cons_head]
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
ab : ¬a = b
ha : a ∈ l
hb : b ∈ l
⊢ List.erase (List.erase l a) b = List.erase (List.erase l b) a

tactic: rw [ab]
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
ab : a = b
⊢ List.erase (List.erase l a) b = List.erase (List.erase l b) a

tactic: simp only [erase_of_not_mem ha, erase_of_not_mem (mt mem_of_mem_erase ha)]
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
ab : ¬a = b
ha : ¬a ∈ l
⊢ List.erase (List.erase l a) b = List.erase (List.erase l b) a

tactic: simp only [erase_of_not_mem hb, erase_of_not_mem (mt mem_of_mem_erase hb)]
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
ab : ¬a = b
ha : a ∈ l
hb : ¬b ∈ l
⊢ List.erase (List.erase l a) b = List.erase (List.erase l b) a

tactic: if h₁ : b ∈ l₁ then
  rw [erase_append_left _ h₁, erase_append_left _ h₁,
      erase_append_right _ (mt mem_of_mem_erase ha'), erase_cons_head]
else
  rw [erase_append_right _ h₁, erase_append_right _ h₁, erase_append_right _ ha',
      erase_cons_tail _ ab, erase_cons_head]
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
ab : ¬a = b
l₁ l₂ : List α
ha' : ¬a ∈ l₁
ha : a ∈ l₁ ++ a :: l₂
hb : b ∈ l₁ ++ a :: l₂
⊢ List.erase (l₁ ++ l₂) b = List.erase (List.erase (l₁ ++ a :: l₂) b) a

tactic: rw [erase_append_left _ h₁, erase_append_left _ h₁,
    erase_append_right _ (mt mem_of_mem_erase ha'), erase_cons_head]
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
ab : ¬a = b
l₁ l₂ : List α
ha' : ¬a ∈ l₁
ha : a ∈ l₁ ++ a :: l₂
hb : b ∈ l₁ ++ a :: l₂
h₁ : b ∈ l₁
⊢ List.erase (l₁ ++ l₂) b = List.erase (List.erase (l₁ ++ a :: l₂) b) a

tactic: rw [erase_append_right _ h₁, erase_append_right _ h₁, erase_append_right _ ha',
    erase_cons_tail _ ab, erase_cons_head]
state_before: α : Type u_1
inst✝ : DecidableEq α
a b : α
l : List α
ab : ¬a = b
l₁ l₂ : List α
ha' : ¬a ∈ l₁
ha : a ∈ l₁ ++ a :: l₂
hb : b ∈ l₁ ++ a :: l₂
h₁ : ¬b ∈ l₁
⊢ List.erase (l₁ ++ l₂) b = List.erase (List.erase (l₁ ++ a :: l₂) b) a