Built with Alectryon, running Coq+SerAPI v8.16.0+0.16.3. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
From Tealeaves Require Import
Classes.Categorical.Monad
Classes.Categorical.DecoratedMonad (shift)
Classes.Kleisli.DecoratedTraversableFunctor
Classes.Kleisli.DecoratedTraversableMonad
Functors.Early.Subset
Functors.Early.Ctxset
Functors.Early.List.Import DecoratedTraversableFunctor.Notations.Import Functor.Notations.Import List.ListNotations.Import Product.Notations.Import Subset.Notations.Import Applicative.Notations.Import Strength.Notations.Import Monoid.Notations.#[local] Generalizable VariablesW M A B G ϕ.Definitionenv (E: Type) (A: Type) := list (E * A).(** * Decorated Traversable Functor Instance (Kleisli)] *)(**********************************************************************)Sectionenv.Context
(E: Type).(** ** Operation <<mapdt>> and Derived Operations *)(********************************************************************)Fixpointmapdt_env (G: Type -> Type) `{Map G} `{Pure G} `{Mult G}
`(f: E * A -> G B) (Γ: env E A): G (env E B) :=
match Γ with
| nil => pure (@nil (E * B))
| (e, a) :: rest =>
pure (@List.cons (E * B))
<⋆> σ (e, f (e, a))
<⋆> mapdt_env G f rest
end.Fixpointtraverse_env (G: Type -> Type) `{Map G} `{Pure G} `{Mult G}
`(f: A -> G B) (l: env E A): G (env E B) :=
match l with
| nil => pure (@nil (E * B))
| (e, a) :: xs =>
pure (@List.cons (E * B))
<⋆> σ (e, f a)
<⋆> traverse_env G f xs
end.Fixpointmapd_env `(f: E * A -> B) (Γ: env E A): env E B :=
match Γ with
| nil => @nil (E * B)
| (e, a) :: rest =>
(e, f (e, a)) :: mapd_env f rest
end.Fixpointmap_env `(f: A -> B) (Γ: env E A): env E B :=
match Γ with
| nil => @nil (E * B)
| (e, a) :: rest =>
(e, f a) :: map_env f rest
end.#[export] InstanceMapdt_env: Mapdt E (env E) := @mapdt_env.#[export] InstanceTraverse_env: Traverse (env E) := @traverse_env.#[export] InstanceMapd_env: Mapd E (env E) := @mapd_env.#[export] InstanceMap_env: Map (env E) := @map_env.Endenv.Ltacsimple_env_tactic :=
intros;
letl := fresh"l"inlete := fresh"e"inleta := fresh"a"inletrest := fresh"rest"inletIHrest := fresh"IHrest"in
ext l;
( induction l as [|[e a] rest IHrest] ||
induction l as [|a rest IHrest] );
[ reflexivity |
try (cbn; nowrewrite IHrest)].(** ** Rewriting Laws for <<mapdt>> *)(**********************************************************************)Sectionmapdt_rewriting_lemmas.Context
`{Applicative G}
(E A B: Type).
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type
forallf : E * A -> G B, mapdt f [] = pure []
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type
forallf : E * A -> G B, mapdt f [] = pure []
reflexivity.Qed.
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type
forall (f : E * A -> G B) (e : E) (a : A),
mapdt f (ret (e, a)) = map (ret ∘ pair e) (f (e, a))
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type
forall (f : E * A -> G B) (e : E) (a : A),
mapdt f (ret (e, a)) = map (ret ∘ pair e) (f (e, a))
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B e: E a: A
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type
forall (f : E * A -> G B) (e : E) (a : A)
(l : env E A),
mapdt f ((e, a) :: l) =
pure cons <⋆> σ (e, f (e, a)) <⋆> mapdt f l
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type
forall (f : E * A -> G B) (e : E) (a : A)
(l : env E A),
mapdt f ((e, a) :: l) =
pure cons <⋆> σ (e, f (e, a)) <⋆> mapdt f l
reflexivity.Qed.
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type
forall (f : E * A -> G B) (l1l2 : env E A),
mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type
forall (f : E * A -> G B) (l1l2 : env E A),
mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B l1, l2: env E A
mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B l2: env E A
mapdt f ([] ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f [] <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B a: E * A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
mapdt f ((a :: l1) ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f (a :: l1) <⋆>
mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B l2: env E A
mapdt f ([] ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f [] <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B l2: env E A
mapdt f l2 =
pure (app (A:=E * B)) <⋆> pure [] <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B l2: env E A
mapdt f l2 = pure (app []) <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B l2: env E A
mapdt f l2 = mapdt f l2
reflexivity.
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B a: E * A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
mapdt f ((a :: l1) ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f (a :: l1) <⋆>
mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B e: E a: A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
mapdt f (((e, a) :: l1) ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f ((e, a) :: l1) <⋆>
mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B e: E a: A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
pure cons <⋆> map (pair e) (f (e, a)) <⋆>
mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆>
(pure cons <⋆> map (pair e) (f (e, a)) <⋆> mapdt f l1) <⋆>
mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B e: E a: A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
pure cons <⋆> map (pair e) (f (e, a)) <⋆>
(pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆> mapdt f l2) =
pure (app (A:=E * B)) <⋆>
(pure cons <⋆> map (pair e) (f (e, a)) <⋆> mapdt f l1) <⋆>
mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B e: E a: A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
pure compose <⋆> pure compose <⋆> pure compose <⋆>
pure compose <⋆> pure compose <⋆> pure compose <⋆>
pure compose <⋆> pure cons <⋆> map (pair e) (f (e, a)) <⋆>
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆> mapdt f l2 =
pure compose <⋆> pure compose <⋆> pure compose <⋆>
pure (app (A:=E * B)) <⋆> pure cons <⋆>
map (pair e) (f (e, a)) <⋆> mapdt f l1 <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B e: E a: A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
pure
((compose ∘ compose) compose compose compose compose
cons) <⋆> map (pair e) (f (e, a)) <⋆>
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆> mapdt f l2 =
pure ((compose ∘ compose) (app (A:=E * B)) cons) <⋆>
map (pair e) (f (e, a)) <⋆> mapdt f l1 <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B e: E a: A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
pure (evalAt (app (A:=E * B))) <⋆>
(pure
((compose ∘ compose) compose compose compose
compose cons) <⋆> map (pair e) (f (e, a))) <⋆>
mapdt f l1 <⋆> mapdt f l2 =
pure ((compose ∘ compose) (app (A:=E * B)) cons) <⋆>
map (pair e) (f (e, a)) <⋆> mapdt f l1 <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B e: E a: A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
pure compose <⋆> pure (evalAt (app (A:=E * B))) <⋆>
pure
((compose ∘ compose) compose compose compose compose
cons) <⋆> map (pair e) (f (e, a)) <⋆> mapdt f l1 <⋆>
mapdt f l2 =
pure ((compose ∘ compose) (app (A:=E * B)) cons) <⋆>
map (pair e) (f (e, a)) <⋆> mapdt f l1 <⋆> mapdt f l2
G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H: Applicative G E, A, B: Type f: E * A -> G B e: E a: A l1: list (E * A) l2: env E A IHl1: mapdt f (l1 ++ l2) =
pure (app (A:=E * B)) <⋆> mapdt f l1 <⋆>
mapdt f l2
pure
(evalAt (app (A:=E * B))
∘ (compose ∘ compose) compose compose compose
compose cons) <⋆> map (pair e) (f (e, a)) <⋆>
mapdt f l1 <⋆> mapdt f l2 =
pure ((compose ∘ compose) (app (A:=E * B)) cons) <⋆>
map (pair e) (f (e, a)) <⋆> mapdt f l1 <⋆> mapdt f l2
forall (E : Type) (G : Type -> Type) (Map_G : Map G)
(Pure_G : Pure G) (Mult_G : Mult G),
Applicative G ->
forall (AB : Type) (f : A -> G B),
traverse f = mapdt (f ∘ extract)
forall (E : Type) (G : Type -> Type) (Map_G : Map G)
(Pure_G : Pure G) (Mult_G : Mult G),
Applicative G ->
forall (AB : Type) (f : A -> G B),
traverse f = mapdt (f ∘ extract)
simple_env_tactic.Qed.
forall (EAB : Type) (f : E * A -> B),
mapd f = mapdt f
forall (EAB : Type) (f : E * A -> B),
mapd f = mapdt f
simple_env_tactic.Qed.
forall (EAB : Type) (f : A -> B),
map f = mapdt (f ∘ extract)
forall (EAB : Type) (f : A -> B),
map f = mapdt (f ∘ extract)
simple_env_tactic.Qed.
E: Type
Compat_Traverse_Mapdt E (env E)
E: Type
Compat_Traverse_Mapdt E (env E)
E: Type
Traverse_env E = DerivedOperations.Traverse_Mapdt
E: Type
Traverse_env E = DerivedOperations.Traverse_Mapdt
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G
Traverse_env E G MapG PureG MultG =
DerivedOperations.Traverse_Mapdt G MapG PureG MultG
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B l: env E A
Traverse_env E G MapG PureG MultG A B f l =
DerivedOperations.Traverse_Mapdt G MapG PureG MultG A
B f l
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B l: env E A
traverse_env E G f l =
DerivedOperations.Traverse_Mapdt G MapG PureG MultG A
B f l
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B l: env E A
traverse f l =
DerivedOperations.Traverse_Mapdt G MapG PureG MultG A
B f l
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B l: env E A
traverse f l = mapdt (f ∘ extract) l
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B
traverse f [] = mapdt (f ∘ extract) []
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B a: E * A l: list (E * A) IHl: traverse f l = mapdt (f ∘ extract) l
traverse f (a :: l) = mapdt (f ∘ extract) (a :: l)
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B
traverse f [] = mapdt (f ∘ extract) []
reflexivity.
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B a: E * A l: list (E * A) IHl: traverse f l = mapdt (f ∘ extract) l
traverse f (a :: l) = mapdt (f ∘ extract) (a :: l)
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B a: E * A l: list (E * A) IHl: traverse f l = mapdt (f ∘ extract) l
(let (e, a) := a in
pure cons <⋆> map (pair e) (f a) <⋆> traverse f l) =
(let (e, a) := a in
pure cons <⋆> map (pair e) ((f ∘ extract) (e, a)) <⋆>
mapdt (f ∘ extract) l)
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B e: E a: A l: list (E * A) IHl: traverse f l = mapdt (f ∘ extract) l
pure cons <⋆> map (pair e) (f a) <⋆> traverse f l =
pure cons <⋆> map (pair e) ((f ∘ extract) (e, a)) <⋆>
mapdt (f ∘ extract) l
E: Type G: Type -> Type MapG: Map G PureG: Pure G MultG: Mult G A, B: Type f: A -> G B e: E a: A l: list (E * A) IHl: traverse f l = mapdt (f ∘ extract) l
pure cons <⋆> map (pair e) (f a) <⋆>
mapdt (f ∘ extract) l =
pure cons <⋆> map (pair e) ((f ∘ extract) (e, a)) <⋆>
mapdt (f ∘ extract) l
reflexivity.Qed.
E: Type
Compat_Map_Mapdt E (env E)
E: Type
Compat_Map_Mapdt E (env E)
E: Type
Map_env E = DerivedOperations.Map_Mapdt
E, A, B: Type f: A -> B l: env E A
Map_env E A B f l =
DerivedOperations.Map_Mapdt A B f l
E, A, B: Type f: A -> B l: env E A
map f l = DerivedOperations.Map_Mapdt A B f l
E, A, B: Type f: A -> B l: env E A
mapdt (f ∘ extract) l =
DerivedOperations.Map_Mapdt A B f l
reflexivity.Qed.
E: Type
Compat_Mapd_Mapdt E (env E)
E: Type
Compat_Mapd_Mapdt E (env E)
E: Type
Mapd_env E = DerivedOperations.Mapd_Mapdt
E, A, B: Type f: E * A -> B l: env E A
Mapd_env E A B f l =
DerivedOperations.Mapd_Mapdt A B f l
E, A: Type a: E * A l: list (E * A) IHl: mapdt extract l = id l
mapdt extract (a :: l) = id (a :: l)
E, A: Type
mapdt extract [] = id []
reflexivity.
E, A: Type a: E * A l: list (E * A) IHl: mapdt extract l = id l
mapdt extract (a :: l) = id (a :: l)
E, A: Type e: E a: A l: list (E * A) IHl: mapdt extract l = id l
mapdt extract ((e, a) :: l) = id ((e, a) :: l)
E, A: Type e: E a: A l: list (E * A) IHl: mapdt extract l = id l
pure cons <⋆> σ (e, extract (e, a)) <⋆>
mapdt extract l = id ((e, a) :: l)
E, A: Type e: E a: A l: list (E * A) IHl: mapdt extract l = id l
pure cons <⋆> σ (e, extract (e, a)) <⋆> id l =
id ((e, a) :: l)
reflexivity.Qed.
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2
forall (ABC : Type) (g : E * B -> G2 C)
(f : E * A -> G1 B),
map (mapdt g) ∘ mapdt f = mapdt (g ⋆3 f)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2
forall (ABC : Type) (g : E * B -> G2 C)
(f : E * A -> G1 B),
map (mapdt g) ∘ mapdt f = mapdt (g ⋆3 f)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B
map (mapdt g) ∘ mapdt f = mapdt (g ⋆3 f)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B l: env E A
(map (mapdt g) ∘ mapdt f) l = mapdt (g ⋆3 f) l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B
(map (mapdt g) ∘ mapdt f) [] = mapdt (g ⋆3 f) []
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B a: E * A l: list (E * A) IHl: (map (mapdt g) ∘ mapdt f) l = mapdt (g ⋆3 f) l
(map (mapdt g) ∘ mapdt f) (a :: l) =
mapdt (g ⋆3 f) (a :: l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B
(map (mapdt g) ∘ mapdt f) [] = mapdt (g ⋆3 f) []
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B
map (mapdt g) (mapdt f []) = mapdt (g ⋆3 f) []
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B
map (mapdt g) (pure []) = pure []
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B
(map (mapdt g) ∘ pure) [] = pure []
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B
(pure ∘ map (mapdt g)) [] = pure []
reflexivity.
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B a: E * A l: list (E * A) IHl: (map (mapdt g) ∘ mapdt f) l = mapdt (g ⋆3 f) l
(map (mapdt g) ∘ mapdt f) (a :: l) =
mapdt (g ⋆3 f) (a :: l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B a: E * A l: list (E * A) IHl: (map (mapdt g) ∘ mapdt f) l = mapdt (g ⋆3 f) l
map (mapdt g) (mapdt f (a :: l)) =
mapdt (g ⋆3 f) (a :: l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B a: E * A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
map (mapdt g) (mapdt f (a :: l)) =
mapdt (g ⋆3 f) (a :: l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
map (mapdt g) (mapdt f ((e, a) :: l)) =
mapdt (g ⋆3 f) ((e, a) :: l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
map (mapdt g)
(pure cons <⋆> σ (e, f (e, a)) <⋆> mapdt f l) =
pure cons <⋆> σ (e, (g ⋆3 f) (e, a)) <⋆>
mapdt (g ⋆3 f) l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
map (mapdt g)
(pure cons <⋆> (pure (pair e) <⋆> f (e, a)) <⋆>
mapdt f l) =
pure cons <⋆> map (pair e) ((g ⋆3 f) (e, a)) <⋆>
mapdt (g ⋆3 f) l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
map (mapdt g)
(pure (cons ∘ pair e) <⋆> f (e, a) <⋆> mapdt f l) =
pure cons <⋆> map (pair e) ((g ⋆3 f) (e, a)) <⋆>
mapdt (g ⋆3 f) l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (mapdt g) <⋆>
(pure (cons ∘ pair e) <⋆> f (e, a) <⋆> mapdt f l) =
pure cons <⋆> map (pair e) ((g ⋆3 f) (e, a)) <⋆>
mapdt (g ⋆3 f) l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g)) <⋆>
(pure (cons ∘ pair e) <⋆> f (e, a)) <⋆> mapdt f l =
pure cons <⋆> map (pair e) ((g ⋆3 f) (e, a)) <⋆>
mapdt (g ⋆3 f) l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure cons <⋆> map (pair e) ((g ⋆3 f) (e, a)) <⋆>
mapdt (g ⋆3 f) l
(* RHS *)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure cons <⋆> (pure (pair e) <⋆> (g ⋆3 f) (e, a)) <⋆>
mapdt (g ⋆3 f) l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure (cons ∘ pair e) <⋆> (g ⋆3 f) (e, a) <⋆>
mapdt (g ⋆3 f) l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure (cons ∘ pair e) <⋆> (g ⋆3 f) (e, a) <⋆>
map (mapdt g) (mapdt f l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure (cons ∘ pair e) <⋆> (g ⋆3 f) (e, a) <⋆>
(pure (mapdt g) <⋆> mapdt f l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure (ap G2) <⋆>
(pure (cons ∘ pair e) <⋆> (g ⋆3 f) (e, a)) <⋆>
(pure (mapdt g) <⋆> mapdt f l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure (ap G2) <⋆>
(pure (ap G2) <⋆> pure (cons ∘ pair e) <⋆>
(g ⋆3 f) (e, a)) <⋆> (pure (mapdt g) <⋆> mapdt f l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure (ap G2) <⋆>
(pure (ap G2) <⋆> pure (pure (cons ∘ pair e)) <⋆>
(g ⋆3 f) (e, a)) <⋆> (pure (mapdt g) <⋆> mapdt f l)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure compose <⋆>
(pure (ap G2) <⋆>
(pure (ap G2) <⋆> pure (pure (cons ∘ pair e)) <⋆>
(g ⋆3 f) (e, a))) <⋆> pure (mapdt g) <⋆> mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure (compose ∘ ap G2) <⋆>
(pure (ap G2 (pure (cons ∘ pair e))) <⋆>
(g ⋆3 f) (e, a)) <⋆> pure (mapdt g) <⋆> mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (compose (mapdt g) ∘ (cons ∘ pair e)) <⋆>
f (e, a) <⋆> mapdt f l =
pure (compose ∘ ap G2 ∘ ap G2 (pure (cons ∘ pair e))) <⋆>
(g ⋆3 f) (e, a) <⋆> pure (mapdt g) <⋆> mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (funa : B => mapdt g ○ cons (e, a)) <⋆> f (e, a) <⋆>
mapdt f l =
pure
(fun (a : G2 C) (f : env E B -> G2 (list (E * C)))
=> ap G2 (pure (cons ○ pair e) <⋆> a) ○ f) <⋆>
map g
(let '(a, t) := cobind f (e, a) in map (pair a) t) <⋆>
pure (mapdt g) <⋆> mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (funa : B => mapdt g ○ cons (e, a)) <⋆> f (e, a) <⋆>
mapdt f l =
pure
(fun (a : G2 C) (f : env E B -> G2 (list (E * C)))
=> ap G2 (pure (cons ○ pair e) <⋆> a) ○ f) <⋆>
map g (let '(a, t) := (e, f (e, a)) in map (pair a) t) <⋆>
pure (mapdt g) <⋆> mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (funa : B => mapdt g ○ cons (e, a)) <⋆> f (e, a) <⋆>
mapdt f l =
pure
(fun (a : G2 C) (f : env E B -> G2 (list (E * C)))
=> ap G2 (pure (cons ○ pair e) <⋆> a) ○ f) <⋆>
(pure g <⋆> (pure (pair e) <⋆> f (e, a))) <⋆>
pure (mapdt g) <⋆> mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (funa : B => mapdt g ○ cons (e, a)) <⋆> f (e, a) <⋆>
mapdt f l =
pure
((fun (a : G2 C) (f : env E B -> G2 (list (E * C)))
=> ap G2 (pure (cons ○ pair e) <⋆> a) ○ f) ∘ g) <⋆>
(pure (pair e) <⋆> f (e, a)) <⋆> pure (mapdt g) <⋆>
mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (funa : B => mapdt g ○ cons (e, a)) <⋆> f (e, a) <⋆>
mapdt f l =
pure
((fun (a : G2 C) (f : env E B -> G2 (list (E * C)))
=> ap G2 (pure (cons ○ pair e) <⋆> a) ○ f) ∘ g
∘ pair e) <⋆> f (e, a) <⋆> pure (mapdt g) <⋆>
mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (funa : B => mapdt g ○ cons (e, a)) <⋆> f (e, a) <⋆>
mapdt f l =
pure (evalAt (mapdt g)) <⋆>
(pure
((fun (a : G2 C) (f : env E B -> G2 (list (E * C)))
=> ap G2 (pure (cons ○ pair e) <⋆> a) ○ f) ∘ g
∘ pair e) <⋆> f (e, a)) <⋆> mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
pure (funa : B => mapdt g ○ cons (e, a)) <⋆> f (e, a) <⋆>
mapdt f l =
pure
(evalAt (mapdt g)
∘ ((fun (a : G2 C)
(f : env E B -> G2 (list (E * C))) =>
ap G2 (pure (cons ○ pair e) <⋆> a) ○ f) ∘ g
∘ pair e)) <⋆> f (e, a) <⋆> mapdt f l
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l
(funa : B => mapdt g ○ cons (e, a)) =
evalAt (mapdt g)
∘ ((fun (a : G2 C) (f : env E B -> G2 (list (E * C)))
=> ap G2 (pure (cons ○ pair e) <⋆> a) ○ f) ∘ g
∘ pair e)
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l b: B l': list (E * B)
mapdt g ((e, b) :: l') =
(evalAt (mapdt g)
∘ ((fun (a : G2 C) (f : env E B -> G2 (list (E * C)))
=> ap G2 (pure (cons ○ pair e) <⋆> a) ○ f) ∘ g
∘ pair e)) b l'
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l b: B l': list (E * B)
mapdt g ((e, b) :: l') =
evalAt (mapdt g)
(funf : env E B -> G2 (list (E * C)) =>
ap G2 (pure (cons ○ pair e) <⋆> g (e, b)) ○ f) l'
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l b: B l': list (E * B)
pure cons <⋆> σ (e, g (e, b)) <⋆> mapdt g l' =
evalAt (mapdt g)
(funf : env E B -> G2 (list (E * C)) =>
ap G2 (pure (cons ○ pair e) <⋆> g (e, b)) ○ f) l'
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l b: B l': list (E * B)
pure cons <⋆> map (pair e) (g (e, b)) <⋆> mapdt g l' =
evalAt (mapdt g)
(funf : env E B -> G2 (list (E * C)) =>
ap G2 (pure (cons ○ pair e) <⋆> g (e, b)) ○ f) l'
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l b: B l': list (E * B)
pure cons <⋆> (pure (pair e) <⋆> g (e, b)) <⋆>
mapdt g l' =
evalAt (mapdt g)
(funf : env E B -> G2 (list (E * C)) =>
ap G2 (pure (cons ○ pair e) <⋆> g (e, b)) ○ f) l'
E: Type G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H0: Applicative G2 A, B, C: Type g: E * B -> G2 C f: E * A -> G1 B e: E a: A l: list (E * A) IHl: map (mapdt g) (mapdt f l) = mapdt (g ⋆3 f) l b: B l': list (E * B)
pure (cons ∘ pair e) <⋆> g (e, b) <⋆> mapdt g l' =
evalAt (mapdt g)
(funf : env E B -> G2 (list (E * C)) =>
ap G2 (pure (cons ○ pair e) <⋆> g (e, b)) ○ f) l'
reflexivity.Qed.
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ
forall (AB : Type) (f : E * A -> G1 B),
ϕ (env E B) ∘ mapdt f = mapdt (ϕ B ∘ f)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ
forall (AB : Type) (f : E * A -> G1 B),
ϕ (env E B) ∘ mapdt f = mapdt (ϕ B ∘ f)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B
ϕ (env E B) ∘ mapdt f = mapdt (ϕ B ∘ f)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B l: env E A
(ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B
(ϕ (env E B) ∘ mapdt f) [] = mapdt (ϕ B ∘ f) []
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B a: E * A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
(ϕ (env E B) ∘ mapdt f) (a :: l) =
mapdt (ϕ B ∘ f) (a :: l)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B
(ϕ (env E B) ∘ mapdt f) [] = mapdt (ϕ B ∘ f) []
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B
ϕ (env E B) (mapdt f []) = mapdt (ϕ B ○ f) []
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B
ϕ (env E B) (pure []) = pure []
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B
pure [] = pure []
reflexivity.
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B a: E * A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
(ϕ (env E B) ∘ mapdt f) (a :: l) =
mapdt (ϕ B ∘ f) (a :: l)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
(ϕ (env E B) ∘ mapdt f) ((e, a) :: l) =
mapdt (ϕ B ∘ f) ((e, a) :: l)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
ϕ (env E B) (mapdt f ((e, a) :: l)) =
mapdt (ϕ B ∘ f) ((e, a) :: l)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
ϕ (env E B)
(pure cons <⋆> σ (e, f (e, a)) <⋆> mapdt f l) =
pure cons <⋆> σ (e, (ϕ B ∘ f) (e, a)) <⋆>
mapdt (ϕ B ∘ f) l
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
ϕ (env E B)
(pure cons <⋆> σ (e, f (e, a)) <⋆> mapdt f l) =
pure cons <⋆> σ (e, (ϕ B ∘ f) (e, a)) <⋆>
(ϕ (env E B) ∘ mapdt f) l
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
ϕ (env E B)
(pure cons <⋆> σ (e, f (e, a)) <⋆> mapdt f l) =
pure cons <⋆> σ (e, (ϕ B ∘ f) (e, a)) <⋆>
ϕ (env E B) (mapdt f l)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
ϕ (list (E * B) -> env E B)
(pure cons <⋆> σ (e, f (e, a))) <⋆>
ϕ (list (E * B)) (mapdt f l) =
pure cons <⋆> σ (e, (ϕ B ∘ f) (e, a)) <⋆>
ϕ (env E B) (mapdt f l)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
ϕ (E * B -> list (E * B) -> env E B) (pure cons) <⋆>
ϕ (E * B) (σ (e, f (e, a))) <⋆>
ϕ (list (E * B)) (mapdt f l) =
pure cons <⋆> σ (e, (ϕ B ∘ f) (e, a)) <⋆>
ϕ (env E B) (mapdt f l)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
pure cons <⋆> ϕ (E * B) (σ (e, f (e, a))) <⋆>
ϕ (list (E * B)) (mapdt f l) =
pure cons <⋆> σ (e, (ϕ B ∘ f) (e, a)) <⋆>
ϕ (env E B) (mapdt f l)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
pure cons <⋆> ϕ (E * B) (map (pair e) (f (e, a))) <⋆>
ϕ (list (E * B)) (mapdt f l) =
pure cons <⋆> map (pair e) ((ϕ B ∘ f) (e, a)) <⋆>
ϕ (env E B) (mapdt f l)
E: Type G1, G2: Type -> Type H: Map G1 H0: Mult G1 H1: Pure G1 H2: Map G2 H3: Mult G2 H4: Pure G2 ϕ: G1 ⇒ G2 H5: ApplicativeMorphism G1 G2 ϕ A, B: Type f: E * A -> G1 B e: E a: A l: list (E * A) IHl: (ϕ (env E B) ∘ mapdt f) l = mapdt (ϕ B ∘ f) l
pure cons <⋆> map (pair e) (ϕ B (f (e, a))) <⋆>
ϕ (list (E * B)) (mapdt f l) =
pure cons <⋆> map (pair e) ((ϕ B ∘ f) (e, a)) <⋆>
ϕ (env E B) (mapdt f l)
forall (EAB : Type) (f : E * A -> B),
mapd f = map (cobind f)
forall (EAB : Type) (f : E * A -> B),
mapd f = map (cobind f)
simple_env_tactic.Qed.
forall (EAB : Type) (f : A -> B),
map f = map (map f)
forall (EAB : Type) (f : A -> B),
map f = map (map f)
simple_env_tactic.Qed.
forall (EAB : Type) (f : A -> B), map f = map f
forall (EAB : Type) (f : A -> B), map f = map f
E, A, B: Type f: A -> B
map f = map f
nowrewrite env_map_spec.Qed.(** * Decorated Traversable Monad Instance (Kleisli) *)(**********************************************************************)Sectionenv.Context
`{Monoid W}.#[export] InstanceReturn_env: Return (env W) :=
funA => ret (T := list) ∘ ret (T := (W ×)) (A := A).Fixpointbinddt_env (G: Type -> Type) `{Map G} `{Pure G} `{Mult G}
`(f: W * A -> G (env W B)) (Γ: env W A): G (env W B) :=
match Γ with
| nil => pure (@nil (W * B))
| (w, a) :: rest =>
pure (@List.app (W * B))
<⋆> map (F := G) (funx => shift list (w, x)) (f (w, a))
<⋆> binddt_env G f rest
end.Fixpointbindd_env `(f: W * A -> env W B) (Γ: env W A): env W B :=
match Γ with
| nil => @nil (W * B)
| (w, a) :: rest =>
shift list (w, f (w, a)) ++ bindd_env f rest
end.Fixpointbind_env `(f: A -> env W B) (l: env W A): env W B :=
match l with
| nil => pure (@nil (W * B))
| (w, a) :: xs =>
pure (@List.app (W * B))
<⋆> shift list (w, f a)
<⋆> bind_env f xs
end.#[export] InstanceBinddt_env: Binddt W (env W) (env W) := @binddt_env.#[export] InstanceBindd_env: Bindd W (env W) (env W) := @bindd_env.#[export] InstanceBind_env: Bind (env W) (env W) := @bind_env.Endenv.