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.Applicative.Import Applicative.Notations.(** * Cartesian Product Bifunctor *)(**********************************************************************)(** ** Bi-map Operation *)(**********************************************************************)Sectionmap_pair.Definitionmap_pair
{ABCD: Type}
(f: A -> B)
(g: C -> D):
A * C -> B * D :=
map_snd g ∘ map_fst f.(** *** Rewriting Laws *)(**********************************************************************)
A, B, C, D: Type f: A -> B g: C -> D
forall (a : A) (c : C),
map_pair f g (a, c) = (f a, g c)
A, B, C, D: Type f: A -> B g: C -> D
forall (a : A) (c : C),
map_pair f g (a, c) = (f a, g c)
reflexivity.Qed.(** *** Lifting <<map>> to <<map_pair>> *)(**********************************************************************)
A, B, C: Type f: A -> B
map_fst f = map_pair f id
A, B, C: Type f: A -> B
map_fst f = map_pair f id
A, B, C: Type f: A -> B
map_fst f = map_pair f id
A, B, C: Type f: A -> B a: A c: C
map_fst f (a, c) = map_pair f id (a, c)
reflexivity.Qed.
A, C, D: Type g: C -> D
map_snd g = map_pair id g
A, C, D: Type g: C -> D
map_snd g = map_pair id g
A, C, D: Type g: C -> D
map_snd g = map_pair id g
A, C, D: Type g: C -> D a: A c: C
map_snd g (a, c) = map_pair id g (a, c)
reflexivity.Qed.Endmap_pair.(** ** Bi-traverse Operation *)(**********************************************************************)Sectiontraverse_pair.Context
{G: Type -> Type}
`{Map G} `{Mult G} `{Pure G}.Context
{ABCD: Type}
(f: A -> G B) (g: C -> G D).Definitiontraverse_pair: A * C -> G (B * D) :=
fun '(a, c) => pure pair <⋆> f a <⋆> g c.
G: Type -> Type H: Map G H0: Mult G H1: Pure G A, B, C, D: Type f: A -> G B g: C -> G D
forall (a : A) (c : C),
traverse_pair (a, c) = pure pair <⋆> f a <⋆> g c
G: Type -> Type H: Map G H0: Mult G H1: Pure G A, B, C, D: Type f: A -> G B g: C -> G D
forall (a : A) (c : C),
traverse_pair (a, c) = pure pair <⋆> f a <⋆> g c