l3lab/ntp-mathlib huggingface dataset:
theorem append_bind {α β} (xs : LazyList α) (ys : Thunk (LazyList α)) (f : α → LazyList β) :
    (xs.append ys).bind f = (xs.bind f).append (ys.get.bind f) := by
  match xs with
  | LazyList.nil => rfl
  | LazyList.cons x xs =>
    simp only [append, Thunk.get, LazyList.bind]
    have := append_bind xs.get ys f
    simp only [Thunk.get] at this
    

Proof state:
α : Type u_1
β : Type u_2
xs✝ : LazyList α
ys : Thunk (LazyList α)
f : α → LazyList β
x : α
xs : Thunk (LazyList α)
this :
  LazyList.bind (append (Thunk.fn xs ()) ys) f =
    append (LazyList.bind (Thunk.fn xs ()) f) { fn := fun x => LazyList.bind (Thunk.fn ys ()) f }
⊢ append (f x) { fn := fun x => LazyList.bind (append (Thunk.fn xs ()) ys) f } =
    append (append (f x) { fn := fun x => LazyList.bind (Thunk.fn xs ()) f })
      { fn := fun x => LazyList.bind (Thunk.fn ys ()) f }

Next tactic:
rw [this, append_assoc]
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; congr
    · congr; funext; apply ih)
  (id_map := by
    

Proof state:
⊢ ∀ {α : Type ?u.101062} (x : LazyList α), id <$> x = x

Next tactic:
intro _ xs
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; congr
    · congr; funext; apply ih)
  (id_map := by
    intro _ xs
    

Proof state:
α✝ : Type ?u.101062
xs : LazyList α✝
⊢ id <$> xs = xs

Next tactic:
induction' xs using LazyList.rec with _ _ _ _ ih
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; congr
    · congr; funext; apply ih)
  (id_map := by
    intro _ xs
    induction' xs using LazyList.rec with _ _ _ _ ih
    · 

Proof state:
case nil
α✝ : Type ?u.101062
⊢ id <$> nil = nil

Next tactic:
rfl
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; congr
    · congr; funext; apply ih)
  (id_map := by
    intro _ xs
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · 

Proof state:
case cons
α✝ : Type ?u.101062
xs : LazyList α✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.101184 tl✝
⊢ id <$> cons hd✝ tl✝ = cons hd✝ tl✝

Next tactic:
simpa only [Functor.map, traverse._eq_2, id_eq, Id.map_eq, Seq.seq, cons.injEq, true_and]
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; congr
    · congr; funext; apply ih)
  (id_map := by
    intro _ xs
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simpa only [Functor.map, traverse._eq_2, id_eq, Id.map_eq, Seq.seq, cons.injEq, true_and]
    · 

Proof state:
case mk
α✝ : Type ?u.101062
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), id <$> fn✝ a = fn✝ a
⊢ Thunk.pure (LazyList.traverse id (Thunk.get { fn := fn✝ })) = { fn := fn✝ }

Next tactic:
ext
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; congr
    · congr; funext; apply ih)
  (id_map := by
    intro _ xs
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simpa only [Functor.map, traverse._eq_2, id_eq, Id.map_eq, Seq.seq, cons.injEq, true_and]
    · ext; 

Proof state:
case mk.eq
α✝ : Type ?u.101062
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), id <$> fn✝ a = fn✝ a
⊢ Thunk.get (Thunk.pure (LazyList.traverse id (Thunk.get { fn := fn✝ }))) = Thunk.get { fn := fn✝ }

Next tactic:
apply ih
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    

Proof state:
⊢ ∀ {α β : Type ?u.101062} (x : α) (f : α → LazyList β), pure x >>= f = f x

Next tactic:
intros
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    

Proof state:
α✝ β✝ : Type ?u.101062
x✝ : α✝
f✝ : α✝ → LazyList β✝
⊢ pure x✝ >>= f✝ = f✝ x✝

Next tactic:
simp only [bind, pure, singleton, LazyList.bind]
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    

