Theorem: Computation.terminates_parallel.aux
File: Mathlib/Data/Seq/Parallel.lean

tactic: have lem1 :
  ∀ l S, (∃ a : α, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S)) := by
  intro l S e
  cases' e with a e
  have : corec parallel.aux1 (l, S) = return a := by
    apply destruct_eq_pure
    simp [parallel.aux1]
    rw [e]
  rw [this]
  exact ret_terminates a
state_before: α : Type u
β : Type v
⊢ ∀ {l : List (Computation α)} {S : WSeq (Computation α)} {c : Computation α},
    c ∈ l → Terminates c → Terminates (corec parallel.aux1 (l, S))

tactic: intro l S c m T
state_before: α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
⊢ ∀ {l : List (Computation α)} {S : WSeq (Computation α)} {c : Computation α},
    c ∈ l → Terminates c → Terminates (corec parallel.aux1 (l, S))

tactic: revert l S
state_before: α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
c : Computation α
m : c ∈ l
T : Terminates c
⊢ Terminates (corec parallel.aux1 (l, S))

tactic: apply @terminatesRecOn _ _ c T _ _
state_before: α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
⊢ ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, c ∈ l → Terminates (corec parallel.aux1 (l, S))

tactic: intro l S e
state_before: α : Type u
β : Type v
⊢ ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))

tactic: cases' e with a e
state_before: α : Type u
β : Type v
l : List (Computation α)
S : WSeq (Computation α)
e : ∃ a, parallel.aux2 l = Sum.inl a
⊢ Terminates (corec parallel.aux1 (l, S))

tactic: have : corec parallel.aux1 (l, S) = return a := by
  apply destruct_eq_pure
  simp [parallel.aux1]
  rw [e]
state_before: case intro
α : Type u
β : Type v
l : List (Computation α)
S : WSeq (Computation α)
a : α
e : parallel.aux2 l = Sum.inl a
⊢ Terminates (corec parallel.aux1 (l, S))

tactic: rw [this]
state_before: case intro
α : Type u
β : Type v
l : List (Computation α)
S : WSeq (Computation α)
a : α
e : parallel.aux2 l = Sum.inl a
this : corec parallel.aux1 (l, S) = Pure.pure a
⊢ Terminates (corec parallel.aux1 (l, S))

tactic: exact ret_terminates a
state_before: case intro
α : Type u
β : Type v
l : List (Computation α)
S : WSeq (Computation α)
a : α
e : parallel.aux2 l = Sum.inl a
this : corec parallel.aux1 (l, S) = Pure.pure a
⊢ Terminates (Pure.pure a)

tactic: apply destruct_eq_pure
state_before: α : Type u
β : Type v
l : List (Computation α)
S : WSeq (Computation α)
a : α
e : parallel.aux2 l = Sum.inl a
⊢ corec parallel.aux1 (l, S) = Pure.pure a

tactic: simp [parallel.aux1]
state_before: case a
α : Type u
β : Type v
l : List (Computation α)
S : WSeq (Computation α)
a : α
e : parallel.aux2 l = Sum.inl a
⊢ destruct (corec parallel.aux1 (l, S)) = Sum.inl a

