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 |
|---|---|---|---|---|---|---|---|---|---|---|
MonadState_stateT : MonadState S stateT | :=
{ get := mkStateT (fun x => ret (x,x))
; put := fun v => mkStateT (fun _ => ret (tt, v))
}. | Instance | MonadState_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadState",
"get",
"put",
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadT_stateT : MonadT stateT m | :=
{ lift := fun _ c => mkStateT (fun s => bind c (fun t => ret (t, s)))
}. | Instance | MonadT_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadT",
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
State_State_stateT T (MS : MonadState T m) : MonadState T stateT | :=
{ get := lift get
; put := fun x => lift (put x)
}. | Instance | State_State_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadState",
"get",
"put",
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadReader_stateT T (MR : MonadReader T m) : MonadReader T stateT | :=
{ ask := mkStateT (fun s => bind ask (fun t => ret (t, s)))
; local := fun _ f c => mkStateT (fun s => local f (runStateT c s))
}. | Instance | MonadReader_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadReader",
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadWriter_stateT T (Mon : Monoid T) (MR : MonadWriter Mon m) : MonadWriter Mon stateT | :=
{ tell := fun x => mkStateT (fun s => bind (tell x) (fun v => ret (v, s)))
; listen := fun _ c => mkStateT (fun s => bind (listen (runStateT c s))
(fun x => let '(a,s,t) := x in
ret (a,t,s)))
; pass := fun _ c => mkStateT (fun s => bind (runStateT c s) (fun x =>
let '(a,t,s) := x in pass (ret ((a,s... | Instance | MonadWriter_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadWriter",
"Monoid",
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Exc_stateT T (MR : MonadExc T m) : MonadExc T stateT | :=
{ raise := fun _ e => lift (raise e)
; catch := fun _ body hnd =>
mkStateT (fun s => catch (runStateT body s) (fun e => runStateT (hnd e) s))
}. | Instance | Exc_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadExc",
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadZero_stateT (MR : MonadZero m) : MonadZero stateT | :=
{ mzero _A := lift mzero
}. | Instance | MonadZero_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadZero",
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadFix_stateT (MF : MonadFix m) : MonadFix stateT | :=
{ mfix := fun _ _ r v =>
mkStateT (fun s => mfix2 _ (fun r v s => runStateT (mkStateT (r v)) s) v s)
}. | Instance | MonadFix_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadFix",
"mfix2",
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadPlus_stateT (MP : MonadPlus m) : MonadPlus stateT | :=
{ mplus _A _B a b :=
mkStateT (fun s => bind (mplus (runStateT a s) (runStateT b s))
(fun res => match res with
| inl (a,s) => ret (inl a, s)
| inr (b,s) => ret (inr b, s)
end))
}. | Instance | MonadPlus_stateT | Data.Monads | theories/Data/Monads/StateMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid"
] | [
"MonadPlus",
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
writerT (Monoid_S : Monoid@{s} S) (m : Type@{d} -> Type@{c})
(t : Type@{d}) : Type | := mkWriterT
{ runWriterT : m (pprod t S)%type }. | Record | writerT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"Monoid",
"pprod",
"type"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
execWriterT {T} (c : writerT Monoid_S m T) : m S | :=
bind (runWriterT c) (fun (x : pprod T S) => ret (psnd x)). | Definition | execWriterT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"pprod",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
evalWriterT {T} (c : writerT Monoid_S m T) : m T | :=
bind (runWriterT c) (fun (x : pprod T S) => ret (pfst x)). | Definition | evalWriterT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"pprod",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
"( x , y )" | := (ppair x y). | Notation | ( x , y ) | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_writerT : Monad (writerT Monoid_S m) | :=
{ ret := fun _ x => mkWriterT _ (@ret _ M _ (x, monoid_unit Monoid_S))
; bind := fun _ _ c1 c2 =>
mkWriterT _ (
@bind _ M _ _ (runWriterT c1) (fun v =>
bind (runWriterT (c2 (pfst v))) (fun v' =>
ret (pfst v', monoid_plus Monoid_S (psnd v) (psnd v')))))
}. | Instance | Monad_writerT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"Monad",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Writer_writerT : MonadWriter Monoid_S (writerT Monoid_S m) | :=
{ tell := fun x => mkWriterT _ (ret (tt, x))
; listen := fun _ c => mkWriterT _ (bind (runWriterT c)
(fun x => ret (pair (pfst x) (psnd x), psnd x)))
; pass := fun _ c => mkWriterT _ (bind (runWriterT c)
(fun x => ret (let '(pp... | Instance | Writer_writerT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"MonadWriter",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadT_writerT : MonadT (writerT Monoid_S m) m | :=
{ lift := fun _ c => mkWriterT _ (bind c (fun x => ret (x, monoid_unit Monoid_S)))
}. | Instance | MonadT_writerT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"MonadT",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Reader_writerT {S'} (MR : MonadReader S' m) : MonadReader S' (writerT Monoid_S m) | :=
{ ask := mkWriterT _ (bind ask (fun v => @ret _ M _ (v, monoid_unit Monoid_S)))
; local := fun _ f c =>
mkWriterT _ (local f (runWriterT c))
}. | Instance | Reader_writerT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"MonadReader",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
State_writerT {S'} (MR : MonadState S' m) : MonadState S' (writerT Monoid_S m) | :=
{ get := lift get
; put := fun v => lift (put v)
}. | Instance | State_writerT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"MonadState",
"get",
"put",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Zero_writerT (MZ : MonadZero m) : MonadZero (writerT Monoid_S m) | :=
{ mzero := fun _ => lift mzero }. | Instance | Zero_writerT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"MonadZero",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Exception_writerT {E} (ME : MonadExc E m) : MonadExc E (writerT Monoid_S m) | :=
{ raise := fun _ v => lift (raise v)
; catch := fun _ c h => mkWriterT _ (catch (runWriterT c) (fun x => runWriterT (h x)))
}. | Instance | Exception_writerT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"MonadExc",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Writer_writerT_pass {T} {MonT : Monoid T} {M : Monad m} {MW : MonadWriter MonT m}
: MonadWriter MonT (writerT Monoid_S m) | :=
{ tell := fun x => mkWriterT _ (bind (tell x)
(fun x => ret (x, monoid_unit Monoid_S)))
; listen := fun _ c => mkWriterT _ (bind (m:=m) (@listen _ _ _ MW _ (runWriterT c))
(fun x => let '(pair (ppair a t) s) := x in
... | Instance | Writer_writerT_pass | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"Monad",
"MonadWriter",
"Monoid",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
mapWriterT (f: m (pprod A W) -> n (pprod B W'))
: writerT Monoid_W m A -> writerT Monoid_W' n B | :=
mkWriterT Monoid_W' ∘ f ∘ runWriterT. | Definition | mapWriterT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"pprod",
"writerT"
] | Map both the return value and output of a computation using the given function.
[[ 'runWriterT' ('mapWriterT' f m) = f ('runWriterT' m) ]] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
castWriterT
: writerT Monoid_W m A -> writerT Monoid_W' m A | :=
mkWriterT Monoid_W' ∘ runWriterT. | Definition | castWriterT | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"writerT"
] | Special case of mapWriterT where mapping function is identity
* Note: This function changes the `Monoid` instance. | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
writer : Type -> Type | :=
writerT Monoid_W ident. | Definition | writer | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"ident",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
runWriter : writer A -> pprod A W | :=
unIdent ∘ (@runWriterT W Monoid_W ident A). | Definition | runWriter | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"ident",
"pprod",
"writer"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
execWriter : writer A -> W | :=
psnd ∘ runWriter. | Definition | execWriter | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"runWriter",
"writer"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
evalWriter : writer A -> A | :=
pfst ∘ runWriter. | Definition | evalWriter | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"runWriter",
"writer"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
mapWriter (f: pprod A W -> pprod B W')
: writer Monoid_W A -> writer Monoid_W' B | :=
mapWriterT Monoid_W' ident B (mkIdent ∘ f ∘ unIdent). | Definition | mapWriter | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"ident",
"mapWriterT",
"pprod",
"writer"
] | Map both the return value and output of a computation using the given function.
[[ 'runWriter' ('mapWriter' f m) = f ('runWriter' m) ]] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
castWriter
: writer Monoid_W A -> writer Monoid_W' A | :=
castWriterT Monoid_W' (m:=ident). | Definition | castWriter | Data.Monads | theories/Data/Monads/WriterMonad.v | [
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.IdentityMonad",
"Coq.Program.Basics"
] | [
"castWriterT",
"ident",
"writer"
] | Special case of mapWriter where mapping function is identity | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
lset (T : Type) : Type | :=
list T. | Definition | lset | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
lset_contains (v : T) (ls : lset T) : bool | :=
match ls with
| nil => false
| l :: ls => if R_dec v l then true else lset_contains v ls
end. | Fixpoint | lset_contains | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"lset"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
lset_empty : lset T | := nil. | Definition | lset_empty | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"lset"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
lset_add (v : T) (ls : lset T) : lset T | :=
if lset_contains v ls then ls else v :: ls. | Definition | lset_add | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"lset",
"lset_contains"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
lset_remove (v : T) : lset T -> lset T | :=
List.filter (fun x => negb (R_dec v x)). | Definition | lset_remove | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"filter",
"lset"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
lset_union (l r : lset T) : lset T | :=
fold_left (fun x y => lset_add y x) l r. | Definition | lset_union | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"fold_left",
"lset",
"lset_add"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
lset_difference (l r : lset T) : lset T | :=
List.filter (fun x => negb (lset_contains x r)) l. | Definition | lset_difference | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"filter",
"lset",
"lset_contains"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
lset_intersect (l r : lset T) : lset T | :=
List.filter (fun x => lset_contains x r) l. | Definition | lset_intersect | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"filter",
"lset",
"lset_contains"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
lset_subset (l r : lset T) : bool | :=
allb (fun x => lset_contains x r) l. | Definition | lset_subset | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"allb",
"lset",
"lset_contains"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
DSet_weak_listset {T} (R : T -> T -> Prop)
(R_dec : RelDec R) : DSet (@lset T) T | :=
{ contains := lset_contains rel_dec
; empty := lset_empty T
; add := lset_add rel_dec
; singleton := fun x => lset_add rel_dec x (lset_empty T)
; remove := lset_remove rel_dec
; union := lset_union rel_dec
; intersect := lset_intersect rel_dec
; difference := lset_difference rel_dec
; subset :=... | Instance | DSet_weak_listset | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"DSet",
"RelDec",
"contains",
"empty",
"filter",
"lset",
"lset_add",
"lset_contains",
"lset_difference",
"lset_empty",
"lset_intersect",
"lset_remove",
"lset_subset",
"lset_union",
"remove",
"singleton"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Foldable_listset {T}
: Foldable (lset T) T | :=
fun _ f a t => List.fold_left (fun x y => f y x) t a. | Instance | Foldable_listset | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"Foldable",
"fold_left",
"lset"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Functor_listset : Functor lset | :=
{ fmap := map }. | Instance | Functor_listset | Data.Set | theories/Data/Set/ListSet.v | [
"List",
"ExtLib.Structures.Sets",
"ExtLib.Core.RelDec",
"ExtLib.Data.List",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor"
] | [
"Functor",
"lset"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
tree | :=
(* Null_t = _ *)
| Null_t : tree
(* [a]
* Two_t X a Y = / \
* X Y
* Invariant: x in X => x < a; y in Y => y > a
*)
| Two_t : tree -> E -> tree -> tree
(* [a][b]
* Three_t X a Y b Z = / | \
* X Y Z
* Invari... | Inductive | tree | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [] | a two-three tree | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
height_t (t:tree) : nat | :=
match t with
| Null_t => O
| Two_t tl _ tr => max (height_t tl) (height_t tr)
| Three_t tl _ tm _ tr => max (max (height_t tl) (height_t tm)) (height_t tr)
end. | Fixpoint | height_t | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"tl",
"tree"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
context | :=
(* Top_c = _ *)
| Top_c : context
(* C
* TwoLeftHole_c a Y C = |
* [a]
* / \
* ? Y
*)
| TwoLeftHole_c : E -> tree -> context -> context
(* C
* TwoRightHole_c X a C = ... | Inductive | context | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"tree"
] | a context of a two-three tree. this is the type of taking a tree and
* replacing a sub-tree with a hole. | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
zip (t:tree) (c:context) : tree | :=
match c with
| Top_c => t
| TwoLeftHole_c em tr c' => zip (Two_t t em tr) c'
| TwoRightHole_c tl em c' => zip (Two_t tl em t) c'
| ThreeLeftHole_c el em er tr c' => zip (Three_t t el em er tr) c'
| ThreeMiddleHole_c tl el er tr c' => zip (Three_t tl el t er tr) c'
| ThreeRightHole_c tl el em er c' => z... | Fixpoint | zip | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"context",
"tl",
"tree"
] | zip takes a context (which can be thought of as a tree with a hole), and a
* subtree, and fills the hole with the subtree | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
fuse (c1:context) (c2:context) : context | :=
match c1 with
| Top_c => c2
| TwoLeftHole_c em tr c1' => TwoLeftHole_c em tr (fuse c1' c2)
| TwoRightHole_c tl em c1' => TwoRightHole_c tl em (fuse c1' c2)
| ThreeLeftHole_c el em er tr c1' => ThreeLeftHole_c el em er tr (fuse c1' c2)
| ThreeMiddleHole_c tl el er tr c1' => ThreeMiddleHole_c tl el er tr (... | Fixpoint | fuse | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"context",
"tl"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
location | :=
(* C
* TwoHole_l X Y C = |
* [?]
* / \
* X Y
*)
| TwoHole_l : tree -> tree -> context -> location
(* C
* TwoHole_l X Y b Z C = |
* [?][b]
* ... | Inductive | location | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"context",
"tree"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
fillLocation (e:E) (l:location) : tree | :=
match l with
| TwoHole_l tl tr c => zip (Two_t tl e tr) c
| ThreeLeftHole_l tl tm vr tr c => zip (Three_t tl e tm vr tr) c
| ThreeRightHole_l tl el tm tr c => zip (Three_t tl el tm e tr) c
end. | Definition | fillLocation | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"location",
"tl",
"tree",
"zip"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
locate (e:E) (t:tree) (c:context) : context + E * location | :=
match t with
| Null_t => inl c
| Two_t tl em tr =>
match comp e em with
| Lt => locate e tl $ TwoLeftHole_c em tr c
| Eq => inr (em, TwoHole_l tl tr c)
| Gt => locate e tr $ TwoRightHole_c tl em c
end
| Three_t tl el tm er tr =>
match comp e el, comp e er with
| Lt, ... | Fixpoint | locate | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"context",
"location",
"tl",
"tree"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
locateGreatest (t:tree) (c:context)
: option (E * (context + E * context)) | :=
match t with
| Null_t => None
| Two_t tl em tr => liftM sum_tot $
locateGreatest tr (TwoRightHole_c tl em c)
<+>
ret (em, inl c)
| Three_t tl el tm er tr => liftM sum_tot $
locateGreatest tr (ThreeRightHole_c tl el tm er c)
<+>
ret (er, inr (el, c))
end. | Fixpoint | locateGreatest | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"context",
"liftM",
"sum_tot",
"tl",
"tree"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
single e | := Two_t Null_t e Null_t. | Definition | single | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
insertUp (tet:tree * E * tree) (c:context) : tree | :=
let '(tl,em,tr) := tet in
match c with
(* _
* |
* [em] => [em]
* // \\ / \
* tl tr tl tr
*)
| Top_c => Two_t tl em tr
(* c' c'
* | |
* [em'] => [em][em']
* / \ / | \
* ... | Fixpoint | insertUp | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"context",
"tl",
"tree",
"zip"
] | if insertion results in a subtree which is too tall, propegate it up into
* its context. | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
insert (e:E) (t:tree) : tree | :=
match locate e t Top_c with
| inl c => insertUp (Null_t, e, Null_t) c
| inr (_, l) => fillLocation e l
end. | Definition | insert | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"fillLocation",
"insertUp",
"locate",
"tree"
] | insert an element into the two-three tree | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
removeUp (t:tree) (c:context) : tree | :=
match c with
(* _
* ||
* e => e
*)
| Top_c => t
(* c' c'
* | |
* [em] => [el']
* // \ / \
* t [el'][er'] [em] [er']
* / | \ / \ / \
* tl' tm' tr' t tl' tm'... | Fixpoint | removeUp | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"context",
"tl",
"tree",
"zip"
] | if remove results in a tree which is too short, propegate the gap into the
* context | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
remove (e:E) (t:tree) : tree | :=
match locate e t Top_c with
(* element doesn't exist *)
| inl _ => t
(* element found at location [loc] *)
| inr (_, loc) =>
match loc with
(* element found at a two-node *)
| TwoHole_l tl tr c =>
let mkContext g c' := TwoLeftHole_c g tr c' in
match locateGreatest tl T... | Definition | remove | Data.Set | theories/Data/Set/TwoThreeTrees.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.OptionMonad",
"ExtLib.Programming.Extras",
"FunNotation",
"MonadNotation",
"MonadPlusNotation"
] | [
"fuse",
"locate",
"locateGreatest",
"removeUp",
"single",
"tl",
"tree",
"zip"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
hlist_to_tuple ps (h : hlist (fun x : Type => x) ps) : asTuple ps | :=
match h in hlist _ ps return asTuple ps with
| Hnil => tt
| Hcons x h => (x,hlist_to_tuple h)
end. | Fixpoint | hlist_to_tuple | Generic | theories/Generic/Data.v | [
"Coq.Lists.List",
"ExtLib.Data.Member",
"ExtLib.Data.HList",
"ExtLib.Generic.Func"
] | [
"asTuple",
"hlist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
itype (ps : list Type) : Type | :=
| Inj : Type -> itype ps
| Rec : hlist (fun x => x) ps -> itype ps
| Sum : itype ps -> itype ps -> itype ps
| Prod : itype ps -> itype ps -> itype ps
| Sig : forall T : Type, (T -> itype ps) -> itype ps
| Pi : forall T : Type, (T -> itype ps) -> itype ps
| Get : forall T : Type, member T ps -> (T -> itype ps) -> ity... | Inductive | itype | Generic | theories/Generic/Data.v | [
"Coq.Lists.List",
"ExtLib.Data.Member",
"ExtLib.Data.HList",
"ExtLib.Generic.Func"
] | [
"hlist",
"member"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Unit {ps} | := @Inj ps unit. | Definition | Unit | Generic | theories/Generic/Data.v | [
"Coq.Lists.List",
"ExtLib.Data.Member",
"ExtLib.Data.HList",
"ExtLib.Generic.Func"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
itypeD (i : itype ps) {struct i}
: asFunc ps Type -> asFunc ps Type | :=
match i return asFunc ps Type -> asFunc ps Type with
| Get pf f => fun F => @get ps _ _ pf (fun x => itypeD (f x) F)
| Inj _ T => fun _ => const T
| Rec h => fun F => const (applyF F (hlist_to_tuple h))
| @Sig _ t f => fun F =>
@under _ _ (fun App => @sigT t (fun x' =... | Fixpoint | itypeD | Generic | theories/Generic/Data.v | [
"Coq.Lists.List",
"ExtLib.Data.Member",
"ExtLib.Data.HList",
"ExtLib.Generic.Func"
] | [
"applyF",
"asFunc",
"combine",
"const",
"get",
"hlist_to_tuple",
"itype",
"replace",
"type",
"under"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
cases (i : itype ps) (k : asFunc ps Type -> asFunc ps Type)
{struct i} : asFunc ps Type | :=
match i with
| Inj _ T => k (const T)
| Sum a b => combine prod ps (cases a k) (cases b k)
| Prod a b =>
cases a (fun A => cases b (fun B =>
under _ _ (fun App => App _ A -> App _ (k B))))
| Rec ps => k (const (applyF RecT (hlist_to_tuple ps)... | Fixpoint | cases | Generic | theories/Generic/Data.v | [
"Coq.Lists.List",
"ExtLib.Data.Member",
"ExtLib.Data.HList",
"ExtLib.Generic.Func"
] | [
"applyF",
"asFunc",
"combine",
"const",
"get",
"hlist_to_tuple",
"itype",
"replace",
"under"
] | NOTE: Non-dependent * | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
asPiE ps {struct ps}
: forall (F : _)
(G : forall x : (forall U, asFunc ps U -> U), F x),
asPi ps F | :=
match ps as ps
return forall F : (forall U : Type, asFunc ps U -> U) -> Type,
(forall x : forall U : Type, asFunc ps U -> U, F x) -> asPi ps F
with
| nil => fun _ G => G _
| p :: ps => fun _ G => fun x => asPiE _ _ (fun x' => G _)
end. | Fixpoint | asPiE | Generic | theories/Generic/Data.v | [
"Coq.Lists.List",
"ExtLib.Data.Member",
"ExtLib.Data.HList",
"ExtLib.Generic.Func"
] | [
"asFunc",
"asPi"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
asPi_combine ps {struct ps}
: forall (F G : _),
asPi ps (fun App => F App -> G App) ->
asPi ps F -> asPi ps G | :=
match ps as ps
return forall F G : (forall U : Type, asFunc ps U -> U) -> Type,
asPi ps (fun App : forall U : Type, asFunc ps U -> U => F App -> G App) ->
asPi ps F -> asPi ps G
with
| nil => fun _ _ a b => a b
| p :: ps => fun _ _ a b x => asPi_combine _ _ _ (a ... | Fixpoint | asPi_combine | Generic | theories/Generic/Data.v | [
"Coq.Lists.List",
"ExtLib.Data.Member",
"ExtLib.Data.HList",
"ExtLib.Generic.Func"
] | [
"asFunc",
"asPi"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
data T : (T -> Type) -> Type | :=
| Inj : forall X, Type -> data X
| Get : forall X, T -> data X
| Prod : forall X, data X -> data X -> data X
| Sigma : forall X (S : Type), (S -> data X) -> data X
| Pi : forall X (S : Type), (S -> data X) -> data X. | Inductive | data | Generic | theories/Generic/DerivingData.v | [
"String",
"List",
"ExtLib.Data.HList"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
dataD (T : Type) (X : T -> Type) (d : data X) : Type | :=
match d with
| Inj _X x => x
| Get X i => X i
| Prod l r => prod (dataD l) (dataD r)
| @Sigma _ _ i s => @sigT i (fun v => dataD (s v))
| @Pi _ _ i s => forall v : i, dataD (s v)
end. | Fixpoint | dataD | Generic | theories/Generic/DerivingData.v | [
"String",
"List",
"ExtLib.Data.HList"
] | [
"data"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
dataList (a : Type) : @data unit (fun _ => list a) | :=
@Sigma _ _ bool (fun x => match x with
| true => @Inj _ _ unit
| false => @Prod _ _ (Inj _ a) (Get _ tt)
end). | Definition | dataList | Generic | theories/Generic/DerivingData.v | [
"String",
"List",
"ExtLib.Data.HList"
] | [
"data"
] | Example of lists as data * | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
dataList_to_list : forall T (x : dataD (dataList T)), list T. | simpl. intros.
destruct x. destruct x.
apply nil.
simpl in *.
apply (fst d :: snd d).
Defined. | Theorem | dataList_to_list | Generic | theories/Generic/DerivingData.v | [
"String",
"List",
"ExtLib.Data.HList"
] | [
"apply",
"dataD",
"dataList"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
list_to_dataList : forall T (ls : list T), dataD (dataList T). | simpl. destruct 1.
exists true. apply tt.
exists false. apply (t, ls).
Defined. | Theorem | list_to_dataList | Generic | theories/Generic/DerivingData.v | [
"String",
"List",
"ExtLib.Data.HList"
] | [
"apply",
"dataD",
"dataList"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
dataP (T : Type) (X : T -> Type) (d : data X) (R : Type) : Type | :=
match d with
| Inj _X x => x -> R
| Get X x => X x -> R
| @Prod _ _ l r => dataP l (dataP r R)
| @Sigma _ _ i s => forall i, dataP (s i) R
| @Pi _ _ i s => (forall i, dataD (s i)) -> R
end. | Fixpoint | dataP | Generic | theories/Generic/DerivingData.v | [
"String",
"List",
"ExtLib.Data.HList"
] | [
"data",
"dataD"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
dataMatch (T : Type) (X : T -> Type) (d : data X) {struct d}
: forall (R : Type), dataP d R -> dataD d -> R | :=
match d as d return forall (R : Type), dataP d R -> dataD d -> R with
| Inj _ _ => fun _ p => p
| Get X x => fun _ p => p
| @Prod _ _ l r => fun _ p v =>
dataMatch r _ (dataMatch l _ p (fst v)) (snd v)
| @Sigma _ _ i d => fun _ p v =>
match v with
| existT _ x y ... | Fixpoint | dataMatch | Generic | theories/Generic/DerivingData.v | [
"String",
"List",
"ExtLib.Data.HList"
] | [
"data",
"dataD",
"dataP"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
asFunc (domain : list Type) (range : Type) : Type | :=
match domain with
| nil => range
| d :: ds => d -> asFunc ds range
end. | Fixpoint | asFunc | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
asPi (ps : list Type) {struct ps} :
((forall U, asFunc ps U -> U) -> Type) -> Type | :=
match ps as ps return ((forall U, asFunc ps U -> U) -> Type) -> Type with
| nil => fun f => f (fun _ x => x)
| p :: ps => fun f => forall x : p, asPi ps (fun App => f (fun _ f' => App _ (f' x)))
end. | Fixpoint | asPi | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [
"asFunc"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
asTuple (domain : list Type) : Type | :=
match domain with
| nil => unit
| d :: ds => prod d (asTuple ds)
end. | Fixpoint | asTuple | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
applyF {domain : list Type} {range : Type}
: asFunc domain range -> asTuple domain -> range | :=
match domain as domain
return asFunc domain range -> asTuple domain -> range
with
| nil => fun x _ => x
| d :: ds => fun f x_xs => applyF (f (fst x_xs)) (snd x_xs)
end. | Fixpoint | applyF | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [
"asFunc",
"asTuple"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
const {D R} (r : R) : asFunc D R | :=
match D with
| nil => r
| _ :: D => fun _ => const r
end. | Fixpoint | const | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [
"asFunc"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
uncurry {D R} {struct D} : (asTuple D -> R) -> asFunc D R | :=
match D as D return (asTuple D -> R) -> asFunc D R with
| nil => fun x => x tt
| d :: D => fun f d => uncurry (fun x => f (d, x))
end. | Fixpoint | uncurry | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [
"asFunc",
"asTuple"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
curry {D R} {struct D} : asFunc D R -> (asTuple D -> R) | :=
match D as D return asFunc D R -> (asTuple D -> R) with
| nil => fun x _ => x
| d :: D => fun f x => curry (f (fst x)) (snd x)
end. | Fixpoint | curry | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [
"asFunc",
"asTuple"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
get (domain : list Type) (range : Type) T (m : member T domain)
: (T -> asFunc domain range) -> asFunc domain range | :=
match m in member _ domain
return (T -> asFunc domain range) -> asFunc domain range
with
| MZ _ _ => fun F x => F x x
| MN _ m => fun F x => @get _ _ _ m (fun y => F y x)
end. | Fixpoint | get | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [
"asFunc",
"member"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
under (domain : list Type) (range : Type)
{struct domain}
: ((forall U, asFunc domain U -> U) -> range)
-> asFunc domain range | :=
match domain as domain
return ((forall U, asFunc domain U -> U) -> range)
-> asFunc domain range
with
| nil => fun F => F (fun _ x => x)
| d :: ds => fun F x =>
under ds range (fun App => F (fun U f => App U (f x)))
end%type. | Fixpoint | under | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [
"asFunc",
"type"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
replace {ps} {T U : Type} (m : member T ps) (v : T) {struct m}
: asFunc ps U -> asFunc ps U | :=
match m in member _ ps return asFunc ps U -> asFunc ps U with
| MZ _ _ => fun f _ => f v
| MN _ m => fun f x => replace m v (f x)
end. | Fixpoint | replace | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [
"asFunc",
"member"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
combine (domain : list Type)
(a : asFunc domain T) (b : asFunc domain U)
: asFunc domain V | :=
under domain _ (fun App => join (App _ a) (App _ b)). | Definition | combine | Generic | theories/Generic/Func.v | [
"Coq.Lists.List",
"ExtLib.Data.Member"
] | [
"asFunc",
"join",
"under"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
type : Type | :=
| Self : type
| Inj : Type -> type. | Inductive | type | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
product | := list type. | Definition | product | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"type"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
variant | := list product. | Definition | variant | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"product"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
typeD (t : type) : Type | :=
match t with
| Self => M
| Inj t => t
end. | Definition | typeD | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"type"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
func (T : Type) (v : product) : Type | :=
fold_right (fun x acc => typeD x -> acc) T v. | Definition | func | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"fold_right",
"product",
"typeD"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
data (v : product) : Type | :=
fold_right (fun x acc => typeD x * acc)%type unit v. | Definition | data | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"fold_right",
"product",
"type",
"typeD"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
matchD (T : Type) (v : variant) : Type | :=
fold_right (fun x acc => func T x -> acc)%type T v. | Definition | matchD | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"fold_right",
"func",
"type",
"variant"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
dataD (v : variant) : Type | :=
fold_right (fun x acc => data x + acc)%type Empty_set v. | Definition | dataD | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"data",
"fold_right",
"type",
"variant"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
recD (T : Type) (c : Type -> Type) (v : variant) : Type | :=
fold_right (fun x acc =>
fold_right (fun x acc =>
match x with
| Inj t => t
| Self => c T
end -> acc) (c T) x -> acc) (M -> T) v. | Definition | recD | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"fold_right",
"variant"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Data (T : Type) : Type | :=
{ repr : variant
; into : dataD T repr -> T
; outof : T -> forall A, matchD T A repr
; rec : forall c {_ : CoMonad c}, forall A, recD T A c repr
}. | Class | Data | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"CoMonad",
"dataD",
"matchD",
"recD",
"variant"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Data_nat : Data nat | :=
{ repr := nil :: (Self :: nil) :: nil
; outof := fun x _ z s =>
match x with
| 0 => z
| S n => s n
end
; into := fun d =>
match d with
| inl tt => 0
| inr (inl (n, tt)) => n
| inr (inr x) => match x with end
end
; rec := fun c _ A z s d =>
extract ((fix recur (d : nat) {struct d} : c A ... | Instance | Data_nat | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"Data"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Data_list {A} : Data (list A) | :=
{ repr := (nil) :: (Inj A :: Self :: nil) :: nil
; outof := fun x _ n c =>
match x with
| nil => n
| x :: xs => c x xs
end
; into := fun d =>
match d with
| inl tt => nil
| inr (inl (x, (xs, tt))) => x :: xs
| inr (inr x) => match x with end
end
; rec := fun c _ T n co d =>
extract ((fi... | Instance | Data_list | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"Data"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Comoand_Id : CoMonad id | :=
{ extract := fun _ x => x
; extend := fun _ _ x f => x f
}. | Instance | Comoand_Id | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"CoMonad"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
ProductResolve (C : Type -> Type) (r : product) : Type | :=
fold_right (fun t acc =>
match t with
| Inj t => C t * acc
| Self => acc
end)%type unit r. | Definition | ProductResolve | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"fold_right",
"product",
"type"
] | Inductive AllResolve (C : Type -> Type) : list type -> Type :=
| AllResolve_nil : AllResolve C nil
| AllResolve_Self : forall ls, AllResolve C ls -> AllResolve C (Self :: ls)
| AllResolve_Inj : forall t ls, C t -> AllResolve C ls -> AllResolve C (Inj t :: ls).
Existing Class AllResolve. | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
VariantResolve (C : Type -> Type) (r : variant) : Type | :=
fold_right (fun p acc => ProductResolve C p * acc)%type unit r. | Definition | VariantResolve | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"ProductResolve",
"fold_right",
"type",
"variant"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
all_resolve | :=
simpl VariantResolve; simpl ProductResolve;
repeat match goal with
| |- unit => apply tt
| |- (unit * _)%type => constructor; [ apply tt | ]
| |- (_ * _)%type => constructor
| |- _ => solve [ eauto with typeclass_instances ]
end. | Ltac | all_resolve | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"ProductResolve",
"VariantResolve",
"apply",
"type"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
comma_before (b : bool) (s : showM) : showM | :=
if b then
cat (show_exact ",") s
else
s. | Definition | comma_before | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"cat",
"showM",
"show_exact"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
show_product (first : bool) (r : list type) {struct r} :
ProductResolve Show r ->
(showM -> showM) ->
(fold_right
(fun (x : type) (acc : Type) =>
match x with
| Self => showM
| Inj t => t
end -> acc) (showM) r). | refine (
match r as r
return
ProductResolve Show r ->
(showM -> showM) ->
(fold_right
(fun (x : type) (acc : Type) =>
match x with
| Self => showM
| Inj t => t
end -> acc) (showM) r)
with
| nil => fun _ f => f empty
... | Fixpoint | show_product | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"ProductResolve",
"Show",
"cat",
"comma_before",
"empty",
"fold_right",
"showM",
"type"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Show_data (T : Type) (d : Data T) (AS : VariantResolve Show repr) : Show T | :=
{ show :=
(fix recur (repr : variant) : VariantResolve Show repr -> recD T showM id repr -> T -> showM :=
match repr as repr return
VariantResolve Show repr -> recD T showM id repr -> T -> showM
with
| nil => fun _ x => x
| r :: rs => fun a k' =>
recur rs (snd a) (k' (show_produ... | Instance | Show_data | Generic | theories/Generic/Ind.v | [
"Coq",
"List",
"String",
"ExtLib.Structures.CoMonad",
"ExtLib.Programming.Show",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Structures.Monads"
] | [
"Data",
"Show",
"VariantResolve",
"cat",
"recD",
"showM",
"show_exact",
"show_product",
"variant"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Eqv T | := eqv : T -> T -> Prop. | Class | Eqv | Programming | theories/Programming/Eqv.v | [
"Equivalence",
"ExtLib.Core.RelDec",
"EqvNotation"
] | [] | 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.