Theorem: Stream'.Seq.nil_append
File: Mathlib/Data/Seq/Seq.lean

tactic: apply coinduction2
state_before: α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ append nil s = s

tactic: intro s
state_before: case H
α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ ∀ (s : Seq α), BisimO (fun s1 s2 => ∃ s, s1 = append nil s ∧ s2 = s) (destruct (append nil s)) (destruct s)

tactic: dsimp [append]
state_before: case H
α : Type u
β : Type v
γ : Type w
s✝ s : Seq α
⊢ BisimO (fun s1 s2 => ∃ s, s1 = append nil s ∧ s2 = s) (destruct (append nil s)) (destruct s)

tactic: rw [corec_eq]
state_before: case H
α : Type u
β : Type v
γ : Type w
s✝ s : Seq α
⊢ match
    destruct
      (corec
        (fun x =>
          match destruct x.fst with
          | none =>
            match destruct x.snd with
            | none => none
            | some (a, b) => some (a, nil, b)
          | some (a, s₁') => some (a, s₁', x.snd))
        (nil, s)),
    destruct s with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match destruct x.fst with
                | none =>
                  match destruct x.snd 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]
state_before: case H
α : Type u
β : Type v
γ : Type w
s✝ s : Seq α
⊢ match
    omap
      (corec fun x =>
        match destruct x.fst with
        | none =>
          match destruct x.snd with
          | none => none
          | some (a, b) => some (a, nil, b)
        | some (a, s₁') => some (a, s₁', x.snd))
      (match destruct (nil, s).fst with
      | none =>
        match destruct (nil, s).snd with
        | none => none
        | some (a, b) => some (a, nil, b)
      | some (a, s₁') => some (a, s₁', (nil, s).snd)),
    destruct s with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match destruct x.fst with
                | none =>
                  match destruct x.snd 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: apply recOn s _ _
state_before: case H
α : Type u
β : Type v
γ : Type w
s✝ s : Seq α
⊢ match
    match
      match destruct s with
      | none => none
      | some (a, b) => some (a, nil, b) with
    | none => none
    | some (a, b) =>
      some
        (a,
          corec
            (fun x =>
              match destruct x.fst with
              | none =>
                match destruct x.snd with
                | none => none
                | some (a, b) => some (a, nil, b)
              | some (a, s₁') => some (a, s₁', x.snd))
            b),
    destruct s with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match destruct x.fst with
                | none =>
                  match destruct x.snd 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: trivial
state_before: α : Type u
β : Type v
γ : Type w
s✝ s : Seq α
⊢ match
    match
      match destruct nil with
      | none => none
      | some (a, b) => some (a, nil, b) with
    | none => none
    | some (a, b) =>
      some
        (a,
          corec
            (fun x =>
              match destruct x.fst with
              | none =>
                match destruct x.snd with
                | none => none
                | some (a, b) => some (a, nil, b)
              | some (a, s₁') => some (a, s₁', x.snd))
            b),
    destruct nil with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match destruct x.fst with
                | none =>
                  match destruct x.snd 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: intro x s
state_before: α : Type u
β : Type v
γ : Type w
s✝ s : Seq α
⊢ ∀ (x : α) (s : Seq α),
    match
      match
        match destruct (cons x s) with
        | none => none
        | some (a, b) => some (a, nil, b) with
      | none => none
      | some (a, b) =>
        some
          (a,
            corec
              (fun x =>
                match destruct x.fst with
                | none =>
                  match destruct x.snd with
                  | none => none
                  | some (a, b) => some (a, nil, b)
                | some (a, s₁') => some (a, s₁', x.snd))
              b),
      destruct (cons x s) with
    | none, none => True
    | some (a, s), some (a', s') =>
      a = a' ∧
        ∃ s_1,
          s =
              corec
                (fun x =>
                  match destruct x.fst with
                  | none =>
                    match destruct x.snd 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]
state_before: α : Type u
β : Type v
γ : Type w
s✝¹ s✝ : Seq α
x : α
s : Seq α
⊢ match
    match
      match destruct (cons x s) with
      | none => none
      | some (a, b) => some (a, nil, b) with
    | none => none
    | some (a, b) =>
      some
        (a,
          corec
            (fun x =>
              match destruct x.fst with
              | none =>
                match destruct x.snd with
                | none => none
                | some (a, b) => some (a, nil, b)
              | some (a, s₁') => some (a, s₁', x.snd))
            b),
    destruct (cons x s) with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧
      ∃ s_1,
        s =
            corec
              (fun x =>
                match destruct x.fst with
                | none =>
                  match destruct x.snd 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
state_before: α : Type u
β : Type v
γ : Type w
s✝¹ 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 destruct x.fst with
              | none =>
                match destruct x.snd 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 destruct x.fst with
                | none =>
                  match destruct x.snd 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: exact ⟨rfl, s, rfl, rfl⟩
state_before: α : Type u
β : Type v
γ : Type w
s✝¹ s✝ : Seq α
x : α
s : Seq α
⊢ x = x ∧
    ∃ s_1,
      corec
            (fun x =>
              match destruct x.fst with
              | none =>
                match destruct x.snd with
                | none => none
                | some (a, b) => some (a, nil, b)
              | some (a, s₁') => some (a, s₁', x.snd))
            (nil, s) =
          corec
            (fun x =>
              match destruct x.fst with
              | none =>
                match destruct x.snd with
                | none => none
                | some (a, b) => some (a, nil, b)
              | some (a, s₁') => some (a, s₁', x.snd))
            (nil, s_1) ∧
        s = s_1