tactic: rw [e]
state_before: case a
α : Type u
β : Type v
l : List (Computation α)
S : WSeq (Computation α)
a : α
e : parallel.aux2 l = Sum.inl a
⊢ (match
      match parallel.aux2 l with
      | Sum.inl a => Sum.inl a
      | Sum.inr b =>
        Sum.inr
          (match Seq.destruct S with
          | none => (b, Seq.nil)
          | some (none, S') => (b, S')
          | some (some c, S') => (c :: b, S')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (corec
          (fun x =>
            match parallel.aux2 x.fst with
            | Sum.inl a => Sum.inl a
            | Sum.inr b =>
              Sum.inr
                (match Seq.destruct x.snd with
                | none => (b, Seq.nil)
                | some (none, S') => (b, S')
                | some (some c, S') => (c :: b, S')))
          b)) =
    Sum.inl a

tactic: intro a l S m
state_before: α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
⊢ ∀ (a : α) {l : List (Computation α)} {S : WSeq (Computation α)}, pure a ∈ l → Terminates (corec parallel.aux1 (l, S))

tactic: apply lem1
state_before: α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
a : α
l : List (Computation α)
S : WSeq (Computation α)
m : pure a ∈ l
⊢ Terminates (corec parallel.aux1 (l, S))

tactic: induction' l with c l IH <;> simp at m
state_before: case a
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
a : α
l : List (Computation α)
S : WSeq (Computation α)
m : pure a ∈ l
⊢ ∃ a, parallel.aux2 l = Sum.inl a

tactic: cases' m with e m
state_before: case a.cons
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
m : pure a = c ∨ pure a ∈ l
⊢ ∃ a, parallel.aux2 (c :: l) = Sum.inl a

tactic: rw [← e]
state_before: case a.cons.inl
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
e : pure a = c
⊢ ∃ a, parallel.aux2 (c :: l) = Sum.inl a

tactic: simp [parallel.aux2]
state_before: case a.cons.inl
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
e : pure a = c
⊢ ∃ a_1, parallel.aux2 (pure a :: l) = Sum.inl a_1

tactic: cases' List.foldr (fun c o =>
  match o with
  | Sum.inl a => Sum.inl a
  | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c)) (Sum.inr List.nil) l with a' ls
state_before: case a.cons.inl
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
e : pure a = c
⊢ ∃ a_1,
    (match
        List.foldr
          (fun c o =>
            match o with
            | Sum.inl a => Sum.inl a
            | Sum.inr ls =>
              match destruct c with
              | Sum.inl a => Sum.inl a
              | Sum.inr b => Sum.inr (b :: ls))
          (Sum.inr []) l with
      | Sum.inl a => Sum.inl a
      | Sum.inr ls => Sum.inl a) =
      Sum.inl a_1

tactic: exacts [⟨a', rfl⟩, ⟨a, rfl⟩]
state_before: case a.cons.inl.inl
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
e : pure a = c
a' : α
⊢ ∃ a_1,
    (match Sum.inl a' with
      | Sum.inl a => Sum.inl a
      | Sum.inr ls => Sum.inl a) =
      Sum.inl a_1

case a.cons.inl.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
e : pure a = c
ls : List (Computation α)
⊢ ∃ a_1,
    (match Sum.inr ls with
      | Sum.inl a => Sum.inl a
      | Sum.inr ls => Sum.inl a) =
      Sum.inl a_1

tactic: cases' IH m with a' e
state_before: case a.cons.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
m : pure a ∈ l
⊢ ∃ a, parallel.aux2 (c :: l) = Sum.inl a

tactic: simp [parallel.aux2]
state_before: case a.cons.inr.intro
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
m : pure a ∈ l
a' : α
e : parallel.aux2 l = Sum.inl a'
⊢ ∃ a, parallel.aux2 (c :: l) = Sum.inl a

tactic: simp [parallel.aux2] at e
state_before: case a.cons.inr.intro
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
m : pure a ∈ l
a' : α
e : parallel.aux2 l = Sum.inl a'
⊢ ∃ a,
    (match
        List.foldr
          (fun c o =>
            match o with
            | Sum.inl a => Sum.inl a
            | Sum.inr ls =>
              match destruct c with
              | Sum.inl a => Sum.inl a
              | Sum.inr b => Sum.inr (b :: ls))
          (Sum.inr []) l with
      | Sum.inl a => Sum.inl a
      | Sum.inr ls =>
        match destruct c with
        | Sum.inl a => Sum.inl a
        | Sum.inr b => Sum.inr (b :: ls)) =
      Sum.inl a

tactic: rw [e]
state_before: case a.cons.inr.intro
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
m : pure a ∈ l
a' : α
e :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls =>
          match destruct c with
          | Sum.inl a => Sum.inl a
          | Sum.inr b => Sum.inr (b :: ls))
      (Sum.inr []) l =
    Sum.inl a'
