Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓to navigate, Ctrl+🖱️to focus. On Mac, use Cmdinstead of Ctrl.
/-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon

! This file was ported from Lean 3 source module data.lazy_list.basic
! leanprover-community/mathlib commit 1f0096e6caa61e9c849ec2adbd227e960e9dff58
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Control.Traversable.Equiv
import Mathlib.Control.Traversable.Instances
import Mathlib.Data.LazyList

/-!
## Definitions on lazy lists

This file contains various definitions and proofs on lazy lists.

TODO: move the `LazyList.lean` file from core to mathlib.
-/


universe u

namespace Thunk

-- Porting note: `Thunk.pure` appears to do the same thing.
#align thunk.mk 
Thunk.pure: {α : Type u_1} → αThunk α
Thunk.pure
-- Porting note: Added `Thunk.ext` to get `ext` tactic to work. @[ext] theorem
ext: ∀ {α : Type u} {a b : Thunk α}, Thunk.get a = Thunk.get ba = b
ext
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} {
a: Thunk α
a
b: Thunk α
b
:
Thunk: Type ?u.7 → Type ?u.7
Thunk
α: Type u
α
} (eq :
a: Thunk α
a
.
get: {α : Type ?u.11} → Thunk αα
get
=
b: Thunk α
b
.
get: {α : Type ?u.16} → Thunk αα
get
) :
a: Thunk α
a
=
b: Thunk α
b
:=

Goals accomplished! 🐙
α: Type u

a, b: Thunk α

eq: Thunk.get a = Thunk.get b


a = b
α: Type u

a, b: Thunk α

fn✝: Unitα

eq: Thunk.get { fn := fn✝ } = Thunk.get b


{ fn := fn✝ } = b
α: Type u

a, b: Thunk α

eq: Thunk.get a = Thunk.get b


a = b
α: Type u

a, b: Thunk α

fn✝¹, fn✝: Unitα

eq: Thunk.get { fn := fn✝¹ } = Thunk.get { fn := fn✝ }


{ fn := fn✝¹ } = { fn := fn✝ }
α: Type u

a, b: Thunk α

eq: Thunk.get a = Thunk.get b


a = b
α: Type u

a, b: Thunk α

fn✝¹, fn✝: Unitα

eq: Thunk.get { fn := fn✝¹ } = Thunk.get { fn := fn✝ }


e_fn
fn✝¹ = fn✝
α: Type u

a, b: Thunk α

eq: Thunk.get a = Thunk.get b


a = b

Goals accomplished! 🐙
instance: {α : Type u} → [inst : DecidableEq α] → DecidableEq (Thunk α)
instance
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} [
DecidableEq: Sort ?u.432 → Sort (max1?u.432)
DecidableEq
α: Type u
α
] :
DecidableEq: Sort ?u.441 → Sort (max1?u.441)
DecidableEq
(
Thunk: Type ?u.442 → Type ?u.442
Thunk
α: Type u
α
) :=

Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α


α: Type u

inst✝: DecidableEq α

a, b: Thunk α


Decidable (a = b)
α: Type u

inst✝: DecidableEq α


α: Type u

inst✝: DecidableEq α

a, b: Thunk α


Decidable (a = b)

Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α

a, b: Thunk α


a = bThunk.get a = Thunk.get b
α: Type u

inst✝: DecidableEq α

a, b: Thunk α

x: a = b


α: Type u

inst✝: DecidableEq α

a, b: Thunk α

x: a = b


α: Type u

inst✝: DecidableEq α

a, b: Thunk α


a = bThunk.get a = Thunk.get b
α: Type u

inst✝: DecidableEq α

a, b: Thunk α

x: a = b


α: Type u

inst✝: DecidableEq α

a, b: Thunk α

x: a = b



Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α

a, b: Thunk α


Decidable (a = b)

Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α

a, b: Thunk α


Thunk.get a = Thunk.get ba = b
α: Type u

inst✝: DecidableEq α

a, b: Thunk α

a✝: Thunk.get a = Thunk.get b


a = b
α: Type u

inst✝: DecidableEq α

a, b: Thunk α

a✝: Thunk.get a = Thunk.get b


a = b
α: Type u

inst✝: DecidableEq α

a, b: Thunk α


Thunk.get a = Thunk.get ba = b
α: Type u

inst✝: DecidableEq α

a, b: Thunk α

a✝: Thunk.get a = Thunk.get b


eq
α: Type u

inst✝: DecidableEq α

a, b: Thunk α

a✝: Thunk.get a = Thunk.get b


eq
α: Type u

inst✝: DecidableEq α

a, b: Thunk α


Thunk.get a = Thunk.get ba = b

Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α

a, b: Thunk α

this: a = b Thunk.get a = Thunk.get b


Decidable (a = b)
α: Type u

inst✝: DecidableEq α


α: Type u

inst✝: DecidableEq α

a, b: Thunk α

this: a = b Thunk.get a = Thunk.get b


Decidable (a = b)
α: Type u

inst✝: DecidableEq α

a, b: Thunk α

this: a = b Thunk.get a = Thunk.get b


α: Type u

inst✝: DecidableEq α

a, b: Thunk α

this: a = b Thunk.get a = Thunk.get b


α: Type u

inst✝: DecidableEq α



Goals accomplished! 🐙
end Thunk namespace LazyList open Function /-- Isomorphism between strict and lazy lists. -/ def
listEquivLazyList: (α : Type u_1) → List α LazyList α
listEquivLazyList
(
α: Type ?u.652
α
:
Type _: Type (?u.652+1)
Type _
) :
List: Type ?u.657 → Type ?u.657
List
α: Type ?u.652
α
LazyList: Type ?u.658 → Type ?u.658
LazyList
α: Type ?u.652
α
where toFun :=
LazyList.ofList: {α : Type ?u.667} → List αLazyList α
LazyList.ofList
invFun :=
LazyList.toList: {α : Type ?u.674} → LazyList αList α
LazyList.toList
right_inv :=

Goals accomplished! 🐙
α: Type ?u.652


Function.RightInverse toList ofList
α: Type ?u.652

xs: LazyList α


ofList (toList xs) = xs
α: Type ?u.652


Function.RightInverse toList ofList
α: Type ?u.652


nil
ofList (toList nil) = nil
α: Type ?u.652

xs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.1678 tl✝


cons
ofList (toList (cons hd✝ tl✝)) = cons hd✝ tl✝
α: Type ?u.652

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a


mk
?m.1678 { fn := fn✝ }
α: Type ?u.652


Function.RightInverse toList ofList
α: Type ?u.652


nil
ofList (toList nil) = nil
α: Type ?u.652


nil
ofList (toList nil) = nil
α: Type ?u.652

xs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.1678 tl✝


cons
ofList (toList (cons hd✝ tl✝)) = cons hd✝ tl✝
α: Type ?u.652

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a


mk
?m.1678 { fn := fn✝ }

Goals accomplished! 🐙
α: Type ?u.652


Function.RightInverse toList ofList
α: Type ?u.652

xs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.1678 tl✝


cons
ofList (toList (cons hd✝ tl✝)) = cons hd✝ tl✝
α: Type ?u.652

