Theorem: List.cons_diff
File: .lake/packages/batteries/Batteries/Data/List/Lemmas.lean

tactic: induction l₂ generalizing l₁ with
| nil => rfl
| cons b l₂ ih =>
  by_cases h : a = b
  next => simp [*]
  next =>
    have := Ne.symm h
    simp[*]
state_before: α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a : α
l₁ l₂ : List α
⊢ (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
state_after: no goals

tactic: rfl
state_before: case nil
α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a : α
l₁ : List α
⊢ (a :: l₁).diff [] = if a ∈ [] then l₁.diff ([].erase a) else a :: l₁.diff []
state_after: no goals

tactic: by_cases h : a = b
state_before: case cons
α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)
state_after: case pos
α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : a = b
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)

case neg
α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : ¬a = b
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)

tactic: next => simp [*]
state_before: case pos
α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : a = b
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)

case neg
α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : ¬a = b
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)
state_after: case neg
α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : ¬a = b
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)

tactic: next =>
  have := Ne.symm h
  simp[*]
state_before: case neg
α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : ¬a = b
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)
state_after: no goals

tactic: simp [*]
state_before: α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : a = b
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)
state_after: no goals

tactic: have := Ne.symm h
state_before: α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : ¬a = b
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)
state_after: α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : ¬a = b
this : b ≠ a
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)

tactic: simp[*]
state_before: α : Type u_1
inst✝¹ : BEq α
inst✝ : LawfulBEq α
a b : α
l₂ : List α
ih : ∀ (l₁ : List α), (a :: l₁).diff l₂ = if a ∈ l₂ then l₁.diff (l₂.erase a) else a :: l₁.diff l₂
l₁ : List α
h : ¬a = b
this : b ≠ a
⊢ (a :: l₁).diff (b :: l₂) = if a ∈ b :: l₂ then l₁.diff ((b :: l₂).erase a) else a :: l₁.diff (b :: l₂)
state_after: no goals