Theorem: Stream'.interleave_eq
File: Mathlib/Data/Stream/Init.lean

tactic: let t := tail s₁ ⋈ tail s₂
state_before: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
⊢ s₁ ⋈ s₂ = s₁.head :: s₂.head :: (s₁.tail ⋈ s₂.tail)
state_after: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ s₁ ⋈ s₂ = s₁.head :: s₂.head :: (s₁.tail ⋈ s₂.tail)

tactic: show s₁ ⋈ s₂ = head s₁::head s₂::t
state_before: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ s₁ ⋈ s₂ = s₁.head :: s₂.head :: (s₁.tail ⋈ s₂.tail)
state_after: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ s₁ ⋈ s₂ = s₁.head :: s₂.head :: t

tactic: unfold interleave
state_before: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ s₁ ⋈ s₂ = s₁.head :: s₂.head :: t
state_after: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ (corecOn (s₁, s₂)
      (fun x =>
        match x with
        | (s₁, snd) => s₁.head)
      fun x =>
      match x with
      | (s₁, s₂) => (s₂, s₁.tail)) =
    s₁.head :: s₂.head :: t

tactic: unfold corecOn
state_before: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ (corecOn (s₁, s₂)
      (fun x =>
        match x with
        | (s₁, snd) => s₁.head)
      fun x =>
      match x with
      | (s₁, s₂) => (s₂, s₁.tail)) =
    s₁.head :: s₂.head :: t
state_after: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ corec
      (fun x =>
        match x with
        | (s₁, snd) => s₁.head)
      (fun x =>
        match x with
        | (s₁, s₂) => (s₂, s₁.tail))
      (s₁, s₂) =
    s₁.head :: s₂.head :: t

tactic: rw [corec_eq]
state_before: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ corec
      (fun x =>
        match x with
        | (s₁, snd) => s₁.head)
      (fun x =>
        match x with
        | (s₁, s₂) => (s₂, s₁.tail))
      (s₁, s₂) =
    s₁.head :: s₂.head :: t
state_after: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ (match (s₁, s₂) with
      | (s₁, snd) => s₁.head) ::
      corec
        (fun x =>
          match x with
          | (s₁, snd) => s₁.head)
        (fun x =>
          match x with
          | (s₁, s₂) => (s₂, s₁.tail))
        (match (s₁, s₂) with
        | (s₁, s₂) => (s₂, s₁.tail)) =
    s₁.head :: s₂.head :: t

tactic: dsimp
state_before: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ (match (s₁, s₂) with
      | (s₁, snd) => s₁.head) ::
      corec
        (fun x =>
          match x with
          | (s₁, snd) => s₁.head)
        (fun x =>
          match x with
          | (s₁, s₂) => (s₂, s₁.tail))
        (match (s₁, s₂) with
        | (s₁, s₂) => (s₂, s₁.tail)) =
    s₁.head :: s₂.head :: t
state_after: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ s₁.head :: corec (fun x => x.1.head) (fun x => (x.2, x.1.tail)) (s₂, s₁.tail) = s₁.head :: s₂.head :: t

tactic: rw [corec_eq]
state_before: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ s₁.head :: corec (fun x => x.1.head) (fun x => (x.2, x.1.tail)) (s₂, s₁.tail) = s₁.head :: s₂.head :: t
state_after: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ s₁.head ::
      (s₂, s₁.tail).1.head ::
        corec (fun x => x.1.head) (fun x => (x.2, x.1.tail)) ((s₂, s₁.tail).2, (s₂, s₁.tail).1.tail) =
    s₁.head :: s₂.head :: t

tactic: rfl
state_before: α : Type u
β : Type v
δ : Type w
s₁ s₂ : Stream' α
t : Stream' α := s₁.tail ⋈ s₂.tail
⊢ s₁.head ::
      (s₂, s₁.tail).1.head ::
        corec (fun x => x.1.head) (fun x => (x.2, x.1.tail)) ((s₂, s₁.tail).2, (s₂, s₁.tail).1.tail) =
    s₁.head :: s₂.head :: t
state_after: no goals