xs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.1678 tl✝


cons
ofList (toList (cons hd✝ tl✝)) = cons hd✝ tl✝
α: Type ?u.652

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a


mk
?m.1678 { fn := fn✝ }

Goals accomplished! 🐙
α: Type ?u.652


Function.RightInverse toList ofList
α: Type ?u.652

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a


mk
{ fn := fun x => ofList (toList (Thunk.get { fn := fn✝ })) } = { fn := fn✝ }
α: Type ?u.652

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a


mk
{ fn := fun x => ofList (toList (Thunk.get { fn := fn✝ })) } = { fn := fn✝ }
α: Type ?u.652

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a


mk
{ fn := fun x => ofList (toList (Thunk.get { fn := fn✝ })) } = { fn := fn✝ }
α: Type ?u.652

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a


mk
{ fn := fun x => ofList (toList (Thunk.fn { fn := fn✝ } ())) } = { fn := fn✝ }
α: Type ?u.652

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a


mk
{ fn := fun x => ofList (toList (Thunk.get { fn := fn✝ })) } = { fn := fn✝ }
α: Type ?u.652

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), ofList (toList (fn✝ a)) = fn✝ a


mk
{ fn := fun x => fn✝ () } = { fn := fn✝ }

Goals accomplished! 🐙
left_inv :=

Goals accomplished! 🐙
α: Type ?u.652


LeftInverse toList ofList
α: Type ?u.652

xs: List α


toList (ofList xs) = xs
α: Type ?u.652


LeftInverse toList ofList
α: Type ?u.652


nil
toList (ofList []) = []
α: Type ?u.652

head✝: α

tail✝: List α

tail_ih✝: toList (ofList tail✝) = tail✝


cons
toList (ofList (head✝ :: tail✝)) = head✝ :: tail✝
α: Type ?u.652


LeftInverse toList ofList
α: Type ?u.652


nil
toList (ofList []) = []
α: Type ?u.652


nil
toList (ofList []) = []
α: Type ?u.652

head✝: α

tail✝: List α

tail_ih✝: toList (ofList tail✝) = tail✝


cons
toList (ofList (head✝ :: tail✝)) = head✝ :: tail✝

Goals accomplished! 🐙
α: Type ?u.652


LeftInverse toList ofList
α: Type ?u.652

head✝: α

tail✝: List α

tail_ih✝: toList (ofList tail✝) = tail✝


cons
toList (ofList (head✝ :: tail✝)) = head✝ :: tail✝
α: Type ?u.652

head✝: α

tail✝: List α

tail_ih✝: toList (ofList tail✝) = tail✝


cons
toList (ofList (head✝ :: tail✝)) = head✝ :: tail✝

Goals accomplished! 🐙
#align lazy_list.list_equiv_lazy_list
LazyList.listEquivLazyList: (α : Type u_1) → List α LazyList α
LazyList.listEquivLazyList
-- Porting note: Added a name to make the recursion work. instance
decidableEq: {α : Type u} → [inst : DecidableEq α] → DecidableEq (LazyList α)
decidableEq
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} [
DecidableEq: Sort ?u.2006 → Sort (max1?u.2006)
DecidableEq
α: Type u
α
] :
DecidableEq: Sort ?u.2015 → Sort (max1?u.2015)
DecidableEq
(
LazyList: Type ?u.2016 → Type ?u.2016
LazyList
α: Type u
α
) |
nil: {α : Type ?u.2035} → LazyList α
nil
,
nil: {α : Type ?u.2038} → LazyList α
nil
=>
isTrue: {p : Prop} → pDecidable p
isTrue
rfl: ∀ {α : Sort ?u.2056} {a : α}, a = a
rfl
|
cons: {α : Type ?u.2062} → αThunk (LazyList α)LazyList α
cons
x: α
x
xs: Thunk (LazyList α)
xs
,
cons: {α : Type ?u.2066} → αThunk (LazyList α)LazyList α
cons
y: α
y
ys: Thunk (LazyList α)
ys
=> if
h: ?m.2121
h
:
x: α
x
=
y: α
y
then match
decidableEq: {α : Type u} → [inst : DecidableEq α] → DecidableEq (LazyList α)
decidableEq
xs: Thunk (LazyList α)
xs
.
get: {α : Type ?u.2125} → Thunk αα
get
ys: Thunk (LazyList α)
ys
.
get: {α : Type ?u.2129} → Thunk αα
get
with |
isFalse: {p : Prop} → ¬pDecidable p
isFalse
h2 =>

Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys


h
¬cons x xs = cons y ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys


h
¬cons x xs = cons y ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys


h
x = y¬xs = ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys


h
x = y¬xs = ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys

a✝: x = y

xs_ys: xs = ys


h
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys

a✝: x = y

xs_ys: xs = ys


h
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys

a✝: x = y

xs_ys: xs = ys


h
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys

a✝: x = y

xs_ys: xs = ys


h
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys

a✝: x = y

xs_ys: xs = ys


h
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: ¬Thunk.get xs = Thunk.get ys

a✝: x = y

xs_ys: xs = ys


h

Goals accomplished! 🐙
|
isTrue: {p : Prop} → pDecidable p
isTrue
h2 =>

Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


h
cons x xs = cons y ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


h
cons x xs = cons y ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


h.e_tl
xs = ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


h.e_tl
xs = ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


h.e_tl.eq
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


h.e_tl.eq
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: x = y

h2: Thunk.get xs = Thunk.get ys


Decidable (cons x xs = cons y ys)

Goals accomplished! 🐙
else

Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y


h
¬cons x xs = cons y ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y


h
¬cons x xs = cons y ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y


h
x = y¬xs = ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y


h
x = y¬xs = ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y


Decidable (cons x xs = cons y ys)
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y

a✝: x = y


h
¬xs = ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y

a✝: x = y


h
¬xs = ys
α: Type u

inst✝: DecidableEq α

x: α

xs: Thunk (LazyList α)

y: α

ys: Thunk (LazyList α)

h: ¬x = y


Decidable (cons x xs = cons y ys)

Goals accomplished! 🐙
|
nil: {α : Type ?u.2278} → LazyList α
nil
,
cons: {α : Type ?u.2280} → αThunk (LazyList α)LazyList α
cons
_ _ =>

Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α

hd✝: α

tl✝: Thunk (LazyList α)


Decidable (nil = cons hd✝ tl✝)
α: Type u

inst✝: DecidableEq α

hd✝: α

tl✝: Thunk (LazyList α)


h
¬nil = cons hd✝ tl✝
α: Type u

inst✝: DecidableEq α

hd✝: α

tl✝: Thunk (LazyList α)


h
¬nil = cons hd✝ tl✝
α: Type u

inst✝: DecidableEq α

hd✝: α

tl✝: Thunk (LazyList α)


Decidable (nil = cons hd✝ tl✝)

Goals accomplished! 🐙
|
cons: {α : Type ?u.2312} → αThunk (LazyList α)LazyList α
cons
_ _,
nil: {α : Type ?u.2317} → LazyList α
nil
=>

