Theorem: List.mem_of_formPerm_apply_mem
File: Mathlib/GroupTheory/Perm/List.lean

tactic: cases' l with y l
state_before: α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝ : List α
x✝ x : α
l : List α
h : ↑(formPerm l) x ∈ l
⊢ x ∈ l

tactic: induction' l with z l IH generalizing x y
state_before: case cons
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝ : List α
x✝ x y : α
l : List α
h : ↑(formPerm (y :: l)) x ∈ y :: l
⊢ x ∈ y :: l

tactic: simp at h
state_before: case nil
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l : List α
x✝ x : α
h : ↑(formPerm []) x ∈ []
⊢ x ∈ []

tactic: simpa using h
state_before: case cons.nil
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝ : List α
x✝¹ x✝ y✝ : α
l : List α
h✝ : ↑(formPerm (y✝ :: l)) x✝ ∈ y✝ :: l
x y : α
h : ↑(formPerm [y]) x ∈ [y]
⊢ x ∈ [y]

tactic: by_cases hx : (z :: l).formPerm x ∈ z :: l
state_before: case cons.cons
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
h : ↑(formPerm (y :: z :: l)) x ∈ y :: z :: l
⊢ x ∈ y :: z :: l

tactic: rw [List.formPerm_cons_cons, mul_apply, swap_apply_def] at h
state_before: case pos
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
h : ↑(formPerm (y :: z :: l)) x ∈ y :: z :: l
hx : ↑(formPerm (z :: l)) x ∈ z :: l
⊢ x ∈ y :: z :: l

tactic: split_ifs at h <;> aesop
state_before: case pos
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
h :
  (if ↑(formPerm (z :: l)) x = y then z else if ↑(formPerm (z :: l)) x = z then y else ↑(formPerm (z :: l)) x) ∈
    y :: z :: l
hx : ↑(formPerm (z :: l)) x ∈ z :: l
⊢ x ∈ y :: z :: l

tactic: replace hx :=
  (Function.Injective.eq_iff (Equiv.injective _)).mp (List.formPerm_apply_of_not_mem _ _ hx)
state_before: case neg
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
h : ↑(formPerm (y :: z :: l)) x ∈ y :: z :: l
hx : ¬↑(formPerm (z :: l)) x ∈ z :: l
⊢ x ∈ y :: z :: l

tactic: simp only [List.formPerm_cons_cons, hx, Equiv.Perm.coe_mul, Function.comp_apply,
  List.mem_cons, swap_apply_def, ite_eq_left_iff] at h
state_before: case neg
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
h : ↑(formPerm (y :: z :: l)) x ∈ y :: z :: l
hx : ↑(formPerm (z :: l)) x = x
⊢ x ∈ y :: z :: l

tactic: simp only [List.mem_cons]
state_before: case neg
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
hx : ↑(formPerm (z :: l)) x = x
h :
  (if x = y then z else if x = z then y else x) = y ∨
    (¬x = y → (if x = z then y else x) = z) ∨ (if x = y then z else if x = z then y else x) ∈ l
⊢ x ∈ y :: z :: l

tactic: rcases h with h | h | h <;> split_ifs at h with h1 <;> try { aesop }
state_before: case neg
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
hx : ↑(formPerm (z :: l)) x = x
h :
  (if x = y then z else if x = z then y else x) = y ∨
    (¬x = y → (if x = z then y else x) = z) ∨ (if x = y then z else if x = z then y else x) ∈ l
⊢ x = y ∨ x = z ∨ x ∈ l

tactic: . simp [h1, imp_false] at h
  simp [h]
state_before: case neg.inr.inl.inr
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
hx : ↑(formPerm (z :: l)) x = x
h1 : ¬x = z
h : ¬x = y → x = z
⊢ x = y ∨ x = z ∨ x ∈ l

tactic: simp [h1, imp_false] at h
state_before: case neg.inr.inl.inr
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
hx : ↑(formPerm (z :: l)) x = x
h1 : ¬x = z
h : ¬x = y → x = z
⊢ x = y ∨ x = z ∨ x ∈ l

tactic: simp [h]
state_before: case neg.inr.inl.inr
α : Type u_1
β : Type ?u.47566
inst✝ : DecidableEq α
l✝¹ : List α
x✝¹ x✝ y✝ : α
l✝ : List α
h✝ : ↑(formPerm (y✝ :: l✝)) x✝ ∈ y✝ :: l✝
z : α
l : List α
IH : ∀ (x y : α), ↑(formPerm (y :: l)) x ∈ y :: l → x ∈ y :: l
x y : α
hx : ↑(formPerm (z :: l)) x = x
h1 : ¬x = z
h : x = y
⊢ x = y ∨ x = z ∨ x ∈ l