Theorem: LazyList.append_bind
File: Mathlib/Data/LazyList/Basic.lean

tactic: match xs with
| LazyList.nil =>
  simp only [append, Thunk.get, LazyList.bind]
| LazyList.cons x xs =>
  simp only [append, Thunk.get, LazyList.bind]
  have := append_bind xs.get ys f
  simp only [Thunk.get] at this
  rw [this, append_assoc]
state_before: α : Type u_1
β : Type u_2
xs : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
⊢ (xs.append ys).bind f = (xs.bind f).append { fn := fun x => ys.get.bind f }
state_after: no goals

tactic: simp only [append, Thunk.get, LazyList.bind]
state_before: α : Type u_1
β : Type u_2
xs : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
⊢ (nil.append ys).bind f = (nil.bind f).append { fn := fun x => ys.get.bind f }
state_after: no goals

tactic: simp only [append, Thunk.get, LazyList.bind]
state_before: α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
⊢ ((cons x xs).append ys).bind f = ((cons x xs).bind f).append { fn := fun x => ys.get.bind f }
state_after: α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
⊢ (f x).append { fn := fun x => ((xs.fn ()).append ys).bind f } =
    ((f x).append { fn := fun x => (xs.fn ()).bind f }).append { fn := fun x => (ys.fn ()).bind f }

tactic: have := append_bind xs.get ys f
state_before: α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
⊢ (f x).append { fn := fun x => ((xs.fn ()).append ys).bind f } =
    ((f x).append { fn := fun x => (xs.fn ()).bind f }).append { fn := fun x => (ys.fn ()).bind f }
state_after: α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
this : (xs.get.append ys).bind f = (xs.get.bind f).append { fn := fun x => ys.get.bind f }
⊢ (f x).append { fn := fun x => ((xs.fn ()).append ys).bind f } =
    ((f x).append { fn := fun x => (xs.fn ()).bind f }).append { fn := fun x => (ys.fn ()).bind f }

tactic: simp only [Thunk.get] at this
state_before: α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
this : (xs.get.append ys).bind f = (xs.get.bind f).append { fn := fun x => ys.get.bind f }
⊢ (f x).append { fn := fun x => ((xs.fn ()).append ys).bind f } =
    ((f x).append { fn := fun x => (xs.fn ()).bind f }).append { fn := fun x => (ys.fn ()).bind f }
state_after: α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
this : ((xs.fn ()).append ys).bind f = ((xs.fn ()).bind f).append { fn := fun x => (ys.fn ()).bind f }
⊢ (f x).append { fn := fun x => ((xs.fn ()).append ys).bind f } =
    ((f x).append { fn := fun x => (xs.fn ()).bind f }).append { fn := fun x => (ys.fn ()).bind f }

tactic: rw [this, append_assoc]
state_before: α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
this : ((xs.fn ()).append ys).bind f = ((xs.fn ()).bind f).append { fn := fun x => (ys.fn ()).bind f }
⊢ (f x).append { fn := fun x => ((xs.fn ()).append ys).bind f } =
    ((f x).append { fn := fun x => (xs.fn ()).bind f }).append { fn := fun x => (ys.fn ()).bind f }
state_after: no goals