Goals accomplished! 🐙
α: Type u

inst✝: DecidableEq α

hd✝: α

tl✝: Thunk (LazyList α)


Decidable (cons hd✝ tl✝ = nil)
α: Type u

inst✝: DecidableEq α

hd✝: α

tl✝: Thunk (LazyList α)


h
¬cons hd✝ tl✝ = nil
α: Type u

inst✝: DecidableEq α

hd✝: α

tl✝: Thunk (LazyList α)


h
¬cons hd✝ tl✝ = nil
α: Type u

inst✝: DecidableEq α

hd✝: α

tl✝: Thunk (LazyList α)


Decidable (cons hd✝ tl✝ = nil)

Goals accomplished! 🐙
/-- Traversal of lazy lists using an applicative effect. -/ protected def
traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → LazyList αm (LazyList β)
traverse
{
m: Type u → Type u
m
:
Type u: Type (u+1)
Type u
Type u: Type (u+1)
Type u
} [
Applicative: (Type ?u.11375 → Type ?u.11374) → Type (max(?u.11375+1)?u.11374)
Applicative
m: Type u → Type u
m
] {
α: Type u
α
β: Type u
β
:
Type u: Type (u+1)
Type u
} (
f: αm β
f
:
α: Type u
α
m: Type u → Type u
m
β: Type u
β
) :
LazyList: Type ?u.11390 → Type ?u.11390
LazyList
α: Type u
α
m: Type u → Type u
m
(
LazyList: Type ?u.11392 → Type ?u.11392
LazyList
β: Type u
β
) |
LazyList.nil: {α : Type ?u.11403} → LazyList α
LazyList.nil
=>
pure: {f : Type ?u.11413 → Type ?u.11412} → [self : Pure f] → {α : Type ?u.11413} → αf α
pure
LazyList.nil: {α : Type ?u.11430} → LazyList α
LazyList.nil
|
LazyList.cons: {α : Type ?u.11450} → αThunk (LazyList α)LazyList α
LazyList.cons
x: α
x
xs: Thunk (LazyList α)
xs
=>
LazyList.cons: {α : Type ?u.11516} → αThunk (LazyList α)LazyList α
LazyList.cons
<$>
f: αm β
f
x: α
x
<*>
Thunk.pure: {α : Type ?u.11569} → αThunk α
Thunk.pure
<$>
xs: Thunk (LazyList α)
xs
.
get: {α : Type ?u.11574} → Thunk αα
get
.
traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → LazyList αm (LazyList β)
traverse
f: αm β
f
#align lazy_list.traverse
LazyList.traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → LazyList αm (LazyList β)
LazyList.traverse
instance :
Traversable: (Type ?u.19645 → Type ?u.19645) → Type (?u.19645+1)
Traversable
LazyList: Type ?u.19646 → Type ?u.19646
LazyList
where map := @
LazyList.traverse: {m : Type ?u.19662 → Type ?u.19662} → [inst : Applicative m] → {α β : Type ?u.19662} → (αm β) → LazyList αm (LazyList β)
LazyList.traverse
Id: Type ?u.19663 → Type ?u.19663
Id
_ traverse := @
LazyList.traverse: {m : Type ?u.19703 → Type ?u.19703} → [inst : Applicative m] → {α β : Type ?u.19703} → (αm β) → LazyList αm (LazyList β)
LazyList.traverse
instance :
IsLawfulTraversable: (t : Type ?u.20080 → Type ?u.20080) → [inst : Traversable t] → Type (?u.20080+1)
IsLawfulTraversable
LazyList: Type ?u.20081 → Type ?u.20081
LazyList
:=

Goals accomplished! 🐙

h₀
∀ {α β : Type ?u.20081} (f : αβ), Functor.map f = Equiv.map listEquivLazyList f

h₁
∀ {α β : Type ?u.20081} (f : β), Functor.mapConst f = (Equiv.map listEquivLazyList const α) f

h₂
∀ {F : Type ?u.20081 → Type ?u.20081} [inst : Applicative F] [inst_1 : LawfulApplicative F] {α β : Type ?u.20081} (f : αF β), traverse f = Equiv.traverse listEquivLazyList f

h₀
∀ {α β : Type ?u.20081} (f : αβ), Functor.map f = Equiv.map listEquivLazyList f

h₁
∀ {α β : Type ?u.20081} (f : β), Functor.mapConst f = (Equiv.map listEquivLazyList const α) f

h₂
∀ {F : Type ?u.20081 → Type ?u.20081} [inst : Applicative F] [inst_1 : LawfulApplicative F] {α β : Type ?u.20081} (f : αF β), traverse f = Equiv.traverse listEquivLazyList f
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f✝: α✝F✝ β✝


h₂
α✝, β✝: Type ?u.20081

f✝: α✝β✝


h₀
α✝, β✝: Type ?u.20081

f✝: β✝


h₁
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f✝: α✝F✝ β✝


h₂
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f✝: α✝F✝ β✝

x✝: LazyList α✝


h₂.h
α✝, β✝: Type ?u.20081

f✝: α✝β✝

x✝: LazyList α✝


h₀.h
f✝ <$> x✝ = Equiv.map listEquivLazyList f✝ x✝
α✝, β✝: Type ?u.20081

f✝: β✝

x✝: LazyList α✝


h₁.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f✝: α✝F✝ β✝

x✝: LazyList α✝


h₂.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝


h₀.h
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝


h₀.h
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝


h₁.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
α✝, β✝: Type ?u.20081

f: α✝β✝


h₀.h.nil
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.20297 tl✝


h₀.h.cons
f <$> cons hd✝ tl✝ = Equiv.map listEquivLazyList f (cons hd✝ tl✝)
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)


h₀.h.mk
?m.20297 { fn := fn✝ }
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝


h₀.h
α✝, β✝: Type ?u.20081

f: α✝β✝


h₀.h.nil
α✝, β✝: Type ?u.20081

f: α✝β✝


h₀.h.nil
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.20297 tl✝


h₀.h.cons
f <$> cons hd✝ tl✝ = Equiv.map listEquivLazyList f (cons hd✝ tl✝)
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)


h₀.h.mk
?m.20297 { fn := fn✝ }

Goals accomplished! 🐙
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝


h₀.h
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.20297 tl✝


h₀.h.cons
f <$> cons hd✝ tl✝ = Equiv.map listEquivLazyList f (cons hd✝ tl✝)
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.20297 tl✝


h₀.h.cons
f <$> cons hd✝ tl✝ = Equiv.map listEquivLazyList f (cons hd✝ tl✝)
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)


h₀.h.mk
?m.20297 { fn := fn✝ }

Goals accomplished! 🐙
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝


h₀.h
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)


h₀.h.mk
Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ })) = { fn := fun x => ofList (List.map f (toList (Thunk.get { fn := fn✝ }))) }
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)


h₀.h.mk
Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ })) = { fn := fun x => ofList (List.map f (toList (Thunk.get { fn := fn✝ }))) }
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)


h₀.h.mk.eq
Thunk.get (Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ }))) = Thunk.get { fn := fun x => ofList (List.map f (toList (Thunk.get { fn := fn✝ }))) }
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)


