Theorem: Stream'.WSeq.eq_or_mem_iff_mem
File: Mathlib/Data/Seq/WSeq.lean

tactic: generalize e : destruct s = c
state_before: α : Type u
β : Type v
γ : Type w
s : WSeq α
a a' : α
s' : WSeq α
⊢ some (a', s') ∈ s.destruct → (a ∈ s ↔ a = a' ∨ a ∈ s')
state_after: α : Type u
β : Type v
γ : Type w
s : WSeq α
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
e : s.destruct = c
⊢ some (a', s') ∈ c → (a ∈ s ↔ a = a' ∨ a ∈ s')

tactic: intro h
state_before: α : Type u
β : Type v
γ : Type w
s : WSeq α
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
e : s.destruct = c
⊢ some (a', s') ∈ c → (a ∈ s ↔ a = a' ∨ a ∈ s')
state_after: α : Type u
β : Type v
γ : Type w
s : WSeq α
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
e : s.destruct = c
h : some (a', s') ∈ c
⊢ a ∈ s ↔ a = a' ∨ a ∈ s'

tactic: revert s
state_before: α : Type u
β : Type v
γ : Type w
s : WSeq α
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
e : s.destruct = c
h : some (a', s') ∈ c
⊢ a ∈ s ↔ a = a' ∨ a ∈ s'
state_after: α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c
⊢ ∀ {s : WSeq α}, s.destruct = c → (a ∈ s ↔ a = a' ∨ a ∈ s')

tactic: apply Computation.memRecOn h <;> [skip; intro c IH] <;> intro s <;>
  induction' s using WSeq.recOn with x s s <;>
  intro m <;>
  have := congr_arg Computation.destruct m <;>
  simp at this
state_before: α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c
⊢ ∀ {s : WSeq α}, s.destruct = c → (a ∈ s ↔ a = a' ∨ a ∈ s')
state_after: case h1.h2
α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c
x : α
s : WSeq α
m : (cons x s).destruct = Computation.pure (some (a', s'))
this : x = a' ∧ s = s'
⊢ a ∈ cons x s ↔ a = a' ∨ a ∈ s'

case h2.h3
α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c✝ : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c✝
c : Computation (Option (α × WSeq α))
IH : ∀ {s : WSeq α}, s.destruct = c → (a ∈ s ↔ a = a' ∨ a ∈ s')
s : WSeq α
m : s.think.destruct = c.think
this : s.destruct = c
⊢ a ∈ s.think ↔ a = a' ∨ a ∈ s'

tactic: cases' this with i1 i2
state_before: case h1.h2
α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c
x : α
s : WSeq α
m : (cons x s).destruct = Computation.pure (some (a', s'))
this : x = a' ∧ s = s'
⊢ a ∈ cons x s ↔ a = a' ∨ a ∈ s'
state_after: case h1.h2.intro
α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c
x : α
s : WSeq α
m : (cons x s).destruct = Computation.pure (some (a', s'))
i1 : x = a'
i2 : s = s'
⊢ a ∈ cons x s ↔ a = a' ∨ a ∈ s'

tactic: rw [i1, i2]
state_before: case h1.h2.intro
α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c
x : α
s : WSeq α
m : (cons x s).destruct = Computation.pure (some (a', s'))
i1 : x = a'
i2 : s = s'
⊢ a ∈ cons x s ↔ a = a' ∨ a ∈ s'
state_after: case h1.h2.intro
α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c
x : α
s : WSeq α
m : (cons x s).destruct = Computation.pure (some (a', s'))
i1 : x = a'
i2 : s = s'
⊢ a ∈ cons a' s' ↔ a = a' ∨ a ∈ s'

tactic: cases' s' with f al
state_before: case h1.h2.intro
α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c
x : α
s : WSeq α
m : (cons x s).destruct = Computation.pure (some (a', s'))
i1 : x = a'
i2 : s = s'
⊢ a ∈ cons a' s' ↔ a = a' ∨ a ∈ s'
state_after: case h1.h2.intro.mk
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
⊢ a ∈ cons a' ⟨f, al⟩ ↔ a = a' ∨ a ∈ ⟨f, al⟩

