theorem
option.comp_traverse
{F G : Type u → Type u}
[applicative F]
[applicative G]
[is_lawful_applicative F]
[is_lawful_applicative G]
{α : Type u_1}
{β γ : Type u}
(f : β → F γ)
(g : α → G β)
(x : option α) :
option.traverse (functor.comp.mk ∘ functor.map f ∘ g) x = functor.comp.mk (option.traverse f <$> option.traverse g x)
theorem
option.naturality
{F G : Type u → Type u}
[applicative F]
[applicative G]
[is_lawful_applicative F]
[is_lawful_applicative G]
(η : applicative_transformation F G)
{α : Type u_1}
{β : Type u}
(f : α → F β)
(x : option α) :
⇑η (option.traverse f x) = option.traverse (⇑η ∘ f) x
@[instance]
Equations
- option.is_lawful_traversable = {to_is_lawful_functor := option.is_lawful_traversable._proof_1, id_traverse := option.id_traverse, comp_traverse := option.comp_traverse, traverse_eq_map_id := option.traverse_eq_map_id, naturality := option.naturality}
theorem
list.comp_traverse
{F G : Type u → Type u}
[applicative F]
[applicative G]
[is_lawful_applicative F]
[is_lawful_applicative G]
{α : Type u_1}
{β γ : Type u}
(f : β → F γ)
(g : α → G β)
(x : list α) :
list.traverse (functor.comp.mk ∘ functor.map f ∘ g) x = functor.comp.mk (list.traverse f <$> list.traverse g x)
theorem
list.naturality
{F G : Type u → Type u}
[applicative F]
[applicative G]
[is_lawful_applicative F]
[is_lawful_applicative G]
(η : applicative_transformation F G)
{α : Type u_1}
{β : Type u}
(f : α → F β)
(x : list α) :
⇑η (list.traverse f x) = list.traverse (⇑η ∘ f) x
@[instance]
Equations
- list.is_lawful_traversable = {to_is_lawful_functor := list.is_lawful_traversable._proof_1, id_traverse := list.id_traverse, comp_traverse := list.comp_traverse, traverse_eq_map_id := list.traverse_eq_map_id, naturality := list.naturality}
@[simp]
@[simp]
theorem
list.traverse_cons
{F : Type u → Type u}
[applicative F]
{α' β' : Type u}
(f : α' → F β')
(a : α')
(l : list α') :
traversable.traverse f (a :: l) = (λ (_x : β') (_y : list β'), _x :: _y) <$> f a <*> traversable.traverse f l
@[simp]
theorem
list.traverse_append
{F : Type u → Type u}
[applicative F]
{α' β' : Type u}
(f : α' → F β')
[is_lawful_applicative F]
(as bs : list α') :
traversable.traverse f (as ++ bs) = has_append.append <$> traversable.traverse f as <*> traversable.traverse f bs
theorem
list.mem_traverse
{α' β' : Type u}
{f : α' → set β'}
(l : list α')
(n : list β') :
n ∈ traversable.traverse f l ↔ list.forall₂ (λ (b : β') (a : α'), b ∈ f a) n l
theorem
sum.comp_traverse
{σ : Type u}
{F G : Type u → Type u}
[applicative F]
[applicative G]
[is_lawful_applicative F]
[is_lawful_applicative G]
{α : Type u_1}
{β γ : Type u}
(f : β → F γ)
(g : α → G β)
(x : σ ⊕ α) :
sum.traverse (functor.comp.mk ∘ functor.map f ∘ g) x = functor.comp.mk (sum.traverse f <$> sum.traverse g x)
theorem
sum.map_traverse
{σ : Type u}
{G : Type u → Type u}
[applicative G]
[is_lawful_applicative G]
{α : Type u_1}
{β γ : Type u}
(g : α → G β)
(f : β → γ)
(x : σ ⊕ α) :
functor.map f <$> sum.traverse g x = sum.traverse (functor.map f ∘ g) x
theorem
sum.traverse_map
{σ : Type u}
{G : Type u → Type u}
[applicative G]
[is_lawful_applicative G]
{α β γ : Type u}
(g : α → β)
(f : β → G γ)
(x : σ ⊕ α) :
sum.traverse f (g <$> x) = sum.traverse (f ∘ g) x
theorem
sum.naturality
{σ : Type u}
{F G : Type u → Type u}
[applicative F]
[applicative G]
[is_lawful_applicative F]
[is_lawful_applicative G]
(η : applicative_transformation F G)
{α : Type u_1}
{β : Type u}
(f : α → F β)
(x : σ ⊕ α) :
⇑η (sum.traverse f x) = sum.traverse (⇑η ∘ f) x
@[instance]
Equations
- sum.is_lawful_traversable = {to_is_lawful_functor := _, id_traverse := _, comp_traverse := _, traverse_eq_map_id := _, naturality := _}