h₀.h.mk.eq
Thunk.get (Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ }))) = Thunk.get { fn := fun x => ofList (List.map f (toList (Thunk.get { fn := fn✝ }))) }
α✝, β✝: Type ?u.20081

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), f <$> fn✝ a = Equiv.map listEquivLazyList f (fn✝ a)


h₀.h.mk
Thunk.pure (LazyList.traverse f (Thunk.get { fn := fn✝ })) = { fn := fun x => ofList (List.map f (toList (Thunk.get { fn := fn✝ }))) }

Goals accomplished! 🐙
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝


h₁.h
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝


h₁.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝


h₁.h
LazyList.traverse (const α✝ f) xs = ofList (const α✝ f <$> toList xs)
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝


h₁.h
α✝, β✝: Type ?u.20081

f: β✝


h₁.h.nil
LazyList.traverse (const α✝ f) nil = ofList (const α✝ f <$> toList nil)
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.21860 tl✝


h₁.h.cons
LazyList.traverse (const α✝ f) (cons hd✝ tl✝) = ofList (const α✝ f <$> toList (cons hd✝ tl✝))
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))


h₁.h.mk
?m.21860 { fn := fn✝ }
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝


h₁.h
α✝, β✝: Type ?u.20081

f: β✝


h₁.h.nil
LazyList.traverse (const α✝ f) nil = ofList (const α✝ f <$> toList nil)
α✝, β✝: Type ?u.20081

f: β✝


h₁.h.nil
LazyList.traverse (const α✝ f) nil = ofList (const α✝ f <$> toList nil)
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.21860 tl✝


h₁.h.cons
LazyList.traverse (const α✝ f) (cons hd✝ tl✝) = ofList (const α✝ f <$> toList (cons hd✝ tl✝))
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))


h₁.h.mk
?m.21860 { fn := fn✝ }

Goals accomplished! 🐙
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝


h₁.h
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.21860 tl✝


h₁.h.cons
LazyList.traverse (const α✝ f) (cons hd✝ tl✝) = ofList (const α✝ f <$> toList (cons hd✝ tl✝))
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.21860 tl✝


h₁.h.cons
LazyList.traverse (const α✝ f) (cons hd✝ tl✝) = ofList (const α✝ f <$> toList (cons hd✝ tl✝))
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))


h₁.h.mk
?m.21860 { fn := fn✝ }

Goals accomplished! 🐙
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝


h₁.h
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))


h₁.h.mk
Thunk.pure (LazyList.traverse (const α✝ f) (Thunk.get { fn := fn✝ })) = { fn := fun x => ofList (List.map (const α✝ f) (toList (Thunk.get { fn := fn✝ }))) }
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))


h₁.h.mk
Thunk.pure (LazyList.traverse (const α✝ f) (Thunk.get { fn := fn✝ })) = { fn := fun x => ofList (List.map (const α✝ f) (toList (Thunk.get { fn := fn✝ }))) }
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))


h₁.h.mk.e_a
LazyList.traverse (const α✝ f) (Thunk.get { fn := fn✝ }) = ofList (List.map (const α✝ f) (toList (Thunk.get { fn := fn✝ })))
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))


h₁.h.mk.e_a
LazyList.traverse (const α✝ f) (Thunk.get { fn := fn✝ }) = ofList (List.map (const α✝ f) (toList (Thunk.get { fn := fn✝ })))
α✝, β✝: Type ?u.20081

f: β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse (const α✝ f) (fn✝ a) = ofList (const α✝ f <$> toList (fn✝ a))


h₁.h.mk
Thunk.pure (LazyList.traverse (const α✝ f) (Thunk.get { fn := fn✝ })) = { fn := fun x => ofList (List.map (const α✝ f) (toList (Thunk.get { fn := fn✝ }))) }

Goals accomplished! 🐙
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝


h₂.h.nil
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih: ?m.23299 tl


h₂.h.cons
LazyList.traverse f (cons hd✝ tl) = ofList <$> List.traverse f (toList (cons hd✝ tl))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse f (fn✝ a) = ofList <$> List.traverse f (toList (fn✝ a))


h₂.h.mk
?m.23299 { fn := fn✝ }
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝


h₂.h.nil
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝


h₂.h.nil
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih: ?m.23299 tl


h₂.h.cons
LazyList.traverse f (cons hd✝ tl) = ofList <$> List.traverse f (toList (cons hd✝ tl))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse f (fn✝ a) = ofList <$> List.traverse f (toList (fn✝ a))


h₂.h.mk
?m.23299 { fn := fn✝ }
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝


h₂.h.nil
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝


h₂.h.nil
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝


h₂.h.nil

Goals accomplished! 🐙
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih: ?m.23299 tl


h₂.h.cons
LazyList.traverse f (cons hd✝ tl) = ofList <$> List.traverse f (toList (cons hd✝ tl))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih: ?m.23299 tl


h₂.h.cons
LazyList.traverse f (cons hd✝ tl) = ofList <$> List.traverse f (toList (cons hd✝ tl))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse f (fn✝ a) = ofList <$> List.traverse f (toList (fn✝ a))


h₂.h.mk
?m.23299 { fn := fn✝ }
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih, this: LazyList.traverse f (Thunk.get tl) = ofList <$> List.traverse f (toList (Thunk.get tl))


h₂.h.cons
LazyList.traverse f (cons hd✝ tl) = ofList <$> List.traverse f (toList (cons hd✝ tl))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih: ?m.23299 tl


h₂.h.cons
LazyList.traverse f (cons hd✝ tl) = ofList <$> List.traverse f (toList (cons hd✝ tl))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih, this: LazyList.traverse f (Thunk.get tl) = ofList <$> List.traverse f (toList (Thunk.get tl))


h₂.h.cons
(Seq.seq (((fun x => x Thunk.pure ofList) cons) <$> f hd✝) fun x => List.traverse f (toList (Thunk.get tl))) = Seq.seq (((fun x => ofList x) List.cons) <$> f hd✝) fun x => List.traverse f (toList (Thunk.get tl))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih: ?m.23299 tl


h₂.h.cons
LazyList.traverse f (cons hd✝ tl) = ofList <$> List.traverse f (toList (cons hd✝ tl))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih, this: LazyList.traverse f (Thunk.get tl) = ofList <$> List.traverse f (toList (Thunk.get tl))


h₂.h.cons
(Seq.seq (((fun x => x Thunk.pure ofList) cons) <$> f hd✝) fun x => List.traverse f (toList (Thunk.get tl))) = Seq.seq (((fun x => ofList x) List.cons) <$> f hd✝) fun x => List.traverse f (toList (Thunk.get tl))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

hd✝: α✝

tl: Thunk (LazyList α✝)

ih, this: LazyList.traverse f (Thunk.get tl) = ofList <$> List.traverse f (toList (Thunk.get tl))


