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

Proof steps:
state_before: α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
⊢ (corec f b).destruct = omap (corec f) (f b)
state_after: α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩)) (corec' (Corec.f f) (some b) 0) =
    match f b with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
tactic: dsimp [corec, destruct, get]
state_before: α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩)) (corec' (Corec.f f) (some b) 0) =
    match f b with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
state_after: α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩)) (corec' (Corec.f f) (some b) 0) =
    match f b with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
tactic: have h : Stream'.corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1 := rfl
state_before: α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩)) (corec' (Corec.f f) (some b) 0) =
    match f b with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
state_after: α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩)) (Corec.f f (some b)).1 =
    match f b with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
tactic: rw [h]
state_before: α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩)) (Corec.f f (some b)).1 =
    match f b with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
state_after: α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩))
      (match f b with
        | none => (none, none)
        | some (a, b') => (some a, some b')).1 =
    match f b with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
tactic: dsimp [Corec.f]
state_before: α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩))
      (match f b with
        | none => (none, none)
        | some (a, b') => (some a, some b')).1 =
    match f b with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
state_after: case none
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
h : f b = none
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩))
      (match none with
        | none => (none, none)
        | some (a, b') => (some a, some b')).1 =
    match none with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)

case some
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
s : α × β
h : f b = some s
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩))
      (match some s with
        | none => (none, none)
        | some (a, b') => (some a, some b')).1 =
    match some s with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
tactic: induction' h : f b with s
state_before: case some
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
s : α × β
h : f b = some s
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩))
      (match some s with
        | none => (none, none)
        | some (a, b') => (some a, some b')).1 =
    match some s with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
state_after: case some.mk
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩))
      (match some (a, b') with
        | none => (none, none)
        | some (a, b') => (some a, some b')).1 =
    match some (a, b') with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
tactic: cases' s with a b'
state_before: case some.mk
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ Option.map (fun a' => (a', tail ⟨corec' (Corec.f f) (some b), ⋯⟩))
      (match some (a, b') with
        | none => (none, none)
        | some (a, b') => (some a, some b')).1 =
    match some (a, b') with
    | none => none
    | some (a, b) => some (a, ⟨corec' (Corec.f f) (some b), ⋯⟩)
state_after: case some.mk
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ some (a, tail ⟨corec' (Corec.f f) (some b), ⋯⟩) = some (a, ⟨corec' (Corec.f f) (some b'), ⋯⟩)
tactic: dsimp [Corec.f]
state_before: case some.mk
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ some (a, tail ⟨corec' (Corec.f f) (some b), ⋯⟩) = some (a, ⟨corec' (Corec.f f) (some b'), ⋯⟩)
state_after: case some.mk
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ tail ⟨corec' (Corec.f f) (some b), ⋯⟩ = ⟨corec' (Corec.f f) (some b'), ⋯⟩
tactic: apply congr_arg fun b' => some (a, b')
state_before: case some.mk
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ tail ⟨corec' (Corec.f f) (some b), ⋯⟩ = ⟨corec' (Corec.f f) (some b'), ⋯⟩
state_after: case some.mk.a
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ ↑(tail ⟨corec' (Corec.f f) (some b), ⋯⟩) = ↑⟨corec' (Corec.f f) (some b'), ⋯⟩
tactic: apply Subtype.eq
state_before: case some.mk.a
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ ↑(tail ⟨corec' (Corec.f f) (some b), ⋯⟩) = ↑⟨corec' (Corec.f f) (some b'), ⋯⟩
state_after: case some.mk.a
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ (corec' (Corec.f f) (some b)).tail = corec' (Corec.f f) (some b')
tactic: dsimp [corec, tail]
state_before: case some.mk.a
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ (corec' (Corec.f f) (some b)).tail = corec' (Corec.f f) (some b')
state_after: case some.mk.a
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ corec' (Corec.f f) (Corec.f f (some b)).2 = corec' (Corec.f f) (some b')
tactic: rw [Stream'.corec'_eq, Stream'.tail_cons]
state_before: case some.mk.a
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ corec' (Corec.f f) (Corec.f f (some b)).2 = corec' (Corec.f f) (some b')
state_after: case some.mk.a
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ corec' (Corec.f f)
      (match f b with
        | none => (none, none)
        | some (a, b') => (some a, some b')).2 =
    corec' (Corec.f f) (some b')
tactic: dsimp [Corec.f]
state_before: case some.mk.a
α : Type u
β : Type v
γ : Type w
f : β → Option (α × β)
b : β
h✝ : corec' (Corec.f f) (some b) 0 = (Corec.f f (some b)).1
a : α
b' : β
h : f b = some (a, b')
⊢ corec' (Corec.f f)
      (match f b with
        | none => (none, none)
        | some (a, b') => (some a, some b')).2 =
    corec' (Corec.f f) (some b')
state_after: no goals
tactic: rw [h]