Proof state:
α✝ β✝ : Type ?u.101062
x✝ : α✝
f✝ : α✝ → LazyList β✝
⊢ append (f✝ x✝) { fn := fun x => LazyList.bind (Thunk.get (Thunk.pure nil)) f✝ } = f✝ x✝

Next tactic:
apply append_nil
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    

Proof state:
⊢ ∀ {α β γ : Type ?u.101062} (x : LazyList α) (f : α → LazyList β) (g : β → LazyList γ),
    x >>= f >>= g = x >>= fun x => f x >>= g

Next tactic:
intro _ _ _ xs _ _
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    

Proof state:
α✝ β✝ γ✝ : Type ?u.101062
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
⊢ xs >>= f✝ >>= g✝ = xs >>= fun x => f✝ x >>= g✝

Next tactic:
induction' xs using LazyList.rec with _ _ _ _ ih
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · 

Proof state:
case nil
α✝ β✝ γ✝ : Type ?u.101062
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
⊢ nil >>= f✝ >>= g✝ = nil >>= fun x => f✝ x >>= g✝

Next tactic:
rfl
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · 

Proof state:
case cons
α✝ β✝ γ✝ : Type ?u.101062
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.101700 tl✝
⊢ cons hd✝ tl✝ >>= f✝ >>= g✝ = cons hd✝ tl✝ >>= fun x => f✝ x >>= g✝

Next tactic:
simp only [bind, LazyList.bind, append_bind]
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; 

Proof state:
case cons
α✝ β✝ γ✝ : Type ?u.101062
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.101700 tl✝
⊢ append (LazyList.bind (f✝ hd✝) g✝)
      { fn := fun x => LazyList.bind (Thunk.get { fn := fun x => LazyList.bind (Thunk.get tl✝) f✝ }) g✝ } =
    append (LazyList.bind (f✝ hd✝) g✝) { fn := fun x => LazyList.bind (Thunk.get tl✝) fun x => LazyList.bind (f✝ x) g✝ }

Next tactic:
congr
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; congr
    · 

Proof state:
case mk
α✝ β✝ γ✝ : Type ?u.101062
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), fn✝ a >>= f✝ >>= g✝ = fn✝ a >>= fun x => f✝ x >>= g✝
⊢ { fn := fun x => LazyList.bind (Thunk.get { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) f✝ }) g✝ } =
    { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) fun x => LazyList.bind (f✝ x) g✝ }

Next tactic:
congr
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; congr
    · congr; 

Proof state:
case mk.e_fn
α✝ β✝ γ✝ : Type ?u.101062
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), fn✝ a >>= f✝ >>= g✝ = fn✝ a >>= fun x => f✝ x >>= g✝
⊢ (fun x => LazyList.bind (Thunk.get { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) f✝ }) g✝) = fun x =>
    LazyList.bind (Thunk.get { fn := fn✝ }) fun x => LazyList.bind (f✝ x) g✝

Next tactic:
funext
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; apply ih)
  (pure_bind := by
    intros
    simp only [bind, pure, singleton, LazyList.bind]
    apply append_nil)
  (bind_assoc := by
    intro _ _ _ xs _ _
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind, LazyList.bind, append_bind]; congr
    · congr; funext; 

Proof state:
case mk.e_fn.h
α✝ β✝ γ✝ : Type ?u.101062
xs : LazyList α✝
f✝ : α✝ → LazyList β✝
g✝ : β✝ → LazyList γ✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), fn✝ a >>= f✝ >>= g✝ = fn✝ a >>= fun x => f✝ x >>= g✝
x✝ : Unit
⊢ LazyList.bind (Thunk.get { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) f✝ }) g✝ =
    LazyList.bind (Thunk.get { fn := fn✝ }) fun x => LazyList.bind (f✝ x) g✝

Next tactic:
apply ih
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    

Proof state:
⊢ ∀ {α β : Type ?u.101062} (f : α → β) (x : LazyList α),
    (do
        let y ← x
        pure (f y)) =
      f <$> x

Next tactic:
intro _ _ f xs
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    

Proof state:
α✝ β✝ : Type ?u.101062
f : α✝ → β✝
xs : LazyList α✝
⊢ (do
      let y ← xs
      pure (f y)) =
    f <$> xs