h₂.h.cons
(Seq.seq (((fun x => x Thunk.pure ofList) cons) <$> f hd✝) fun x => List.traverse f (toList (Thunk.get tl))) = Seq.seq (((fun x => ofList x) List.cons) <$> f hd✝) fun x => List.traverse f (toList (Thunk.get tl))

Goals accomplished! 🐙
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝


h₂.h
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse f (fn✝ a) = ofList <$> List.traverse f (toList (fn✝ a))


h₂.h.mk
LazyList.traverse f (Thunk.get { fn := fn✝ }) = ofList <$> List.traverse f (toList (Thunk.get { fn := fn✝ }))
F✝: Type ?u.20081 → Type ?u.20081

inst✝¹: Applicative F✝

inst✝: LawfulApplicative F✝

α✝, β✝: Type ?u.20081

f: α✝F✝ β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), LazyList.traverse f (fn✝ a) = ofList <$> List.traverse f (toList (fn✝ a))


h₂.h.mk
LazyList.traverse f (Thunk.get { fn := fn✝ }) = ofList <$> List.traverse f (toList (Thunk.get { fn := fn✝ }))

Goals accomplished! 🐙
/-- `init xs`, if `xs` non-empty, drops the last element of the list. Otherwise, return the empty list. -/ def
init: {α : Type u_1} → LazyList αLazyList α
init
{
α: Type ?u.25676
α
} :
LazyList: Type ?u.25676 → Type ?u.25676
LazyList
α: ?m.25672
α
LazyList: Type ?u.25678 → Type ?u.25678
LazyList
α: ?m.25672
α
|
LazyList.nil: {α : Type ?u.25685} → LazyList α
LazyList.nil
=>
LazyList.nil: {α : Type ?u.25694} → LazyList α
LazyList.nil
|
LazyList.cons: {α : Type ?u.25696} → αThunk (LazyList α)LazyList α
LazyList.cons
x: α
x
xs: Thunk (LazyList α)
xs
=> let
xs': ?m.25718
xs'
:=
xs: Thunk (LazyList α)
xs
.
get: {α : Type ?u.25719} → Thunk αα
get
match
xs': ?m.25718
xs'
with |
LazyList.nil: {α : Type ?u.25725} → LazyList α
LazyList.nil
=>
LazyList.nil: {α : Type ?u.25733} → LazyList α
LazyList.nil
|
LazyList.cons: {α : Type ?u.25735} → αThunk (LazyList α)LazyList α
LazyList.cons
_ _ =>
LazyList.cons: {α : Type ?u.25757} → αThunk (LazyList α)LazyList α
LazyList.cons
x: α
x
(
init: {α : Type ?u.25676} → LazyList αLazyList α
init
xs': ?m.25718
xs'
) #align lazy_list.init
LazyList.init: {α : Type u_1} → LazyList αLazyList α
LazyList.init
/-- Return the first object contained in the list that satisfies predicate `p` -/ def
find: {α : Type ?u.34584} → (p : αProp) → [inst : DecidablePred p] → LazyList αOption α
find
{
α: ?m.34566
α
} (
p: αProp
p
:
α: ?m.34566
α
Prop: Type
Prop
) [
DecidablePred: {α : Sort ?u.34573} → (αProp) → Sort (max1?u.34573)
DecidablePred
p: αProp
p
] :
LazyList: Type ?u.34584 → Type ?u.34584
LazyList
α: ?m.34566
α
Option: Type ?u.34586 → Type ?u.34586
Option
α: ?m.34566
α
|
nil: {α : Type ?u.34596} → LazyList α
nil
=>
none: {α : Type ?u.34605} → Option α
none
|
cons: {α : Type ?u.34608} → αThunk (LazyList α)LazyList α
cons
h: α
h
t: Thunk (LazyList α)
t
=> if
p: αProp
p
h: α
h
then
some: {α : Type ?u.34639} → αOption α
some
h: α
h
else
t: Thunk (LazyList α)
t
.
get: {α : Type ?u.34641} → Thunk αα
get
.
find: {α : Type ?u.34584} → (p : αProp) → [inst : DecidablePred p] → LazyList αOption α
find
p: αProp
p
#align lazy_list.find
LazyList.find: {α : Type u_1} → (p : αProp) → [inst : DecidablePred p] → LazyList αOption α
LazyList.find
/-- `interleave xs ys` creates a list where elements of `xs` and `ys` alternate. -/ def
interleave: {α : Type u_1} → LazyList αLazyList αLazyList α
interleave
{
α: ?m.42506
α
} :
LazyList: Type ?u.42510 → Type ?u.42510
LazyList
α: ?m.42506
α
LazyList: Type ?u.42513 → Type ?u.42513
LazyList
α: ?m.42506
α
LazyList: Type ?u.42515 → Type ?u.42515
LazyList
α: ?m.42506
α
|
LazyList.nil: {α : Type ?u.42525} → LazyList α
LazyList.nil
,
xs: LazyList α
xs
=>
xs: LazyList α
xs
|
a: LazyList α
a
@(
LazyList.cons: {α : Type ?u.42543} → αThunk (LazyList α)LazyList α
LazyList.cons
_ _),
LazyList.nil: {α : Type ?u.42548} → LazyList α
LazyList.nil
=>
a: LazyList α
a
|
LazyList.cons: {α : Type ?u.42598} → αThunk (LazyList α)LazyList α
LazyList.cons
x: α
x
xs: Thunk (LazyList α)
xs
,
LazyList.cons: {α : Type ?u.42602} → αThunk (LazyList α)LazyList α
LazyList.cons
y: α
y
ys: Thunk (LazyList α)
ys
=>
LazyList.cons: {α : Type ?u.42639} → αThunk (LazyList α)LazyList α
LazyList.cons
x: α
x
(
LazyList.cons: {α : Type ?u.42641} → αThunk (LazyList α)LazyList α
LazyList.cons
y: α
y
(
interleave: {α : Type ?u.42510} → LazyList αLazyList αLazyList α
interleave
xs: Thunk (LazyList α)
xs
.
get: {α : Type ?u.42644} → Thunk αα
get
ys: Thunk (LazyList α)
ys
.
get: {α : Type ?u.42648} → Thunk αα
get
)) #align lazy_list.interleave
LazyList.interleave: {α : Type u_1} → LazyList αLazyList αLazyList α
LazyList.interleave
/-- `interleaveAll (xs::ys::zs::xss)` creates a list where elements of `xs`, `ys` and `zs` and the rest alternate. Every other element of the resulting list is taken from `xs`, every fourth is taken from `ys`, every eighth is taken from `zs` and so on. -/ def
interleaveAll: {α : Type ?u.52567} → List (LazyList α)LazyList α
interleaveAll
{
α: ?m.52562
α
} :
List: Type ?u.52566 → Type ?u.52566
List
(
LazyList: Type ?u.52567 → Type ?u.52567
LazyList
α: ?m.52562
α
) →
LazyList: Type ?u.52569 → Type ?u.52569
LazyList
α: ?m.52562
α
| [] =>
LazyList.nil: {α : Type ?u.52585} → LazyList α
LazyList.nil
|
x: LazyList α
x
::
xs: List (LazyList α)
xs
=>
interleave: {α : Type ?u.52608} → LazyList αLazyList αLazyList α
interleave
x: LazyList α
x
(
interleaveAll: {α : Type ?u.52567} → List (LazyList α)LazyList α
interleaveAll
xs: List (LazyList α)
xs
) #align lazy_list.interleave_all
LazyList.interleaveAll: {α : Type u_1} → List (LazyList α)LazyList α
LazyList.interleaveAll
/-- Monadic bind operation for `LazyList`. -/ protected def
bind: {α : Type u_1} → {β : Type u_2} → LazyList α(αLazyList β) → LazyList β
bind
{
α: Type ?u.52848
α
β: ?m.52844
β
} :
LazyList: Type ?u.52848 → Type ?u.52848
LazyList
α: ?m.52841
α
→ (
α: ?m.52841
α
LazyList: Type ?u.52853 → Type ?u.52853
LazyList
β: ?m.52844
β
) →
LazyList: Type ?u.52855 → Type ?u.52855
LazyList
β: ?m.52844
β
|
LazyList.nil: {α : Type ?u.52868} → LazyList α
LazyList.nil
, _ =>
LazyList.nil: {α : Type ?u.52888} → LazyList α
LazyList.nil
|
LazyList.cons: {α : Type ?u.52891} → αThunk (LazyList α)LazyList α
LazyList.cons
x: α
x
xs: Thunk (LazyList α)
xs
,
f: αLazyList β
f
=> (
f: αLazyList β
f
x: α
x
).
append: {α : Type ?u.52926} → LazyList αThunk (LazyList α)LazyList α
append
(
xs: Thunk (LazyList α)
xs
.
get: {α : Type ?u.52931} → Thunk αα
get
.
bind: {α : Type ?u.52848} → {β : Type ?u.52853} → LazyList α(αLazyList β) → LazyList β
bind
f: αLazyList β
f
) #align lazy_list.bind
LazyList.bind: {α : Type u_1} → {β : Type u_2} → LazyList α(αLazyList β) → LazyList β
LazyList.bind
/-- Reverse the order of a `LazyList`. It is done by converting to a `List` first because reversal involves evaluating all the list and if the list is all evaluated, `List` is a better representation for it than a series of thunks. -/ def
reverse: {α : Type ?u.61945} → LazyList αLazyList α
reverse
{
α: ?m.61942
α
} (
xs: LazyList α
xs
:
LazyList: Type ?u.61945 → Type ?u.61945
LazyList
α: ?m.61942
α
) :
LazyList: Type ?u.61948 → Type ?u.61948
LazyList
α: ?m.61942
α
:=
ofList: {α : Type ?u.61952} → List αLazyList α
ofList
xs: LazyList α
xs
.
toList: {α : Type ?u.61955} → LazyList αList α
toList
.
reverse: {α : Type ?u.61957} → List αList α
reverse
#align lazy_list.reverse
LazyList.reverse: {α : Type u_1} → LazyList αLazyList α
LazyList.reverse
instance: Monad LazyList
instance
:
Monad: (Type ?u.61990 → Type ?u.61989) → Type (max(?u.61990+1)?u.61989)
Monad
LazyList: Type ?u.61991 → Type ?u.61991
LazyList
where pure := @
LazyList.singleton: {α : Type ?u.62028} → αLazyList α
LazyList.singleton
bind := @
LazyList.bind: {α : Type ?u.62121} → {β : Type ?u.62120} → LazyList α(αLazyList β) → LazyList β
LazyList.bind
-- Porting note: Added `Thunk.pure` to definition. theorem
append_nil: ∀ {α : Type u_1} (xs : LazyList α), append xs (Thunk.pure nil) = xs
append_nil
{
α: Type u_1
α
} (
xs: LazyList α
xs
:
LazyList: Type ?u.62778 → Type ?u.62778
LazyList
α: ?m.62775
α
) :
xs: LazyList α
xs
.
append: {α : Type ?u.62782} → LazyList αThunk (LazyList α)LazyList α
append
(
Thunk.pure: {α : Type ?u.62788} → αThunk α
Thunk.pure
LazyList.nil: {α : Type ?u.62791} → LazyList α
LazyList.nil
) =
xs: LazyList α
xs
:=

