theorem
functor.map_map
{α β γ : Type u}
{f : Type u → Type v}
[functor f]
[is_lawful_functor f]
(m : α → β)
(g : β → γ)
(x : f α) :
Equations
- mzip_with' f (x :: xs) (y :: ys) = f x y *> mzip_with' f xs ys
- mzip_with' f (hd :: tl) list.nil = has_pure.pure punit.star
- mzip_with' f list.nil (hd :: tl) = has_pure.pure punit.star
- mzip_with' f list.nil list.nil = has_pure.pure punit.star
@[simp]
theorem
pure_id'_seq
{α : Type u}
{F : Type u → Type v}
[applicative F]
[is_lawful_applicative F]
(x : F α) :
has_pure.pure (λ (x : α), x) <*> x = x
theorem
seq_map_assoc
{α β γ : Type u}
{F : Type u → Type v}
[applicative F]
[is_lawful_applicative F]
(x : F (α → β))
(f : γ → α)
(y : F γ) :
theorem
map_seq
{α β γ : Type u}
{F : Type u → Type v}
[applicative F]
[is_lawful_applicative F]
(f : β → γ)
(x : F (α → β))
(y : F α) :
Equations
- list.mpartition p (x :: xs) = mcond (p x) (prod.map (list.cons x) id <$> list.mpartition p xs) (prod.map id (list.cons x) <$> list.mpartition p xs)
- list.mpartition p list.nil = has_pure.pure (list.nil α, list.nil α)
theorem
seq_bind_eq
{α β γ : Type u}
{m : Type u → Type v}
[monad m]
[is_lawful_monad m]
(x : m α)
{g : β → m γ}
{f : α → β} :
theorem
seq_eq_bind_map
{α β : Type u}
{m : Type u → Type v}
[monad m]
[is_lawful_monad m]
{x : m α}
{f : m (α → β)} :
theorem
fish_pure
{m : Type u → Type v}
[monad m]
[is_lawful_monad m]
{α : Sort u_1}
{β : Type u}
(f : α → m β) :
f >=> has_pure.pure = f
theorem
fish_pipe
{m : Type u → Type v}
[monad m]
[is_lawful_monad m]
{α β : Type u}
(f : α → m β) :
has_pure.pure >=> f = f
theorem
fish_assoc
{m : Type u → Type v}
[monad m]
[is_lawful_monad m]
{α : Sort u_1}
{β γ φ : Type u}
(f : α → m β)
(g : β → m γ)
(h : γ → m φ) :
Equations
- list.mmap_accumr f a (x :: xs) = list.mmap_accumr f a xs >>= λ (_p : β' × list γ'), list.mmap_accumr._match_2 f x _p
- list.mmap_accumr f a list.nil = has_pure.pure (a, list.nil γ')
- list.mmap_accumr._match_2 f x (a', ys) = f x a' >>= λ (_p : β' × γ'), list.mmap_accumr._match_1 ys _p
- list.mmap_accumr._match_1 ys (a'', y) = has_pure.pure (a'', y :: ys)
Equations
- list.mmap_accuml f a (x :: xs) = f a x >>= λ (_p : β' × γ'), list.mmap_accuml._match_2 (λ (a' : β'), list.mmap_accuml f a' xs) _p
- list.mmap_accuml f a list.nil = has_pure.pure (a, list.nil γ')
- list.mmap_accuml._match_2 _f_1 (a', y) = _f_1 a' >>= λ (_p : β' × list γ'), list.mmap_accuml._match_1 y _p
- list.mmap_accuml._match_1 y (a'', ys) = has_pure.pure (a'', y :: ys)
theorem
mjoin_map_map
{m : Type u → Type u}
[monad m]
[is_lawful_monad m]
{α β : Type u}
(f : α → β)
(a : m (m α)) :
theorem
mjoin_map_mjoin
{m : Type u → Type u}
[monad m]
[is_lawful_monad m]
{α : Type u}
(a : m (m (m α))) :
@[simp]
theorem
mjoin_map_pure
{m : Type u → Type u}
[monad m]
[is_lawful_monad m]
{α : Type u}
(a : m α) :
mjoin (has_pure.pure <$> a) = a
@[simp]
theorem
mjoin_pure
{m : Type u → Type u}
[monad m]
[is_lawful_monad m]
{α : Type u}
(a : m α) :
mjoin (has_pure.pure a) = a
@[simp]
@[simp]
@[instance]
Equations
@[instance]
Equations
@[class]
theorem
is_comm_applicative.commutative_map
{m : Type u_1 → Type u_2}
[applicative m]
[is_comm_applicative m]
{α β γ : Type u_1}
(a : m α)
(b : m β)
{f : α → β → γ} :