⊢ ∃ a,
    (match
        List.foldr
          (fun c o =>
            match o with
            | Sum.inl a => Sum.inl a
            | Sum.inr ls =>
              match destruct c with
              | Sum.inl a => Sum.inl a
              | Sum.inr b => Sum.inr (b :: ls))
          (Sum.inr []) l with
      | Sum.inl a => Sum.inl a
      | Sum.inr ls =>
        match destruct c with
        | Sum.inl a => Sum.inl a
        | Sum.inr b => Sum.inr (b :: ls)) =
      Sum.inl a

tactic: exact ⟨a', rfl⟩
state_before: case a.cons.inr.intro
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
a : α
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : pure a ∈ l✝
c : Computation α
l : List (Computation α)
IH : pure a ∈ l → ∃ a, parallel.aux2 l = Sum.inl a
m : pure a ∈ l
a' : α
e :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls =>
          match destruct c with
          | Sum.inl a => Sum.inl a
          | Sum.inr b => Sum.inr (b :: ls))
      (Sum.inr []) l =
    Sum.inl a'
⊢ ∃ a,
    (match Sum.inl a' with
      | Sum.inl a => Sum.inl a
      | Sum.inr ls =>
        match destruct c with
        | Sum.inl a => Sum.inl a
        | Sum.inr b => Sum.inr (b :: ls)) =
      Sum.inl a

tactic: intro s IH l S m
state_before: α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
⊢ ∀ (s : Computation α),
    (∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))) →
      ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, think s ∈ l → Terminates (corec parallel.aux1 (l, S))

tactic: induction' h : parallel.aux2 l with a l'
state_before: α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
⊢ Terminates (corec parallel.aux1 (l, S))

tactic: induction' l with c l IH' <;> intro l' e' <;> simp at m
state_before: α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
⊢ ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'

tactic: cases' m with e m <;> simp [parallel.aux2] at e'
state_before: case cons
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
e' : parallel.aux2 (c :: l) = Sum.inr l'
m : think s = c ∨ think s ∈ l
⊢ s ∈ l'

tactic: rw [← e] at e'
state_before: case cons.inl
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
e' :
  (match
      List.foldr
        (fun c o =>
          match o with
          | Sum.inl a => Sum.inl a
          | Sum.inr ls =>
            match destruct c with
            | Sum.inl a => Sum.inl a
            | Sum.inr b => Sum.inr (b :: ls))
        (Sum.inr []) l with
    | Sum.inl a => Sum.inl a
    | Sum.inr ls =>
      match destruct c with
      | Sum.inl a => Sum.inl a
      | Sum.inr b => Sum.inr (b :: ls)) =
    Sum.inr l'
e : think s = c
⊢ s ∈ l'

tactic: revert e'
state_before: case cons.inl
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
e' :
  (match
      List.foldr
        (fun c o =>
          match o with
          | Sum.inl a => Sum.inl a
          | Sum.inr ls =>
            match destruct c with
            | Sum.inl a => Sum.inl a
            | Sum.inr b => Sum.inr (b :: ls))
        (Sum.inr []) l with
    | Sum.inl a => Sum.inl a
    | Sum.inr ls =>
      match destruct (think s) with
      | Sum.inl a => Sum.inl a
      | Sum.inr b => Sum.inr (b :: ls)) =
    Sum.inr l'
e : think s = c
⊢ s ∈ l'

