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 Export
Classes.Kleisli.TraversableFunctor
Classes.Categorical.ContainerFunctor
Classes.Categorical.ShapelyFunctor
Classes.Categorical.Monad (Return, ret)
Functors.Backwards
Functors.Constant
Functors.Identity
Functors.Early.List
Functors.ProductFunctor
Misc.Prop.From Tealeaves Require Import
Classes.Categorical.ApplicativeCommutativeIdempotent.From Tealeaves Require
Classes.Coalgebraic.TraversableFunctor
Adapters.KleisliToCoalgebraic.TraversableFunctor.From Coq Require Import Logic.Decidable.Import Kleisli.TraversableFunctor.Notations.Import ContainerFunctor.Notations.Import Monoid.Notations.Import Subset.Notations.Import Categorical.Applicative.Notations.Import ProductFunctor.Notations. (* ◻ *)#[local] Generalizable VariableT G M ϕ A B C.(** * Miscellaneous Properties of Traversable Functors *)(**********************************************************************)(** ** Traversing in the Idempotent Center stays in the Idempotent Center *)(**********************************************************************)Sectiontraverse_comm_idem.Context
`{TraversableFunctor T}
`{Applicative G}.Context `{f: A -> G B}
(Hyp: foralla, IdempotentCenter G B (f a)).
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H0: Applicative G A, B: Type f: A -> G B Hyp: foralla : A, IdempotentCenter G B (f a)
forallt : T A,
IdempotentCenter G (T B) (traverse f t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H0: Applicative G A, B: Type f: A -> G B Hyp: foralla : A, IdempotentCenter G B (f a)
forallt : T A,
IdempotentCenter G (T B) (traverse f t)
(* Actually, this requires the representation theorem *)Abort.Endtraverse_comm_idem.(** ** Interaction between <<traverse>> and <<pure>> *)(**********************************************************************)Sectiontraversable_purity.Context
`{TraversableFunctor T}.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
forall (G : Type -> Type) (Map_G : Map G)
(Pure_G : Pure G) (Mult_G : Mult G),
Applicative G -> forallA : Type, traverse pure = pure
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
forall (G : Type -> Type) (Map_G : Map G)
(Pure_G : Pure G) (Mult_G : Mult G),
Applicative G -> forallA : Type, traverse pure = pure
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H0: Applicative G A: Type
traverse pure = pure
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H0: Applicative G A: Type
traverse (pure ∘ id) = pure
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H0: Applicative G A: Type
pure ∘ traverse id = pure
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H0: Applicative G A: Type
pure ∘ id = pure
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
forall (G2 : Type -> Type) (Map_G : Map G2)
(Pure_G : Pure G2) (Mult_G : Mult G2),
Applicative G2 ->
forall (G1 : Type -> Type) (Map_G0 : Map G1)
(Pure_G0 : Pure G1) (Mult_G0 : Mult G1),
Applicative G1 ->
forall (AB : Type) (f : A -> G1 B),
traverse (pure ∘ f) = pure ∘ traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
forall (G2 : Type -> Type) (Map_G : Map G2)
(Pure_G : Pure G2) (Mult_G : Mult G2),
Applicative G2 ->
forall (G1 : Type -> Type) (Map_G0 : Map G1)
(Pure_G0 : Pure G1) (Mult_G0 : Mult G1),
Applicative G1 ->
forall (AB : Type) (f : A -> G1 B),
traverse (pure ∘ f) = pure ∘ traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T G2: Type -> Type Map_G: Map G2 Pure_G: Pure G2 Mult_G: Mult G2 H0: Applicative G2 G1: Type -> Type Map_G0: Map G1 Pure_G0: Pure G1 Mult_G0: Mult G1 H1: Applicative G1 A, B: Type f: A -> G1 B
traverse (pure ∘ f) = pure ∘ traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T G2: Type -> Type Map_G: Map G2 Pure_G: Pure G2 Mult_G: Mult G2 H0: Applicative G2 G1: Type -> Type Map_G0: Map G1 Pure_G0: Pure G1 Mult_G0: Mult G1 H1: Applicative G1 A, B: Type f: A -> G1 B
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T
forall (G2 : Type -> Type) (Map_G : Map G2)
(Pure_G : Pure G2) (Mult_G : Mult G2),
Applicative G2 ->
forall (AB : Type) (f : A -> B),
traverse (pure ∘ f) = pure ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T
forall (G2 : Type -> Type) (Map_G : Map G2)
(Pure_G : Pure G2) (Mult_G : Mult G2),
Applicative G2 ->
forall (AB : Type) (f : A -> B),
traverse (pure ∘ f) = pure ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G2: Type -> Type Map_G: Map G2 Pure_G: Pure G2 Mult_G: Mult G2 H1: Applicative G2 A, B: Type f: A -> B
traverse (pure ∘ f) = pure ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G2: Type -> Type Map_G: Map G2 Pure_G: Pure G2 Mult_G: Mult G2 H1: Applicative G2 A, B: Type f: A -> B
pure ∘ traverse f = pure ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G2: Type -> Type Map_G: Map G2 Pure_G: Pure G2 Mult_G: Mult G2 H1: Applicative G2 A, B: Type f: A -> B
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H3: Applicative G A, B: Type f: A -> G B
traverse f = runBatch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H3: Applicative G A, B: Type f: A -> G B
traverse f = runBatch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H3: Applicative G A, B: Type f: A -> G B
traverse f = runBatch f ∘ traverse (batch A B)
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H3: Applicative G A, B: Type f: A -> G B
traverse f = traverse (runBatch f ∘ batch A B)
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T G: Type -> Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H3: Applicative G A, B: Type f: A -> G B
traverse f = traverse f
reflexivity.Qed.
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B: Type f: A -> B
map f = runBatch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B: Type f: A -> B
map f = runBatch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B: Type f: A -> B
traverse f = runBatch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B: Type f: A -> B
runBatch f ∘ toBatch = runBatch f ∘ toBatch
reflexivity.Qed.
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forallA : Type, id = runBatch id ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forallA : Type, id = runBatch id ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A: Type
id = runBatch id ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A: Type
traverse id = runBatch id ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A: Type
runBatch id ∘ toBatch = runBatch id ∘ toBatch
reflexivity.Qed.(** ** Naturality of <<toBatch>> *)(********************************************************************)
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forall (ABA' : Type) (f : A -> B),
toBatch ∘ map f = mapfst_Batch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forall (ABA' : Type) (f : A -> B),
toBatch ∘ map f = mapfst_Batch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B, A': Type f: A -> B
toBatch ∘ map f = mapfst_Batch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B, A': Type f: A -> B
traverse (batch B A') ∘ map f =
mapfst_Batch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B, A': Type f: A -> B
traverse (batch B A' ∘ f) = mapfst_Batch f ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B, A': Type f: A -> B
traverse (batch B A' ∘ f) =
mapfst_Batch f ∘ traverse (batch A A')
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B, A': Type f: A -> B
traverse (batch B A' ∘ f) =
traverse (mapfst_Batch f ∘ batch A A')
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, B, A': Type f: A -> B
traverse (batch B A' ∘ f) = traverse (batch B A' ∘ f)
reflexivity.Qed.
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forall (XAA' : Type) (f : A -> A'),
mapsnd_Batch f ∘ toBatch = map (map f) ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forall (XAA' : Type) (f : A -> A'),
mapsnd_Batch f ∘ toBatch = map (map f) ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T X, A, A': Type f: A -> A'
mapsnd_Batch f ∘ toBatch = map (map f) ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T X, A, A': Type f: A -> A'
mapsnd_Batch f ∘ traverse (batch X A') =
map (map f) ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T X, A, A': Type f: A -> A'
traverse (mapsnd_Batch f ∘ batch X A') =
map (map f) ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T X, A, A': Type f: A -> A'
traverse (map f ∘ batch X A) = map (map f) ∘ toBatch
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T X, A, A': Type f: A -> A'
traverse (map f ∘ batch X A) =
map (map f) ∘ traverse (batch X A)
T: Type -> Type H: Map T H0: ToBatch T H1: Traverse T H2: Kleisli.TraversableFunctor.TraversableFunctor T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T X, A, A': Type f: A -> A'
traverse (map f ∘ batch X A) =
traverse (map f ∘ batch X A)
reflexivity.Qed.Endfactorize_operations.(** * Traversals by Particular Applicative Functors *)(**********************************************************************)(** ** Product of Two Applicative Functors *)(**********************************************************************)Sectiontraverse_applicative_product.Definitionapplicative_arrow_combine {FGAB}
`(f: A -> F B) `(g: A -> G B): A -> (F ◻ G) B :=
funa => product (f a) (g a).#[local] Notation"f <◻> g" :=
(applicative_arrow_combine f g) (at level60): tealeaves_scope.Context
`{TraversableFunctor T}
`{Map T}
`{! Compat_Map_Traverse T}
`{Applicative G1}
`{Applicative G2}.Variables
(AB: Type)
(f: A -> G1 B)
(g: A -> G2 B).
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B
forallt : T A,
pi1 (traverse (f <◻> g) t) = traverse f t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B
forallt : T A,
pi1 (traverse (f <◻> g) t) = traverse f t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A
pi1 (traverse (f <◻> g) t) = traverse f t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A a:= ApplicativeMorphism_pi1 G1 G2: ApplicativeMorphism (G1 ◻ G2) G1 (@pi1 G1 G2)
pi1 (traverse (f <◻> g) t) = traverse f t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A a:= ApplicativeMorphism_pi1 G1 G2: ApplicativeMorphism (G1 ◻ G2) G1 (@pi1 G1 G2)
(pi1 ∘ traverse (f <◻> g)) t = traverse f t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A a:= ApplicativeMorphism_pi1 G1 G2: ApplicativeMorphism (G1 ◻ G2) G1 (@pi1 G1 G2)
traverse (pi1 ∘ (f <◻> g)) t = traverse f t
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B
forallt : T A,
pi2 (traverse (f <◻> g) t) = traverse g t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B
forallt : T A,
pi2 (traverse (f <◻> g) t) = traverse g t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A
pi2 (traverse (f <◻> g) t) = traverse g t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A a:= ApplicativeMorphism_pi2 G1 G2: ApplicativeMorphism (G1 ◻ G2) G2 (@pi2 G1 G2)
pi2 (traverse (f <◻> g) t) = traverse g t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A a:= ApplicativeMorphism_pi2 G1 G2: ApplicativeMorphism (G1 ◻ G2) G2 (@pi2 G1 G2)
(pi2 ∘ traverse (f <◻> g)) t = traverse g t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A a:= ApplicativeMorphism_pi2 G1 G2: ApplicativeMorphism (G1 ◻ G2) G2 (@pi2 G1 G2)
traverse (pi2 ∘ (f <◻> g)) t = traverse g t
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B
traverse (f <◻> g) = traverse f <◻> traverse g
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B
traverse (f <◻> g) = traverse f <◻> traverse g
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B
traverse (f <◻> g) = traverse f <◻> traverse g
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A
traverse (f <◻> g) t = (traverse f <◻> traverse g) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A
traverse (f <◻> g) t =
product (traverse f t) (traverse g t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A
traverse (f <◻> g) t =
product (pi1 (traverse (f <◻> g) t)) (traverse g t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T G1: Type -> Type Map_G: Map G1 Pure_G: Pure G1 Mult_G: Mult G1 H1: Applicative G1 G2: Type -> Type Map_G0: Map G2 Pure_G0: Pure G2 Mult_G0: Mult G2 H2: Applicative G2 A, B: Type f: A -> G1 B g: A -> G2 B t: T A
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M
forall (AB : Type) (f : A -> M),
traverse f = traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M
forall (AB : Type) (f : A -> M),
traverse f = traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M A, B: Type f: A -> M
traverse f = traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M A, B: Type f: A -> M
map (map exfalso) ∘ traverse (f : A -> const M False) =
traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M A, B: Type f: A -> M
traverse (map exfalso ∘ f) = traverse f
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M
forall (A : Type) (f : A -> M) (fake1fake2 : Type),
traverse f = traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M
forall (A : Type) (f : A -> M) (fake1fake2 : Type),
traverse f = traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M A: Type f: A -> M fake1, fake2: Type
traverse f = traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M A: Type f: A -> M fake1, fake2: Type
traverse f = traverse f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M A: Type f: A -> M fake1, fake2: Type
traverse f = traverse f
reflexivity.Qed.Endconstant_applicatives.(** ** Traversals by Commutative Applicatives *)(**********************************************************************)Sectiontraversals_commutative.Import Coalgebraic.TraversableFunctor.Import KleisliToCoalgebraic.TraversableFunctor.Import KleisliToCoalgebraic.TraversableFunctor.DerivedOperations.
forall (T : Type -> Type) (Traverse_T : Traverse T),
Kleisli.TraversableFunctor.TraversableFunctor T ->
forall (G : Type -> Type) (mapG : Map G)
(pureG : Pure G) (multG : Mult G),
ApplicativeCommutative G ->
forall (AB : Type) (f : A -> G B),
forwards ∘ traverse (mkBackwards ∘ f) = traverse f
forall (T : Type -> Type) (Traverse_T : Traverse T),
Kleisli.TraversableFunctor.TraversableFunctor T ->
forall (G : Type -> Type) (mapG : Map G)
(pureG : Pure G) (multG : Mult G),
ApplicativeCommutative G ->
forall (AB : Type) (f : A -> G B),
forwards ∘ traverse (mkBackwards ∘ f) = traverse f
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B
forwards ∘ traverse (mkBackwards ∘ f) = traverse f
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A
(forwards ∘ traverse (mkBackwards ∘ f)) t =
traverse f t
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A
forwards (traverse (mkBackwards ○ f) t) = traverse f t
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A
forwards ((runBatch (mkBackwards ○ f) ∘ toBatch) t) =
(runBatch f ∘ toBatch) t
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A C: Type c: C
forwards (runBatch (mkBackwards ○ f) (Done c)) =
runBatch f (Done c)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A C: Type b: Batch A B (B -> C) a: A IHb: forwards (runBatch (mkBackwards ○ f) b) =
runBatch f b
forwards (runBatch (mkBackwards ○ f) (Step b a)) =
runBatch f (Step b a)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A C: Type c: C
forwards (runBatch (mkBackwards ○ f) (Done c)) =
runBatch f (Done c)
reflexivity.
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A C: Type b: Batch A B (B -> C) a: A IHb: forwards (runBatch (mkBackwards ○ f) b) =
runBatch f b
forwards (runBatch (mkBackwards ○ f) (Step b a)) =
runBatch f (Step b a)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A C: Type b: Batch A B (B -> C) a: A IHb: forwards (runBatch (mkBackwards ○ f) b) =
runBatch f b
forwards
(runBatch (mkBackwards ○ f) b <⋆>
{| forwards := f a |}) = runBatch f (Step b a)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A C: Type b: Batch A B (B -> C) a: A IHb: forwards (runBatch (mkBackwards ○ f) b) =
runBatch f b
map evalAt (forwards {| forwards := f a |}) <⋆>
forwards (runBatch (mkBackwards ○ f) b) =
runBatch f (Step b a)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A C: Type b: Batch A B (B -> C) a: A IHb: forwards (runBatch (mkBackwards ○ f) b) =
runBatch f b
map evalAt (forwards {| forwards := f a |}) <⋆>
runBatch f b = runBatch f (Step b a)
(* RHS *)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A C: Type b: Batch A B (B -> C) a: A IHb: forwards (runBatch (mkBackwards ○ f) b) =
runBatch f b
map evalAt (forwards {| forwards := f a |}) <⋆>
runBatch f b = runBatch f b <⋆> f a
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T G: Type -> Type mapG: Map G pureG: Pure G multG: Mult G H0: ApplicativeCommutative G A, B: Type f: A -> G B t: T A C: Type b: Batch A B (B -> C) a: A IHb: forwards (runBatch (mkBackwards ○ f) b) =
runBatch f b
runBatch f b <⋆> f a = runBatch f b <⋆> f a
reflexivity.Qed.Endtraversals_commutative.(*(** ** Traversals by Subset *)(**********************************************************************)Section traversals_by_subset. Import Coalgebraic.TraversableFunctor. Import KleisliToCoalgebraic.TraversableFunctor. Lemma traverse_by_subset: forall `{Kleisli.TraversableFunctor.TraversableFunctor T} `{ToBatch T} `{! Compat_ToBatch_Traverse T} (A B: Type) (f: A -> subset B), forwards ∘ traverse (T := T) (G := Backwards subset) (mkBackwards ∘ f) = traverse (T := T) f. Proof. intros. rewrite traverse_commutative. intros. ext t. unfold compose. do 2 rewrite traverse_through_runBatch. unfold compose. induction (toBatch t). - reflexivity. - cbn. rewrite IHb. unfold ap. ext c. unfold_ops @Mult_subset. unfold_ops @Map_subset. propext. { intros [[mk b'] [[[b'' c'] [rest1 rest2]] Heq]]. cbn in rest2. inversion rest2. subst. exists (mk, b'). tauto. } { intros [[mk b'] [rest1 rest2]]. subst. exists (mk, b'). split; auto. exists (b', mk). tauto. } Qed.End traversals_by_subset.*)(** * Derived Operation: <<mapReduce>> *)(**********************************************************************)(** ** Operation <<mapReduce>> *)(**********************************************************************)DefinitionmapReduce
{T: Type -> Type}
`{Traverse T}
`{op: Monoid_op M} `{unit: Monoid_unit M}
{A: Type} (f: A -> M): T A -> M :=
traverse (G := const M) (B := False) f.SectionmapReduce.(** ** As a Special Case of <<traverse>> *)(********************************************************************)Sectionto_traverse.Context
`{Traverse T}
`{! TraversableFunctor T}.
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M
forall (A : Type) (f : A -> M),
mapReduce f = traverse f
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M
forall (A : Type) (f : A -> M),
mapReduce f = traverse f
reflexivity.Qed.
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M
forall (fakeA : Type) (f : A -> M),
mapReduce f = traverse f
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M
forall (fakeA : Type) (f : A -> M),
mapReduce f = traverse f
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M fake, A: Type f: A -> M
mapReduce f = traverse f
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M fake, A: Type f: A -> M
traverse f = traverse f
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M fake, A: Type f: A -> M
traverse f = traverse f
reflexivity.Qed.(** ** Composition with <<map>> and <<traverse>> *)(******************************************************************)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M G: Type -> Type B: Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H1: Applicative G
forall (g : B -> M) (A : Type) (f : A -> G B),
map (mapReduce g) ∘ traverse f = mapReduce (map g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M G: Type -> Type B: Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H1: Applicative G
forall (g : B -> M) (A : Type) (f : A -> G B),
map (mapReduce g) ∘ traverse f = mapReduce (map g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M G: Type -> Type B: Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H1: Applicative G g: B -> M A: Type f: A -> G B
map (mapReduce g) ∘ traverse f = mapReduce (map g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M G: Type -> Type B: Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H1: Applicative G g: B -> M A: Type f: A -> G B
map (traverse g) ∘ traverse f = mapReduce (map g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M G: Type -> Type B: Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H1: Applicative G g: B -> M A: Type f: A -> G B
traverse (g ⋆2 f) = mapReduce (map g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M G: Type -> Type B: Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H1: Applicative G g: B -> M A: Type f: A -> G B
traverse (g ⋆2 f) = traverse (map g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M G: Type -> Type B: Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H1: Applicative G g: B -> M A: Type f: A -> G B
traverse (g ⋆2 f) = traverse (map g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T M: Type op: Monoid_op M unit0: Monoid_unit M H0: Monoid M G: Type -> Type B: Type Map_G: Map G Pure_G: Pure G Mult_G: Mult G H1: Applicative G g: B -> M A: Type f: A -> G B
traverse (g ⋆2 f) = traverse (map g ∘ f)
reflexivity.Qed.
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M
forall (B : Type) (g : B -> M) (A : Type) (f : A -> B),
mapReduce g ∘ map f = mapReduce (g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M
forall (B : Type) (g : B -> M) (A : Type) (f : A -> B),
mapReduce g ∘ map f = mapReduce (g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M B: Type g: B -> M A: Type f: A -> B
mapReduce g ∘ map f = mapReduce (g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M B: Type g: B -> M A: Type f: A -> B
mapReduce g ∘ traverse f = mapReduce (g ∘ f)
T: Type -> Type H: Traverse T TraversableFunctor0: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M B: Type g: B -> M A: Type f: A -> B
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M
forallf : A -> M, mapReduce f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M
forallf : A -> M, mapReduce f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M f: A -> M
mapReduce f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M f: A -> M
traverse f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M f: A -> M
runBatch f ∘ toBatch = runBatch f ∘ toBatch
reflexivity.Qed.
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M
forall (Afake : Type) (f : A -> M),
mapReduce f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M
forall (Afake : Type) (f : A -> M),
mapReduce f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M
mapReduce f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M
traverse f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M
traverse f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M
traverse f = runBatch f ∘ toBatch
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M
runBatch f ∘ toBatch = runBatch f ∘ toBatch
reflexivity.Qed.(** ** Factorizing through <<toBatch>> *)(******************************************************************)
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M
forall (Afake : Type) (f : A -> M) (t : T A),
mapReduce f t = mapReduce f (toBatch t)
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M
forall (Afake : Type) (f : A -> M) (t : T A),
mapReduce f t = mapReduce f (toBatch t)
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M t: T A
mapReduce f t = mapReduce f (toBatch t)
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M t: T A
(runBatch f ∘ toBatch) t = mapReduce f (toBatch t)
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M t: T A
(map extract_Batch ∘ traverse f ∘ toBatch) t =
mapReduce f (toBatch t)
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M t: T A
((funt : const M (Batch fake fake (T fake)) => t)
∘ traverse f ∘ toBatch) t = mapReduce f (toBatch t)
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M t: T A
traverse f (toBatch t) = mapReduce f (toBatch t)
T: Type -> Type H: Traverse T H0: Kleisli.TraversableFunctor.TraversableFunctor T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H2: Monoid M A, fake: Type f: A -> M t: T A
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T
forall (AB : Type) (f : A -> B),
map f ∘ tolist = tolist ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type f: A -> B
map f ∘ tolist = tolist ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type f: A -> B
map f ∘ mapReduce ret = mapReduce ret ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type f: A -> B
mapReduce (map f ∘ ret) = mapReduce ret ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type f: A -> B
mapReduce (map f ∘ ret) = mapReduce (ret ∘ f)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type f: A -> B
mapReduce (ret ∘ map f) = mapReduce (ret ∘ f)
reflexivity.Qed.(** ** Rewriting <<tolist>> to <<traverse>> *)(********************************************************************)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T
forallA : Type, tolist = mapReduce ret
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T
forallA : Type, tolist = mapReduce ret
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T
forallA : Type, tolist = traverse ret
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T
forallA : Type, tolist = traverse ret
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T
forallAfake : Type, tolist = traverse ret
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T
forallAfake : Type, tolist = traverse ret
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, fake: Type
tolist = traverse ret
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, fake: Type
traverse ret = traverse ret
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, fake: Type
traverse ret = traverse ret
reflexivity.Qed.(** ** Factoring <<tolist>> through <<runBatch>> and <<toBatch>> *)(********************************************************************)Import Coalgebraic.TraversableFunctor.Import KleisliToCoalgebraic.TraversableFunctor.
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type t: T A
tolist t = tolist (toBatch t)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type t: T A
tolist t = tolist (toBatch t)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type t: T A
mapReduce ret t = tolist (toBatch t)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type t: T A
mapReduce ret (toBatch t) = tolist (toBatch t)
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type t: T A
tolist t =
runBatch (ret : A -> const (list A) tag) (toBatch t)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type t: T A
tolist t =
runBatch (ret : A -> const (list A) tag) (toBatch t)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type t: T A
traverse ret t = runBatch ret (toBatch t)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T H1: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type t: T A
(runBatch ret ∘ toBatch) t = runBatch ret (toBatch t)
reflexivity.Qed.(** ** Factoring any <<mapReduce>> through <<tolist>> *)(********************************************************************)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M
forall (A : Type) (f : A -> M),
mapReduce f = mapReduce f ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M
forall (A : Type) (f : A -> M),
mapReduce f = mapReduce f ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M A: Type f: A -> M
mapReduce f = mapReduce f ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M A: Type f: A -> M
mapReduce f = mapReduce f ∘ mapReduce ret
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M A: Type f: A -> M
mapReduce f = mapReduce_list f ∘ mapReduce ret
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M A: Type f: A -> M
mapReduce f = mapReduce (mapReduce_list f ∘ ret)
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T M: Type op: Monoid_op M unit0: Monoid_unit M H1: Monoid M A: Type f: A -> M
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
Natural (@tosubset T ToSubset_Traverse)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
Natural (@tosubset T ToSubset_Traverse)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
Functor T
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forall (AB : Type) (f : A -> B),
map f ∘ tosubset = tosubset ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forall (AB : Type) (f : A -> B),
map f ∘ tosubset = tosubset ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A, B: Type f: A -> B
map f ∘ tosubset = tosubset ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A, B: Type f: A -> B
map f ∘ mapReduce ret = mapReduce ret ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A, B: Type f: A -> B
mapReduce (map f ∘ ret) = mapReduce ret ∘ map f
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A, B: Type f: A -> B
mapReduce (map f ∘ ret) = mapReduce (ret ∘ f)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A, B: Type f: A -> B
mapReduce (ret ∘ map f) = mapReduce (ret ∘ f)
reflexivity.Qed.(** ** Rewriting <<tosubset>> to <<mapReduce>> *)(********************************************************************)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T ToSubset_inst: ToSubset T Traverse_inst: Traverse T H2: Compat_ToSubset_Traverse T
forallA : Type, tosubset = mapReduce ret
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T ToSubset_inst: ToSubset T Traverse_inst: Traverse T H2: Compat_ToSubset_Traverse T
forallA : Type, tosubset = mapReduce ret
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T ToSubset_inst: ToSubset T Traverse_inst: Traverse T H2: Compat_ToSubset_Traverse T
forallA : Type, ToSubset_Traverse A = mapReduce ret
reflexivity.Qed.(** ** Factoring <<tosubset>> through <<tolist>> *)(********************************************************************)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forallA : Type, tosubset = tosubset ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forallA : Type, tosubset = tosubset ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type
tosubset = tosubset ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type
mapReduce ret = tosubset ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type
mapReduce ret ∘ tolist = tosubset ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type t: T A
(mapReduce ret ∘ tolist) t = (tosubset ∘ tolist) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type t: T A
mapReduce ret nil = tosubset nil
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type t: T A a: A l: list A IHl: mapReduce ret l = tosubset l
mapReduce ret (a :: l) = tosubset (a :: l)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type t: T A
mapReduce ret nil = tosubset nil
reflexivity.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type t: T A a: A l: list A IHl: mapReduce ret l = tosubset l
mapReduce ret (a :: l) = tosubset (a :: l)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type t: T A a: A l: list A IHl: mapReduce ret l = tosubset l
(pure cons ● ret a) ● mapReduce ret l =
tosubset (a :: l)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type t: T A a: A l: list A IHl: mapReduce ret l = tosubset l
(pure cons ● ret a) ● tosubset l = tosubset (a :: l)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type t: T A a: A l: list A IHl: mapReduce ret l = tosubset l
Ƶ ∪ (funb : A => a = b) ∪ (funa : A => List.In a l) =
(funa0 : A => List.In a0 (a :: l))
now simpl_subset.Qed.(** ** Rewriting <<a ∈ t>> to <<mapReduce>> *)(********************************************************************)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forall (A : Type) (a : A),
element_of a = mapReduce {{a}}
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forall (A : Type) (a : A),
element_of a = mapReduce {{a}}
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A
element_of a = mapReduce {{a}}
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A
(funt : T A => tosubset t a) = mapReduce {{a}}
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A
(funt : T A => mapReduce ret t a) = mapReduce {{a}}
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
mapReduce ret t a = mapReduce {{a}} t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
evalAt a (mapReduce ret t) = mapReduce {{a}} t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
(evalAt a ∘ mapReduce ret) t = mapReduce {{a}} t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
mapReduce (evalAt a ∘ ret) t = mapReduce {{a}} t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
evalAt a ∘ ret = {{a}}
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A b: A
(evalAt a ∘ ret) b = {{a}} b
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A b: A
(b = a) = (a = b)
now propext.Qed.(** ** Factoring <<a ∈ t>> through <<tolist>> *)(********************************************************************)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forall (A : Type) (a : A),
element_of a = element_of a ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forall (A : Type) (a : A),
element_of a = element_of a ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A
element_of a = element_of a ∘ tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
a ∈ t = (element_of a ∘ tolist) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
a ∈ t = a ∈ tolist t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
tosubset t a = tosubset (tolist t) a
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
(tosubset ∘ tolist) t a = tosubset (tolist t) a
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forall (A : Type) (a : A) (t : T A),
a ∈ t <-> a ∈ tolist t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T
forall (A : Type) (a : A) (t : T A),
a ∈ t <-> a ∈ tolist t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type a: A t: T A
a ∈ t <-> a ∈ tolist t
nowrewrite element_of_through_tolist.Qed.(** ** Factoring <<tosubset>> through <<runBatch>> *)(********************************************************************)Import Coalgebraic.TraversableFunctor.Import KleisliToCoalgebraic.TraversableFunctor.
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forallA : Type, tosubset = runBatch ret ∘ toBatch
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forallA : Type, tosubset = runBatch ret ∘ toBatch
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A: Type
tosubset = runBatch ret ∘ toBatch
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A: Type
mapReduce ret = runBatch ret ∘ toBatch
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A: Type
runBatch ret ∘ toBatch = runBatch ret ∘ toBatch
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forallAtag : Type, tosubset = runBatch ret ∘ toBatch
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T
forallAtag : Type, tosubset = runBatch ret ∘ toBatch
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type
tosubset = runBatch ret ∘ toBatch
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type
mapReduce ret = runBatch ret ∘ toBatch
T: Type -> Type Traverse_T: Traverse T H: Kleisli.TraversableFunctor.TraversableFunctor T H0: Map T H1: ToSubset T Compat_Map_Traverse0: Compat_Map_Traverse T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T H2: ToBatch T Compat_ToBatch_Traverse0: Compat_ToBatch_Traverse T A, tag: Type
runBatch ret ∘ toBatch = runBatch ret ∘ toBatch
reflexivity.Qed.Endelements.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
Compat_ToSubset_Tolist T
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
Compat_ToSubset_Tolist T
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
@tosubset T ToSubset_Traverse =
@tosubset T ToSubset_Tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
(funA : Type => mapReduce ret) =
@tosubset T ToSubset_Tolist
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
(funA : Type => mapReduce ret) =
(funA : Type => tosubset ∘ tolist)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
(funA : Type => mapReduce ret) =
(funA : Type => tosubset ∘ mapReduce ret)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type
mapReduce ret = tosubset ∘ mapReduce ret
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type
mapReduce ret = mapReduce (tosubset ∘ ret)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type
mapReduce ret = mapReduce ret
reflexivity.Qed.(** * <<mapReduce>> Corollary: <<Forall, Forany>> *)(**********************************************************************)Sectionquantification.Context
`{TraversableFunctor T}
`{! ToSubset T}
`{! Compat_ToSubset_Traverse T}.(** ** Operations <<Forall>> and <<Forany>> *)(********************************************************************)DefinitionForall `(P: A -> Prop): T A -> Prop :=
@mapReduce T _ Prop Monoid_op_and Monoid_unit_true A P.DefinitionForany `(P: A -> Prop): T A -> Prop :=
@mapReduce T _ Prop Monoid_op_or Monoid_unit_false A P.(** ** Specification via <<element_of>> *)(********************************************************************)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forall P t <-> (foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forall P t <-> (foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce P t <-> (foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
(mapReduce P ∘ tolist) t <->
(foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce P (tolist t) <->
(foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce P (tolist t) <->
(foralla : A, a ∈ tolist t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce_list P (tolist t) <->
(foralla : A, a ∈ tolist t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce_list P nil <->
(foralla : A, a ∈ nil -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(foralla : A, a ∈ l -> P a)
mapReduce_list P (a :: l) <->
(foralla0 : A, a0 ∈ (a :: l) -> P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce_list P nil <->
(foralla : A, a ∈ nil -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Ƶ <-> (foralla : A, a ∈ nil -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
True <-> (foralla : A, a ∈ nil -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
True <-> (foralla : A, a ∈ nil -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
True <-> (foralla : A, False -> P a)
intuition.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(foralla : A, a ∈ l -> P a)
mapReduce_list P (a :: l) <->
(foralla0 : A, a0 ∈ (a :: l) -> P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(foralla : A, a ∈ l -> P a)
P a ● mapReduce_list P l <->
(foralla0 : A, a0 ∈ (a :: l) -> P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(foralla : A, a ∈ l -> P a)
P a /\ mapReduce_list P l <->
(foralla0 : A, a0 ∈ (a :: l) -> P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(foralla : A, a ∈ l -> P a)
P a /\ mapReduce_list P l <->
(foralla0 : A, a0 ∈ (a :: l) -> P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(foralla : A, a ∈ l -> P a)
P a /\ mapReduce_list P l <->
(foralla0 : A, a0 ∈ (a :: l) -> P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(foralla : A, a ∈ l -> P a)
P a /\ (foralla : A, a ∈ l -> P a) <->
(foralla0 : A, a0 ∈ (a :: l) -> P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(foralla : A, a ∈ l -> P a)
P a /\ (foralla : A, a ∈ l -> P a) <->
(foralla0 : A, a0 = a \/ a0 ∈ l -> P a0)
T: Type -> Type Traverse_T: Traverse T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A trf_traverse_id: forallA : Type, traverse id = id trf_traverse_traverse: forall (G1 : Type -> Type)
(Map_G : Map G1)
(Pure_G : Pure G1)
(Mult_G : Mult G1),
Applicative G1 ->
forall (G2 : Type -> Type)
(Map_G0 : Map G2)
(Pure_G0 : Pure G2)
(Mult_G0 : Mult G2),
Applicative G2 ->
forall (ABC : Type)
(g : B -> G2 C)
(f : A -> G1 B),
map (traverse g) ∘ traverse f =
traverse (g ⋆2 f) trf_traverse_morphism: forall (G1G2 : Type -> Type)
(H : Map G1) (H0 : Mult G1)
(H1 : Pure G1) (H2 : Map G2)
(H3 : Mult G2)
(H4 : Pure G2)
(ϕ : forallA : Type,
G1 A -> G2 A),
ApplicativeMorphism G1 G2 ϕ ->
forall (AB : Type)
(f : A -> G1 B),
ϕ (T B) ∘ traverse f =
traverse (ϕ B ∘ f) a0: A H: P a H3: foralla : A, a ∈ l -> P a H2: a0 = a H1: mapReduce_list P l H0: foralla : A, a ∈ l -> P a
P a0
nowsubst.Qed.(* More useful for rewriting *)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forall P t = (foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forall P t = (foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forall P t <-> (foralla : A, a ∈ t -> P a)
apply forall_iff.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forany P t <-> (existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forany P t <-> (existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce P t <-> (existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
(mapReduce P ∘ tolist) t <->
(existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
(mapReduce_list P ∘ tolist) t <->
(existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce_list P (tolist t) <->
(existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce_list P (tolist t) <->
(existsa : A, a ∈ tolist t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce_list P nil <->
(existsa : A, a ∈ nil /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
mapReduce_list P (a :: l) <->
(existsa0 : A, a0 ∈ (a :: l) /\ P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
mapReduce_list P nil <->
(existsa : A, a ∈ nil /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Ƶ <-> (existsa : A, a ∈ nil /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
False <-> (existsa : A, a ∈ nil /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
False <-> (existsa : A, False /\ P a)
firstorder.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
mapReduce_list P (a :: l) <->
(existsa0 : A, a0 ∈ (a :: l) /\ P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
P a ● mapReduce_list P l <->
(existsa0 : A, a0 ∈ (a :: l) /\ P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
P a \/ mapReduce_list P l <->
(existsa0 : A, a0 ∈ (a :: l) /\ P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
P a \/ mapReduce_list P l <->
(existsa0 : A, a0 ∈ (a :: l) /\ P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
P a \/ mapReduce_list P l <->
(existsa0 : A, a0 ∈ (a :: l) /\ P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
P a \/ (existsa : A, a ∈ l /\ P a) <->
(existsa0 : A, a0 ∈ (a :: l) /\ P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
P a \/ (existsa : A, a ∈ l /\ P a) <->
(existsa0 : A, (a0 = a \/ a0 ∈ l) /\ P a0)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
P a \/ (existsa : A, a ∈ l /\ P a) ->
existsa0 : A, (a0 = a \/ a0 ∈ l) /\ P a0
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
(existsa0 : A, (a0 = a \/ a0 ∈ l) /\ P a0) ->
P a \/ (existsa : A, a ∈ l /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
P a \/ (existsa : A, a ∈ l /\ P a) ->
existsa0 : A, (a0 = a \/ a0 ∈ l) /\ P a0
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) hyp: P a
existsa0 : A, (a0 = a \/ a0 ∈ l) /\ P a0
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) hyp: existsa : A, a ∈ l /\ P a
existsa0 : A, (a0 = a \/ a0 ∈ l) /\ P a0
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) hyp: P a
existsa0 : A, (a0 = a \/ a0 ∈ l) /\ P a0
eauto.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) hyp: existsa : A, a ∈ l /\ P a
existsa0 : A, (a0 = a \/ a0 ∈ l) /\ P a0
firstorder.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a)
(existsa0 : A, (a0 = a \/ a0 ∈ l) /\ P a0) ->
P a \/ (existsa : A, a ∈ l /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) a': A hyp: a' = a rest: P a'
P a \/ (existsa : A, a ∈ l /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) a': A hyp: a' ∈ l rest: P a'
P a \/ (existsa : A, a ∈ l /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) a': A hyp: a' = a rest: P a'
P a \/ (existsa : A, a ∈ l /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) rest: P a
P a \/ (existsa : A, a ∈ l /\ P a)
nowleft.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) a': A hyp: a' ∈ l rest: P a'
P a \/ (existsa : A, a ∈ l /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) a': A hyp: a' ∈ l rest: P a'
existsa : A, a ∈ l /\ P a
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A a: A l: list A IHl: mapReduce_list P l <->
(existsa : A, a ∈ l /\ P a) a': A hyp: a' ∈ l rest: P a'
a' ∈ l /\ P a'
auto.Qed.(* More useful for rewriting *)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forany P t = (existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forany P t = (existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop t: T A
Forany P t <-> (existsa : A, a ∈ t /\ P a)
apply forany_iff.Qed.(** ** Decidability of <<Forall>> and <<Forany>> *)(**********************************************************************)Sectiondecidability.Definitiondecidable_pred {A: Type} (P: A -> Prop) :=
foralla, decidable (P a).
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop X: decidable_pred P a1, a2: A
(~ (P a1 /\ P a2)) = (~ P a1 \/ ~ P a2)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop X: decidable_pred P a1, a2: A
(~ (P a1 /\ P a2)) = (~ P a1 \/ ~ P a2)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop X: decidable_pred P a1, a2: A
~ (P a1 /\ P a2) -> ~ P a1 \/ ~ P a2
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop X: decidable_pred P a1, a2: A
~ P a1 \/ ~ P a2 -> ~ (P a1 /\ P a2)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop X: decidable_pred P a1, a2: A
~ (P a1 /\ P a2) -> ~ P a1 \/ ~ P a2
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop X: decidable_pred P a1, a2: A
decidable (P a1)
apply (X a1).
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop X: decidable_pred P a1, a2: A
~ P a1 \/ ~ P a2 -> ~ (P a1 /\ P a2)
intros [Case1|Case2]; intuition.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P
decidable_pred (Forall P)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P
decidable_pred (Forall P)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable (Forall P t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
Forall P t \/ ~ Forall P t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
mapReduce P t \/ ~ mapReduce P t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
(mapReduce P ∘ tolist) t \/ ~ (mapReduce P ∘ tolist) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
(mapReduce_list P ∘ tolist) t \/
~ (mapReduce_list P ∘ tolist) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
mapReduce_list P (tolist t) \/
~ mapReduce_list P (tolist t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
mapReduce_list P nil \/ ~ mapReduce_list P nil
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A rest: list A IHrest: mapReduce_list P rest \/
~ mapReduce_list P rest
mapReduce_list P (a :: rest) \/
~ mapReduce_list P (a :: rest)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
mapReduce_list P nil \/ ~ mapReduce_list P nil
nowleft.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A rest: list A IHrest: mapReduce_list P rest \/
~ mapReduce_list P rest
mapReduce_list P (a :: rest) \/
~ mapReduce_list P (a :: rest)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A rest: list A IHrest: mapReduce_list P rest \/
~ mapReduce_list P rest
P a ● mapReduce_list P rest \/
~ P a ● mapReduce_list P rest
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A rest: list A IHrest: mapReduce_list P rest \/
~ mapReduce_list P rest
P a /\ mapReduce_list P rest \/
~ (P a /\ mapReduce_list P rest)
destruct IHrest as [yes_rest | no_rest];
destruct (Dec a) as [yes_a | no_a]; tauto.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P
decidable_pred (Forany P)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P
decidable_pred (Forany P)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable (Forany P t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
Forany P t \/ ~ Forany P t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
mapReduce P t \/ ~ mapReduce P t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
(mapReduce P ∘ tolist) t \/ ~ (mapReduce P ∘ tolist) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
(mapReduce_list P ∘ tolist) t \/
~ (mapReduce_list P ∘ tolist) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
mapReduce_list P (tolist t) \/
~ mapReduce_list P (tolist t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
mapReduce_list P nil \/ ~ mapReduce_list P nil
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A rest: list A IHrest: mapReduce_list P rest \/
~ mapReduce_list P rest
mapReduce_list P (a :: rest) \/
~ mapReduce_list P (a :: rest)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
mapReduce_list P nil \/ ~ mapReduce_list P nil
nowright.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A rest: list A IHrest: mapReduce_list P rest \/
~ mapReduce_list P rest
mapReduce_list P (a :: rest) \/
~ mapReduce_list P (a :: rest)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A rest: list A IHrest: mapReduce_list P rest \/
~ mapReduce_list P rest
P a ● mapReduce_list P rest \/
~ P a ● mapReduce_list P rest
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A rest: list A IHrest: mapReduce_list P rest \/
~ mapReduce_list P rest
(P a \/ mapReduce_list P rest) \/
~ (P a \/ mapReduce_list P rest)
destruct IHrest as [yes_rest | no_rest];
destruct (Dec a) as [yes_a | no_a]; tauto.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable (foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable (foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable (Forall P t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable_pred P
assumption.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable (existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable (existsa : A, a ∈ t /\ P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable (Forany P t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
decidable_pred P
assumption.Qed.Enddecidability.(** ** Corollaries of decidability *)(**********************************************************************)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ Forall P t -> Forany (not ∘ P) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ Forall P t -> Forany (not ∘ P) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ mapReduce P t -> mapReduce (not ∘ P) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ (mapReduce P ∘ tolist) t -> mapReduce (not ∘ P) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ (mapReduce P ∘ tolist) t ->
(mapReduce (not ∘ P) ∘ tolist) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ mapReduce P nil -> mapReduce (not ○ P) nil
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A l: list A IHl: ~ mapReduce P l -> mapReduce (not ○ P) l
~ mapReduce P (a :: l) -> mapReduce (not ○ P) (a :: l)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ mapReduce P nil -> mapReduce (not ○ P) nil
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
(True -> False) -> False
firstorder.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A l: list A IHl: ~ mapReduce P l -> mapReduce (not ○ P) l
~ mapReduce P (a :: l) -> mapReduce (not ○ P) (a :: l)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A l: list A IHl: ~ mapReduce_list P l ->
mapReduce_list (not ○ P) l
~ mapReduce_list P (a :: l) ->
mapReduce_list (not ○ P) (a :: l)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A l: list A IHl: ~ mapReduce_list P l ->
mapReduce_list (not ○ P) l
~ P a ● mapReduce_list P l ->
(~ P a) ● mapReduce_list (not ○ P) l
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A l: list A IHl: ~ mapReduce_list P l ->
mapReduce_list (not ○ P) l
~ (P a /\ mapReduce_list P l) ->
(~ P a) ● mapReduce_list (not ○ P) l
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A a: A l: list A IHl: ~ mapReduce_list P l ->
mapReduce_list (not ○ P) l
~ (P a /\ mapReduce_list P l) ->
~ P a \/ mapReduce_list (not ○ P) l
firstorder.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ Forall P t <-> Forany (not ∘ P) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ Forall P t <-> Forany (not ∘ P) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A
~ Forall P t <-> Forany (funa : A => P a -> False) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A YesAll: Forall P t
~ Forall P t <-> Forany (funa : A => P a -> False) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A NotAll: ~ Forall P t
~ Forall P t <-> Forany (funa : A => P a -> False) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A YesAll: Forall P t
~ Forall P t <-> Forany (funa : A => P a -> False) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A YesAll: Forall P t
~ Forall P t -> Forany (funa : A => P a -> False) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A YesAll: Forall P t
Forany (funa : A => P a -> False) t -> ~ Forall P t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A YesAll: Forall P t
~ Forall P t -> Forany (funa : A => P a -> False) t
contradiction.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A YesAll: Forall P t
Forany (funa : A => P a -> False) t -> ~ Forall P t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A YesAll: foralla : A, a ∈ t -> P a
(existsa : A, a ∈ t /\ (P a -> False)) ->
~ (foralla : A, a ∈ t -> P a)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A YesAll: foralla : A, a ∈ t -> P a a: A Hin: a ∈ t HP: P a -> False
False
intuition.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A NotAll: ~ Forall P t
~ Forall P t <-> Forany (funa : A => P a -> False) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A NotAll: ~ Forall P t
~ Forall P t -> Forany (funa : A => P a -> False) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A NotAll: ~ Forall P t
Forany (funa : A => P a -> False) t -> ~ Forall P t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A NotAll: ~ Forall P t
~ Forall P t -> Forany (funa : A => P a -> False) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A NotAll: ~ Forall P t
decidable_pred P
assumption.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T ToSubset0: ToSubset T Compat_ToSubset_Traverse0: Compat_ToSubset_Traverse T A: Type P: A -> Prop Dec: decidable_pred P t: T A NotAll: ~ Forall P t
Forany (funa : A => P a -> False) t -> ~ Forall P t
easy.Qed.Endquantification.(** * <<mapReduce>> Corollary: <<plength>> *)(**********************************************************************)From Tealeaves Require Import Misc.NaturalNumbers.Definitionplength `{Traverse T}: forall {A}, T A -> nat :=
funA => mapReduce (fun_ => 1).(** ** <<plength>> of a <<list>> *)(**********************************************************************)
forall (A : Type) (l : list A), plength l = length l
forall (A : Type) (l : list A), plength l = length l
A: Type l: list A
plength l = length l
A: Type
plength nil = length nil
A: Type a: A l: list A IHl: plength l = length l
plength (a :: l) = length (a :: l)
A: Type
plength nil = length nil
reflexivity.
A: Type a: A l: list A IHl: plength l = length l
plength (a :: l) = length (a :: l)
A: Type a: A l: list A IHl: plength l = length l
S (plength l) = S (length l)
nowrewrite IHl.Qed.(** ** Factoring <<plength>> through <<list>> *)(**********************************************************************)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
forall (A : Type) (t : T A),
plength t = length (tolist t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T
forall (A : Type) (t : T A),
plength t = length (tolist t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type t: T A
plength t = length (tolist t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type t: T A
mapReduce (fun_ : A => 1) t = length (tolist t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type t: T A
(mapReduce (fun_ : A => 1) ∘ tolist) t =
length (tolist t)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type t: T A
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type
forall (f : A -> B) (t : T A),
plength (map f t) = plength t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type
forall (f : A -> B) (t : T A),
plength (map f t) = plength t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type f: A -> B t: T A
plength (map f t) = plength t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type f: A -> B t: T A
(plength ∘ map f) t = plength t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type f: A -> B t: T A
(mapReduce (fun_ : B => 1) ∘ map f) t =
mapReduce (fun_ : A => 1) t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type f: A -> B t: T A
mapReduce ((fun_ : B => 1) ∘ f) t =
mapReduce (fun_ : A => 1) t
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A: Type
forallt : T A, plength (shape t) = plength t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A: Type
forallt : T A, plength (shape t) = plength t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A: Type t: T A
plength (shape t) = plength t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A: Type t: T A
plength (map (const tt) t) = plength t
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A: Type t: T A
plength t = plength t
reflexivity.Qed.
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type
forall (t : T A) (u : T B),
shape t = shape u -> plength t = plength u
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type
forall (t : T A) (u : T B),
shape t = shape u -> plength t = plength u
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type t: T A u: T B Hshape: shape t = shape u
plength t = plength u
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type t: T A u: T B Hshape: shape t = shape u
plength (shape t) = plength u
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type t: T A u: T B Hshape: shape t = shape u
plength (shape t) = plength (shape u)
T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T H0: Map T Compat_Map_Traverse0: Compat_Map_Traverse T A, B: Type t: T A u: T B Hshape: shape t = shape u
plength (shape u) = plength (shape u)
reflexivity.Qed.Endnaturality_plength.(** * <<mapReduce>> by a Commutative Monoid *)(**********************************************************************)SectionmapReduce_commutative_monoid.Import List.ListNotations.#[local] Arguments mapReduce {T}%function_scope {H} {M}%type_scope
(op) {unit} {A}%type_scope f%function_scope _.
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type
forall (f : A -> M) (l : list A),
mapReduce op f l =
mapReduce (Monoid_op_Opposite op) f (List.rev l)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type
forall (f : A -> M) (l : list A),
mapReduce op f l =
mapReduce (Monoid_op_Opposite op) f (List.rev l)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M l: list A
mapReduce op f l =
mapReduce (Monoid_op_Opposite op) f (List.rev l)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M l: list A
mapReduce_list f l = mapReduce_list f (List.rev l)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M
mapReduce_list f [] = mapReduce_list f (List.rev [])
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M a: A l: list A IHl: mapReduce_list f l =
mapReduce_list f (List.rev l)
mapReduce_list f (a :: l) =
mapReduce_list f (List.rev (a :: l))
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M
mapReduce_list f [] = mapReduce_list f (List.rev [])
reflexivity.
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M a: A l: list A IHl: mapReduce_list f l =
mapReduce_list f (List.rev l)
mapReduce_list f (a :: l) =
mapReduce_list f (List.rev (a :: l))
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M a: A l: list A IHl: mapReduce_list f l =
mapReduce_list f (List.rev l)
f a ● mapReduce_list f l =
mapReduce_list f (List.rev (a :: l))
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M a: A l: list A IHl: mapReduce_list f l =
mapReduce_list f (List.rev l)
f a ● mapReduce_list f l =
mapReduce_list f (List.rev l ++ [a])
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M a: A l: list A IHl: mapReduce_list f l =
mapReduce_list f (List.rev l)
f a ● mapReduce_list f l =
mapReduce_list f (List.rev l) ● mapReduce_list f [a]
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M a: A l: list A IHl: mapReduce_list f l =
mapReduce_list f (List.rev l)
f a ● mapReduce_list f (List.rev l) =
mapReduce_list f (List.rev l) ● mapReduce_list f [a]
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M a: A l: list A IHl: mapReduce_list f l =
mapReduce_list f (List.rev l)
f a ● mapReduce_list f (List.rev l) =
mapReduce_list f [a] ● mapReduce_list f (List.rev l)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type f: A -> M a: A l: list A IHl: mapReduce_list f l =
mapReduce_list f (List.rev l)
f a ● mapReduce_list f (List.rev l) =
f a ● mapReduce_list f (List.rev l)
reflexivity.Qed.
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op
forall (f : A -> M) (l : list A),
mapReduce op f l = mapReduce op f (List.rev l)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op
forall (f : A -> M) (l : list A),
mapReduce op f l = mapReduce op f (List.rev l)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M l: list A
mapReduce op f l = mapReduce op f (List.rev l)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M
mapReduce op f [] = mapReduce op f (List.rev [])
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
mapReduce op f (a :: l) =
mapReduce op f (List.rev (a :: l))
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M
mapReduce op f [] = mapReduce op f (List.rev [])
reflexivity.
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
mapReduce op f (a :: l) =
mapReduce op f (List.rev (a :: l))
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
mapReduce_list f (a :: l) =
mapReduce_list f (List.rev (a :: l))
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
f a ● mapReduce_list f l =
mapReduce_list f (List.rev (a :: l))
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
mapReduce_list f l ● f a =
mapReduce_list f (List.rev (a :: l))
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
mapReduce_list f l ● f a =
mapReduce_list f (List.rev l ++ [a])
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
mapReduce_list f l ● f a =
mapReduce_list f (List.rev l) ● mapReduce_list f [a]
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
mapReduce_list f l ● f a =
mapReduce_list f (List.rev l) ● f a
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
mapReduce op f l ● f a =
mapReduce op f (List.rev l) ● f a
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M A: Type comm: CommutativeMonoidOp op f: A -> M a: A l: list A IHl: mapReduce op f l = mapReduce op f (List.rev l)
mapReduce op f (List.rev l) ● f a =
mapReduce op f (List.rev l) ● f a
reflexivity.Qed.
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M comm: CommutativeMonoidOp op T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type
forall (f : A -> M) (t : T A),
mapReduce op f t =
mapReduce (Monoid_op_Opposite op) f t
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M comm: CommutativeMonoidOp op T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type
forall (f : A -> M) (t : T A),
mapReduce op f t =
mapReduce (Monoid_op_Opposite op) f t
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M comm: CommutativeMonoidOp op T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type f: A -> M t: T A
mapReduce op f t =
mapReduce (Monoid_op_Opposite op) f t
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M comm: CommutativeMonoidOp op T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type f: A -> M t: T A
(mapReduce op f ∘ tolist) t =
mapReduce (Monoid_op_Opposite op) f t
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M comm: CommutativeMonoidOp op T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type f: A -> M t: T A
(mapReduce op f ∘ tolist) t =
(mapReduce (Monoid_op_Opposite op) f ∘ tolist) t
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M comm: CommutativeMonoidOp op T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type f: A -> M t: T A
mapReduce op f (tolist t) =
mapReduce (Monoid_op_Opposite op) f (tolist t)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M comm: CommutativeMonoidOp op T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type f: A -> M t: T A
mapReduce (Monoid_op_Opposite op) f
(List.rev (tolist t)) =
mapReduce (Monoid_op_Opposite op) f (tolist t)
M: Type unit: Monoid_unit M op: Monoid_op M Monoid0: Monoid M comm: CommutativeMonoidOp op T: Type -> Type Traverse_T: Traverse T H: TraversableFunctor T A: Type f: A -> M t: T A
mapReduce (Monoid_op_Opposite op) f (tolist t) =
mapReduce (Monoid_op_Opposite op) f (tolist t)