-- Mathlib/Data/Seq/WSeq.lean
theorem eq_or_mem_iff_mem {s : WSeq α} {a a' s'} :
    some (a', s') ∈ destruct s → (a ∈ s ↔ a = a' ∨ a ∈ s')

Proof state:
case h1.h2.intro.mk
α : Type u
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:
rcases o with e | m

Result:
case h1.h2.intro.mk.inl
α : Type u
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
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)

Proof state:
case h1.h2.intro.mk
α : Type u
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']

Result:
case h1.h2.intro.mk
α : Type u
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

Proof state:
case h1.h2.intro.mk.inl
α : Type u
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:
rw [e]

Result:
case h1.h2.intro.mk.inl
α : Type u
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)

Proof state:
α : Type u
s : WSeq α
a a' : α
s' : WSeq α
⊢ some (a', s') ∈ s.destruct → (a ∈ s ↔ a = a' ∨ a ∈ s')

Tactic:
generalize e : destruct s = c

Result:
α : Type u
s : WSeq α
a a' : α
s' : WSeq α
c : Computation (Option (α × WSeq α))
e : s.destruct = c
⊢ some (a', s') ∈ c → (a ∈ s ↔ a = a' ∨ a ∈ s')

Proof state:
α : Type u
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

Result:
case h1.h2
α : Type u
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
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'

Proof state:
case h2.h3
α : Type u
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:
simp [IH this]

Result:
no goals

Proof state:
case h1.h2.intro.mk
α : Type u
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

Tactic:
have h_a_eq_a' : a = a' ↔ some (some a) = some (some a') := by simp

Result:
case h1.h2.intro.mk
α : Type u
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

Proof state:
case h1.h2.intro.mk
α : Type u
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 => ?_⟩

Result:
case h1.h2.intro.mk
α : Type u
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)

Proof state:
case h1.h2.intro
α : Type u
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:
obtain ⟨f, al⟩ := s'

Result:
case h1.h2.intro.mk
α : Type u
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⟩

Proof state:
case h1.h2.intro.mk.inl
α : Type u
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

Result:
no goals