tactic: have h_a_eq_a' : a = a' ↔ some (some a) = some (some a') := by simp
state_before: case h1.h2.intro.mk
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
⊢ Any (fun b => some (some a) = b) (some (some a') :: f) ↔ a = a' ∨ Any (fun b => some (some a) = b) f
state_after: case h1.h2.intro.mk
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
⊢ Any (fun b => some (some a) = b) (some (some a') :: f) ↔ a = a' ∨ Any (fun b => some (some a) = b) f

tactic: rw [h_a_eq_a']
state_before: case h1.h2.intro.mk
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
⊢ Any (fun b => some (some a) = b) (some (some a') :: f) ↔ a = a' ∨ Any (fun b => some (some a) = b) f
state_after: case h1.h2.intro.mk
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
⊢ Any (fun b => some (some a) = b) (some (some a') :: f) ↔
    some (some a) = some (some a') ∨ Any (fun b => some (some a) = b) f

tactic: refine ⟨Stream'.eq_or_mem_of_mem_cons, fun o => ?_⟩
state_before: case h1.h2.intro.mk
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
⊢ Any (fun b => some (some a) = b) (some (some a') :: f) ↔
    some (some a) = some (some a') ∨ Any (fun b => some (some a) = b) f
state_after: case h1.h2.intro.mk
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
o : some (some a) = some (some a') ∨ Any (fun b => some (some a) = b) f
⊢ Any (fun b => some (some a) = b) (some (some a') :: f)

tactic: simp
state_before: α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
⊢ a = a' ↔ some (some a) = some (some a')
state_after: no goals

tactic: cases' o with e m
state_before: case h1.h2.intro.mk
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
o : some (some a) = some (some a') ∨ Any (fun b => some (some a) = b) f
⊢ Any (fun b => some (some a) = b) (some (some a') :: f)
state_after: case h1.h2.intro.mk.inl
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
e : some (some a) = some (some a')
⊢ Any (fun b => some (some a) = b) (some (some a') :: f)

case h1.h2.intro.mk.inr
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m✝ : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
m : Any (fun b => some (some a) = b) f
⊢ Any (fun b => some (some a) = b) (some (some a') :: f)

tactic: rw [e]
state_before: case h1.h2.intro.mk.inl
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
e : some (some a) = some (some a')
⊢ Any (fun b => some (some a) = b) (some (some a') :: f)
state_after: case h1.h2.intro.mk.inl
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
e : some (some a) = some (some a')
⊢ Any (fun b => some (some a') = b) (some (some a') :: f)

tactic: apply Stream'.mem_cons
state_before: case h1.h2.intro.mk.inl
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
e : some (some a) = some (some a')
⊢ Any (fun b => some (some a') = b) (some (some a') :: f)
state_after: no goals

tactic: exact Stream'.mem_cons_of_mem _ m
state_before: case h1.h2.intro.mk.inr
α : Type u
β : Type v
γ : Type w
a a' : α
c : Computation (Option (α × WSeq α))
x : α
s : WSeq α
i1 : x = a'
f : Stream' (Option (Option α))
al : f.IsSeq
h : some (a', ⟨f, al⟩) ∈ c
m✝ : (cons x s).destruct = Computation.pure (some (a', ⟨f, al⟩))
i2 : s = ⟨f, al⟩
h_a_eq_a' : a = a' ↔ some (some a) = some (some a')
m : Any (fun b => some (some a) = b) f
⊢ Any (fun b => some (some a) = b) (some (some a') :: f)
state_after: no goals

tactic: simp [IH this]
state_before: case h2.h3
α : Type u
β : Type v
γ : Type w
a a' : α
s' : WSeq α
c✝ : Computation (Option (α × WSeq α))
h : some (a', s') ∈ c✝
c : Computation (Option (α × WSeq α))
IH : ∀ {s : WSeq α}, s.destruct = c → (a ∈ s ↔ a = a' ∨ a ∈ s')
s : WSeq α
m : s.think.destruct = c.think
this : s.destruct = c
⊢ a ∈ s.think ↔ a = a' ∨ a ∈ s'
state_after: no goals