The areas / V33. Data structures and computation
Mathlib.Control.Traversable.Instances
23 declarations. Mathlib docs · Source
theorem Sum.traverse.match_1.congr_eq_1 E1 #
∀ {σ : Type u_1} {α : Type u_2} (motive : σ ⊕ α → Sort u_3) (x : σ ⊕ α) (h_1 : (x : σ) → motive (Sum.inl x))
(h_2 : (x : α) → motive (Sum.inr x)) (x_1 : σ),
x = Sum.inl x_1 →
(match x with
| Sum.inl x => h_1 x
| Sum.inr x => h_2 x) ≍
h_1 x_1
theorem Sum.traverse.match_1.congr_eq_2 E1 #
∀ {σ : Type u_1} {α : Type u_2} (motive : σ ⊕ α → Sort u_3) (x : σ ⊕ α) (h_1 : (x : σ) → motive (Sum.inl x))
(h_2 : (x : α) → motive (Sum.inr x)) (x_1 : α),
x = Sum.inr x_1 →
(match x with
| Sum.inl x => h_1 x
| Sum.inr x => h_2 x) ≍
h_2 x_1
theorem Option.id_traverse E1 #
∀ {α : Type u_1} (x : Option α), Option.traverse pure x = pure x
theorem Option.comp_traverse E1 #
∀ {F G : Type u → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative G] {α : Type u_1}
{β γ : Type u} (f : β → F γ) (g : α → G β) (x : Option α),
Option.traverse (Functor.Comp.mk ∘ (fun x ↦ f <$> x) ∘ g) x =
Functor.Comp.mk (Option.traverse f <$> Option.traverse g x)
theorem Option.traverse_eq_map_id E1 #
∀ {α β : Type u_1} (f : α → β) (x : Option α), Option.traverse (pure ∘ f) x = pure (f <$> x)
theorem Option.naturality E1 #
∀ {F G : Type u → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative G]
(η : ApplicativeTransformation F G) [LawfulApplicative F] {α : Type u_1} {β : Type u} (f : α → F β) (x : Option α),
(fun {α} ↦ η.app α) (Option.traverse f x) = Option.traverse ((fun {α} ↦ η.app α) ∘ f) x
instance instLawfulTraversableOption E0 #
LawfulTraversable Option
theorem List.id_traverse E1 #
∀ {α : Type u_1} (xs : List α), List.traverse pure xs = pure xs
theorem List.comp_traverse E1 #
∀ {F G : Type u → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative G] {α : Type u_1}
{β γ : Type u} (f : β → F γ) (g : α → G β) (x : List α),
List.traverse (Functor.Comp.mk ∘ (fun x ↦ f <$> x) ∘ g) x = Functor.Comp.mk (List.traverse f <$> List.traverse g x)
theorem List.traverse_eq_map_id E1 #
∀ {α β : Type u_1} (f : α → β) (x : List α), List.traverse (pure ∘ f) x = pure (f <$> x)
theorem List.naturality E1 #
∀ {F G : Type u → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative G] [LawfulApplicative F]
(η : ApplicativeTransformation F G) {α : Type u_1} {β : Type u} (f : α → F β) (x : List α),
(fun {α} ↦ η.app α) (List.traverse f x) = List.traverse ((fun {α} ↦ η.app α) ∘ f) x
instance List.instLawfulTraversable E0 #
LawfulTraversable List
theorem List.traverse_nil E0 #
∀ {F : Type u → Type u} [inst : Applicative F] {α' β' : Type u} (f : α' → F β'), traverse f [] = pure []
theorem List.traverse_cons E0 #
∀ {F : Type u → Type u} [inst : Applicative F] {α' β' : Type u} (f : α' → F β') (a : α') (l : List α'),
traverse f (a :: l) = (fun x1 x2 ↦ x1 :: x2) <$> f a <*> traverse f l
theorem List.traverse_append E0 #
∀ {F : Type u → Type u} [inst : Applicative F] {α' β' : Type u} (f : α' → F β') [LawfulApplicative F] (as bs : List α'),
traverse f (as ++ bs) = (fun x1 x2 ↦ x1 ++ x2) <$> traverse f as <*> traverse f bs
theorem List.mem_traverse E0 #
∀ {α' β' : Type u} {f : α' → Set β'} (l : List α') (n : List β'),
n ∈ traverse f l ↔ List.Forall₂ (fun b a ↦ b ∈ f a) n l
theorem Sum.traverse_map E1 #
∀ {σ : Type u} {G : Type u → Type u} [inst : Applicative G] {α β γ : Type u} (g : α → β) (f : β → G γ) (x : σ ⊕ α),
Sum.traverse f (g <$> x) = Sum.traverse (f ∘ g) x
theorem Sum.id_traverse E1 #
∀ {σ α : Type u_1} (x : σ ⊕ α), Sum.traverse pure x = x
theorem Sum.comp_traverse E1 #
∀ {σ : Type u} {F G : Type u → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative G]
{α β γ : Type u} (f : β → F γ) (g : α → G β) (x : σ ⊕ α),
Sum.traverse (Functor.Comp.mk ∘ (fun x ↦ f <$> x) ∘ g) x = Functor.Comp.mk (Sum.traverse f <$> Sum.traverse g x)
theorem Sum.traverse_eq_map_id E1 #
∀ {σ α β : Type u} (f : α → β) (x : σ ⊕ α), Sum.traverse (pure ∘ f) x = pure (f <$> x)
theorem Sum.map_traverse E0 #
∀ {σ : Type u} {G : Type u → Type u} [inst : Applicative G] [LawfulApplicative G] {α : Type u_1} {β γ : Type u}
(g : α → G β) (f : β → γ) (x : σ ⊕ α), (fun x ↦ f <$> x) <$> Sum.traverse g x = Sum.traverse (fun x ↦ f <$> g x) x
theorem Sum.naturality E1 #
∀ {σ : Type u} {F G : Type u → Type u} [inst : Applicative F] [inst_1 : Applicative G] [LawfulApplicative G]
[LawfulApplicative F] (η : ApplicativeTransformation F G) {α : Type u_1} {β : Type u} (f : α → F β) (x : σ ⊕ α),
(fun {α} ↦ η.app α) (Sum.traverse f x) = Sum.traverse ((fun {α} ↦ η.app α) ∘ f) x
instance Sum.instLawfulTraversable E0 #
∀ {σ : Type u}, LawfulTraversable (Sum σ)