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
"' pat <- c1 ;; c2"
:= (@bind _ _ _ _ c1 (fun x => match x with pat => c2 end)) (at level 61, pat pattern, c1 at next level, right associativity) : monad_scope.
Notation
' pat <- c1 ;; c2
Structures
theories/Structures/Monad.v
[ "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "MonadBaseNotation" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
"'let*' p ':=' c1 'in' c2"
:= (@bind _ _ _ _ c1 (fun p => c2)) (at level 61, p as pattern, c1 at next level, right associativity) : monad_scope.
Notation
'let*' p ':=' c1 'in' c2
Structures
theories/Structures/Monad.v
[ "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "MonadBaseNotation" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Functor_Monad@{} : Functor m
:= { fmap := @liftM _ _ }.
Instance
Functor_Monad
Structures
theories/Structures/Monad.v
[ "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "MonadBaseNotation" ]
[ "Functor", "liftM" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Applicative_Monad@{} : Applicative m
:= { pure := @ret _ _ ; ap := @apM _ _ }.
Instance
Applicative_Monad
Structures
theories/Structures/Monad.v
[ "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "MonadBaseNotation" ]
[ "Applicative", "apM", "pure" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Cont (m : Type -> Type) : Type
:= { callCC : forall a b, ((a -> m b) -> m a) -> m a }.
Class
Cont
Structures
theories/Structures/MonadCont.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadExc (E : Type) (m : Type -> Type) : Type
:= { raise : forall {T}, E -> m T ; catch : forall {T}, m T -> (E -> m T) -> m T }.
Class
MonadExc
Structures
theories/Structures/MonadExc.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadFix (m : Type -> Type) : Type
:= { mfix : forall {T U}, ((T -> m U) -> T -> m U) -> T -> m U }.
Class
MonadFix
Structures
theories/Structures/MonadFix.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
ftype (ls : list Type) (r : Type) : Type
:= match ls with | nil => r | cons l ls => l -> ftype ls r end.
Fixpoint
ftype
Structures
theories/Structures/MonadFix.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
tuple (ls : list Type) : Type
:= match ls with | nil => unit | cons l ls => l * tuple ls end%type.
Fixpoint
tuple
Structures
theories/Structures/MonadFix.v
[ "ExtLib.Structures.Monad" ]
[ "type" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
wrap (ls : list Type) R {struct ls} : (tuple ls -> R) -> ftype ls R
:= match ls as ls return (tuple ls -> R) -> ftype ls R with | nil => fun f => f tt | cons l ls => fun f => fun x => wrap ls (fun g => f (x,g)) end.
Fixpoint
wrap
Structures
theories/Structures/MonadFix.v
[ "ExtLib.Structures.Monad" ]
[ "ftype", "tuple" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
apply (ls : list Type) R {struct ls} : ftype ls R -> tuple ls -> R
:= match ls as ls return ftype ls R -> tuple ls -> R with | nil => fun f _ => f | cons l ls => fun f t => @apply ls R (f (fst t)) (snd t) end.
Fixpoint
apply
Structures
theories/Structures/MonadFix.v
[ "ExtLib.Structures.Monad" ]
[ "ftype", "tuple" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
mfix_multi (ls : list Type) (R : Type) (f : ftype ls (m R) -> ftype ls (m R)) : ftype ls (m R)
:= @wrap ls (m R) (@mfix _ MF (tuple ls) R (fun packed => apply ls (m R) (f (wrap ls packed)))).
Definition
mfix_multi
Structures
theories/Structures/MonadFix.v
[ "ExtLib.Structures.Monad" ]
[ "apply", "ftype", "tuple", "wrap" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
mfix2 A B C (ff:(A -> B -> m C) -> (A -> B -> m C)) (a:A) (b:B) : m C
:= let ff' fabp (abp:A*B) := let (a,b) := abp in let fab a b := fabp (a,b) in ff fab a b in mfix ff' (a,b).
Definition
mfix2
Structures
theories/Structures/MonadFix.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
mfix3 A B C D (ff:(A -> B -> C -> m D) -> (A -> B -> C -> m D)) (a:A) (b:B) (c:C) : m D
:= let ff' fabcp (abcp:A*B*C) := let (abp,c) := abcp in let (a,b) := abp in let fabc a b c := fabcp (a,b,c) in ff fabc a b c in mfix ff' (a,b,c).
Definition
mfix3
Structures
theories/Structures/MonadFix.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadLaws
:= { bind_of_return : forall {A B} (a : A) (f : A -> m B), bind (ret a) f = f a ; return_of_bind : forall {A} (aM: m A), bind aM ret = aM ; bind_associativity : forall {A B C} (aM:m A) (f:A -> m B) (g:B -> m C), bind (bind aM f) g = bind aM (fun a => bind (f a) g) }.
Class
MonadLaws
Structures
theories/Structures/MonadLaws.v
[ "Setoid", "Coq.Classes.Morphisms", "ExtLib.Structures.Monads", "ExtLib.Data.Fun", "ExtLib.Data.Unit" ]
[]
This <= relation is a computational <= relation based on the ideas of domain theory. It generalizes the usual equivalence relation by, enabling the relation to talk about computations that are "more defined" than others. This generalization is done to support the fixpoint law. *
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadTLaws {n} (nM : Monad n) (MT : MonadT m n)
:= { lift_ret : forall {T} (x : T), lift (ret x) = ret x ; lift_bind : forall {T U} (c : n T) (f : T -> n U), lift (bind c f) = bind (lift c) (fun x => lift (f x)) }.
Class
MonadTLaws
Structures
theories/Structures/MonadLaws.v
[ "Setoid", "Coq.Classes.Morphisms", "ExtLib.Structures.Monads", "ExtLib.Data.Fun", "ExtLib.Data.Unit" ]
[ "Monad", "MonadT" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadStateLaws (MS : MonadState S m)
:= { get_put : bind get put = ret tt :> m unit ; put_get : forall x : S, bind (put x) (fun _ => get) = bind (put x) (fun _ => ret x) :> m S ; put_put : forall {A} (x y : S) (f : unit -> m A), bind (put x) (fun _ => bind (put y) f) = bind (put y) f ; get_get : forall {A} (f : S -> S -> m ...
Class
MonadStateLaws
Structures
theories/Structures/MonadLaws.v
[ "Setoid", "Coq.Classes.Morphisms", "ExtLib.Structures.Monads", "ExtLib.Data.Fun", "ExtLib.Data.Unit" ]
[ "MonadState", "get", "put" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadReaderLaws (MR : MonadReader S m)
:= { ask_local : forall f : S -> S, local f ask = bind ask (fun x => ret (f x)) ; local_bind : forall {A B} (aM : m A) (f : S -> S) (g : A -> m B), local f (bind aM g) = bind (local f aM) (fun x => local f (g x)) ; local_ret : forall {A} (x : A) (f : S -> S), local f (ret x) = ret ...
Class
MonadReaderLaws
Structures
theories/Structures/MonadLaws.v
[ "Setoid", "Coq.Classes.Morphisms", "ExtLib.Structures.Monads", "ExtLib.Data.Fun", "ExtLib.Data.Unit" ]
[ "MonadReader" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadZeroLaws (MZ : MonadZero m)
:= { bind_zero : forall {A B} (f : A -> m B), bind mzero f = mzero }.
Class
MonadZeroLaws
Structures
theories/Structures/MonadLaws.v
[ "Setoid", "Coq.Classes.Morphisms", "ExtLib.Structures.Monads", "ExtLib.Data.Fun", "ExtLib.Data.Unit" ]
[ "MonadZero" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadFixLaws (MF : MonadFix m) : Type
:= { mleq : forall {T}, relation T -> relation (m T) ; mfix_monotonic : forall {T U} (F : (T -> m U) -> T -> m U), respectful eq (mleq eq) (mfix F) (F (mfix F)) }.
Class
MonadFixLaws
Structures
theories/Structures/MonadLaws.v
[ "Setoid", "Coq.Classes.Morphisms", "ExtLib.Structures.Monads", "ExtLib.Data.Fun", "ExtLib.Data.Unit" ]
[ "MonadFix" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadPlus (m : Type -> Type) : Type
:= { mplus : forall {A B:Type}, m A -> m B -> m (A + B)%type }.
Class
MonadPlus
Structures
theories/Structures/MonadPlus.v
[ "ExtLib.Structures.Monad" ]
[ "type" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
mjoin {m : Type -> Type} {M : Monad m} {MP : MonadPlus m} {T} (a b : m T) : m T
:= bind (mplus a b) (fun x => match x with | inl x | inr x => ret x end).
Definition
mjoin
Structures
theories/Structures/MonadPlus.v
[ "ExtLib.Structures.Monad" ]
[ "Monad", "MonadPlus" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
"x <+> y"
:= (@mplus _ _ _ _ x y) (at level 54, left associativity) : monad_scope.
Notation
x <+> y
Structures
theories/Structures/MonadPlus.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadReader@{d c} (T : Type@{d}) (m : Type@{d} -> Type@{c}) : Type
:= { local : forall {t : Type@{d}}, (T -> T) -> m t -> m t ; ask : m T }.
Class
MonadReader
Structures
theories/Structures/MonadReader.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
asks@{d c} {m : Type@{d} -> Type@{c}} {M : Monad m} {T : Type@{d}} {MR : MonadReader@{d c} T m} {U : Type@{d}} (f : T -> U) : m U
:= bind ask (fun x => ret (f x)).
Definition
asks
Structures
theories/Structures/MonadReader.v
[ "ExtLib.Structures.Monad" ]
[ "Monad", "MonadReader" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
ReaderProd@{d c} {m : Type@{d} -> Type@{c}} {M : Monad m} {T S : Type@{d}} {MR : MonadReader T m} (f : T -> S) (g : S -> T -> T) : MonadReader@{d c} S m
:= {| ask := @asks m M T MR S f ; local := fun _T up (c : m _T) => @local T m MR _ (fun s => g (up (f s)) s) c |}.
Definition
ReaderProd
Structures
theories/Structures/MonadReader.v
[ "ExtLib.Structures.Monad" ]
[ "Monad", "MonadReader", "asks" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadState@{s d c} (T : Type@{s}) (m : Type@{d} -> Type@{c}) : Type
:= { get : m T ; put : T -> m unit }.
Class
MonadState
Structures
theories/Structures/MonadState.v
[ "ExtLib.Structures.Monad" ]
[ "get", "put" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
modify (f : T -> T) : m T
:= bind get (fun x => bind (put (f x)) (fun _ => ret x)).
Definition
modify
Structures
theories/Structures/MonadState.v
[ "ExtLib.Structures.Monad" ]
[ "get", "put" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
gets {U} (f : T -> U) : m U
:= bind get (fun x => ret (f x)).
Definition
gets
Structures
theories/Structures/MonadState.v
[ "ExtLib.Structures.Monad" ]
[ "get" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
StateProd (f : T -> S) (g : S -> T -> T) : MonadState S m
:= {| get := @gets m M T MS S f ; put := fun x => bind get (fun s => put (g x s)) |}.
Definition
StateProd
Structures
theories/Structures/MonadState.v
[ "ExtLib.Structures.Monad" ]
[ "MonadState", "get", "gets", "put" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadT (m : Type -> Type) (mt : Type -> Type) : Type
:= { lift : forall {t}, mt t -> m t }.
Class
MonadT
Structures
theories/Structures/MonadTrans.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadWriter@{d c s} (T : Type@{s}) (M : Monoid T) (m : Type@{d} -> Type@{c}) : Type
:= { tell : T -> m unit ; listen : forall {A : Type@{d}}, m A -> m (A * T)%type ; pass : forall {A : Type@{d}}, m (A * (T -> T))%type -> m A }.
Class
MonadWriter
Structures
theories/Structures/MonadWriter.v
[ "ExtLib.Structures.Monad", "ExtLib.Structures.Monoid" ]
[ "Monoid", "type" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
listens@{d c s} {m : Type@{d} -> Type@{c}} {S : Type@{s}} {Monad_m : Monad m} {Monoid_S : Monoid S} {Writer_m : MonadWriter Monoid_S m} {A B : Type@{d}} (f : S -> B) (c : m A) : m (A * B)%type
:= liftM (fun x => (fst x, f (snd x))) (listen c).
Definition
listens
Structures
theories/Structures/MonadWriter.v
[ "ExtLib.Structures.Monad", "ExtLib.Structures.Monoid" ]
[ "Monad", "MonadWriter", "Monoid", "liftM", "type" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
censor@{d c s} {m : Type@{d} -> Type@{c}} {S : Type@{s}} {Monad_m : Monad m} {Monoid_S : Monoid S} {Writer_m : MonadWriter Monoid_S m} {A : Type@{d}} (f : S -> S) (c : m A) : m A
:= pass (liftM (fun x => (x, f)) c).
Definition
censor
Structures
theories/Structures/MonadWriter.v
[ "ExtLib.Structures.Monad", "ExtLib.Structures.Monoid" ]
[ "Monad", "MonadWriter", "Monoid", "liftM" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonadZero (m : Type -> Type) : Type
:= { mzero : forall {T}, m T }.
Class
MonadZero
Structures
theories/Structures/MonadZero.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
assert (b : bool) : m unit
:= if b then ret tt else mzero.
Definition
assert
Structures
theories/Structures/MonadZero.v
[ "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Monoid@{} : Type
:= { monoid_plus : S -> S -> S ; monoid_unit : S }.
Record
Monoid
Structures
theories/Structures/Monoid.v
[ "ExtLib.Structures.BinOps" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
MonoidLaws@{} (M : Monoid)
:= { monoid_assoc : Associative M.(monoid_plus) eq ; monoid_lunit : LeftUnit M.(monoid_plus) M.(monoid_unit) eq ; monoid_runit : RightUnit M.(monoid_plus) M.(monoid_unit) eq }.
Class
MonoidLaws
Structures
theories/Structures/Monoid.v
[ "ExtLib.Structures.BinOps" ]
[ "Associative", "LeftUnit", "Monoid", "RightUnit" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Ident : Type
:= lunit : forall a, equ (op u a) a.
Class
Ident
Structures
theories/Structures/Ops.v
[]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Reducible (T E : Type) : Type
:= reduce : forall {A} (base : A) (single : E -> A) (join : A -> A -> A), T -> A.
Class
Reducible
Structures
theories/Structures/Reducible.v
[ "Coq.Classes.RelationClasses", "ExtLib.Structures.BinOps", "ExtLib.Structures.Monad" ]
[ "join", "single" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Foldable (T E : Type) : Type
:= fold : forall {A} (add : E -> A -> A) (base : A), T -> A.
Class
Foldable
Structures
theories/Structures/Reducible.v
[ "Coq.Classes.RelationClasses", "ExtLib.Structures.BinOps", "ExtLib.Structures.Monad" ]
[ "fold" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Reducible_from_Foldable (R : Foldable T E) : Reducible T E | 100
:= fun A base single join => @fold _ _ R A (fun x => join (single x)) base.
Instance
Reducible_from_Foldable
Structures
theories/Structures/Reducible.v
[ "Coq.Classes.RelationClasses", "ExtLib.Structures.BinOps", "ExtLib.Structures.Monad" ]
[ "Foldable", "Reducible", "fold", "join", "single" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
foldM {A} (add : E -> A -> m A) (base : m A) (t : T) : m A
:= fold (fun x acc => bind acc (add x)) base t.
Definition
foldM
Structures
theories/Structures/Reducible.v
[ "Coq.Classes.RelationClasses", "ExtLib.Structures.BinOps", "ExtLib.Structures.Monad" ]
[ "fold" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
reduceM {A} (base : m A) (single : E -> m A) (join : A -> A -> m A) (t : T) : m A
:= reduce base single (fun x y => bind x (fun x => bind y (fun y => join x y))) t.
Definition
reduceM
Structures
theories/Structures/Reducible.v
[ "Coq.Classes.RelationClasses", "ExtLib.Structures.BinOps", "ExtLib.Structures.Monad" ]
[ "join", "single" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
iterM : T -> m unit
:= reduce (ret tt) f (fun x y => bind x (fun _ => y)).
Definition
iterM
Structures
theories/Structures/Reducible.v
[ "Coq.Classes.RelationClasses", "ExtLib.Structures.BinOps", "ExtLib.Structures.Monad" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
DSet : Type
:= { contains : T -> S -> bool ; empty : S ; singleton : T -> S ; union : S -> S -> S ; filter : (T -> bool) -> S -> S ; intersect : S -> S -> S ; difference : S -> S -> S ; subset : S -> S -> bool (** point-wise **) ; add : T -> S -> S ; remove : T -> S -> S ...
Class
DSet
Structures
theories/Structures/Sets.v
[ "ExtLib.Structures.Monoid" ]
[ "contains", "empty", "filter", "remove", "singleton" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
DSet_Laws : Type
:= { DSet_WF : S -> Prop ; empty_WF : DSet_WF empty ; singleton_WF : forall x, DSet_WF (singleton x) ; union_WF : forall s s', DSet_WF s -> DSet_WF s' -> DSet_WF (union s s') ; filter_WF : forall s f, DSet_WF s -> DSet_WF (filter f s) ; intersect_WF : forall s s', DSet_WF s -> DSet_WF s' -> DSet_WF (interse...
Class
DSet_Laws
Structures
theories/Structures/Sets.v
[ "ExtLib.Structures.Monoid" ]
[ "contains", "empty", "filter", "remove", "singleton" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Monoid_set_union : Monoid S
:= {| monoid_plus := union ; monoid_unit := empty |}.
Definition
Monoid_set_union
Structures
theories/Structures/Sets.v
[ "ExtLib.Structures.Monoid" ]
[ "Monoid", "empty" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Traversable@{d r} (T : Type@{d} -> Type@{r}) : Type
:= { mapT : forall {F : Type@{d} -> Type@{r} } {Ap:Applicative@{d r} F} {A B : Type@{d}}, (A -> F B) -> T A -> F (T B) }.
Class
Traversable
Structures
theories/Structures/Traversable.v
[ "ExtLib.Structures.Applicative" ]
[ "Applicative" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
sequence@{d r} {T : Type@{d} -> Type@{r}} {Tr:Traversable T} {F : Type@{d} -> Type@{r}} {Ap:Applicative F} {A : Type@{d}} : T (F A) -> F (T A)
:= mapT (@id (F A)).
Definition
sequence
Structures
theories/Structures/Traversable.v
[ "ExtLib.Structures.Applicative" ]
[ "Applicative", "Traversable" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
forT@{d r} {T : Type@{d} -> Type@{r}} {Tr:Traversable T} {F : Type@{d} -> Type@{r}} {Ap:Applicative F} {A B : Type@{d}} (aT:T A) (f:A -> F B) : F (T B)
:= mapT f aT.
Definition
forT
Structures
theories/Structures/Traversable.v
[ "ExtLib.Structures.Applicative" ]
[ "Applicative", "Traversable" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
negb_true : forall a, negb a = true -> a = false.
Proof. destruct a; auto. Qed.
Lemma
negb_true
Tactics
theories/Tactics/BoolTac.v
[ "Coq.Bool.Bool" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
negb_false : forall a, negb a = false -> a = true.
Proof. destruct a; auto. Qed.
Lemma
negb_false
Tactics
theories/Tactics/BoolTac.v
[ "Coq.Bool.Bool" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
do_bool' runner
:= ( autorewrite with bool_rw in * ); repeat match goal with | [ H : negb _ = true |- _ ] => apply negb_true in H | [ H : negb _ = false |- _ ] => apply negb_false in H | [ H : andb _ _ = true |- _ ] => apply andb_true_iff in H; destruct H | [ H : orb _ _ = f...
Ltac
do_bool'
Tactics
theories/Tactics/BoolTac.v
[ "Coq.Bool.Bool" ]
[ "apply", "negb_false", "negb_true" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
do_bool_case
:= let t H := (destruct H) in do_bool' t.
Ltac
do_bool_case
Tactics
theories/Tactics/BoolTac.v
[ "Coq.Bool.Bool" ]
[ "do_bool'" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
do_bool
:= let t _ := idtac in do_bool' t.
Ltac
do_bool
Tactics
theories/Tactics/BoolTac.v
[ "Coq.Bool.Bool" ]
[ "do_bool'" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
forward' dst sol
:= let check X := match X with | match _ with _ => _ end => fail 1 | if _ then _ else _ => fail 1 | _ => idtac end in let go X := first [ (dst X; try solve [ sol ]); [ intros ] | dst X; solve [ sol ] ] in repeat match goal with | [ H : context [ match ?X with...
Ltac
forward'
Tactics
theories/Tactics/Cases.v
[ "ExtLib.Tactics.Consider" ]
[ "context" ]
This tactic will perform case splits on terms that are matched on. It only does this on terms where only one of the cases is non-trivial (i.e. by [intuition congruence]). ** *
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
forward
:= forward' ltac:(fun x => consider x; intros) ltac:(intuition congruence).
Ltac
forward
Tactics
theories/Tactics/Cases.v
[ "ExtLib.Tactics.Consider" ]
[ "consider", "forward'" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
forward_unsafe' dst sol
:= let check X := match X with | match _ with _ => _ end => fail 1 | if _ then _ else _ => fail 1 | _ => idtac end in let go X := dst X; try solve [ sol ] in repeat match goal with | [ H : context [ match ?X with _ => _ end ] |- _ ] => go X | ...
Ltac
forward_unsafe'
Tactics
theories/Tactics/Cases.v
[ "ExtLib.Tactics.Consider" ]
[ "context" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
forward_unsafe
:= forward_unsafe' ltac:(fun x => consider x; intros) ltac:(intuition congruence).
Ltac
forward_unsafe
Tactics
theories/Tactics/Cases.v
[ "ExtLib.Tactics.Consider" ]
[ "consider", "forward_unsafe'" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
change_rewrite H
:= match type of H with | ?X = _ => match goal with | |- context [ ?Y ] => change Y with X ; rewrite H end end.
Ltac
change_rewrite
Tactics
theories/Tactics/Cases.v
[ "ExtLib.Tactics.Consider" ]
[ "context", "type" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
change_rewrite_in H H'
:= match type of H with | ?X = _ => match type of H' with | context [ ?Y ] => change Y with X in H' ; rewrite H in H' end end.
Ltac
change_rewrite_in
Tactics
theories/Tactics/Cases.v
[ "ExtLib.Tactics.Consider" ]
[ "context", "type" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rewrite_all_goal
:= repeat match goal with | [ H : _ |- _ ] => progress (erewrite H by eauto with typeclass_instances) end.
Ltac
rewrite_all_goal
Tactics
theories/Tactics/Cases.v
[ "ExtLib.Tactics.Consider" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rewrite_all_in H'
:= repeat match goal with | [ H : _ |- _ ] => progress (erewrite H in H' by eauto with typeclass_instances) end.
Ltac
rewrite_all_in
Tactics
theories/Tactics/Cases.v
[ "ExtLib.Tactics.Consider" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rewrite_all_star
:= repeat match goal with | [ H : _ |- _ ] => progress (erewrite H in * by eauto with typeclass_instances) end.
Ltac
rewrite_all_star
Tactics
theories/Tactics/Cases.v
[ "ExtLib.Tactics.Consider" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
reflect (P Q : Prop) : bool -> Type
:= | reflect_true : P -> reflect P Q true | reflect_false : Q -> reflect P Q false.
Inductive
reflect
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[]
Two inductives to perform case-based reasonning
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
semi_reflect (P : Prop) : bool -> Type
:= | semi_reflect_true : P -> semi_reflect P true | semi_reflect_false : semi_reflect P false.
Inductive
semi_reflect
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
iff_to_reflect {A B} (P : A -> B -> Prop) (T : A -> B -> bool) : (forall x y, T x y = true <-> P x y) -> (forall x y, reflect (P x y) (~P x y) (T x y)).
Proof. intros. case_eq (T x y); intros Hxy; constructor. apply H. assumption. intros Hf. apply H in Hf. congruence. Qed.
Lemma
iff_to_reflect
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "apply", "reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
impl_to_semireflect {A B} (P : A -> B -> Prop) (T : A -> B -> bool) : (forall x y, T x y = true -> P x y) -> (forall x y, semi_reflect (P x y) (T x y)).
Proof. intros. case_eq (T x y); intros Hxy; constructor. apply H; auto. Qed.
Lemma
impl_to_semireflect
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "apply", "semi_reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
reflect_true_inv P Q : reflect P Q true -> P.
Proof. exact (fun x => match x in reflect _ _ b return if b then P else ID with | reflect_true _ _ H => H | reflect_false _ _ H => (fun _ x => x) end). Qed.
Lemma
reflect_true_inv
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "ID", "reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
reflect_false_inv P Q : reflect P Q false -> Q.
Proof. exact (fun x => match x in reflect _ _ b return if b then ID else Q with | reflect_true _ _ H => fun _ x => x | reflect_false _ _ H => H end). Qed.
Lemma
reflect_false_inv
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "ID", "reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
semi_reflect_true_inv P : semi_reflect P true -> P.
Proof. exact (fun x => match x in semi_reflect _ b return if b then P else ID with | semi_reflect_true _ H => H | semi_reflect_false _ => (fun _ x => x) end). Qed.
Lemma
semi_reflect_true_inv
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "ID", "semi_reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Reflect (T : bool) (P Q : Prop)
:= _Reflect : reflect P Q T.
Class
Reflect
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
SemiReflect (T : bool) (P : Prop)
:= _SemiReflect : semi_reflect P T.
Class
SemiReflect
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "semi_reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
t
:= repeat match goal with | H: Reflect true ?P ?Q |- _ => apply (reflect_true_inv P Q) in H | H: Reflect false ?P ?Q |- _ => apply (reflect_false_inv P Q) in H end.
Ltac
t
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "Reflect", "apply", "reflect_false_inv", "reflect_true_inv" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Reflect_andb : Reflect (T1 && T2)%bool (P1 /\ P2) (Q1 \/ Q2).
Proof. destruct T1; destruct T2; t; constructor; tauto. Qed.
Instance
Reflect_andb
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "Reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Reflect_orb : Reflect (T1 || T2)%bool (P1 \/ P2) (Q1 /\ Q2).
Proof. destruct T1; destruct T2; t; constructor; tauto. Qed.
Instance
Reflect_orb
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "Reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Reflect_negb : Reflect (negb T1)%bool Q1 P1.
Proof. destruct T1; t; constructor; tauto. Qed.
Instance
Reflect_negb
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "Reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Reflect_RelDecCorrect (a b : T) : Reflect (rel_dec a b) (eqt a b) (~(eqt a b)).
Proof. eapply iff_to_reflect. eapply rel_dec_correct. Qed.
Instance
Reflect_RelDecCorrect
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "Reflect", "iff_to_reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
consider f
:= let rec clean := match goal with | |- true = true -> _ => intros _ ; clean | |- false = true -> _ => discriminate | |- ?P1 -> ?P2 => let H := fresh in intros H ; clean; revert H | |- _ => idtac end in (repeat match goal with | [ H : context [ f ] |- _ ] => ...
Ltac
consider
Tactics
theories/Tactics/Consider.v
[ "ExtLib.Core.RelDec" ]
[ "Reflect", "SemiReflect", "context", "type" ]
The main tactic. [consider f] will perform case-analysis (using [case]) on the function symbol [f] using a reflection-lemma that is inferred by type-class resolution.
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
UIP_refl : forall {x : A} (p1 : x = x), p1 = refl_equal _.
intros. eapply Eqdep_dec.UIP_dec. apply equiv_dec. Qed.
Theorem
UIP_refl
Tactics
theories/Tactics/EqDep.v
[ "Coq.Classes", "EquivDec", "ExtLib.Structures.EqDep", "Coq.Logic", "Eqdep_dec" ]
[ "apply" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
UIP_equal : forall {x y : A} (p1 p2 : x = y), p1 = p2.
eapply Eqdep_dec.UIP_dec. apply equiv_dec. Qed.
Theorem
UIP_equal
Tactics
theories/Tactics/EqDep.v
[ "Coq.Classes", "EquivDec", "ExtLib.Structures.EqDep", "Coq.Logic", "Eqdep_dec" ]
[ "apply" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
notVar X
:= match X with | _ _ => idtac | _ _ _ => idtac | _ _ _ _ => idtac | _ _ _ _ _ => idtac | _ _ _ _ _ _ => idtac | _ _ _ _ _ _ _ => idtac | _ _ _ _ _ _ _ _ => idtac | _ _ _ _ _ _ _ _ _ => idtac | _ _ _ _ _ _ _ _ _ _ => idtac | _ _ _ _ _ _ _ _ _ _ _ => idtac | _ _ _ _ _ _ _ _ ...
Ltac
notVar
Tactics
theories/Tactics/EqDep.v
[ "Coq.Classes", "EquivDec", "ExtLib.Structures.EqDep", "Coq.Logic", "Eqdep_dec" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
gen_refl
:= repeat match goal with | H : context [ @eq_refl ?X ?Y ] |- _ => generalize dependent (@eq_refl X Y) | |- context [ @eq_refl ?X ?Y ] => generalize dependent (@eq_refl X Y) end.
Ltac
gen_refl
Tactics
theories/Tactics/EqDep.v
[ "Coq.Classes", "EquivDec", "ExtLib.Structures.EqDep", "Coq.Logic", "Eqdep_dec" ]
[ "context" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
uip_all
:= repeat match goal with | [ H : _ = _ |- _ ] => rewrite H | [ |- context [ match ?X in _ = t return _ with | refl_equal => _ end ] ] => notVar X; generalize X | [ |- context [ eq_rect_r _ _ ?X ] ] => notVar X; generalize X ...
Ltac
uip_all
Tactics
theories/Tactics/EqDep.v
[ "Coq.Classes", "EquivDec", "ExtLib.Structures.EqDep", "Coq.Logic", "Eqdep_dec" ]
[ "UIP_refl", "context", "notVar" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
uip_all'
:= repeat match goal with | [ H : _ = _ |- _ ] => rewrite H | [ |- context [ match ?X in _ = t return _ with | refl_equal => _ end ] ] => notVar X; generalize X | [ |- context [ eq_rect_r _ _ ?X ] ] => notVar X; generalize X ...
Ltac
uip_all'
Tactics
theories/Tactics/EqDep.v
[ "Coq.Classes", "EquivDec", "ExtLib.Structures.EqDep", "Coq.Logic", "Eqdep_dec" ]
[ "UIP_refl", "context", "notVar" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_rw_goal
:= autorewrite with eq_rw.
Ltac
eq_rw_goal
Tactics
theories/Tactics/Equality.v
[ "ExtLib.Data.Eq" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_rw_hyp H
:= autorewrite with eq_rw in H.
Ltac
eq_rw_hyp
Tactics
theories/Tactics/Equality.v
[ "ExtLib.Data.Eq" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_rw_star
:= autorewrite with eq_rw in *.
Ltac
eq_rw_star
Tactics
theories/Tactics/Equality.v
[ "ExtLib.Data.Eq" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
forward_reason
:= repeat match goal with | H : exists x, _ |- _ => destruct H | H : _ /\ _ |- _ => destruct H | H' : ?X , H : ?X -> ?Y |- _ => match type of X with | Prop => specialize (H H') end | H : ?X -> ?Y |- _ => mat...
Ltac
forward_reason
Tactics
theories/Tactics/Forward.v
[]
[ "assert", "type" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rwHyps
:= repeat match goal with [ H: ?l = ?r |- _] => match r with | context [l] => idtac | _ => rewrite -> H end end.
Ltac
rwHyps
Tactics
theories/Tactics/Forward.v
[]
[ "context" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rwHypsR
:= repeat match goal with [ H: _ = _ |- _] => rewrite <- H end.
Ltac
rwHypsR
Tactics
theories/Tactics/Forward.v
[]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rwHypsA
:= repeat match goal with [ H: _ = _ |- _] => rewrite -> H in * end.
Ltac
rwHypsA
Tactics
theories/Tactics/Forward.v
[]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rwHypsRA
:= repeat match goal with [ H: _ = _ |- _] => rewrite <- H in * end.
Ltac
rwHypsRA
Tactics
theories/Tactics/Forward.v
[]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
clear_trivials
:= repeat match goal with | [ H : ?T = ?T |- _ ] => clear H | [ H : ?T <-> ?T |- _ ] => clear H | [ H : ?T -> ?T |- _ ] => clear H | [ H1 : ?T, H2 : ?T |- _ ] => clear H2 | [ H : True |- _ ] => clear H | [ H : not False |- _ ] => clear H end.
Ltac
clear_trivials
Tactics
theories/Tactics/Forward.v
[]
[]
based on a tactic written by Vincent Rahli
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Hidden (P:Type) : Prop
:= | hidden (p:P): Hidden P.
Inductive
Hidden
Tactics
theories/Tactics/Hide.v
[]
[]
The names of the tactics here come from the 2013 distribution of Software Foundations (SF). The implementations are different, though: 1) The hiding mechanism is SF was not fully reliable: tactics that compute on hypotheses could unhide stuff 2) Hiding in SF was always reversible. Here, unhiding only works when provi...
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
show_hyp H
:= destruct H as [H].
Ltac
show_hyp
Tactics
theories/Tactics/Hide.v
[]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
hide_hyp H
:= apply hidden in H.
Ltac
hide_hyp
Tactics
theories/Tactics/Hide.v
[]
[ "apply" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
show_hyps
:= repeat match goal with H: Hidden _ |- _ => show_hyp H end.
Ltac
show_hyps
Tactics
theories/Tactics/Hide.v
[]
[ "Hidden", "show_hyp" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Injective (P : Prop) : Type
:= { result : Prop ; injection : P -> result }.
Class
Injective
Tactics
theories/Tactics/Injection.v
[]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075