Theorem: SymOptionSuccEquiv.encode_decode
File: Mathlib/Data/Sym/Basic.lean

tactic: obtain s | s := s
state_before: α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym (Option α) n ⊕ Sym α n.succ
⊢ encode (decode s) = s
state_after: case inl
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym (Option α) n
⊢ encode (decode (Sum.inl s)) = Sum.inl s

case inr
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
⊢ encode (decode (Sum.inr s)) = Sum.inr s

tactic: simp
state_before: case inl
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym (Option α) n
⊢ encode (decode (Sum.inl s)) = Sum.inl s
state_after: no goals

tactic: unfold SymOptionSuccEquiv.encode
state_before: case inr
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
⊢ encode (decode (Sum.inr s)) = Sum.inr s
state_after: case inr
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
⊢ (if h : none ∈ decode (Sum.inr s) then Sum.inl ((decode (Sum.inr s)).erase none h)
    else Sum.inr (map (fun o => (↑o).get ⋯) (decode (Sum.inr s)).attach)) =
    Sum.inr s

tactic: split_ifs with h
state_before: case inr
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
⊢ (if h : none ∈ decode (Sum.inr s) then Sum.inl ((decode (Sum.inr s)).erase none h)
    else Sum.inr (map (fun o => (↑o).get ⋯) (decode (Sum.inr s)).attach)) =
    Sum.inr s
state_after: case pos
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∈ decode (Sum.inr s)
⊢ False

case neg
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∉ decode (Sum.inr s)
⊢ Sum.inr (map (fun o => (↑o).get ⋯) (decode (Sum.inr s)).attach) = Sum.inr s

tactic: obtain ⟨a, _, ha⟩ := Multiset.mem_map.mp h
state_before: case pos
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∈ decode (Sum.inr s)
⊢ False
state_after: case pos.intro.intro
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∈ decode (Sum.inr s)
a : α
left✝ : a ∈ ↑s
ha : Embedding.some a = none
⊢ False

tactic: exact Option.some_ne_none _ ha
state_before: case pos.intro.intro
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∈ decode (Sum.inr s)
a : α
left✝ : a ∈ ↑s
ha : Embedding.some a = none
⊢ False
state_after: no goals

tactic: refine congr_arg Sum.inr ?_
state_before: case neg
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∉ decode (Sum.inr s)
⊢ Sum.inr (map (fun o => (↑o).get ⋯) (decode (Sum.inr s)).attach) = Sum.inr s
state_after: case neg
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∉ decode (Sum.inr s)
⊢ map (fun o => (↑o).get ⋯) (decode (Sum.inr s)).attach = s

tactic: refine map_injective (Option.some_injective _) _ ?_
state_before: case neg
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∉ decode (Sum.inr s)
⊢ map (fun o => (↑o).get ⋯) (decode (Sum.inr s)).attach = s
state_after: case neg
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∉ decode (Sum.inr s)
⊢ map some (map (fun o => (↑o).get ⋯) (decode (Sum.inr s)).attach) = map some s

tactic: refine Eq.trans ?_ (.trans (SymOptionSuccEquiv.decode (Sum.inr s)).attach_map_coe ?_) <;> simp
state_before: case neg
α : Type u_1
n : ℕ
inst✝ : DecidableEq α
s : Sym α n.succ
h : none ∉ decode (Sum.inr s)
⊢ map some (map (fun o => (↑o).get ⋯) (decode (Sum.inr s)).attach) = map some s
state_after: no goals