l3lab/ntp-mathlib huggingface dataset:
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [

Proof state:
case h1.h1
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
⊢ append nil (join S) = cons b ss → a ∈ append nil (join S) → a ∈ nil ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
induction' S using WSeq.recOn with s S S
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; 

Proof state:
case h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
b' : α
s : WSeq α
⊢ append (cons b' s) (join S) = cons b ss → a ∈ append (cons b' s) (join S) → a ∈ cons b' s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
skip
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; 

Proof state:
case h1.h3
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
s : WSeq α
⊢ append (think s) (join S) = cons b ss → a ∈ append (think s) (join S) → a ∈ think s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
skip
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      

Proof state:
case h1.h1.h1
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
⊢ append nil (join nil) = cons b ss → a ∈ append nil (join nil) → a ∈ nil ∨ ∃ s, s ∈ nil ∧ a ∈ s

Next tactic:
intro ej m
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      

Proof state:
case h1.h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
s : WSeq α
S : WSeq (WSeq α)
⊢ append nil (join (cons s S)) = cons b ss →
    a ∈ append nil (join (cons s S)) → a ∈ nil ∨ ∃ s_1, s_1 ∈ cons s S ∧ a ∈ s_1

Next tactic:
intro ej m
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      

Proof state:
case h1.h1.h3
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
⊢ append nil (join (think S)) = cons b ss → a ∈ append nil (join (think S)) → a ∈ nil ∨ ∃ s, s ∈ think S ∧ a ∈ s

Next tactic:
intro ej m
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      

Proof state:
case h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
b' : α
s : WSeq α
⊢ append (cons b' s) (join S) = cons b ss → a ∈ append (cons b' s) (join S) → a ∈ cons b' s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
intro ej m
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      

Proof state:
case h1.h3
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
s : WSeq α
⊢ append (think s) (join S) = cons b ss → a ∈ append (think s) (join S) → a ∈ think s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
intro ej m
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> 

Proof state:
case h1.h1.h1
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
ej : append nil (join nil) = cons b ss
m : a ∈ append nil (join nil)
⊢ a ∈ nil ∨ ∃ s, s ∈ nil ∧ a ∈ s

Next tactic:
simp at ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> 

Proof state:
case h1.h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
s : WSeq α
S : WSeq (WSeq α)
ej : append nil (join (cons s S)) = cons b ss
m : a ∈ append nil (join (cons s S))
⊢ a ∈ nil ∨ ∃ s_1, s_1 ∈ cons s S ∧ a ∈ s_1

Next tactic:
simp at ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> 

Proof state:
case h1.h1.h3
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
ej : append nil (join (think S)) = cons b ss
m : a ∈ append nil (join (think S))
⊢ a ∈ nil ∨ ∃ s, s ∈ think S ∧ a ∈ s

Next tactic:
simp at ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> 

Proof state:
case h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
b' : α
s : WSeq α
ej : append (cons b' s) (join S) = cons b ss
m : a ∈ append (cons b' s) (join S)
⊢ a ∈ cons b' s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
simp at ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> 

Proof state:
case h1.h3
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
s : WSeq α
ej : append (think s) (join S) = cons b ss
m : a ∈ append (think s) (join S)
⊢ a ∈ think s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
simp at ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> 

Proof state:
case h1.h1.h1
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
m : a ∈ append nil (join nil)
ej : nil = cons b ss
⊢ a ∈ nil ∨ ∃ s, s ∈ nil ∧ a ∈ s

Next tactic:
have := congr_arg Seq.destruct ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> 

Proof state:
case h1.h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
s : WSeq α
S : WSeq (WSeq α)
m : a ∈ append nil (join (cons s S))
ej : think (append s (join S)) = cons b ss
⊢ a ∈ nil ∨ ∃ s_1, s_1 ∈ cons s S ∧ a ∈ s_1

Next tactic:
have := congr_arg Seq.destruct ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> 

Proof state:
case h1.h1.h3
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
m : a ∈ append nil (join (think S))
ej : think (join S) = cons b ss
⊢ a ∈ nil ∨ ∃ s, s ∈ think S ∧ a ∈ s

Next tactic:
have := congr_arg Seq.destruct ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> 

Proof state:
case h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
b' : α
s : WSeq α
m : a ∈ append (cons b' s) (join S)
ej : cons b' (append s (join S)) = cons b ss
⊢ a ∈ cons b' s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
have := congr_arg Seq.destruct ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> 

Proof state:
case h1.h3
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
s : WSeq α
m : a ∈ append (think s) (join S)
ej : think (append s (join S)) = cons b ss
⊢ a ∈ think s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
have := congr_arg Seq.destruct ej
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> have := congr_arg Seq.destruct ej <;>
      

Proof state:
case h1.h1.h1
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
m : a ∈ append nil (join nil)
ej : nil = cons b ss
this : Seq.destruct nil = Seq.destruct (cons b ss)
⊢ a ∈ nil ∨ ∃ s, s ∈ nil ∧ a ∈ s

Next tactic:
simp at this
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> have := congr_arg Seq.destruct ej <;>
      

Proof state:
case h1.h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
s : WSeq α
S : WSeq (WSeq α)
m : a ∈ append nil (join (cons s S))
ej : think (append s (join S)) = cons b ss
this : Seq.destruct (think (append s (join S))) = Seq.destruct (cons b ss)
⊢ a ∈ nil ∨ ∃ s_1, s_1 ∈ cons s S ∧ a ∈ s_1

Next tactic:
simp at this
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> have := congr_arg Seq.destruct ej <;>
      

Proof state:
case h1.h1.h3
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
m : a ∈ append nil (join (think S))
ej : think (join S) = cons b ss
this : Seq.destruct (think (join S)) = Seq.destruct (cons b ss)
⊢ a ∈ nil ∨ ∃ s, s ∈ think S ∧ a ∈ s

Next tactic:
simp at this
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> have := congr_arg Seq.destruct ej <;>
      

Proof state:
case h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
b' : α
s : WSeq α
m : a ∈ append (cons b' s) (join S)
ej : cons b' (append s (join S)) = cons b ss
this : Seq.destruct (cons b' (append s (join S))) = Seq.destruct (cons b ss)
⊢ a ∈ cons b' s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
simp at this
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> have := congr_arg Seq.destruct ej <;>
      

Proof state:
case h1.h3
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
s : WSeq α
m : a ∈ append (think s) (join S)
ej : think (append s (join S)) = cons b ss
this : Seq.destruct (think (append s (join S))) = Seq.destruct (cons b ss)
⊢ a ∈ think s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
simp at this
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> have := congr_arg Seq.destruct ej <;>
      simp at this; 

Proof state:
case h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
b' : α
s : WSeq α
m : a ∈ append (cons b' s) (join S)
ej : cons b' (append s (join S)) = cons b ss
this : b' = b ∧ append s (join S) = ss
⊢ a ∈ cons b' s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
try cases this; try contradiction
theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S → ∃ s, s ∈ S ∧ a ∈ s := by
  suffices
    ∀ ss : WSeq α,
      a ∈ ss → ∀ s S, append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
    from fun S h => (this _ h nil S (by simp) (by simp [h])).resolve_left (not_mem_nil _)
  intro ss h; apply mem_rec_on h <;> [intro b ss o; intro ss IH] <;> intro s S
  · induction' s using WSeq.recOn with b' s s <;>
      [induction' S using WSeq.recOn with s S S; skip; skip] <;>
      intro ej m <;> simp at ej <;> have := congr_arg Seq.destruct ej <;>
      simp at this; try 

Proof state:
case h1.h2
α : Type u
β : Type v
γ : Type w
a : α
ss✝ : WSeq α
h : a ∈ ss✝
b : α
ss : WSeq α
o :
  a = b ∨
    ∀ (s : WSeq α) (S : WSeq (WSeq α)), append s (join S) = ss → a ∈ append s (join S) → a ∈ s ∨ ∃ s, s ∈ S ∧ a ∈ s
S : WSeq (WSeq α)
b' : α
s : WSeq α
m : a ∈ append (cons b' s) (join S)
ej : cons b' (append s (join S)) = cons b ss
this : b' = b ∧ append s (join S) = ss
⊢ a ∈ cons b' s ∨ ∃ s, s ∈ S ∧ a ∈ s

Next tactic:
cases this