-- Mathlib/Data/Seq/Seq.lean
theorem nil_append (s : Seq α) : append nil s = s

Proof state:
case H.cons
α : Type u
s : Seq α
x✝ : α
s✝ : Seq α
⊢ match
    match
      match (cons x✝ s✝).destruct with
      | none => none
      | some (a, b) => some (a, nil, b) with
    | none => none
    | some (a, b) =>
      some
        (a,
          corec
            (fun x =>
              match x.fst.destruct with
              | none =>
                match x.snd.destruct with
                | none => none
                | some (a, b) => some (a, nil, b)
              | some (a, s₁') => some (a, s₁', x.snd))
            b),
    (cons x✝ s✝).destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match x.fst.destruct with
                | none =>
                  match x.snd.destruct with
                  | none => none
                  | some (a, b) => some (a, nil, b)
                | some (a, s₁') => some (a, s₁', x.snd))
              (nil, s_1) ∧
          s' = s_1
  | x, x_1 => False

Tactic:
rw [destruct_cons]

Result:
case H.cons
α : Type u
s : Seq α
x✝ : α
s✝ : Seq α
⊢ match
    match
      match some (x✝, s✝) with
      | none => none
      | some (a, b) => some (a, nil, b) with
    | none => none
    | some (a, b) =>
      some
        (a,
          corec
            (fun x =>
              match x.fst.destruct with
              | none =>
                match x.snd.destruct with
                | none => none
                | some (a, b) => some (a, nil, b)
              | some (a, s₁') => some (a, s₁', x.snd))
            b),
    some (x✝, s✝) with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match x.fst.destruct with
                | none =>
                  match x.snd.destruct with
                  | none => none
                  | some (a, b) => some (a, nil, b)
                | some (a, s₁') => some (a, s₁', x.snd))
              (nil, s_1) ∧
          s' = s_1
  | x, x_1 => False

Proof state:
case H
α : Type u
s✝ s : Seq α
⊢ match
    (corec
        (fun x =>
          match x.fst.destruct with
          | none =>
            match x.snd.destruct with
            | none => none
            | some (a, b) => some (a, nil, b)
          | some (a, s₁') => some (a, s₁', x.snd))
        (nil, s)).destruct,
    s.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match x.fst.destruct with
                | none =>
                  match x.snd.destruct with
                  | none => none
                  | some (a, b) => some (a, nil, b)
                | some (a, s₁') => some (a, s₁', x.snd))
              (nil, s_1) ∧
          s' = s_1
  | x, x_1 => False

Tactic:
rw [corec_eq]

Result:
case H
α : Type u
s✝ s : Seq α
⊢ match
    omap
      (corec fun x =>
        match x.fst.destruct with
        | none =>
          match x.snd.destruct with
          | none => none
          | some (a, b) => some (a, nil, b)
        | some (a, s₁') => some (a, s₁', x.snd))
      (match (nil, s).fst.destruct with
      | none =>
        match (nil, s).snd.destruct with
        | none => none
        | some (a, b) => some (a, nil, b)
      | some (a, s₁') => some (a, s₁', (nil, s).snd)),
    s.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match x.fst.destruct with
                | none =>
                  match x.snd.destruct with
                  | none => none
                  | some (a, b) => some (a, nil, b)
                | some (a, s₁') => some (a, s₁', x.snd))
              (nil, s_1) ∧
          s' = s_1
  | x, x_1 => False

Proof state:
case H
α : Type u
s : Seq α
⊢ ∀ (s : Seq α), BisimO (fun s1 s2 => ∃ s, s1 = nil.append s ∧ s2 = s) (nil.append s).destruct s.destruct

Tactic:
intro s

Result:
case H
α : Type u
s✝ s : Seq α
⊢ BisimO (fun s1 s2 => ∃ s, s1 = nil.append s ∧ s2 = s) (nil.append s).destruct s.destruct

Proof state:
case H
α : Type u
s✝ s : Seq α
⊢ match
    omap
      (corec fun x =>
        match x.fst.destruct with
        | none =>
          match x.snd.destruct with
          | none => none
          | some (a, b) => some (a, nil, b)
        | some (a, s₁') => some (a, s₁', x.snd))
      (match (nil, s).fst.destruct with
      | none =>
        match (nil, s).snd.destruct with
        | none => none
        | some (a, b) => some (a, nil, b)
      | some (a, s₁') => some (a, s₁', (nil, s).snd)),
    s.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match x.fst.destruct with
                | none =>
                  match x.snd.destruct with
                  | none => none
                  | some (a, b) => some (a, nil, b)
                | some (a, s₁') => some (a, s₁', x.snd))
              (nil, s_1) ∧
          s' = s_1
  | x, x_1 => False

Tactic:
dsimp [append]

Result:
case H
α : Type u
s✝ s : Seq α
⊢ match
    match
      match s.destruct with
      | none => none
      | some (a, b) => some (a, nil, b) with
    | none => none
    | some (a, b) =>
      some
        (a,
          corec
            (fun x =>
              match x.fst.destruct with
              | none =>
                match x.snd.destruct with
                | none => none
                | some (a, b) => some (a, nil, b)
              | some (a, s₁') => some (a, s₁', x.snd))
            b),
    s.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match x.fst.destruct with
                | none =>
                  match x.snd.destruct with
                  | none => none
                  | some (a, b) => some (a, nil, b)
                | some (a, s₁') => some (a, s₁', x.snd))
              (nil, s_1) ∧
          s' = s_1
  | x, x_1 => False