tactic: cases' List.foldr (fun c o =>
    match o with
    | Sum.inl a => Sum.inl a
    | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
  (Sum.inr []) l with a' ls <;> intro e' <;> [injection e'; injection e' with e']
state_before: case cons.inl
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
e : think s = c
⊢ (match
        List.foldr
          (fun c o =>
            match o with
            | Sum.inl a => Sum.inl a
            | Sum.inr ls =>
              match destruct c with
              | Sum.inl a => Sum.inl a
              | Sum.inr b => Sum.inr (b :: ls))
          (Sum.inr []) l with
      | Sum.inl a => Sum.inl a
      | Sum.inr ls =>
        match destruct (think s) with
        | Sum.inl a => Sum.inl a
        | Sum.inr b => Sum.inr (b :: ls)) =
      Sum.inr l' →
    s ∈ l'

tactic: rw [← e']
state_before: case cons.inl.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
e : think s = c
ls : List (Computation α)
e' : tail (think s) :: ls = l'
⊢ s ∈ l'

tactic: simp
state_before: case cons.inl.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
e : think s = c
ls : List (Computation α)
e' : tail (think s) :: ls = l'
⊢ s ∈ tail (think s) :: ls

tactic: induction' e : List.foldr (fun c o =>
    match o with
    | Sum.inl a => Sum.inl a
    | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
  (Sum.inr List.nil) l with a' ls <;> erw [e] at e'
state_before: case cons.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
e' :
  (match
      List.foldr
        (fun c o =>
          match o with
          | Sum.inl a => Sum.inl a
          | Sum.inr ls =>
            match destruct c with
            | Sum.inl a => Sum.inl a
            | Sum.inr b => Sum.inr (b :: ls))
        (Sum.inr []) l with
    | Sum.inl a => Sum.inl a
    | Sum.inr ls =>
      match destruct c with
      | Sum.inl a => Sum.inl a
      | Sum.inr b => Sum.inr (b :: ls)) =
    Sum.inr l'
m : think s ∈ l
⊢ s ∈ l'

tactic: have := IH' m _ e
state_before: case cons.inr.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
m : think s ∈ l
x✝ : α ⊕ List (Computation α)
e✝ :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    x✝
ls : List (Computation α)
e' :
  (match Sum.inr ls with
    | Sum.inl a => Sum.inl a
    | Sum.inr ls =>
      match destruct c with
      | Sum.inl a => Sum.inl a
      | Sum.inr b => Sum.inr (b :: ls)) =
    Sum.inr l'
e :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    Sum.inr ls
⊢ s ∈ l'

tactic: simp [parallel.aux2] at e'
state_before: case cons.inr.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
m : think s ∈ l
x✝ : α ⊕ List (Computation α)
e✝ :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    x✝
ls : List (Computation α)
e' :
  (match Sum.inr ls with
    | Sum.inl a => Sum.inl a
    | Sum.inr ls =>
      match destruct c with
      | Sum.inl a => Sum.inl a
      | Sum.inr b => Sum.inr (b :: ls)) =
    Sum.inr l'
e :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    Sum.inr ls
this : s ∈ ls
⊢ s ∈ l'

tactic: revert e'
state_before: case cons.inr.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
m : think s ∈ l
x✝ : α ⊕ List (Computation α)
e✝ :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    x✝
ls : List (Computation α)
e' :
  (match destruct c with
    | Sum.inl a => Sum.inl a
    | Sum.inr b => Sum.inr (b :: ls)) =
    Sum.inr l'
e :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    Sum.inr ls
this : s ∈ ls
⊢ s ∈ l'

tactic: cases destruct c <;> intro e' <;> [injection e'; injection e' with h']
state_before: case cons.inr.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
m : think s ∈ l
x✝ : α ⊕ List (Computation α)
e✝ :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    x✝
ls : List (Computation α)
e :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    Sum.inr ls
this : s ∈ ls
⊢ (match destruct c with
      | Sum.inl a => Sum.inl a
      | Sum.inr b => Sum.inr (b :: ls)) =
      Sum.inr l' →
    s ∈ l'

tactic: rw [← h']
state_before: case cons.inr.inr.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
m : think s ∈ l
x✝ : α ⊕ List (Computation α)
e✝ :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    x✝
ls : List (Computation α)
e :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    Sum.inr ls
this : s ∈ ls
val✝ : Computation α
h' : val✝ :: ls = l'
⊢ s ∈ l'

tactic: simp [this]
state_before: case cons.inr.inr.inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
m : think s ∈ l
x✝ : α ⊕ List (Computation α)
e✝ :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    x✝
ls : List (Computation α)
e :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    Sum.inr ls
this : s ∈ ls
val✝ : Computation α
h' : val✝ :: ls = l'
⊢ s ∈ val✝ :: ls

tactic: contradiction
state_before: case cons.inr.inl
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c✝ : Computation α
T : Terminates c✝
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l✝ : List (Computation α)
S : WSeq (Computation α)
m✝ : think s ∈ l✝
c : Computation α
l : List (Computation α)
IH' : think s ∈ l → ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
l' : List (Computation α)
m : think s ∈ l
x✝ : α ⊕ List (Computation α)
e✝ :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    x✝
a' : α
e' :
  (match Sum.inl a' with
    | Sum.inl a => Sum.inl a
    | Sum.inr ls =>
      match destruct c with
      | Sum.inl a => Sum.inl a
      | Sum.inr b => Sum.inr (b :: ls)) =
    Sum.inr l'
e :
  List.foldr
      (fun c o =>
        match o with
        | Sum.inl a => Sum.inl a
        | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
      (Sum.inr []) l =
    Sum.inl a'
⊢ s ∈ l'

tactic: exact lem1 _ _ ⟨a, h⟩
state_before: case inl
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
x✝ : α ⊕ List (Computation α)
h✝ : parallel.aux2 l = x✝
a : α
h : parallel.aux2 l = Sum.inl a
⊢ Terminates (corec parallel.aux1 (l, S))

tactic: have H2 : corec parallel.aux1 (l, S) = think _ := by
  apply destruct_eq_think
  simp [parallel.aux1]
  rw [h]
state_before: case inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
x✝ : α ⊕ List (Computation α)
h✝ : parallel.aux2 l = x✝
l' : List (Computation α)
h : parallel.aux2 l = Sum.inr l'
⊢ Terminates (corec parallel.aux1 (l, S))

tactic: rw [H2]
state_before: case inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
x✝ : α ⊕ List (Computation α)
h✝ : parallel.aux2 l = x✝
l' : List (Computation α)
h : parallel.aux2 l = Sum.inr l'
H2 :
  corec parallel.aux1 (l, S) =
    think
      (corec
        (fun x =>
          match parallel.aux2 x.fst with
          | Sum.inl a => Sum.inl a
          | Sum.inr b =>
            Sum.inr
              (match Seq.destruct x.snd with
              | none => (b, Seq.nil)
              | some (none, S') => (b, S')
              | some (some c, S') => (c :: b, S')))
        (match Seq.destruct S with
        | none => (l', Seq.nil)
        | some (none, S') => (l', S')
        | some (some c, S') => (c :: l', S')))
⊢ Terminates (corec parallel.aux1 (l, S))

tactic: refine @Computation.think_terminates _ _ ?_
state_before: case inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
x✝ : α ⊕ List (Computation α)
h✝ : parallel.aux2 l = x✝
l' : List (Computation α)
h : parallel.aux2 l = Sum.inr l'
H2 :
  corec parallel.aux1 (l, S) =
    think
      (corec
        (fun x =>
          match parallel.aux2 x.fst with
          | Sum.inl a => Sum.inl a
          | Sum.inr b =>
            Sum.inr
              (match Seq.destruct x.snd with
              | none => (b, Seq.nil)
              | some (none, S') => (b, S')
              | some (some c, S') => (c :: b, S')))
        (match Seq.destruct S with
        | none => (l', Seq.nil)
        | some (none, S') => (l', S')
        | some (some c, S') => (c :: l', S')))
⊢ Terminates
    (think
      (corec
        (fun x =>
          match parallel.aux2 x.fst with
          | Sum.inl a => Sum.inl a
          | Sum.inr b =>
            Sum.inr
              (match Seq.destruct x.snd with
              | none => (b, Seq.nil)
              | some (none, S') => (b, S')
              | some (some c, S') => (c :: b, S')))
        (match Seq.destruct S with
        | none => (l', Seq.nil)
        | some (none, S') => (l', S')
        | some (some c, S') => (c :: l', S'))))

tactic: have := H1 _ h
state_before: case inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
x✝ : α ⊕ List (Computation α)
h✝ : parallel.aux2 l = x✝
l' : List (Computation α)
h : parallel.aux2 l = Sum.inr l'
H2 :
  corec parallel.aux1 (l, S) =
    think
      (corec
        (fun x =>
          match parallel.aux2 x.fst with
          | Sum.inl a => Sum.inl a
          | Sum.inr b =>
            Sum.inr
              (match Seq.destruct x.snd with
              | none => (b, Seq.nil)
              | some (none, S') => (b, S')
              | some (some c, S') => (c :: b, S')))
        (match Seq.destruct S with
        | none => (l', Seq.nil)
        | some (none, S') => (l', S')
        | some (some c, S') => (c :: l', S')))
⊢ Terminates
    (corec
      (fun x =>
        match parallel.aux2 x.fst with
        | Sum.inl a => Sum.inl a
        | Sum.inr b =>
          Sum.inr
            (match Seq.destruct x.snd with
            | none => (b, Seq.nil)
            | some (none, S') => (b, S')
            | some (some c, S') => (c :: b, S')))
      (match Seq.destruct S with
      | none => (l', Seq.nil)
      | some (none, S') => (l', S')
      | some (some c, S') => (c :: l', S')))

tactic: rcases Seq.destruct S with (_ | ⟨_ | c, S'⟩) <;> simp [parallel.aux1] <;> apply IH <;>
  simp [this]
state_before: case inr
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
x✝ : α ⊕ List (Computation α)
h✝ : parallel.aux2 l = x✝
l' : List (Computation α)
h : parallel.aux2 l = Sum.inr l'
H2 :
  corec parallel.aux1 (l, S) =
    think
      (corec
        (fun x =>
          match parallel.aux2 x.fst with
          | Sum.inl a => Sum.inl a
          | Sum.inr b =>
            Sum.inr
              (match Seq.destruct x.snd with
              | none => (b, Seq.nil)
              | some (none, S') => (b, S')
              | some (some c, S') => (c :: b, S')))
        (match Seq.destruct S with
        | none => (l', Seq.nil)
        | some (none, S') => (l', S')
        | some (some c, S') => (c :: l', S')))
this : s ∈ l'
⊢ Terminates
    (corec
      (fun x =>
        match parallel.aux2 x.fst with
        | Sum.inl a => Sum.inl a
        | Sum.inr b =>
          Sum.inr
            (match Seq.destruct x.snd with
            | none => (b, Seq.nil)
            | some (none, S') => (b, S')
            | some (some c, S') => (c :: b, S')))
      (match Seq.destruct S with
      | none => (l', Seq.nil)
      | some (none, S') => (l', S')
      | some (some c, S') => (c :: l', S')))

tactic: apply destruct_eq_think
state_before: α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
x✝ : α ⊕ List (Computation α)
h✝ : parallel.aux2 l = x✝
l' : List (Computation α)
h : parallel.aux2 l = Sum.inr l'
⊢ corec parallel.aux1 (l, S) = think ?m.51261

tactic: simp [parallel.aux1]
state_before: case a
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
x✝ : α ⊕ List (Computation α)
h✝ : parallel.aux2 l = x✝
l' : List (Computation α)
h : parallel.aux2 l = Sum.inr l'
⊢ destruct (corec parallel.aux1 (l, S)) = Sum.inr ?m.51261

tactic: rw [h]
state_before: case a
α : Type u
β : Type v
lem1 :
  ∀ (l : List (Computation α)) (S : WSeq (Computation α)),
    (∃ a, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S))
c : Computation α
T : Terminates c
s : Computation α
IH : ∀ {l : List (Computation α)} {S : WSeq (Computation α)}, s ∈ l → Terminates (corec parallel.aux1 (l, S))
l : List (Computation α)
S : WSeq (Computation α)
m : think s ∈ l
H1 : ∀ (l' : List (Computation α)), parallel.aux2 l = Sum.inr l' → s ∈ l'
x✝ : α ⊕ List (Computation α)
h✝ : parallel.aux2 l = x✝
l' : List (Computation α)
h : parallel.aux2 l = Sum.inr l'
⊢ (match
      match parallel.aux2 l with
      | Sum.inl a => Sum.inl a
      | Sum.inr b =>
        Sum.inr
          (match Seq.destruct S with
          | none => (b, Seq.nil)
          | some (none, S') => (b, S')
          | some (some c, S') => (c :: b, S')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (corec
          (fun x =>
            match parallel.aux2 x.fst with
            | Sum.inl a => Sum.inl a
            | Sum.inr b =>
              Sum.inr
                (match Seq.destruct x.snd with
                | none => (b, Seq.nil)
                | some (none, S') => (b, S')
                | some (some c, S') => (c :: b, S')))
          b)) =
    Sum.inr ?m.51261