-- Lean 4 proof step from Mathlib.Data.WSeq.Defs (goal)
Goal:
α : Type u
s : WSeq α
s1 s2 : Computation ℕ
h :
  ∃ (l : List α) (s : WSeq α),
    s1 =
        Computation.corec
          (fun (x : ℕ × WSeq α) ↦
            match (motive := ℕ × WSeq α → ℕ ⊕ ℕ × WSeq α) x with
            | (n, s) =>
              match (motive := Option (Seq1 (Option α)) → ℕ ⊕ ℕ × WSeq α) Seq.destruct s with
              | none => Sum.inl n
              | some (none, s') => Sum.inr (n, s')
              | some (some val, s') => Sum.inr (n + 1, s'))
          (l.length, s) ∧
      s2 =
        Computation.map (α := List α) List.length
          (Computation.corec
            (fun (x : List α × WSeq α) ↦
              match (motive := List α × WSeq α → List α ⊕ List α × WSeq α) x with
              | (l, s) =>
                match (motive := Option (Seq1 (Option α)) → List α ⊕ List α × WSeq α) 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 : Computation ℕ) ↦
      ∃ (l : List α) (s : WSeq α),
        c1 =
            Computation.corec
              (fun (x : ℕ × WSeq α) ↦
                match (motive := ℕ × WSeq α → ℕ ⊕ ℕ × WSeq α) x with
                | (n, s) =>
                  match (motive := Option (Seq1 (Option α)) → ℕ ⊕ ℕ × WSeq α) Seq.destruct s with
                  | none => Sum.inl n
                  | some (none, s') => Sum.inr (n, s')
                  | some (some val, s') => Sum.inr (n + 1, s'))
              (l.length, s) ∧
          c2 =
            Computation.map (α := List α) List.length
              (Computation.corec
                (fun (x : List α × WSeq α) ↦
                  match (motive := List α × WSeq α → List α ⊕ List α × WSeq α) x with
                  | (l, s) =>
                    match (motive := Option (Seq1 (Option α)) → List α ⊕ List α × WSeq α) 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
have rcases : ∀ (l : List α) (s : WSeq α)
  (h :
    s1 =
        Computation.corec
          (fun (x : ℕ × WSeq α) ↦
            match (motive := ℕ × WSeq α → ℕ ⊕ ℕ × WSeq α) x with
            | (n, s) =>
              match (motive := Option (Seq1 (Option α)) → ℕ ⊕ ℕ × WSeq α) Seq.destruct s with
              | none => Sum.inl n
              | some (none, s') => Sum.inr (n, s')
              | some (some val, s') => Sum.inr (n + 1, s'))
          (l.length, s) ∧
      s2 =
        Computation.map (α := List α) List.length
          (Computation.corec
            (fun (x : List α × WSeq α) ↦
              match (motive := List α × WSeq α → List α ⊕ List α × WSeq α) x with
              | (l, s) =>
                match (motive := Option (Seq1 (Option α)) → List α ⊕ List α × WSeq α) 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 : Computation ℕ) ↦
      ∃ (l : List α) (s : WSeq α),
        c1 =
            Computation.corec
              (fun (x : ℕ × WSeq α) ↦
                match (motive := ℕ × WSeq α → ℕ ⊕ ℕ × WSeq α) x with
                | (n, s) =>
                  match (motive := Option (Seq1 (Option α)) → ℕ ⊕ ℕ × WSeq α) Seq.destruct s with
                  | none => Sum.inl n
                  | some (none, s') => Sum.inr (n, s')
                  | some (some val, s') => Sum.inr (n + 1, s'))
              (l.length, s) ∧
          c2 =
            Computation.map (α := List α) List.length
              (Computation.corec
                (fun (x : List α × WSeq α) ↦
                  match (motive := List α × WSeq α → List α ⊕ List α × WSeq α) x with
                  | (l, s) =>
                    match (motive := Option (Seq1 (Option α)) → List α ⊕ List α × WSeq α) 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
Tactic: rcases h with ⟨l, s, h⟩
Cleared hypotheses: h