Goals accomplished! 🐙
α: Type u_1

xs: LazyList α


append xs (Thunk.pure nil) = xs
α: Type u_1


nil
append nil (Thunk.pure nil) = nil
α: Type u_1

xs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.62825 tl✝


cons
append (cons hd✝ tl✝) (Thunk.pure nil) = cons hd✝ tl✝
α: Type u_1

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a


mk
?m.62825 { fn := fn✝ }
α: Type u_1

xs: LazyList α


append xs (Thunk.pure nil) = xs
α: Type u_1


nil
append nil (Thunk.pure nil) = nil
α: Type u_1


nil
append nil (Thunk.pure nil) = nil
α: Type u_1

xs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.62825 tl✝


cons
append (cons hd✝ tl✝) (Thunk.pure nil) = cons hd✝ tl✝
α: Type u_1

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a


mk
?m.62825 { fn := fn✝ }

Goals accomplished! 🐙
α: Type u_1

xs: LazyList α


append xs (Thunk.pure nil) = xs
α: Type u_1

xs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.62825 tl✝


cons
append (cons hd✝ tl✝) (Thunk.pure nil) = cons hd✝ tl✝
α: Type u_1

xs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.62825 tl✝


cons
append (cons hd✝ tl✝) (Thunk.pure nil) = cons hd✝ tl✝
α: Type u_1

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a


mk
?m.62825 { fn := fn✝ }

Goals accomplished! 🐙
α: Type u_1

xs: LazyList α


append xs (Thunk.pure nil) = xs
α: Type u_1

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a


mk
{ fn := fun x => append (Thunk.get { fn := fn✝ }) (Thunk.pure nil) } = { fn := fn✝ }
α: Type u_1

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a


mk
{ fn := fun x => append (Thunk.get { fn := fn✝ }) (Thunk.pure nil) } = { fn := fn✝ }
α: Type u_1

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a


mk.eq
Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) (Thunk.pure nil) } = Thunk.get { fn := fn✝ }
α: Type u_1

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a


mk.eq
Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) (Thunk.pure nil) } = Thunk.get { fn := fn✝ }
α: Type u_1

xs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (fn✝ a) (Thunk.pure nil) = fn✝ a


mk
{ fn := fun x => append (Thunk.get { fn := fn✝ }) (Thunk.pure nil) } = { fn := fn✝ }

