-- Mathlib/Data/Seq/WSeq.lean
theorem toList'_map (l : List α) (s : WSeq α) :
    Computation.corec (fun ⟨l, s⟩ =>
      match Seq.destruct s with
      | none => Sum.inl l.reverse
      | some (none, s') => Sum.inr (l, s')
      | some (some a, s') => Sum.inr (a :: l, s')) (l, s) = (l.reverse ++ ·) <$> toList s

Proof state:
α : Type u
l : List α
s : WSeq α
⊢ Computation.IsBisimulation fun c1 c2 =>
    ∃ l' s,
      c1 =
          Computation.corec
            (fun x =>
              match x with
              | (l, s) =>
                match Seq.destruct s with
                | none => Sum.inl l.reverse
                | some (none, s') => Sum.inr (l, s')
                | some (some a, s') => Sum.inr (a :: l, s'))
            (l' ++ l, s) ∧
        c2 =
          Computation.map (fun x => l.reverse ++ x)
            (Computation.corec
              (fun x =>
                match x with
                | (l, s) =>
                  match Seq.destruct s with
                  | none => Sum.inl l.reverse
                  | some (none, s') => Sum.inr (l, s')
                  | some (some a, s') => Sum.inr (a :: l, s'))
              (l', s))

Tactic:
intro s1 s2 h

Result:
α : Type u
l : List α
s : WSeq α
s1 s2 : Computation (List α)
h :
  ∃ l' s,
    s1 =
        Computation.corec
          (fun x =>
            match x with
            | (l, s) =>
              match Seq.destruct s with
              | none => Sum.inl l.reverse
              | some (none, s') => Sum.inr (l, s')
              | some (some a, s') => Sum.inr (a :: l, s'))
          (l' ++ l, s) ∧
      s2 =
        Computation.map (fun x => l.reverse ++ x)
          (Computation.corec
            (fun x =>
              match x with
              | (l, s) =>
                match Seq.destruct s with
                | none => Sum.inl l.reverse
                | some (none, s') => Sum.inr (l, s')
                | some (some a, s') => Sum.inr (a :: l, s'))
            (l', s))
⊢ Computation.BisimO
    (fun c1 c2 =>
      ∃ l' s,
        c1 =
            Computation.corec
              (fun x =>
                match x with
                | (l, s) =>
                  match Seq.destruct s with
                  | none => Sum.inl l.reverse
                  | some (none, s') => Sum.inr (l, s')
                  | some (some a, s') => Sum.inr (a :: l, s'))
              (l' ++ l, s) ∧
          c2 =
            Computation.map (fun x => l.reverse ++ x)
              (Computation.corec
                (fun x =>
                  match x with
                  | (l, s) =>
                    match Seq.destruct s with
                    | none => Sum.inl l.reverse
                    | some (none, s') => Sum.inr (l, s')
                    | some (some a, s') => Sum.inr (a :: l, s'))
                (l', s)))
    s1.destruct s2.destruct

Proof state:
case intro.intro.h3
α : Type u
l : List α
s✝ : WSeq α
s1 s2 : Computation (List α)
l' : List α
s : WSeq α
h :
  s1 =
      Computation.corec
        (fun x =>
          match x with
          | (l, s) =>
            match Seq.destruct s with
            | none => Sum.inl l.reverse
            | some (none, s') => Sum.inr (l, s')
            | some (some a, s') => Sum.inr (a :: l, s'))
        (l' ++ l, s.think) ∧
    s2 =
      Computation.map (fun x => l.reverse ++ x)
        (Computation.corec
          (fun x =>
            match x with
            | (l, s) =>
              match Seq.destruct s with
              | none => Sum.inl l.reverse
              | some (none, s') => Sum.inr (l, s')
              | some (some a, s') => Sum.inr (a :: l, s'))
          (l', s.think))
⊢ ∃ l'_1 s_1,
    Computation.corec
          (fun x =>
            match Seq.destruct x.snd with
            | none => Sum.inl x.fst.reverse
            | some (none, s') => Sum.inr (x.fst, s')
            | some (some a, s') => Sum.inr (a :: x.fst, s'))
          (l' ++ l, s) =
        Computation.corec
          (fun x =>
            match Seq.destruct x.snd with
            | none => Sum.inl x.fst.reverse
            | some (none, s') => Sum.inr (x.fst, s')
            | some (some a, s') => Sum.inr (a :: x.fst, s'))
          (l'_1 ++ l, s_1) ∧
      Computation.map (fun x => l.reverse ++ x)
          (Computation.corec
            (fun x =>
              match Seq.destruct x.snd with
              | none => Sum.inl x.fst.reverse
              | some (none, s') => Sum.inr (x.fst, s')
              | some (some a, s') => Sum.inr (a :: x.fst, s'))
            (l', s)) =
        Computation.map (fun x => l.reverse ++ x)
          (Computation.corec
            (fun x =>
              match Seq.destruct x.snd with
              | none => Sum.inl x.fst.reverse
              | some (none, s') => Sum.inr (x.fst, s')
              | some (some a, s') => Sum.inr (a :: x.fst, s'))
            (l'_1, s_1))

Tactic:
refine ⟨l', s, ?_, ?_⟩ <;> simp

Result:
no goals

Proof state:
case intro.intro.h2
α : Type u
l : List α
s✝ : WSeq α
s1 s2 : Computation (List α)
l' : List α
a : α
s : WSeq α
h :
  s1 =
      Computation.corec
        (fun x =>
          match x with
          | (l, s) =>
            match Seq.destruct s with
            | none => Sum.inl l.reverse
            | some (none, s') => Sum.inr (l, s')
            | some (some a, s') => Sum.inr (a :: l, s'))
        (l' ++ l, cons a s) ∧
    s2 =
      Computation.map (fun x => l.reverse ++ x)
        (Computation.corec
          (fun x =>
            match x with
            | (l, s) =>
              match Seq.destruct s with
              | none => Sum.inl l.reverse
              | some (none, s') => Sum.inr (l, s')
              | some (some a, s') => Sum.inr (a :: l, s'))
          (l', cons a s))
⊢ ∃ l'_1 s_1,
    Computation.corec
          (fun x =>
            match Seq.destruct x.snd with
            | none => Sum.inl x.fst.reverse
            | some (none, s') => Sum.inr (x.fst, s')
            | some (some a, s') => Sum.inr (a :: x.fst, s'))
          (a :: (l' ++ l), s) =
        Computation.corec
          (fun x =>
            match Seq.destruct x.snd with
            | none => Sum.inl x.fst.reverse
            | some (none, s') => Sum.inr (x.fst, s')
            | some (some a, s') => Sum.inr (a :: x.fst, s'))
          (l'_1 ++ l, s_1) ∧
      Computation.map (fun x => l.reverse ++ x)
          (Computation.corec
            (fun x =>
              match Seq.destruct x.snd with
              | none => Sum.inl x.fst.reverse
              | some (none, s') => Sum.inr (x.fst, s')
              | some (some a, s') => Sum.inr (a :: x.fst, s'))
            (a :: l', s)) =
        Computation.map (fun x => l.reverse ++ x)
          (Computation.corec
            (fun x =>
              match Seq.destruct x.snd with
              | none => Sum.inl x.fst.reverse
              | some (none, s') => Sum.inr (x.fst, s')
              | some (some a, s') => Sum.inr (a :: x.fst, s'))
            (l'_1, s_1))

Tactic:
refine ⟨a::l', s, ?_, ?_⟩ <;> simp

Result:
no goals