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.Functor
Classes.Kleisli.ContainerMonad
Classes.Kleisli.Monad.#[local] Generalizable VariablesU T A B.Import ContainerFunctor.Notations.(** * Derived Properties of <<ContainerMonad>> *)(**********************************************************************)Sectioncorollaries.Context
`{ContainerMonad T}
`{Map_inst: Map T}
`{! Compat_Map_Bind T T}.(** ** <<ret>> is Injective *)(********************************************************************)
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (A : Type) (aa' : A), ret a = ret a' -> a = a'
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (A : Type) (aa' : A), ret a = ret a' -> a = a'
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
a = a'
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
tosubset (ret a) = tosubset (ret a') -> a = a'
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
tosubset (ret a) = tosubset (ret a')
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
(tosubset ∘ ret) a = tosubset (ret a') -> a = a'
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
tosubset (ret a) = tosubset (ret a')
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
(tosubset ∘ ret) a = (tosubset ∘ ret) a' -> a = a'
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
tosubset (ret a) = tosubset (ret a')
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
ret a = ret a' -> a = a'
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
tosubset (ret a) = tosubset (ret a')
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a, a': A hyp: ret a = ret a'
tosubset (ret a) = tosubset (ret a')
nowrewrite hyp.Qed.(** ** Specification of <<a ∈ ret ->> *)(********************************************************************)
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (A : Type) (a1a2 : A), a1 ∈ ret a2 <-> a1 = a2
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (A : Type) (a1a2 : A), a1 ∈ ret a2 <-> a1 = a2
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a1, a2: A
a1 ∈ ret a2 <-> a1 = a2
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a1, a2: A
(element_of a1 ∘ ret) a2 <-> a1 = a2
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a1, a2: A
(evalAt a1 ∘ tosubset ∘ ret) a2 <-> a1 = a2
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a1, a2: A
(evalAt a1 ∘ (tosubset ∘ ret)) a2 <-> a1 = a2
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type a1, a2: A
(evalAt a1 ∘ ret) a2 <-> a1 = a2
easy.Qed.(** ** Specification of <<b ∈ bind f t>> *)(********************************************************************)
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (AB : Type) (f : A -> T B) (t : T A) (b : B),
b ∈ bind f t <-> (existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (AB : Type) (f : A -> T B) (t : T A) (b : B),
b ∈ bind f t <-> (existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A, B: Type f: A -> T B t: T A b: B
b ∈ bind f t <-> (existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A, B: Type f: A -> T B t: T A b: B
(element_of b ∘ bind f) t <->
(existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A, B: Type f: A -> T B t: T A b: B
(evalAt b ∘ tosubset ∘ bind f) t <->
(existsa : A, a ∈ t /\ (evalAt b ∘ tosubset) (f a))
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A, B: Type f: A -> T B t: T A b: B
(evalAt b ∘ (tosubset ∘ bind f)) t <->
(existsa : A, a ∈ t /\ (evalAt b ∘ tosubset) (f a))
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A, B: Type f: A -> T B t: T A b: B
(evalAt b ∘ (bind (tosubset ∘ f) ∘ tosubset)) t <->
(existsa : A, a ∈ t /\ (evalAt b ∘ tosubset) (f a))
reflexivity.Qed.(** ** Respectfulness Properties for <<bind>> *)(********************************************************************)(** This is just a more convenient name for consistency *)
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (AB : Type) (t : T A) (fg : A -> T B),
(foralla : A, a ∈ t -> f a = g a) ->
bind f t = bind g t
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (AB : Type) (t : T A) (fg : A -> T B),
(foralla : A, a ∈ t -> f a = g a) ->
bind f t = bind g t
exact contm_pointwise.Qed.
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (AB : Type) (f1 : A -> T B) (f2 : A -> B)
(t : T A),
(foralla : A, a ∈ t -> f1 a = ret (f2 a)) ->
bind f1 t = map f2 t
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (AB : Type) (f1 : A -> T B) (f2 : A -> B)
(t : T A),
(foralla : A, a ∈ t -> f1 a = ret (f2 a)) ->
bind f1 t = map f2 t
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A, B: Type f1: A -> T B f2: A -> B t: T A hyp: foralla : A, a ∈ t -> f1 a = ret (f2 a)
bind f1 t = map f2 t
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A, B: Type f1: A -> T B f2: A -> B t: T A hyp: foralla : A, a ∈ t -> f1 a = ret (f2 a)
bind f1 t = DerivedOperations.Map_Bind T T A B f2 t
noweapply bind_respectful.Qed.
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (A : Type) (f1 : A -> T A) (t : T A),
(foralla : A, a ∈ t -> f1 a = ret a) -> bind f1 t = t
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T
forall (A : Type) (f1 : A -> T A) (t : T A),
(foralla : A, a ∈ t -> f1 a = ret a) -> bind f1 t = t
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type f1: A -> T A t: T A hyp: foralla : A, a ∈ t -> f1 a = ret a
bind f1 t = t
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type f1: A -> T A t: T A hyp: foralla : A, a ∈ t -> f1 a = ret a
bind f1 t = id t
T: Type -> Type H: Bind T T H0: Return T H1: ToSubset T H2: ContainerMonad T Map_inst: Map T Compat_Map_Bind0: Compat_Map_Bind T T A: Type f1: A -> T A t: T A hyp: foralla : A, a ∈ t -> f1 a = ret a
bind f1 t = bind ret t
nowapply bind_respectful.Qed.Endcorollaries.(** * Derived Properties of <<ContainerRightModule>> *)(**********************************************************************)Sectioncorollaries.Context
`{Return T}
`{Module_inst: ContainerRightModule T U}
`{Map_U_inst: Map U}
`{! Compat_Map_Bind T U}.(** ** Specification of <<b ∈ bind f t>> *)(********************************************************************)
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U
forall (AB : Type) (f : A -> T B) (t : U A) (b : B),
b ∈ bind f t <-> (existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U
forall (AB : Type) (f : A -> T B) (t : U A) (b : B),
b ∈ bind f t <-> (existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A, B: Type f: A -> T B t: U A b: B
b ∈ bind f t <-> (existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A, B: Type f: A -> T B t: U A b: B
(element_of b ∘ bind f) t <->
(existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A, B: Type f: A -> T B t: U A b: B
(evalAt b ∘ tosubset ∘ bind f) t <->
(existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A, B: Type f: A -> T B t: U A b: B
(evalAt b ∘ (tosubset ∘ bind f)) t <->
(existsa : A, a ∈ t /\ b ∈ f a)
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A, B: Type f: A -> T B t: U A b: B
(evalAt b ∘ (bind (tosubset ∘ f) ∘ tosubset)) t <->
(existsa : A, a ∈ t /\ b ∈ f a)
reflexivity.Qed.(** ** Respectfulness Properties for <<bind>> *)(********************************************************************)
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U
forall (AB : Type) (t : U A) (fg : A -> T B),
(foralla : A, a ∈ t -> f a = g a) ->
bind f t = bind g t
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U
forall (AB : Type) (t : U A) (fg : A -> T B),
(foralla : A, a ∈ t -> f a = g a) ->
bind f t = bind g t
apply contmod_pointwise.Qed.
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U
forall (AB : Type) (f1 : A -> T B) (f2 : A -> B)
(t : U A),
(foralla : A, a ∈ t -> f1 a = ret (f2 a)) ->
bind f1 t = map f2 t
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U
forall (AB : Type) (f1 : A -> T B) (f2 : A -> B)
(t : U A),
(foralla : A, a ∈ t -> f1 a = ret (f2 a)) ->
bind f1 t = map f2 t
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A, B: Type f1: A -> T B f2: A -> B t: U A hyp: foralla : A, a ∈ t -> f1 a = ret (f2 a)
bind f1 t = map f2 t
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A, B: Type f1: A -> T B f2: A -> B t: U A hyp: foralla : A, a ∈ t -> f1 a = ret (f2 a)
bind f1 t = DerivedOperations.Map_Bind T U A B f2 t
noweapply mod_bind_respectful.Qed.
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U
forall (A : Type) (f1 : A -> T A) (t : U A),
(foralla : A, a ∈ t -> f1 a = ret a) -> bind f1 t = t
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U
forall (A : Type) (f1 : A -> T A) (t : U A),
(foralla : A, a ∈ t -> f1 a = ret a) -> bind f1 t = t
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A: Type f1: A -> T A t: U A hyp: foralla : A, a ∈ t -> f1 a = ret a
bind f1 t = t
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A: Type f1: A -> T A t: U A hyp: foralla : A, a ∈ t -> f1 a = ret a
bind f1 t = id t
T: Type -> Type H: Return T U: Type -> Type H0: Bind T T H1: Bind T U H2: Return T H3: ToSubset T H4: ToSubset U Module_inst: ContainerRightModule T U Map_U_inst: Map U Compat_Map_Bind0: Compat_Map_Bind T U A: Type f1: A -> T A t: U A hyp: foralla : A, a ∈ t -> f1 a = ret a