Goals accomplished! 🐙
#align lazy_list.append_nil
LazyList.append_nil: ∀ {α : Type u_1} (xs : LazyList α), append xs (Thunk.pure nil) = xs
LazyList.append_nil
theorem
append_assoc: ∀ {α : Type u_1} (xs ys zs : LazyList α), append (append xs { fn := fun x => ys }) { fn := fun x => zs } = append xs { fn := fun x => append ys { fn := fun x => zs } }
append_assoc
{
α: Type u_1
α
} (
xs: LazyList α
xs
ys: LazyList α
ys
zs: LazyList α
zs
:
LazyList: Type ?u.63490 → Type ?u.63490
LazyList
α: ?m.63484
α
) : (
xs: LazyList α
xs
.
append: {α : Type ?u.63497} → LazyList αThunk (LazyList α)LazyList α
append
ys: LazyList α
ys
).
append: {α : Type ?u.64408} → LazyList αThunk (LazyList α)LazyList α
append
zs: LazyList α
zs
=
xs: LazyList α
xs
.
append: {α : Type ?u.65226} → LazyList αThunk (LazyList α)LazyList α
append
(
ys: LazyList α
ys
.
append: {α : Type ?u.65231} → LazyList αThunk (LazyList α)LazyList α
append
zs: LazyList α
zs
) :=

Goals accomplished! 🐙
α: Type u_1

xs, ys, zs: LazyList α


append (append xs { fn := fun x => ys }) { fn := fun x => zs } = append xs { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

ys, zs: LazyList α


nil
append (append nil { fn := fun x => ys }) { fn := fun x => zs } = append nil { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

xs, ys, zs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.66088 tl✝


cons
append (append (cons hd✝ tl✝) { fn := fun x => ys }) { fn := fun x => zs } = append (cons hd✝ tl✝) { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

xs, ys, zs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } = append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }


mk
?m.66088 { fn := fn✝ }
α: Type u_1

xs, ys, zs: LazyList α


append (append xs { fn := fun x => ys }) { fn := fun x => zs } = append xs { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

ys, zs: LazyList α


nil
append (append nil { fn := fun x => ys }) { fn := fun x => zs } = append nil { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

ys, zs: LazyList α


nil
append (append nil { fn := fun x => ys }) { fn := fun x => zs } = append nil { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

xs, ys, zs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.66088 tl✝


cons
append (append (cons hd✝ tl✝) { fn := fun x => ys }) { fn := fun x => zs } = append (cons hd✝ tl✝) { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

xs, ys, zs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } = append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }


mk
?m.66088 { fn := fn✝ }

Goals accomplished! 🐙
α: Type u_1

xs, ys, zs: LazyList α


append (append xs { fn := fun x => ys }) { fn := fun x => zs } = append xs { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

xs, ys, zs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.66088 tl✝


cons
append (append (cons hd✝ tl✝) { fn := fun x => ys }) { fn := fun x => zs } = append (cons hd✝ tl✝) { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

xs, ys, zs: LazyList α

hd✝: α

tl✝: Thunk (LazyList α)

tl_ih✝: ?m.66088 tl✝


cons
append (append (cons hd✝ tl✝) { fn := fun x => ys }) { fn := fun x => zs } = append (cons hd✝ tl✝) { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

xs, ys, zs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } = append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }


mk
?m.66088 { fn := fn✝ }

Goals accomplished! 🐙
α: Type u_1

xs, ys, zs: LazyList α


append (append xs { fn := fun x => ys }) { fn := fun x => zs } = append xs { fn := fun x => append ys { fn := fun x => zs } }
α: Type u_1

xs, ys, zs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } = append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }


mk
{ fn := fun x => append (Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => ys } }) { fn := fun x => zs } } = { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => append ys { fn := fun x => zs } } }
α: Type u_1

xs, ys, zs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } = append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }


mk
{ fn := fun x => append (Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => ys } }) { fn := fun x => zs } } = { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => append ys { fn := fun x => zs } } }
α: Type u_1

xs, ys, zs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } = append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }


mk.eq
Thunk.get { fn := fun x => append (Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => ys } }) { fn := fun x => zs } } = Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => append ys { fn := fun x => zs } } }
α: Type u_1

xs, ys, zs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } = append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }


mk.eq
Thunk.get { fn := fun x => append (Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => ys } }) { fn := fun x => zs } } = Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => append ys { fn := fun x => zs } } }
α: Type u_1

xs, ys, zs: LazyList α

fn✝: UnitLazyList α

ih: ∀ (a : Unit), append (append (fn✝ a) { fn := fun x => ys }) { fn := fun x => zs } = append (fn✝ a) { fn := fun x => append ys { fn := fun x => zs } }


mk
{ fn := fun x => append (Thunk.get { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => ys } }) { fn := fun x => zs } } = { fn := fun x => append (Thunk.get { fn := fn✝ }) { fn := fun x => append ys { fn := fun x => zs } } }

