theorem
functor.map_map
{α β γ : Type u}
{f : Type u → Type v}
[functor f]
[is_lawful_functor f]
(m : α → β)
(g : β → γ)
(x : f α) :
def
mzip_with
{F : Type u → Type v}
[applicative F]
{α₁ α₂ φ : Type u}
(f : α₁ → α₂ → F φ)
(ma₁ : list α₁)
(ma₂ : list α₂) :
F (list φ)
Equations
- mzip_with' f (x :: xs) (y :: ys) = f x y *> mzip_with' f xs ys
- mzip_with' f (hd :: tl) list.nil = pure punit.star
- mzip_with' f list.nil (hd :: tl) = pure punit.star
- mzip_with' f list.nil list.nil = pure punit.star
@[simp]
theorem
pure_id'_seq
{α : Type u}
{F : Type u → Type v}
[applicative F]
[is_lawful_applicative F]
(x : F α) :
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 = 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_assoc
{m : Type u → Type v}
[monad m]
[is_lawful_monad m]
{α : Sort u_1}
{β γ φ : Type u}
(f : α → m β)
(g : β → m γ)
(h : γ → m φ) :
def
list.mmap_accumr
{α : Type u}
{β' γ' : Type v}
{m' : Type v → Type w}
[monad m']
(f : α → β' → 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 = 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) = pure (a'', y :: ys)
def
list.mmap_accuml
{α : Type u}
{β' γ' : Type v}
{m' : Type v → Type w}
[monad m']
(f : β' → α → m' (β' × γ')) :
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 = 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) = 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]
@[simp]
@[simp]
@[simp]
@[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 : α → β → γ} :