Next tactic:
simp only [bind, Functor.map, pure, singleton]
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    

Proof state:
α✝ β✝ : Type ?u.101062
f : α✝ → β✝
xs : LazyList α✝
⊢ (LazyList.bind xs fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f xs

Next tactic:
induction' xs using LazyList.rec with _ _ _ _ ih
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · 

Proof state:
case nil
α✝ β✝ : Type ?u.101062
f : α✝ → β✝
⊢ (LazyList.bind nil fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f nil

Next tactic:
rfl
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · 

Proof state:
case cons
α✝ β✝ : Type ?u.101062
f : α✝ → β✝
xs : LazyList α✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.102462 tl✝
⊢ (LazyList.bind (cons hd✝ tl✝) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (cons hd✝ tl✝)

Next tactic:
simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; 

Proof state:
case cons
α✝ β✝ : Type ?u.101062
f : α✝ → β✝
xs : LazyList α✝
hd✝ : α✝
tl✝ : Thunk (LazyList α✝)
tl_ih✝ : ?m.102462 tl✝
⊢ cons (f hd✝)
      {
        fn := fun x =>
          append (Thunk.get (Thunk.pure nil))
            { fn := fun x => LazyList.bind (Thunk.get tl✝) fun y => cons (f y) (Thunk.pure nil) } } =
    Seq.seq (cons (f hd✝)) fun x => Thunk.pure (LazyList.traverse f (Thunk.get tl✝))

Next tactic:
congr
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · 

Proof state:
case mk
α✝ β✝ : Type ?u.101062
f : α✝ → β✝
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (fn✝ a)
⊢ {
      fn := fun x =>
        append (Thunk.get (Thunk.pure nil))
          { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) fun y => cons (f y) (Thunk.pure nil) } } =
    (fun x => Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ }))) ()

Next tactic:
ext
instance : LawfulMonad LazyList := LawfulMonad.mk'
  (bind_pure_comp := by
    intro _ _ f xs
    simp only [bind, Functor.map, pure, singleton]
    induction' xs using LazyList.rec with _ _ _ _ ih
    · rfl
    · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
    · ext; 

Proof state:
case mk.eq
α✝ β✝ : Type ?u.101062
f : α✝ → β✝
xs : LazyList α✝
fn✝ : Unit → LazyList α✝
ih : ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (fn✝ a)
⊢ Thunk.get
      {
        fn := fun x =>
          append (Thunk.get (Thunk.pure nil))
            { fn := fun x => LazyList.bind (Thunk.get { fn := fn✝ }) fun y => cons (f y) (Thunk.pure nil) } } =
    Thunk.get ((fun x => Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ }))) ())

Next tactic:
apply ih
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
  | LazyList.nil => by
    

Proof state:
α : Type ?u.120251
inst✝ : DecidableEq α
x : α
⊢ Decidable (x ∈ nil)

Next tactic:
apply Decidable.isFalse
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
  | LazyList.nil => by
    apply Decidable.isFalse
    

Proof state:
case h
α : Type ?u.120251
inst✝ : DecidableEq α
x : α
⊢ x ∉ nil

Next tactic:
simp [Membership.mem, LazyList.Mem]
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
  | LazyList.nil => by
    apply Decidable.isFalse
    simp [Membership.mem, LazyList.Mem]
  | LazyList.cons y ys =>
    if h : x = y then by
      

Proof state:
α : Type ?u.120251
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : x = y
⊢ Decidable (x ∈ cons y ys)

Next tactic:
apply Decidable.isTrue
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
  | LazyList.nil => by
    apply Decidable.isFalse
    simp [Membership.mem, LazyList.Mem]
  | LazyList.cons y ys =>
    if h : x = y then by
      apply Decidable.isTrue
      

Proof state:
case h
α : Type ?u.120251
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : x = y
⊢ x ∈ cons y ys

Next tactic:
simp only [Membership.mem, LazyList.Mem]
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
  | LazyList.nil => by
    apply Decidable.isFalse
    simp [Membership.mem, LazyList.Mem]
  | LazyList.cons y ys =>
    if h : x = y then by
      apply Decidable.isTrue
      simp only [Membership.mem, LazyList.Mem]
      