Goals accomplished! 🐙
#align lazy_list.append_assoc
LazyList.append_assoc: ∀ {α : Type u_1} (xs ys zs : LazyList α), append (append xs { fn := fun x => ys }) { fn := fun x => zs } = append xs { fn := fun x => append ys { fn := fun x => zs } }
LazyList.append_assoc
-- Porting note: Rewrote proof of `append_bind`. theorem
append_bind: ∀ {α : Type u_1} {β : Type u_2} (xs : LazyList α) (ys : Thunk (LazyList α)) (f : αLazyList β), LazyList.bind (append xs ys) f = append (LazyList.bind xs f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
append_bind
{
α: Type u_1
α
β: Type u_2
β
} (
xs: LazyList α
xs
:
LazyList: Type ?u.66434 → Type ?u.66434
LazyList
α: ?m.66428
α
) (
ys: Thunk (LazyList α)
ys
:
Thunk: Type ?u.66437 → Type ?u.66437
Thunk
(
LazyList: Type ?u.66438 → Type ?u.66438
LazyList
α: ?m.66428
α
)) (
f: αLazyList β
f
:
α: ?m.66428
α
LazyList: Type ?u.66443 → Type ?u.66443
LazyList
β: ?m.66431
β
) : (
xs: LazyList α
xs
.
append: {α : Type ?u.66447} → LazyList αThunk (LazyList α)LazyList α
append
ys: Thunk (LazyList α)
ys
).
bind: {α : Type ?u.66455} → {β : Type ?u.66454} → LazyList α(αLazyList β) → LazyList β
bind
f: αLazyList β
f
= (
xs: LazyList α
xs
.
bind: {α : Type ?u.66468} → {β : Type ?u.66467} → LazyList α(αLazyList β) → LazyList β
bind
f: αLazyList β
f
).
append: {α : Type ?u.66479} → LazyList αThunk (LazyList α)LazyList α
append
(
ys: Thunk (LazyList α)
ys
.
get: {α : Type ?u.66484} → Thunk αα
get
.
bind: {α : Type ?u.66487} → {β : Type ?u.66486} → LazyList α(αLazyList β) → LazyList β
bind
f: αLazyList β
f
) :=

Goals accomplished! 🐙
α: Type u_1

β: Type u_2

xs: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β


LazyList.bind (append xs ys) f = append (LazyList.bind xs f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
α: Type u_1

β: Type u_2

xs: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β


LazyList.bind (append xs ys) f = append (LazyList.bind xs f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
α: Type u_1

β: Type u_2

xs: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β


LazyList.bind (append nil ys) f = append (LazyList.bind nil f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
α: Type u_1

β: Type u_2

xs: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β


LazyList.bind (append xs ys) f = append (LazyList.bind xs f) { fn := fun x => LazyList.bind (Thunk.get ys) f }

Goals accomplished! 🐙
α: Type u_1

β: Type u_2

xs: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β


LazyList.bind (append xs ys) f = append (LazyList.bind xs f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
α: Type u_1

β: Type u_2

xs✝: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β

x: α

xs: Thunk (LazyList α)


LazyList.bind (append (cons x xs) ys) f = append (LazyList.bind (cons x xs) f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
α: Type u_1

β: Type u_2

xs: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β


LazyList.bind (append xs ys) f = append (LazyList.bind xs f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
α: Type u_1

β: Type u_2

xs✝: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β

x: α

xs: Thunk (LazyList α)


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 }
α: Type u_1

β: Type u_2

xs✝: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β

x: α

xs: Thunk (LazyList α)


LazyList.bind (append (cons x xs) ys) f = append (LazyList.bind (cons x xs) f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
α: Type u_1

β: Type u_2

xs✝: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β

x: α

xs: Thunk (LazyList α)

this: LazyList.bind (append (Thunk.get xs) ys) f = append (LazyList.bind (Thunk.get xs) f) { fn := fun x => LazyList.bind (Thunk.get 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 }
α: Type u_1

β: Type u_2

xs✝: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β

x: α

xs: Thunk (LazyList α)


LazyList.bind (append (cons x xs) ys) f = append (LazyList.bind (cons x xs) f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
α: 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 }
α: Type u_1

β: Type u_2

xs✝: LazyList α

ys: Thunk (LazyList α)

f: αLazyList β

x: α

xs: Thunk (LazyList α)


LazyList.bind (append (cons x xs) ys) f = append (LazyList.bind (cons x xs) f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
α: 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 }
α: 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 => append (LazyList.bind (Thunk.fn xs ()) f) { fn := fun x => LazyList.bind (Thunk.fn ys ()) f } } = append (append (f x) { fn := fun x => LazyList.bind (Thunk.fn xs ()) f }) { fn := fun x => LazyList.bind (Thunk.fn ys ()) f }
α: 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 }
α: 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 => append (LazyList.bind (Thunk.fn xs ()) f) { fn := fun x => LazyList.bind (Thunk.fn ys ()) f } } = append (f x) { fn := fun x => append (LazyList.bind (Thunk.fn xs ()) f) { fn := fun x => LazyList.bind (Thunk.fn ys ()) f } }

Goals accomplished! 🐙
#align lazy_list.append_bind
LazyList.append_bind: ∀ {α : Type u_1} {β : Type u_2} (xs : LazyList α) (ys : Thunk (LazyList α)) (f : αLazyList β), LazyList.bind (append xs ys) f = append (LazyList.bind xs f) { fn := fun x => LazyList.bind (Thunk.get ys) f }
LazyList.append_bind
instance :
LawfulMonad: (m : Type ?u.76376 → Type ?u.76375) → [inst : Monad m] → Prop
LawfulMonad
LazyList: Type ?u.76377 → Type ?u.76377
LazyList
:=
LawfulMonad.mk': ∀ (m : Type ?u.76390 → Type ?u.76389) [inst : Monad m], (∀ {α : Type ?u.76390} (x : m α), id <$> x = x) → (∀ {α β : Type ?u.76390} (x : α) (f : αm β), pure x >>= f = f x) → (∀ {α β γ : Type ?u.76390} (x : m α) (f : αm β) (g : βm γ), x >>= f >>= g = x >>= fun x => f x >>= g) → autoParam (∀ {α β : Type ?u.76390} (x : α) (y : m β), Functor.mapConst x y = const β x <$> y) _auto✝autoParam (∀ {α β : Type ?u.76390} (x : m α) (y : m β), (SeqLeft.seqLeft x fun x => y) = do let a ← x let _ ← y pure a) _auto✝¹autoParam (∀ {α β : Type ?u.76390} (x : m α) (y : m β), (SeqRight.seqRight x fun x => y) = do let _ ← x y) _auto✝²autoParam (∀ {α β : Type ?u.76390} (f : αβ) (x : m α), (do let y ← x pure (f y)) = f <$> x) _auto✝³autoParam (∀ {α β : Type ?u.76390} (f : m (αβ)) (x : m α), (do let x_1 ← f x_1 <$> x) = Seq.seq f fun x_1 => x) _auto✝⁴LawfulMonad m
LawfulMonad.mk'
(bind_pure_comp :=

Goals accomplished! 🐙

∀ {α β : Type ?u.76377} (f : αβ) (x : LazyList α), (do let y ← x pure (f y)) = f <$> x
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝


(do let y ← xs pure (f y)) = f <$> xs

∀ {α β : Type ?u.76377} (f : αβ) (x : LazyList α), (do let y ← x pure (f y)) = f <$> x
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝


(LazyList.bind xs fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f xs

∀ {α β : Type ?u.76377} (f : αβ) (x : LazyList α), (do let y ← x pure (f y)) = f <$> x
α✝, β✝: Type ?u.76377

f: α✝β✝


nil
(LazyList.bind nil fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f nil
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.77774 tl✝


cons
(LazyList.bind (cons hd✝ tl✝) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (cons hd✝ tl✝)
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (fn✝ a)


mk
?m.77774 { fn := fn✝ }

∀ {α β : Type ?u.76377} (f : αβ) (x : LazyList α), (do let y ← x pure (f y)) = f <$> x
α✝, β✝: Type ?u.76377

f: α✝β✝


nil
(LazyList.bind nil fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f nil
α✝, β✝: Type ?u.76377

f: α✝β✝


nil
(LazyList.bind nil fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f nil
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.77774 tl✝


cons
(LazyList.bind (cons hd✝ tl✝) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (cons hd✝ tl✝)
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (fn✝ a)


mk
?m.77774 { fn := fn✝ }

Goals accomplished! 🐙

∀ {α β : Type ?u.76377} (f : αβ) (x : LazyList α), (do let y ← x pure (f y)) = f <$> x
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.77774 tl✝


cons
(LazyList.bind (cons hd✝ tl✝) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (cons hd✝ tl✝)
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.77774 tl✝


cons
(LazyList.bind (cons hd✝ tl✝) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (cons hd✝ tl✝)
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (fn✝ a)


mk
?m.77774 { fn := fn✝ }
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.77774 tl✝


cons
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✝))
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.77774 tl✝


cons
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✝))
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

hd✝: α✝

tl✝: Thunk (LazyList α✝)

tl_ih✝: ?m.77774 tl✝


cons
(LazyList.bind (cons hd✝ tl✝) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (cons hd✝ tl✝)

Goals accomplished! 🐙

∀ {α β : Type ?u.76377} (f : αβ) (x : LazyList α), (do let y ← x pure (f y)) = f <$> x
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (fn✝ a)


mk
{ 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✝ }))) ()
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)) = LazyList.traverse f (fn✝ a)


mk
{ 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✝ }))) ()
α✝, β✝: Type ?u.76377

f: α✝β✝

xs: LazyList α✝

fn✝: UnitLazyList α✝

ih: ∀ (a : Unit), (LazyList.bind (fn✝ a) fun y => cons (f y) (Thunk.pure nil)<