statement stringlengths 1 1.02k | proof stringlengths 0 5.19k | type stringclasses 13
values | symbolic_name stringlengths 1 30 | library stringclasses 15
values | filename stringclasses 117
values | imports listlengths 0 16 | deps listlengths 0 16 | docstring stringclasses 50
values | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
pmap_insert (p : positive) (v : T) (m : pmap) {struct p} : pmap | :=
match p with
| xH => Branch (Some v) (pmap_left m) (pmap_right m)
| xO p =>
Branch (pmap_here m) (pmap_insert p v (pmap_left m)) (pmap_right m)
| xI p =>
Branch (pmap_here m) (pmap_left m) (pmap_insert p v (pmap_right m))
end. | Fixpoint | pmap_insert | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap",
"pmap_here",
"pmap_left",
"pmap_right"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
branch (o : option T) (l r : pmap) : pmap | :=
match o , l , r with
| None , Empty , Empty => Empty
| _ , _ , _ => Branch o l r
end. | Definition | branch | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_remove (p : positive) (m : pmap) {struct p} : pmap | :=
match m with
| Empty => Empty
| Branch d l r =>
match p with
| xH => branch None l r
| xO p => branch d (pmap_remove p l) r
| xI p => branch d l (pmap_remove p r)
end
end. | Fixpoint | pmap_remove | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"branch",
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_empty : pmap | := Empty. | Definition | pmap_empty | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_union (f m : pmap) : pmap | :=
match f with
| Empty => m
| Branch d l r =>
Branch (match d with
| Some x => Some x
| None => pmap_here m
end) (pmap_union l (pmap_left m)) (pmap_union r (pmap_right m))
end. | Fixpoint | pmap_union | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap",
"pmap_here",
"pmap_left",
"pmap_right"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Map_pmap : Map positive T pmap | :=
{ empty := pmap_empty
; add := pmap_insert
; remove := pmap_remove
; lookup := pmap_lookup
; union := pmap_union
}. | Instance | Map_pmap | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"Map",
"empty",
"pmap",
"pmap_empty",
"pmap_insert",
"pmap_lookup",
"pmap_remove",
"pmap_union",
"remove"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
tilde_1_inj_neg : forall k k',
(k~1)%positive <> (k'~1)%positive -> k <> k'. | Proof.
induction k; destruct k'; intuition;
try match goal with
| H : _ = _ |- _ => inversion H; clear H; subst
end; intuition eauto.
Qed. | Lemma | tilde_1_inj_neg | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
tilde_0_inj_neg : forall k k',
(k~0)%positive <> (k'~0)%positive -> k <> k'. | Proof.
induction k; destruct k'; intuition;
try match goal with
| H : _ = _ |- _ => inversion H; clear H; subst
end; intuition eauto.
Qed. | Lemma | tilde_0_inj_neg | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_lookup_insert_empty : forall k k' v,
k <> k' ->
pmap_lookup k' (pmap_insert k v Empty) = None. | Proof.
induction k; destruct k'; simpl; intros;
eauto using tilde_0_inj_neg, tilde_1_inj_neg.
destruct k'; simpl; auto.
destruct k'; simpl; auto.
destruct k'; simpl; auto.
destruct k'; simpl; auto.
congruence.
Qed. | Lemma | pmap_lookup_insert_empty | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap_insert",
"pmap_lookup",
"tilde_0_inj_neg",
"tilde_1_inj_neg"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
lookup_empty : forall k, pmap_lookup k Empty = None. | Proof.
destruct k; reflexivity.
Qed. | Lemma | lookup_empty | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap_lookup"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_lookup_insert_eq
: forall (m : pmap) (k : positive) (v : T),
pmap_lookup k (pmap_insert k v m) = Some v. | Proof.
intros m k; revert m.
induction k; simpl; intros; forward; Cases.rewrite_all_goal; eauto.
Qed. | Lemma | pmap_lookup_insert_eq | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"forward",
"pmap",
"pmap_insert",
"pmap_lookup",
"rewrite_all_goal"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_lookup_insert_Some_neq
: forall (m : pmap) (k : positive) (v : T) (k' : positive),
k <> k' ->
forall v' : T,
pmap_lookup k' m = Some v' <-> pmap_lookup k' (pmap_insert k v m) = Some v'. | Proof.
intros m k; revert m.
induction k; simpl; intros; forward; Cases.rewrite_all_goal;
autorewrite with pmap_rw; eauto.
{ destruct k'; simpl; destruct m; simpl;
autorewrite with pmap_rw; Cases.rewrite_all_goal; try reflexivity.
erewrite IHk; eauto using tilde_1_inj_neg. reflexivity. }
... | Lemma | pmap_lookup_insert_Some_neq | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"forward",
"pmap",
"pmap_insert",
"pmap_lookup",
"rewrite_all_goal",
"tilde_0_inj_neg",
"tilde_1_inj_neg"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_lookup_insert_None_neq
: forall (m : pmap) (k : positive) (v : T) (k' : positive),
k <> k' ->
pmap_lookup k' m = None <-> pmap_lookup k' (pmap_insert k v m) = None. | Proof.
intros m k; revert m.
induction k; simpl; intros; forward; Cases.rewrite_all_goal;
autorewrite with pmap_rw; eauto.
{ destruct k'; simpl; destruct m; simpl;
autorewrite with pmap_rw; Cases.rewrite_all_goal; try reflexivity.
erewrite IHk; eauto using tilde_1_inj_neg. reflexivity. }
... | Lemma | pmap_lookup_insert_None_neq | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"forward",
"pmap",
"pmap_insert",
"pmap_lookup",
"rewrite_all_goal",
"tilde_0_inj_neg",
"tilde_1_inj_neg"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_lookup_insert_neq
: forall (m : pmap) (k : positive) (v : T) (k' : positive),
k <> k' ->
forall v' : T,
pmap_lookup k' (pmap_insert k v m) = pmap_lookup k' m. | Proof.
intros.
remember (pmap_lookup k' m).
destruct o; [
apply pmap_lookup_insert_Some_neq; intuition |
apply pmap_lookup_insert_None_neq; intuition].
Qed. | Lemma | pmap_lookup_insert_neq | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"apply",
"pmap",
"pmap_insert",
"pmap_lookup",
"pmap_lookup_insert_None_neq",
"pmap_lookup_insert_Some_neq"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_lookup_remove_eq
: forall (m : pmap) (k : positive) (v : T),
pmap_lookup k (pmap_remove k m) <> Some v. | Proof.
induction m; destruct k; simpl; intros; try congruence.
{ destruct o; simpl; eauto.
destruct m1; simpl; eauto.
destruct (pmap_remove k m2) eqn:?; try congruence.
rewrite <- Heqp. eauto. }
{ destruct o; simpl; eauto.
destruct (pmap_remove k m1) eqn:?; try congruence.
- de... | Lemma | pmap_lookup_remove_eq | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap",
"pmap_lookup",
"pmap_remove"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_lookup_remove_neq
: forall (m : pmap) (k k' : positive),
k <> k' ->
forall v' : T, pmap_lookup k' m = Some v' <-> pmap_lookup k' (pmap_remove k m) = Some v'. | Proof.
induction m.
Local Ltac t :=
unfold branch;
repeat match goal with
| |- context [ match ?X with _ => _ end ] =>
lazymatch X with
| match _ with _ => _ end => fail
| _ => destruct X eqn:?; subst; try tauto
end
... | Lemma | pmap_lookup_remove_neq | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"assert",
"branch",
"context",
"lookup_empty",
"pmap",
"pmap_lookup",
"pmap_remove",
"split"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MapOk_pmap : MapOk (@eq _) Map_pmap. | Proof.
refine {| mapsto := fun k v m => pmap_lookup k m = Some v |}.
{ abstract (induction k; simpl; congruence). }
{ abstract (induction k; simpl; intros; forward). }
{ eauto using pmap_lookup_insert_eq. }
{ eauto using pmap_lookup_insert_Some_neq. }
{ eauto using pmap_lookup_remove_eq. }
{ e... | Instance | MapOk_pmap | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"MapOk",
"Map_pmap",
"forward",
"pmap_lookup",
"pmap_lookup_insert_Some_neq",
"pmap_lookup_insert_eq",
"pmap_lookup_remove_eq",
"pmap_lookup_remove_neq"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
from_list : list T -> pmap | :=
(fix from_list acc i ls {struct ls} :=
match ls with
| nil => acc
| List.cons l ls =>
from_list (pmap_insert i l acc) (Pos.succ i) ls
end) Empty 1%positive. | Definition | from_list | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap",
"pmap_insert"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
fmap_pmap (m : pmap T) : pmap U | :=
match m with
| Empty => Empty
| Branch h l r => Branch (fmap f h) (fmap_pmap l) (fmap_pmap r)
end. | Fixpoint | fmap_pmap | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
fmap_lookup : forall a b m,
mapsto a b m ->
mapsto a (f b) (fmap_pmap m). | Proof.
induction a; destruct m; simpl; intros; try congruence.
{ eapply IHa. eapply H. }
{ eapply IHa; eapply H. }
{ subst. auto. }
Qed. | Theorem | fmap_lookup | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"fmap_pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
fmap_lookup_bk : forall a b m,
mapsto a b (fmap_pmap m) ->
exists b', mapsto a b' m /\ f b' = b. | Proof.
induction a; destruct m; simpl; intros; try congruence.
{ eapply IHa. eapply H. }
{ eapply IHa. eapply H. }
{ destruct o; try congruence. eexists; split; eauto. inversion H; auto. }
Qed. | Theorem | fmap_lookup_bk | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"fmap_pmap",
"split"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Functor_pmap : Functor pmap | :=
{ fmap := fmap_pmap }. | Instance | Functor_pmap | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"Functor",
"fmap_pmap",
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
twothree (T : Type) : Type | :=
| Leaf
| Two : twothree T -> K -> T -> twothree T -> twothree T
| Three : twothree T -> K -> T -> twothree T -> K -> T -> twothree T -> twothree T. | Inductive | twothree | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
remove_greatest (m : twothree V) {T} (k_oops : unit -> T) (k_ok : K -> V -> twothree V -> T) : T | :=
match m with
| Leaf => k_oops tt
| Two l k v r =>
remove_greatest r (fun _ => k_ok k v l) (fun k' v' r' => k_ok k' v' (Two l k v r'))
| Three l k v m k' v' r =>
remove_greatest r (fun _ => k_ok k' v' (Two l k v m)) (fun k'' v'' r'' => k_ok k'' v'' (Three l k v m k' v... | Fixpoint | remove_greatest | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [
"twothree"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
twothree_modify (m : twothree V) {T} (k_ok : twothree V -> T) (k_splice_up : twothree V -> K -> V -> twothree V -> T) {struct m} : T | :=
match m with
| Leaf =>
match def with
| Some v => k_splice_up Leaf k v Leaf
| None => k_ok Leaf
end
| Two l k' v' r =>
match RD_K k k' with
| Eq =>
match upd v' with
| Some v' => k_ok (Two l k v' r)
... | Fixpoint | twothree_modify | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [
"remove_greatest",
"twothree"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
twothree_add {V} (k : K) (v : V) (m : twothree V) : twothree V | :=
twothree_modify k (fun _ => Some v) (Some v) m (fun m => m) Two. | Definition | twothree_add | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [
"twothree",
"twothree_modify"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
twothree_remove {V} (k : K) (m : twothree V) : twothree V | :=
twothree_modify k (fun _ => None) None m (fun m => m) Two. | Definition | twothree_remove | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [
"twothree",
"twothree_modify"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
twothree_find {V} (k : K) (m : twothree V) : option V | :=
match m with
| Leaf => None
| Two l k' v' r =>
match RD_K k k' with
| Eq => Some v'
| Lt => twothree_find k l
| Gt => twothree_find k r
end
| Three l k1 v1 m k2 v2 r =>
match RD_K k k1 with
| Eq => Some v1
| Lt => twothre... | Fixpoint | twothree_find | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [
"twothree"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
twothree_fold (acc : T) (map : twothree V) : T | :=
match map with
| Leaf => acc
| Two l k v r =>
let acc := twothree_fold acc l in
let acc := f k v acc in
twothree_fold acc r
| Three l k1 v1 m k2 v2 r =>
let acc := twothree_fold acc l in
let acc := f k1 v1 acc in
let acc := two... | Fixpoint | twothree_fold | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [
"twothree"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
twothree_union {V} (m1 m2 : twothree V) : twothree V | :=
twothree_fold twothree_add m2 m1. | Definition | twothree_union | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [
"twothree",
"twothree_add",
"twothree_fold"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Map_twothree V : Map K V (twothree V) | :=
{ empty := Leaf
; add := twothree_add
; remove := twothree_remove
; lookup := twothree_find
; union := twothree_union
}. | Instance | Map_twothree | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [
"Map",
"empty",
"remove",
"twothree",
"twothree_add",
"twothree_find",
"twothree_remove",
"twothree_union"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Foldable_twothree V : Foldable (twothree V) (K * V) | :=
fun _ f b x => twothree_fold (fun k v => f (k,v)) b x. | Instance | Foldable_twothree | Data.Map | theories/Data/Map/FMapTwoThreeK.v | [
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"MonadNotation"
] | [
"Foldable",
"twothree",
"twothree_fold"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
contT (A : Type) : Type | := mkContT
{ runContT : (A -> M R) -> M R }. | Record | contT | Data.Monads | theories/Data/Monads/ContMonad.v | [
"ExtLib.Structures.Monad",
"ExtLib.Structures.MonadTrans"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_contT : Monad contT | :=
{ ret := fun _ x => mkContT (fun k => k x)
; bind := fun _ _ c1 c2 =>
mkContT (fun c =>
runContT c1 (fun a => runContT (c2 a) c))
}. | Instance | Monad_contT | Data.Monads | theories/Data/Monads/ContMonad.v | [
"ExtLib.Structures.Monad",
"ExtLib.Structures.MonadTrans"
] | [
"Monad",
"contT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadT_contT {Monad_M : Monad M} : MonadT contT M | :=
{ lift := fun _ c => mkContT (bind c)
}. | Instance | MonadT_contT | Data.Monads | theories/Data/Monads/ContMonad.v | [
"ExtLib.Structures.Monad",
"ExtLib.Structures.MonadTrans"
] | [
"Monad",
"MonadT",
"contT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
resetT {M} {Monad_M : Monad M} {R R'} (u : contT R M R) : contT R' M R | :=
mkContT (fun k => bind (runContT u ret) k). | Definition | resetT | Data.Monads | theories/Data/Monads/ContMonad.v | [
"ExtLib.Structures.Monad",
"ExtLib.Structures.MonadTrans"
] | [
"Monad",
"contT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
shiftT {M} {Monad_M : Monad M} {R A}
(f : (A -> M R) -> contT R M R) : contT R M A | :=
mkContT (fun k => runContT (f k) ret). | Definition | shiftT | Data.Monads | theories/Data/Monads/ContMonad.v | [
"ExtLib.Structures.Monad",
"ExtLib.Structures.MonadTrans"
] | [
"Monad",
"contT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_either : Monad (sum T) | :=
{ ret := fun _ v => inr v
; bind := fun _ _ c1 c2 => match c1 with
| inl v => inl v
| inr v => c2 v
end
}. | Instance | Monad_either | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"Monad"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Exception_either : MonadExc T (sum T) | :=
{ raise := fun _ v => inl v
; catch := fun _ c h => match c with
| inl v => h v
| x => x
end
}. | Instance | Exception_either | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"MonadExc"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
eitherT A | := mkEitherT { unEitherT : m (sum T A) }. | Inductive | eitherT | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_eitherT : Monad eitherT | :=
{ ret := fun _ x => mkEitherT (ret (inr x))
; bind := fun _ _ c f => mkEitherT (
xM <- unEitherT c ;;
match xM with
| inl x => ret (inl x)
| inr x => unEitherT (f x)
end
)
}. | Instance | Monad_eitherT | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"Monad",
"eitherT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Exception_eitherT : MonadExc T eitherT | :=
{ raise := fun _ v => mkEitherT (ret (inl v))
; catch := fun _ c h => mkEitherT (
xM <- unEitherT c ;;
match xM with
| inl x => unEitherT (h x)
| inr x => ret (inr x)
end
)
}. | Instance | Exception_eitherT | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"MonadExc",
"eitherT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadPlus_eitherT : MonadPlus eitherT | :=
{ mplus _A _B mA mB := mkEitherT (
x <- unEitherT mA ;;
match x with
| inl _ =>
y <- unEitherT mB ;;
match y with
| inl t => ret (inl t)
| inr b => ret (inr (inr b))
end
| inr a => ret (inr (inl a))
end
)
}. | Instance | MonadPlus_eitherT | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"MonadPlus",
"eitherT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadT_eitherT : MonadT eitherT m | :=
{ lift := fun _ c => mkEitherT (liftM inr c) }. | Instance | MonadT_eitherT | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"MonadT",
"eitherT",
"liftM"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadState_eitherT {T} (MS : MonadState T m) : MonadState T eitherT | :=
{ get := lift get
; put := fun v => lift (put v)
}. | Instance | MonadState_eitherT | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"MonadState",
"eitherT",
"get",
"put"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadReader_eitherT {T} (MR : MonadReader T m) : MonadReader T eitherT | :=
{ ask := lift ask
; local := fun _ f cmd => mkEitherT (local f (unEitherT cmd))
}. | Instance | MonadReader_eitherT | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"MonadReader",
"eitherT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadWriter_eitherT {T} (Mon : Monoid T) (MW : MonadWriter Mon m) : MonadWriter Mon eitherT | :=
{ tell := fun x => lift (tell x)
; listen := fun _ c => mkEitherT (
x <- listen (unEitherT c) ;;
match x with
| (inl l, _) => ret (inl l)
| (inr a, t) => ret (inr (a, t))
end)
; pass := fun _ c => mkEitherT (
x <- unEitherT c ;;
match x with
| inl s => ret (inl s)
| ... | Instance | MonadWriter_eitherT | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"MonadWriter",
"Monoid",
"eitherT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadFix_eitherT (MF : MonadFix m) : MonadFix eitherT | :=
{ mfix := fun _ _ r v =>
mkEitherT (mfix (fun f x => unEitherT (r (fun x => mkEitherT (f x)) x)) v)
}. | Instance | MonadFix_eitherT | Data.Monads | theories/Data/Monads/EitherMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"MonadNotation"
] | [
"MonadFix",
"eitherT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
FixResult (T : Type) | :=
| Term : T -> FixResult T
| Diverge : FixResult T. | Inductive | FixResult | Data.Monads | theories/Data/Monads/FuelMonad.v | [
"ExtLib.Structures.Monads",
"BinPos"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
GFix (T : Type) : Type | := mkGFix
{ runGFix : N -> FixResult T }. | Inductive | GFix | Data.Monads | theories/Data/Monads/FuelMonad.v | [
"ExtLib.Structures.Monads",
"BinPos"
] | [
"FixResult"
] | This is essentially ReaderT (optionT m)) * | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
MonadFix_GFix : MonadFix GFix | :=
{ mfix := fun T U f v => mkGFix (fun n : N =>
match n with
| N0 => Diverge
| Npos g =>
let F := fix rec (acc : T -> FixResult U) (gas : positive) (x : T)
: FixResult U :=
match gas return FixResult U with
| xI p =>
runGFix (f (fun x => mkGFi... | Instance | MonadFix_GFix | Data.Monads | theories/Data/Monads/FuelMonad.v | [
"ExtLib.Structures.Monads",
"BinPos"
] | [
"FixResult",
"GFix",
"MonadFix"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_GFix : Monad GFix | :=
{ ret := fun _ v => mkGFix (fun _ => Term v)
; bind := fun _ _ c1 c2 =>
mkGFix (fun gas =>
match runGFix c1 gas with
| Diverge => Diverge
| Term v => runGFix (c2 v) gas
end)
}. | Instance | Monad_GFix | Data.Monads | theories/Data/Monads/FuelMonad.v | [
"ExtLib.Structures.Monads",
"BinPos"
] | [
"GFix",
"Monad"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
ident A | := mkIdent { unIdent : A }. | Inductive | ident | Data.Monads | theories/Data/Monads/IdentityMonad.v | [
"ExtLib.Structures.Monad"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_ident : Monad ident | :=
{ ret := fun _ v => mkIdent v
; bind := fun _ _ c f => f (unIdent c)
}. | Instance | Monad_ident | Data.Monads | theories/Data/Monads/IdentityMonad.v | [
"ExtLib.Structures.Monad"
] | [
"Monad",
"ident"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
istate (i s t: Type) : Type | := mkIState
{ runIState : i -> t * s }. | Record | istate | Data.Monads | theories/Data/Monads/IStateMonad.v | [
"ExtLib.Structures.IXMonad"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
evalState {i s t} (c : istate i s t) (s : i) : t | :=
fst (runIState c s). | Definition | evalState | Data.Monads | theories/Data/Monads/IStateMonad.v | [
"ExtLib.Structures.IXMonad"
] | [
"istate"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
execState {i s t} (c : istate i s t) (st : i) : s | :=
snd (runIState c st). | Definition | execState | Data.Monads | theories/Data/Monads/IStateMonad.v | [
"ExtLib.Structures.IXMonad"
] | [
"istate"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
IMonad_Ixstate : IxMonad istate | :=
{
ret := fun _ _ v => mkIState (fun s => (v, s))
; bind := fun _ _ _ _ _ c1 c2 =>
mkIState (fun s =>
let (v,s) := runIState c1 s in
runIState (c2 v) s)
}. | Instance | IMonad_Ixstate | Data.Monads | theories/Data/Monads/IStateMonad.v | [
"ExtLib.Structures.IXMonad"
] | [
"IxMonad",
"istate"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
get {i : Type} | := @mkIState i i i (fun s => (s,s)). | Definition | get | Data.Monads | theories/Data/Monads/IStateMonad.v | [
"ExtLib.Structures.IXMonad"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
put {i o : Type} | := (fun v => @mkIState i o unit (fun _ => (tt, v))). | Definition | put | Data.Monads | theories/Data/Monads/IStateMonad.v | [
"ExtLib.Structures.IXMonad"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
put_ {i o : Type} (s : o) : istate i o unit | := (bind (put s) (fun _ => ret tt)). | Definition | put_ | Data.Monads | theories/Data/Monads/IStateMonad.v | [
"ExtLib.Structures.IXMonad"
] | [
"istate",
"put"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
modify {i o : Type} (f : i -> o) : istate i o i | :=
bind get (fun x : i => bind (put (f x)) (fun _ : unit => ret x)). | Definition | modify | Data.Monads | theories/Data/Monads/IStateMonad.v | [
"ExtLib.Structures.IXMonad"
] | [
"get",
"istate",
"put"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
modify_ {i o : Type} (f : i -> o) : istate i o unit | :=
bind (modify f) (fun _ => ret tt). | Definition | modify_ | Data.Monads | theories/Data/Monads/IStateMonad.v | [
"ExtLib.Structures.IXMonad"
] | [
"istate",
"modify"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_option : Monad option | :=
{ ret := @Some
; bind := fun _ _ c1 c2 => match c1 with
| None => None
| Some v => c2 v
end
}. | Instance | Monad_option | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"Monad"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Zero_option : MonadZero option | :=
{ mzero := @None }. | Instance | Zero_option | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadZero"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Plus_option : MonadPlus option | :=
{ mplus _A _B aM bM :=
match aM with
| None => liftM inr bM
| Some a => Some (inl a)
end
}. | Instance | Plus_option | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadPlus",
"liftM"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Exception_option : MonadExc unit option | :=
{ raise _ _ := None
; catch _ c h := match c with
| None => h tt
| Some x => Some x
end
}. | Instance | Exception_option | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadExc"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
optionT a | := mkOptionT { unOptionT : m (option a) }. | Inductive | optionT | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_optionT : Monad optionT | :=
{ ret _A := fun x => mkOptionT (ret (Some x))
; bind _A _B aMM f := mkOptionT
(aM <- unOptionT aMM ;;
match aM with
| None => ret None
| Some a => unOptionT (f a)
end)
}. | Instance | Monad_optionT | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"Monad",
"optionT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Zero_optionT : MonadZero optionT | :=
{ mzero _A := mkOptionT (ret None) }. | Instance | Zero_optionT | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadZero",
"optionT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadT_optionT : MonadT optionT m | :=
{ lift _A aM := mkOptionT (liftM Some aM) }. | Instance | MonadT_optionT | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadT",
"liftM",
"optionT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
State_optionT {T} (SM : MonadState T m) : MonadState T optionT | :=
{ get := lift get
; put v := lift (put v)
}. | Instance | State_optionT | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadState",
"get",
"optionT",
"put"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Plus_optionT_right : MonadPlus optionT | :=
{ mplus _A _B a b :=
mkOptionT (bind (unOptionT b) (fun b =>
match b with
| None =>
bind (unOptionT a) (fun a =>
match a with
| None => ret None
| Some a => ret (Some (inl a... | Instance | Plus_optionT_right | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadPlus",
"optionT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Plus_optionT_left : MonadPlus optionT | :=
{ mplus _A _B a b :=
mkOptionT (bind (unOptionT a) (fun a =>
match a with
| None =>
bind (unOptionT b) (fun b =>
match b with
| None => ret None
| Some b => ret (Some (inr b... | Instance | Plus_optionT_left | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadPlus",
"optionT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Plus_optionT : MonadPlus optionT | := Plus_optionT_left. | Instance | Plus_optionT | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadPlus",
"Plus_optionT_left",
"optionT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Reader_optionT {T} (SM : MonadReader T m) : MonadReader T optionT | :=
{ ask := lift ask
; local _T v cmd := mkOptionT (local v (unOptionT cmd))
}. | Instance | Reader_optionT | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadReader",
"optionT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
OptionTError : MonadExc unit optionT | :=
{ raise _u _A := mzero
; catch _A aMM f := mkOptionT
(aM <- unOptionT aMM ;;
match aM with
| None => unOptionT (f tt)
| Some x => ret (Some x)
end)
}. | Instance | OptionTError | Data.Monads | theories/Data/Monads/OptionMonad.v | [
"ExtLib.Structures.Monads",
"MonadNotation"
] | [
"MonadExc",
"optionT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
reader (t : Type) : Type | := mkReader
{ runReader : S -> t }. | Record | reader | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_reader : Monad reader | :=
{ ret := fun _ v => mkReader (fun _ => v)
; bind := fun _ _ c1 c2 =>
mkReader (fun s =>
let v := runReader c1 s in
runReader (c2 v) s)
}. | Instance | Monad_reader | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"Monad",
"reader"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadReader_reader : MonadReader S reader | :=
{ ask := mkReader (fun x => x)
; local := fun _ f cmd => mkReader (fun x => runReader cmd (f x))
}. | Instance | MonadReader_reader | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadReader",
"reader"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
readerT (t : Type) : Type | := mkReaderT
{ runReaderT : S -> m t }. | Record | readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_readerT : Monad readerT | :=
{ ret := fun _ x => mkReaderT (fun s => @ret _ M _ x)
; bind := fun _ _ c1 c2 =>
mkReaderT (fun s =>
@bind _ M _ _ (runReaderT c1 s) (fun v =>
runReaderT (c2 v) s))
}. | Instance | Monad_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"Monad",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadReader_readerT : MonadReader S readerT | :=
{ ask := mkReaderT (fun x => ret x)
; local := fun _ f cmd => mkReaderT (fun x => runReaderT cmd (f x))
}. | Instance | MonadReader_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadReader",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadT_readerT : MonadT readerT m | :=
{ lift := fun _ c => mkReaderT (fun _ => c)
}. | Instance | MonadT_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadT",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadZero_readerT (MZ : MonadZero m) : MonadZero readerT | :=
{ mzero := fun _ => lift mzero }. | Instance | MonadZero_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadZero",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadState_readerT T (MS : MonadState T m) : MonadState T readerT | :=
{ get := lift get
; put := fun x => lift (put x)
}. | Instance | MonadState_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadState",
"get",
"put",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadWriter_readerT T (Mon : Monoid T) (MW : MonadWriter Mon m) : MonadWriter Mon readerT | :=
{ tell := fun v => lift (tell v)
; listen := fun _ c => mkReaderT (fun s => listen (runReaderT c s))
; pass := fun _ c => mkReaderT (fun s => pass (runReaderT c s))
}. | Instance | MonadWriter_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadWriter",
"Monoid",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadExc_readerT {E} (ME : MonadExc E m) : MonadExc E readerT | :=
{ raise := fun _ v => lift (raise v)
; catch := fun _ c h => mkReaderT (fun s => catch (runReaderT c s) (fun x => runReaderT (h x) s))
}. | Instance | MonadExc_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadExc",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadPlus_readerT {MP:MonadPlus m} : MonadPlus readerT | :=
{ mplus _A _B mA mB := mkReaderT (fun r => mplus (runReaderT mA r)
(runReaderT mB r))
}. | Instance | MonadPlus_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadPlus",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadFix_readerT (MF : MonadFix m) : MonadFix readerT | :=
{ mfix := fun _ _ r x =>
mkReaderT (fun s => mfix2 _ (fun f x => runReaderT (r (fun x => mkReaderT (f x)) x)) x s)
}. | Instance | MonadFix_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadFix",
"mfix2",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadReader_lift_readerT T S m (R : MonadReader T m) : MonadReader T (readerT S m) | :=
{ ask := mkReaderT (fun _ => ask)
; local := fun _ f c =>
mkReaderT (fun s => local f (runReaderT c s))
}. | Instance | MonadReader_lift_readerT | Data.Monads | theories/Data/Monads/ReaderMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadReader",
"readerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
state (t : Type) : Type | := mkState
{ runState : S -> t * S }. | Record | state | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
evalState {t} (c : state t) (s : S) : t | :=
fst (runState c s). | Definition | evalState | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"state"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
execState {t} (c : state t) (s : S) : S | :=
snd (runState c s). | Definition | execState | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"state"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_state : Monad state | :=
{ ret := fun _ v => mkState (fun s => (v, s))
; bind := fun _ _ c1 c2 =>
mkState (fun s =>
let (v,s) := runState c1 s in
runState (c2 v) s)
}. | Instance | Monad_state | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"Monad",
"state"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadState_state : MonadState S state | :=
{ get := mkState (fun x => (x,x))
; put := fun v => mkState (fun _ => (tt, v))
}. | Instance | MonadState_state | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadState",
"get",
"put",
"state"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
stateT (t : Type) : Type | := mkStateT
{ runStateT : S -> m (t * S)%type }. | Record | stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"type"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
evalStateT {t} (c : stateT t) (s : S) : m t | :=
bind (runStateT c s) (fun x => ret (fst x)). | Definition | evalStateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
execStateT {t} (c : stateT t) (s : S) : m S | :=
bind (runStateT c s) (fun x => ret (snd x)). | Definition | execStateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_stateT : Monad stateT | :=
{ ret := fun _ x => mkStateT (fun s => @ret _ M _ (x,s))
; bind := fun _ _ c1 c2 =>
mkStateT (fun s =>
@bind _ M _ _ (runStateT c1 s) (fun vs =>
let (v,s) := vs in
runStateT (c2 v) s))
}. | Instance | Monad_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"Monad",
"stateT"
] | [Monad_stateT] is not a Global Instance because it can cause an infinite loop
in typeclass inference under certain circumstances. Use [Existing Instance
Monad_stateT.] to bring the instance into context. | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.