Proof state:
case h
α : Type ?u.120251
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : x = y
⊢ x = y ∨ LazyList.Mem x (Thunk.get ys)

Next tactic:
exact Or.inl h
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
  | LazyList.nil => by
    apply Decidable.isFalse
    simp [Membership.mem, LazyList.Mem]
  | LazyList.cons y ys =>
    if h : x = y then by
      apply Decidable.isTrue
      simp only [Membership.mem, LazyList.Mem]
      exact Or.inl h
    else by
      

Proof state:
α : Type ?u.120251
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : ¬x = y
⊢ Decidable (x ∈ cons y ys)

Next tactic:
have := Mem.decidable x ys.get
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
  | LazyList.nil => by
    apply Decidable.isFalse
    simp [Membership.mem, LazyList.Mem]
  | LazyList.cons y ys =>
    if h : x = y then by
      apply Decidable.isTrue
      simp only [Membership.mem, LazyList.Mem]
      exact Or.inl h
    else by
      have := Mem.decidable x ys.get
      

Proof state:
α : Type ?u.120251
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : ¬x = y
this : Decidable (x ∈ Thunk.get ys)
⊢ Decidable (x ∈ cons y ys)

Next tactic:
have : (x ∈ ys.get) ↔ (x ∈ cons y ys) := by simp [(· ∈ ·), LazyList.Mem, h]
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
  | LazyList.nil => by
    apply Decidable.isFalse
    simp [Membership.mem, LazyList.Mem]
  | LazyList.cons y ys =>
    if h : x = y then by
      apply Decidable.isTrue
      simp only [Membership.mem, LazyList.Mem]
      exact Or.inl h
    else by
      have := Mem.decidable x ys.get
      have : (x ∈ ys.get) ↔ (x ∈ cons y ys) := by 

Proof state:
α : Type ?u.120251
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : ¬x = y
this : Decidable (x ∈ Thunk.get ys)
⊢ x ∈ Thunk.get ys ↔ x ∈ cons y ys

Next tactic:
simp [(· ∈ ·), LazyList.Mem, h]
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
  | LazyList.nil => by
    apply Decidable.isFalse
    simp [Membership.mem, LazyList.Mem]
  | LazyList.cons y ys =>
    if h : x = y then by
      apply Decidable.isTrue
      simp only [Membership.mem, LazyList.Mem]
      exact Or.inl h
    else by
      have := Mem.decidable x ys.get
      have : (x ∈ ys.get) ↔ (x ∈ cons y ys) := by simp [(· ∈ ·), LazyList.Mem, h]
      

Proof state:
α : Type ?u.120251
inst✝ : DecidableEq α
x y : α
ys : Thunk (LazyList α)
h : ¬x = y
this✝ : Decidable (x ∈ Thunk.get ys)
this : x ∈ Thunk.get ys ↔ x ∈ cons y ys
⊢ Decidable (x ∈ cons y ys)

Next tactic:
exact decidable_of_decidable_of_iff this
@[simp]
theorem mem_cons {α} (x y : α) (ys : Thunk (LazyList α)) :
    x ∈ @LazyList.cons α y ys ↔ x = y ∨ x ∈ ys.get := by
  

Proof state:
α : Type u_1
x y : α
ys : Thunk (LazyList α)
⊢ x ∈ cons y ys ↔ x = y ∨ x ∈ Thunk.get ys

Next tactic:
simp [Membership.mem, LazyList.Mem]
theorem forall_mem_cons {α} {p : α → Prop} {a : α} {l : Thunk (LazyList α)} :
    (∀ x ∈ @LazyList.cons _ a l, p x) ↔ p a ∧ ∀ x ∈ l.get, p x := by
  

Proof state:
α : Type u_1
p : α → Prop
a : α
l : Thunk (LazyList α)
⊢ (∀ x ∈ cons a l, p x) ↔ p a ∧ ∀ x ∈ Thunk.get l, p x

Next tactic:
simp only [Membership.mem, LazyList.Mem, or_imp, forall_and, forall_eq]