Module: Mathlib.Data.WSeq.Defs

Goal state before:
pp: case cons
α : Type u
s✝ : WSeq α
s1 s2 : Computation ℕ
l : List α
a : α
s : WSeq α
h :
  s1 =
      Computation.corec
        (fun x ↦
          match x with
          | (n, s) =>
            match 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, cons a s) ∧
    s2 =
      Computation.map List.length
        (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))
⊢ Computation.BisimO
    (fun c1 c2 ↦
      ∃ l s,
        c1 =
            Computation.corec
              (fun x ↦
                match x with
                | (n, s) =>
                  match 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.length
              (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.corec
        (fun x ↦
          match x with
          | (n, s) =>
            match 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, cons a s)).destruct
    (Computation.map List.length
        (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))).destruct

Tactic:
simpa using

Goal state after:
case cons
α : Type u
s✝ : WSeq α
s1 s2 : Computation ℕ
l : List α
a : α
s : WSeq α
h :
  s1 =
      Computation.corec
        (fun x ↦
          match x with
          | (n, s) =>
            match 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, cons a s) ∧
    s2 =
      Computation.map List.length
        (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.2 with
            | none => Sum.inl x.1
            | some (none, s') => Sum.inr (x.1, s')
            | some (some val, s') => Sum.inr (x.1 + 1, s'))
          (l.length + 1, s) =
        Computation.corec
          (fun x ↦
            match Seq.destruct x.2 with
            | none => Sum.inl x.1
            | some (none, s') => Sum.inr (x.1, s')
            | some (some val, s') => Sum.inr (x.1 + 1, s'))
          (l_1.length, s_1) ∧
      Computation.map List.length
          (Computation.corec
            (fun x ↦
              match Seq.destruct x.2 with
              | none => Sum.inl x.1.reverse
              | some (none, s') => Sum.inr (x.1, s')
              | some (some a, s') => Sum.inr (a :: x.1, s'))
            (a :: l, s)) =
        Computation.map List.length
          (Computation.corec
            (fun x ↦
              match Seq.destruct x.2 with
              | none => Sum.inl x.1.reverse
              | some (none, s') => Sum.inr (x.1, s')
              | some (some a, s') => Sum.inr (a :: x.1, s'))
            (l_1, s_1))