Theorem: List.card_remove_of_mem
File: Mathlib/Data/List/Card.lean

tactic: cases Decidable.em (a = a') with
| inl h' =>
  simp [remove, if_pos h']
  cases Decidable.em (a ∈ as) with
  | inl h'' =>
    have h₃ : a' ∈ as := h' ▸ h''
    simp [card_remove_of_mem h'', h₃]
  | inr h'' =>
    have h₃ : a' ∉ as := h' ▸ h''
    simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
| inr h' =>
    have h₃ : a ∈ as := (mem_cons.1 h).resolve_left h'
    simp [remove, h']
    cases Decidable.em (a' ∈ as) with
    | inl h'' =>
      have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
      simp [h'', this, card_remove_of_mem h₃]
    | inr h'' =>
      have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
      simp [h'', this, card_remove_of_mem h₃]
state_before: α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1

tactic: simp [remove, if_pos h']
state_before: case inl
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1

tactic: cases Decidable.em (a ∈ as) with
| inl h'' =>
  have h₃ : a' ∈ as := h' ▸ h''
  simp [card_remove_of_mem h'', h₃]
| inr h'' =>
  have h₃ : a' ∉ as := h' ▸ h''
  simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
state_before: case inl
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
⊢ card (a' :: as) = card (remove a as) + 1

tactic: have h₃ : a' ∈ as := h' ▸ h''
state_before: case inl.inl
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : a ∈ as
⊢ card (a' :: as) = card (remove a as) + 1

tactic: simp [card_remove_of_mem h'', h₃]
state_before: case inl.inl
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : a ∈ as
h₃ : a' ∈ as
⊢ card (a' :: as) = card (remove a as) + 1

tactic: have h₃ : a' ∉ as := h' ▸ h''
state_before: case inl.inr
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : ¬a ∈ as
⊢ card (a' :: as) = card (remove a as) + 1

tactic: simp [card_cons_of_not_mem h₃, remove_eq_of_not_mem h'']
state_before: case inl.inr
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : a = a'
h'' : ¬a ∈ as
h₃ : ¬a' ∈ as
⊢ card (a' :: as) = card (remove a as) + 1

tactic: have h₃ : a ∈ as := (mem_cons.1 h).resolve_left h'
state_before: case inr
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1

tactic: simp [remove, h']
state_before: case inr
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
⊢ card (a' :: as) = card (remove a (a' :: as)) + 1

tactic: cases Decidable.em (a' ∈ as) with
| inl h'' =>
  have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
  simp [h'', this, card_remove_of_mem h₃]
| inr h'' =>
  have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
  simp [h'', this, card_remove_of_mem h₃]
state_before: case inr
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
⊢ card (a' :: as) = card (a' :: remove a as) + 1

tactic: have : a' ∈ remove a as := by rw [mem_remove_iff]; exact ⟨h'', Ne.symm h'⟩
state_before: case inr.inl
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : a' ∈ as
⊢ card (a' :: as) = card (a' :: remove a as) + 1

tactic: simp [h'', this, card_remove_of_mem h₃]
state_before: case inr.inl
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : a' ∈ as
this : a' ∈ remove a as
⊢ card (a' :: as) = card (a' :: remove a as) + 1

tactic: rw [mem_remove_iff]
state_before: α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : a' ∈ as
⊢ a' ∈ remove a as

tactic: exact ⟨h'', Ne.symm h'⟩
state_before: α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : a' ∈ as
⊢ a' ∈ as ∧ a' ≠ a

tactic: have : a' ∉ remove a as := fun h ↦ h'' (mem_of_mem_remove h)
state_before: case inr.inr
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : ¬a' ∈ as
⊢ card (a' :: as) = card (a' :: remove a as) + 1

tactic: simp [h'', this, card_remove_of_mem h₃]
state_before: case inr.inr
α : Type u_1
β : Sort ?u.28067
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a a' : α
as : List α
h : a ∈ a' :: as
h' : ¬a = a'
h₃ : a ∈ as
h'' : ¬a' ∈ as
this : ¬a' ∈ remove a as
⊢ card (a' :: as) = card (a' :: remove a as) + 1