Dataset Viewer
Auto-converted to Parquet Duplicate
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
value : Type
:= | Int : nat -> value | Bool : bool -> value.
Inductive
value
examples
examples/EvalWithExc.v
[ "Coq.Strings.String", "ExtLib.Structures.Monads", "ExtLib.Data.Monads.EitherMonad", "ExtLib.Data.String", "MonadNotation" ]
[]
Syntax and values of a simple language *
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
exp : Type
:= | ConstI : nat -> exp | ConstB : bool -> exp | Plus : exp -> exp -> exp | If : exp -> exp -> exp -> exp.
Inductive
exp
examples
examples/EvalWithExc.v
[ "Coq.Strings.String", "ExtLib.Structures.Monads", "ExtLib.Data.Monads.EitherMonad", "ExtLib.Data.String", "MonadNotation" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
asInt (v : value) : m nat
:= match v with | Int n => ret n | _ => (** if we don't have an integer, signal an error using ** [raise] from the MoandExc instance **) raise ("expected integer got bool")%string end.
Definition
asInt
examples
examples/EvalWithExc.v
[ "Coq.Strings.String", "ExtLib.Structures.Monads", "ExtLib.Data.Monads.EitherMonad", "ExtLib.Data.String", "MonadNotation" ]
[ "value" ]
Functions that get [nat] or [bool] values from a [value] *
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
asBool (v : value) : m bool
:= match v with | Bool b => ret b | _ => raise ("expected bool got integer")%string end.
Definition
asBool
examples
examples/EvalWithExc.v
[ "Coq.Strings.String", "ExtLib.Structures.Monads", "ExtLib.Data.Monads.EitherMonad", "ExtLib.Data.String", "MonadNotation" ]
[ "value" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eval' (e : exp) : m value
:= match e with (** when there is no error, we can just return (i.e. [ret]) ** the answer **) | ConstI i => ret (Int i) | ConstB b => ret (Bool b) | Plus l r => (** evaluate the sub-terms to numbers **) l <- eval' l ;; l <- asInt l ;; r <- ...
Fixpoint
eval'
examples
examples/EvalWithExc.v
[ "Coq.Strings.String", "ExtLib.Structures.Monads", "ExtLib.Data.Monads.EitherMonad", "ExtLib.Data.String", "MonadNotation" ]
[ "asBool", "asInt", "exp", "value" ]
The main evaluator routine returns a [value], but since we are ** working in the [m] monad, we return [m value] *
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eval : exp -> string + value
:= eval' (m := sum string).
Definition
eval
examples
examples/EvalWithExc.v
[ "Coq.Strings.String", "ExtLib.Structures.Monads", "ExtLib.Data.Monads.EitherMonad", "ExtLib.Data.String", "MonadNotation" ]
[ "eval'", "exp", "value" ]
Wrap the [eval] function up with the monad instance that we ** want to use *
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
update1 : istate A B unit
:= modify_ function1.
Definition
update1
examples
examples/indexedstate.v
[ "ExtLib.Data.Monads.IStateMonad", "ExtLib.Structures.IXMonad", "IxMonadNotation" ]
[ "istate", "modify_" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
update2 : istate B C unit
:= modify_ function2.
Definition
update2
examples
examples/indexedstate.v
[ "ExtLib.Data.Monads.IStateMonad", "ExtLib.Structures.IXMonad", "IxMonadNotation" ]
[ "istate", "modify_" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
compose : istate A C unit
:= update1 ;; update2.
Definition
compose
examples
examples/indexedstate.v
[ "ExtLib.Data.Monads.IStateMonad", "ExtLib.Structures.IXMonad", "IxMonadNotation" ]
[ "istate", "update1", "update2" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
repeatM `{Monad M} (n : nat) `(x : A) (p : A -> M A) : M unit
:= match n with | O => ret tt | S n => y <- p x;; repeatM n y p end.
Fixpoint
repeatM
examples
examples/Notations.v
[ "ExtLib.Structures.Monad", "MonadNotation", "MonadLetNotation" ]
[ "Monad" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
repeatM `{Monad M} (n : nat) `(x : A) (p : A -> M A) : M unit
:= match n with | O => ret tt | S n => let* y := p x in repeatM n y p end.
Fixpoint
repeatM
examples
examples/Notations.v
[ "ExtLib.Structures.Monad", "MonadNotation", "MonadLetNotation" ]
[ "Monad" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
PrinterMonad : Type -> Type
:= writerT (@show_mon _ ShowScheme_string_compose) ident.
Definition
PrinterMonad
examples
examples/Printing.v
[ "Coq.Strings.String", "ExtLib.Structures.MonadWriter", "ExtLib.Data.PPair", "ExtLib.Data.Monads.WriterMonad", "ExtLib.Data.Monads.IdentityMonad", "ExtLib.Programming.Show" ]
[ "ShowScheme_string_compose", "ident", "writerT" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
print {T : Type} {ST : Show T} (val : T) : PrinterMonad unit
:= @MonadWriter.tell _ (@show_mon _ ShowScheme_string_compose) _ _ (@show _ ST val _ show_inj (@show_mon _ ShowScheme_string_compose)).
Definition
print
examples
examples/Printing.v
[ "Coq.Strings.String", "ExtLib.Structures.MonadWriter", "ExtLib.Data.PPair", "ExtLib.Data.Monads.WriterMonad", "ExtLib.Data.Monads.IdentityMonad", "ExtLib.Programming.Show" ]
[ "MonadWriter", "PrinterMonad", "Show", "ShowScheme_string_compose" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
printString (str : string) : PrinterMonad unit
:= @MonadWriter.tell _ (@show_mon _ ShowScheme_string_compose) _ _ (@show_exact str _ show_inj (@show_mon _ ShowScheme_string_compose)).
Definition
printString
examples
examples/Printing.v
[ "Coq.Strings.String", "ExtLib.Structures.MonadWriter", "ExtLib.Data.PPair", "ExtLib.Data.Monads.WriterMonad", "ExtLib.Data.Monads.IdentityMonad", "ExtLib.Programming.Show" ]
[ "MonadWriter", "PrinterMonad", "ShowScheme_string_compose", "show_exact" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
runPrinter {T : Type} (c : PrinterMonad T) : T * string
:= let '(ppair val str) := unIdent (runWriterT c) in (val, str ""%string).
Definition
runPrinter
examples
examples/Printing.v
[ "Coq.Strings.String", "ExtLib.Structures.MonadWriter", "ExtLib.Data.PPair", "ExtLib.Data.Monads.WriterMonad", "ExtLib.Data.Monads.IdentityMonad", "ExtLib.Programming.Show" ]
[ "PrinterMonad" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
GameValue : Type
:= Z.
Definition
GameValue
examples
examples/StateGame.v
[ "Coq.ZArith.ZArith_base", "Coq.Strings.String", "Coq.Strings.Ascii", "ExtLib.Data.Monads.StateMonad", "ExtLib.Structures.Monads", "MonadNotation" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
GameState : Type
:= (prod bool Z).
Definition
GameState
examples
examples/StateGame.v
[ "Coq.ZArith.ZArith_base", "Coq.Strings.String", "Coq.Strings.Ascii", "ExtLib.Data.Monads.StateMonad", "ExtLib.Structures.Monads", "MonadNotation" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
playGame (s: string) {struct s}: m GameValue
:= match s with | EmptyString => v <- get ;; let '(on, score) := v in ret score | String x xs => v <- get ;; let '(on, score) := v in match x, on with | "a", true => put (on, score + 1) | "b", true => put (on, score - 1) | "c", _ => pu...
Fixpoint
playGame
examples
examples/StateGame.v
[ "Coq.ZArith.ZArith_base", "Coq.Strings.String", "Coq.Strings.Ascii", "ExtLib.Data.Monads.StateMonad", "ExtLib.Structures.Monads", "MonadNotation" ]
[ "GameValue", "get", "put" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
startState: GameState
:= (false, 0).
Definition
startState
examples
examples/StateGame.v
[ "Coq.ZArith.ZArith_base", "Coq.Strings.String", "Coq.Strings.Ascii", "ExtLib.Data.Monads.StateMonad", "ExtLib.Structures.Monads", "MonadNotation" ]
[ "GameState" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
main : GameValue
:= (@evalState GameState GameValue (playGame (state GameState) "abcaaacbbcabbab") startState).
Definition
main
examples
examples/StateGame.v
[ "Coq.ZArith.ZArith_base", "Coq.Strings.String", "Coq.Strings.Ascii", "ExtLib.Data.Monads.StateMonad", "ExtLib.Structures.Monads", "MonadNotation" ]
[ "GameState", "GameValue", "evalState", "playGame", "startState", "state" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
foo : stateT unit option unit
:= ret tt.
Definition
foo
examples
examples/StateTMonad.v
[ "ExtLib", "Monad", "OptionMonad", "StateMonad" ]
[ "stateT" ]
Now the definition succeeds
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
contains_both (v1 v2 : V) (s : set) : bool
:= contains v1 s && contains v2 s.
Definition
contains_both
examples
examples/UsingSets.v
[ "Coq.Bool.Bool", "ExtLib.Structures.Sets", "ExtLib.Structures.Reducible", "ExtLib.Structures.Functor", "ExtLib.Data.Set.ListSet", "ExtLib.ExtLib" ]
[ "contains" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
toList (s : set) : list V
:= fold (@cons _) nil s.
Definition
toList
examples
examples/UsingSets.v
[ "Coq.Bool.Bool", "ExtLib.Structures.Sets", "ExtLib.Structures.Reducible", "ExtLib.Structures.Functor", "ExtLib.Data.Set.ListSet", "ExtLib.ExtLib" ]
[ "fold" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RTest : Set
:= mkRTest { a : bool ; b : nat ; c : bool }.
Record
RTest
examples
examples/WithDemo.v
[ "List", "ExtLib.Programming.With" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Struct_RTest : Struct RTest
:= { fields := ((@existT _ _ _ a) :: (@existT _ _ _ b) :: (@existT _ _ _ c):: nil) ; ctor := mkRTest }.
Instance
Struct_RTest
examples
examples/WithDemo.v
[ "List", "ExtLib.Programming.With" ]
[ "RTest", "Struct" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Acc_RTest_a : Accessor a
:= { acc := Here }.
Instance
Acc_RTest_a
examples
examples/WithDemo.v
[ "List", "ExtLib.Programming.With" ]
[ "Accessor" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Acc_RTest_b : Accessor b
:= { acc := Next Here }.
Instance
Acc_RTest_b
examples
examples/WithDemo.v
[ "List", "ExtLib.Programming.With" ]
[ "Accessor" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Acc_RTest_c : Accessor c
:= { acc := Next (Next Here) }.
Instance
Acc_RTest_c
examples
examples/WithDemo.v
[ "List", "ExtLib.Programming.With" ]
[ "Accessor" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
compose (A B C : Type) (f : A -> B) (g : B -> C) : A -> C
:= fun x => g (f x).
Definition
compose
scratch
scratch/FunctorFromMonad.v
[ "Relations", "ExtLib.Data.Fun", "ExtLib.Structures.Proper", "ExtLib.Structures.Monad", "ExtLib.Structures.FunctorRelations", "ExtLib.Structures.MonadLaws" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
pure (T : Type) : T -> m T
:= @ret _ _ _.
Definition
pure
scratch
scratch/FunctorFromMonad.v
[ "Relations", "ExtLib.Data.Fun", "ExtLib.Structures.Proper", "ExtLib.Structures.Monad", "ExtLib.Structures.FunctorRelations", "ExtLib.Structures.MonadLaws" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
fapply (T U : Type) (f : m (T -> U)) (x : m T) : m U
:= bind f (fun f => bind x (fun x => ret (f x))).
Definition
fapply
scratch
scratch/FunctorFromMonad.v
[ "Relations", "ExtLib.Data.Fun", "ExtLib.Structures.Proper", "ExtLib.Structures.Monad", "ExtLib.Structures.FunctorRelations", "ExtLib.Structures.MonadLaws" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
fun_app_proper (A B : Type) (rA : relation A) (rB : relation B) (pA : Proper rA) (pB : Proper rB) (f : A -> B) x : proper f -> proper x -> proper (f x).
Proof. intros. apply H. auto. Qed.
Instance
fun_app_proper
scratch
scratch/FunctorFromMonad.v
[ "Relations", "ExtLib.Data.Fun", "ExtLib.Structures.Proper", "ExtLib.Structures.Monad", "ExtLib.Structures.FunctorRelations", "ExtLib.Structures.MonadLaws" ]
[ "apply" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
fun_abs (A B : Type) (rA : relation A) (rB : relation B) (pA : Proper rA) (pB : Proper rB) (f : A -> B) : (forall x, proper x -> proper (f x)) -> (forall x y, proper x -> proper y -> rA x y -> rB (f x) (f y)) -> proper (fun x => f x).
Proof. intros. split; auto; eapply H. Qed.
Instance
fun_abs
scratch
scratch/FunctorFromMonad.v
[ "Relations", "ExtLib.Data.Fun", "ExtLib.Structures.Proper", "ExtLib.Structures.Monad", "ExtLib.Structures.FunctorRelations", "ExtLib.Structures.MonadLaws" ]
[ "split" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
prove_proper x k
:= match x with | _ => match goal with | [ H : proper x |- _ ] => k H end | bind ?A ?B => prove_proper A ltac:(fun a => prove_proper B ltac:(fun b => let H := fresh in assert (H : proper x); [ eapply bind_proper; eauto with typeclass_instances |...
Ltac
prove_proper
scratch
scratch/FunctorFromMonad.v
[ "Relations", "ExtLib.Data.Fun", "ExtLib.Structures.Proper", "ExtLib.Structures.Monad", "ExtLib.Structures.FunctorRelations", "ExtLib.Structures.MonadLaws" ]
[ "apply", "assert", "fun_abs" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
PReflexive_stuff : PReflexive (pfun_ext (pfun_ext (pfun_ext rC pA) (Proper_pfun pB pC)) (Proper_pfun pA pB)).
Proof. intuition. Qed.
Instance
PReflexive_stuff
scratch
scratch/FunctorFromMonad.v
[ "Relations", "ExtLib.Data.Fun", "ExtLib.Structures.Proper", "ExtLib.Structures.Monad", "ExtLib.Structures.FunctorRelations", "ExtLib.Structures.MonadLaws" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
bind_law : forall (f : A -> B) (g : B -> C), proper f -> proper g -> mleq (pfun_ext rC pA) (fapply (fapply (pure (@compose A B C)) (pure f)) (pure g)) (pure (compose f g)).
Proof. unfold fapply, pure, compose; simpl; intros. propers. (eapply ptransitive; [ | | | | eapply (@bind_associativity _ _ _ _ MonadLaws_mleq) | ]); eauto with typeclass_instances; propers. (eapply ptransitive; [ | | | | eapply (@bind_of_return _ _ _ _ MonadLaws_mleq) | ]); eauto with typeclass_instan...
Theorem
bind_law
scratch
scratch/FunctorFromMonad.v
[ "Relations", "ExtLib.Data.Fun", "ExtLib.Structures.Proper", "ExtLib.Structures.Monad", "ExtLib.Structures.FunctorRelations", "ExtLib.Structures.MonadLaws" ]
[ "compose", "fapply", "pure" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Any (T : Type) : Prop.
Class
Any
Core
theories/Core/Any.v
[]
[]
This class should be used when no requirements are needed *
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Any_a (T : Type) : Any T
:= {}.
Instance
Any_a
Core
theories/Core/Any.v
[]
[ "Any" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RESOLVE (T : Type) : Type
:= T.
Definition
RESOLVE
Core
theories/Core/Any.v
[]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
CmpDec (T : Type) (equ : T -> T -> Prop) (ltu : T -> T -> Prop) : Type
:= { cmp_dec : T -> T -> comparison }.
Class
CmpDec
Core
theories/Core/CmpDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "ExtLib.Tactics.Consider" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
CmpDec_Correct T (equ ltu : T -> T -> Prop) (ED : CmpDec equ ltu) : Prop
:= { cmp_dec_correct : forall x y : T, match cmp_dec x y with | Eq => equ x y | Lt => ltu x y | Gt => ltu y x end }.
Class
CmpDec_Correct
Core
theories/Core/CmpDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "ExtLib.Tactics.Consider" ]
[ "CmpDec" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
cmp_case (P Q R : Prop) : comparison -> Prop
:= | CaseEq : P -> cmp_case P Q R Eq | CaseLt : Q -> cmp_case P Q R Lt | CaseGt : R -> cmp_case P Q R Gt.
Inductive
cmp_case
Core
theories/Core/CmpDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "ExtLib.Tactics.Consider" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_pair (a b : T * U) : Prop
:= eqt (fst a) (fst b) /\ equ (snd a) (snd b).
Definition
eq_pair
Core
theories/Core/CmpDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "ExtLib.Tactics.Consider" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
lt_pair (a b : T * U) : Prop
:= ltt (fst a) (fst b) \/ (eqt (fst a) (fst b) /\ ltu (snd a) (snd b)).
Definition
lt_pair
Core
theories/Core/CmpDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "ExtLib.Tactics.Consider" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
CmpDec_pair : CmpDec eq_pair lt_pair
:= { cmp_dec := fun a b => let '(al,ar) := a in let '(bl,br) := b in match cmp_dec al bl with | Eq => cmp_dec ar br | x => x end }.
Instance
CmpDec_pair
Core
theories/Core/CmpDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "ExtLib.Tactics.Consider" ]
[ "CmpDec", "eq_pair", "lt_pair" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
CmpDec_Correct_pair : CmpDec_Correct CmpDec_pair.
Proof. constructor. destruct x; destruct y; unfold eq_pair, lt_pair; simpl in *. generalize (cmp_dec_correct t t0); destruct (cmp_dec t t0); simpl; intros; auto. generalize (cmp_dec_correct u u0); destruct (cmp_dec u u0); simpl; intros; auto. Qed.
Instance
CmpDec_Correct_pair
Core
theories/Core/CmpDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "ExtLib.Tactics.Consider" ]
[ "CmpDec_Correct", "CmpDec_pair", "eq_pair", "lt_pair" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
decideP (P : Prop) {D : Decidable P} : {P} + {~P}
:= match @Decidable_witness P D as X return (X = true -> P) -> (X = false -> ~P) -> {P} + {~P} with | true => fun pf _ => left (pf eq_refl) | false => fun _ pf => right (pf eq_refl) end (@Decidable_sound _ D) (@Decidable_complete_alt _ D).
Definition
decideP
Core
theories/Core/Decision.v
[ "Coq.Classes", "DecidableClass" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
cases_ifd Hn
:= match goal with |- context[if ?d then ?tt else ?ff] => let Hnt := fresh Hn "t" in let Hnf := fresh Hn "f" in destruct d as [Hnt | Hnf] end.
Ltac
cases_ifd
Core
theories/Core/Decision.v
[ "Coq.Classes", "DecidableClass" ]
[ "context" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
decide_decideP {P:Prop }`{Decidable P} {R:Type} (a b : R) : (if (decide P) then a else b) = (if (decideP P) then a else b).
Proof. symmetry. unfold decide. destruct (decideP P). - rewrite Decidable_complete; auto. - rewrite Decidable_sound_alt; auto. Qed.
Lemma
decide_decideP
Core
theories/Core/Decision.v
[ "Coq.Classes", "DecidableClass" ]
[ "decideP" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
EquivDec_refl_left {T : Type} {c : EqDec T (@eq T)} : forall (n : T), equiv_dec n n = left (refl_equal _).
Proof. intros. destruct (equiv_dec n n); try congruence. Require Eqdep_dec. rewrite (Eqdep_dec.UIP_dec (A := T) (@equiv_dec _ _ _ c) e (refl_equal _)). reflexivity. Qed.
Theorem
EquivDec_refl_left
Core
theories/Core/EquivDec.v
[ "Coq.Classes", "EquivDec", "Eqdep_dec" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec (T : Type) (equ : T -> T -> Prop) : Type
:= { rel_dec : T -> T -> bool }.
Class
RelDec
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec_Correct T (equ : T -> T -> Prop) (ED : RelDec equ) : Prop
:= { rel_dec_correct : forall x y : T, rel_dec x y = true <-> equ x y }.
Class
RelDec_Correct
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[ "RelDec" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
"a ?[ r ] b"
:= (@rel_dec _ r _ a b) (at level 30, b at next level).
Notation
a ?[ r ] b
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_dec {T : Type} {ED : RelDec (@eq T)}
:= rel_dec.
Definition
eq_dec
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[ "RelDec" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
neg_rel_dec_correct : forall {x y}, ~R x y <-> rel_dec x y = false.
Proof. intros x y. destruct (bool_dec (rel_dec x y) true) ; constructor ; intros ; repeat match goal with | [ |- ~ _ ] => unfold not ; intros | [ H1 : ?P, H2 : ~?P |- _ ] => specialize (H2 H1) ; contradiction | [ H1 : ?P = true, H2 : ?P = false |- _ ] => rewrite H1 in H2 ; discriminate ...
Definition
neg_rel_dec_correct
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[ "apply" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rel_dec_p (x:T) (y:T) : {R x y} + {~R x y}.
Proof. destruct (bool_dec (rel_dec x y) true) as [H | H]. apply rel_dec_correct in H ; eauto. apply not_true_is_false in H ; apply neg_rel_dec_correct in H ; eauto. Qed.
Definition
rel_dec_p
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[ "apply", "neg_rel_dec_correct" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
neg_rel_dec_p (x:T) (y:T) : {~R x y} + {R x y}.
Proof. destruct (rel_dec_p x y) ; [ right | left ] ; auto. Qed.
Definition
neg_rel_dec_p
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[ "rel_dec_p" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rel_dec_eq_true : forall x y, eqt x y -> rel_dec x y = true.
Proof. intros. eapply rel_dec_correct in H. assumption. Qed.
Theorem
rel_dec_eq_true
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rel_dec_neq_false : forall x y, ~eqt x y -> rel_dec x y = false.
Proof. intros. remember (x ?[ eqt ] y). symmetry in Heqb. destruct b; try reflexivity. exfalso. eapply (@rel_dec_correct _ _ _ rc) in Heqb. auto. Qed.
Theorem
rel_dec_neq_false
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
rel_dec_sym : Symmetric eqt -> forall x y, x ?[ eqt ] y = y ?[ eqt ] x.
Proof. intros. remember (x ?[ eqt ] y); remember (y ?[ eqt ] x); intuition. destruct b; destruct b0; auto. { symmetry in Heqb; symmetry in Heqb0. eapply (@rel_dec_correct _ _ _ rc) in Heqb. symmetry in Heqb. eapply (@rel_dec_correct _ _ _ rc) in Heqb. congruence. } { symmetry...
Theorem
rel_dec_sym
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec_from_dec : RelDec R
:= {| rel_dec := fun a b => match f a b with | left _ => true | right _ => false end |}.
Definition
RelDec_from_dec
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[ "RelDec" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec_Correct_eq_typ : RelDec_Correct RelDec_from_dec.
Proof. constructor. intros. unfold rel_dec; simpl. destruct (f x y). - tauto. - split. + inversion 1. + intro. apply n in H. tauto. Qed.
Instance
RelDec_Correct_eq_typ
Core
theories/Core/RelDec.v
[ "Coq.Bool.Bool", "Coq.Classes.RelationClasses", "Coq.Setoids.Setoid" ]
[ "RelDec_Correct", "RelDec_from_dec", "apply", "split" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec_eq : RelDec (@eq bool)
:= { rel_dec := fun x y => match x , y with | true , true | false , false => true | _ , _=> false end }.
Instance
RelDec_eq
Data
theories/Data/Bool.v
[ "ExtLib.Core.RelDec" ]
[ "RelDec" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec_Correct_eq_bool : RelDec_Correct RelDec_eq.
constructor. destruct x; destruct y; auto; simpl; intuition. Qed.
Instance
RelDec_Correct_eq_bool
Data
theories/Data/Bool.v
[ "ExtLib.Core.RelDec" ]
[ "RelDec_Correct", "RelDec_eq" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec_ascii : RelDec (@eq Ascii.ascii)
:= { rel_dec := Ascii.eqb }.
Instance
RelDec_ascii
Data
theories/Data/Char.v
[ "Coq.Strings.Ascii", "ExtLib.Data.Bool", "ExtLib.Tactics.Consider", "ExtLib.Core.RelDec", "Ascii" ]
[ "RelDec" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec_Correct_ascii : RelDec_Correct RelDec_ascii.
Proof. constructor; auto using Ascii.eqb_eq. Qed.
Instance
RelDec_Correct_ascii
Data
theories/Data/Char.v
[ "Coq.Strings.Ascii", "ExtLib.Data.Bool", "ExtLib.Tactics.Consider", "ExtLib.Core.RelDec", "Ascii" ]
[ "RelDec_Correct", "RelDec_ascii" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Reflect_ascii_dec a b : Reflect (Ascii.eqb a b) (a = b) (a <> b).
Proof. apply iff_to_reflect; auto using Ascii.eqb_eq. Qed.
Instance
Reflect_ascii_dec
Data
theories/Data/Char.v
[ "Coq.Strings.Ascii", "ExtLib.Data.Bool", "ExtLib.Tactics.Consider", "ExtLib.Core.RelDec", "Ascii" ]
[ "Reflect", "apply", "iff_to_reflect" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
digit2ascii (n:nat) : Ascii.ascii
:= match n with | 0 => "0" | 1 => "1" | 2 => "2" | 3 => "3" | 4 => "4" | 5 => "5" | 6 => "6" | 7 => "7" | 8 => "8" | 9 => "9" | n => ascii_of_nat (n - 10 + nat_of_ascii "A") end%char.
Definition
digit2ascii
Data
theories/Data/Char.v
[ "Coq.Strings.Ascii", "ExtLib.Data.Bool", "ExtLib.Tactics.Consider", "ExtLib.Core.RelDec", "Ascii" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
chr_newline : ascii
:= Eval compute in ascii_of_nat 10.
Definition
chr_newline
Data
theories/Data/Char.v
[ "Coq.Strings.Ascii", "ExtLib.Data.Bool", "ExtLib.Tactics.Consider", "ExtLib.Core.RelDec", "Ascii" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Checked : option T -> Type
:= | Success : forall {v}, F v -> Checked (Some v) | Failure : Checked None.
Inductive
Checked
Data
theories/Data/Checked.v
[]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
succeeded (o : option T) (d : Checked o) : bool
:= match d with | Success _ _ => true | Failure => false end.
Definition
succeeded
Data
theories/Data/Checked.v
[]
[ "Checked" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
failed (o : option T) (d : Checked o) : bool
:= match d with | Success _ _ => false | Failure => true end.
Definition
failed
Data
theories/Data/Checked.v
[]
[ "Checked" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
asOption (o : option T) (d : Checked o) : option (match o with | None => False | Some x => F x end)
:= match d in Checked o return option match o with | None => False | Some x => F x end with | Success _ x => Some x | Failure => None end.
Definition
asOption
Data
theories/Data/Checked.v
[]
[ "Checked" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_sym_eq : forall T (a b : T) (pf : a = b) (F : T -> Type) val, match eq_sym pf in _ = x return F x with | eq_refl => val end = match pf in _ = x return F x -> F a with | eq_refl => fun x => x end val.
Proof. destruct pf. reflexivity. Defined.
Lemma
eq_sym_eq
Data
theories/Data/Eq.v
[ "ExtLib.Data.Eq.UIP_trans" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
match_eq_sym_eq : forall T (a b : T) (pf : a = b) F X, match pf in _ = t return F t with | eq_refl => match eq_sym pf in _ = t return F t with | eq_refl => X end end = X.
Proof. destruct pf. reflexivity. Defined.
Lemma
match_eq_sym_eq
Data
theories/Data/Eq.v
[ "ExtLib.Data.Eq.UIP_trans" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
match_eq_sym_eq' : forall T (a b : T) (pf : a = b) F X, match eq_sym pf in _ = t return F t with | eq_refl => match pf in _ = t return F t with | eq_refl => X end end = X.
Proof. destruct pf. reflexivity. Defined.
Lemma
match_eq_sym_eq'
Data
theories/Data/Eq.v
[ "ExtLib.Data.Eq.UIP_trans" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
match_eq_match_eq : forall T F (a b : T) (pf : a = b) X Y, X = Y -> match pf in _ = T return F T with | eq_refl => X end = match pf in _ = T return F T with | eq_refl => Y end.
Proof. intros. subst. auto. Defined.
Lemma
match_eq_match_eq
Data
theories/Data/Eq.v
[ "ExtLib.Data.Eq.UIP_trans" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_sym_eq_trans : forall T (a b c : T) (pf : a = b) (pf' : b = c), eq_sym (eq_trans pf pf') = eq_trans (eq_sym pf') (eq_sym pf).
Proof. clear. destruct pf. destruct pf'. reflexivity. Defined.
Lemma
eq_sym_eq_trans
Data
theories/Data/Eq.v
[ "ExtLib.Data.Eq.UIP_trans" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_Const_eq : forall T (a b : T) (pf : a = b) (R : Type) val, match pf in _ = x return R with | eq_refl => val end = val.
Proof. destruct pf. reflexivity. Defined.
Lemma
eq_Const_eq
Data
theories/Data/Eq.v
[ "ExtLib.Data.Eq.UIP_trans" ]
[]
Particular Instances *
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_Arr_eq : forall T (a b : T) (pf : a = b) (F G : T -> Type) val x, match pf in _ = x return F x -> G x with | eq_refl => val end x = match pf in _ = x return G x with | eq_refl => val match eq_sym pf in _ = x return F x with | eq_refl => x end ...
Proof. destruct pf. reflexivity. Defined.
Lemma
eq_Arr_eq
Data
theories/Data/Eq.v
[ "ExtLib.Data.Eq.UIP_trans" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
eq_sym_eq_sym : forall (T : Type) (a b : T) (pf : a = b), eq_sym (eq_sym pf) = pf.
Proof. destruct pf. reflexivity. Defined.
Lemma
eq_sym_eq_sym
Data
theories/Data/Eq.v
[ "ExtLib.Data.Eq.UIP_trans" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
autorewrite_eq_rw
:= repeat progress (autorewrite with eq_rw; repeat match goal with | |- context [ match ?X in @eq _ _ _ return _ -> _ with | eq_refl => _ end ] => rewrite (eq_Arr_eq X) ...
Ltac
autorewrite_eq_rw
Data
theories/Data/Eq.v
[ "ExtLib.Data.Eq.UIP_trans" ]
[ "context", "eq_Arr_eq" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
fin : nat -> Type
:= | F0 : forall {n}, fin (S n) | FS : forall {n}, fin n -> fin (S n).
Inductive
fin
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[]
`fin n` corresponds to "naturals less than `n`", i.e. a finite set of size n *
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
fin_all (n : nat) : list (fin n)
:= match n as n return list (fin n) with | 0 => nil | S n => @F0 n :: List.map (@FS _) (fin_all n) end%list.
Fixpoint
fin_all
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "fin" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
fin_all_In : forall {n} (f : fin n), List.In f (fin_all n).
Proof. induction n; intros. inversion f. remember (S n). destruct f. simpl; firstorder. inversion Heqn0. subst. simpl. right. apply List.in_map. auto. Qed.
Theorem
fin_all_In
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "apply", "fin", "fin_all" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
fin_case : forall n (f : fin (S n)), f = F0 \/ exists f', f = FS f'.
Proof. intros. generalize (fin_all_In f). intros. destruct H; auto. eapply List.in_map_iff in H. right. destruct H. exists x. intuition. Qed.
Theorem
fin_case
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "fin", "fin_all_In" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
fin0_elim (f : fin 0) : forall T, T
:= match f in fin n return match n with | 0 => forall T, T | _ => unit end with | F0 _ => tt | FS _ _ => tt end.
Definition
fin0_elim
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "fin" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
pf_lt (n m : nat) : Prop
:= match n , m with | 0 , S _ => True | S n , S m => pf_lt n m | _ , _ => False end.
Fixpoint
pf_lt
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
make (m n : nat) {struct m} : pf_lt n m -> fin m
:= match n as n , m as m return pf_lt n m -> fin m with | 0 , 0 => @False_rect _ | 0 , S n => fun _ => F0 | S n , 0 => @False_rect _ | S n , S m => fun pf => FS (make m n pf) end.
Fixpoint
make
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "fin", "pf_lt" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
"'##' n"
:= (@make _ n I) (at level 0).
Notation
'##' n
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "make" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Injective_FS {n : nat} (a b : fin n) : Injective (FS a = FS b).
refine {| result := a = b |}. abstract (intro ; inversion H ; eapply inj_pair2 in H1 ; assumption). Defined.
Instance
Injective_FS
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "Injective", "fin", "inj_pair2" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
fin_eq_dec {n} (x : fin n) {struct x} : fin n -> bool
:= match x in fin n' return fin n' -> bool with | F0 _ => fun y => match y with | F0 _ => true | _ => false end | FS n' x' => fun y : fin (S n') => match y in fin n'' return (match n'' with | 0 =>...
Fixpoint
fin_eq_dec
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "fin" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec_fin_eq (n : nat) : RelDec (@eq (fin n))
:= { rel_dec := fin_eq_dec }.
Instance
RelDec_fin_eq
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "RelDec", "fin", "fin_eq_dec" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
RelDec_Correct_fin_eq (n : nat) : RelDec_Correct (RelDec_fin_eq n).
Proof. constructor. induction x. simpl. intro. destruct (fin_case y) ; subst. intuition. destruct H ; subst. intuition; auto with *; try congruence. (* inversion H.*) intro ; destruct (fin_case y) ; subst ; simpl. intuition ; try congruence. inversion H. destruct H ; subst. split ; intro. f_equ...
Instance
RelDec_Correct_fin_eq
Data
theories/Data/Fin.v
[ "Coq.Lists.List", "ExtLib.Core.RelDec", "ExtLib.Tactics.EqDep", "ExtLib.Tactics.Injection" ]
[ "RelDec_Correct", "RelDec_fin_eq", "apply", "fin_case", "inv_all", "split" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Functor_Fun : Functor (Fun A)
:= { fmap _A _B g f x := g (f x) }.
Instance
Functor_Fun
Data
theories/Data/Fun.v
[ "ExtLib.Data.PreFun", "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "ExtLib.Structures.CoFunctor", "ExtLib.Structures.Monoid", "PreFun" ]
[ "Fun", "Functor" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
CoFunctor_Fun T : CoFunctor (fun x => x -> T)
:= {| cofmap := fun _ _ g f => fun x => f (g x) |}.
Instance
CoFunctor_Fun
Data
theories/Data/Fun.v
[ "ExtLib.Data.PreFun", "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "ExtLib.Structures.CoFunctor", "ExtLib.Structures.Monoid", "PreFun" ]
[ "CoFunctor" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Functor_functor F G (fF : Functor F) (fG : Functor G) : Functor (fun x => F (G x))
:= {| fmap := fun _ _ g => @fmap F _ _ _ (@fmap G _ _ _ g) |}.
Instance
Functor_functor
Data
theories/Data/Fun.v
[ "ExtLib.Data.PreFun", "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "ExtLib.Structures.CoFunctor", "ExtLib.Structures.Monoid", "PreFun" ]
[ "Functor" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
CoFunctor_functor F G (fF : Functor F) (fG : CoFunctor G) : CoFunctor (fun x => F (G x))
:= {| cofmap := fun _ _ g => @fmap F _ _ _ (@cofmap G _ _ _ g) |}.
Instance
CoFunctor_functor
Data
theories/Data/Fun.v
[ "ExtLib.Data.PreFun", "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "ExtLib.Structures.CoFunctor", "ExtLib.Structures.Monoid", "PreFun" ]
[ "CoFunctor", "Functor" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
Functor_cofunctor F G (fF : CoFunctor F) (fG : Functor G) : CoFunctor (fun x => F (G x))
:= {| cofmap := fun _ _ g => @cofmap F _ _ _ (@fmap G _ _ _ g) |}.
Instance
Functor_cofunctor
Data
theories/Data/Fun.v
[ "ExtLib.Data.PreFun", "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "ExtLib.Structures.CoFunctor", "ExtLib.Structures.Monoid", "PreFun" ]
[ "CoFunctor", "Functor" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
CoFunctor_cofunctor F G (fF : CoFunctor F) (fG : CoFunctor G) : Functor (fun x => F (G x))
:= {| fmap := fun _ _ g => @cofmap F _ _ _ (@cofmap G _ _ _ g) |}.
Instance
CoFunctor_cofunctor
Data
theories/Data/Fun.v
[ "ExtLib.Data.PreFun", "ExtLib.Structures.Functor", "ExtLib.Structures.Applicative", "ExtLib.Structures.CoFunctor", "ExtLib.Structures.Monoid", "PreFun" ]
[ "CoFunctor", "Functor" ]
https://github.com/coq-community/coq-ext-lib
ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075
End of preview. Expand in Data Studio

Coq-ExtLib

Structured dataset from coq-ext-lib — Extended standard library with monads and data structures.

Source

Schema

Column Type Description
statement string Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof
proof string Verbatim proof/body, empty if the declaration has none
type string Declaration keyword
symbolic_name string Declaration identifier
library string Sub-library
filename string Repository-relative source path
imports list[string] File-level Require/Import modules
deps list[string] Intra-corpus identifiers referenced
docstring string Preceding documentation comment, empty if absent
source_url string Upstream repository
commit string Upstream commit extracted

Statistics

  • Entries: 1,019
  • With proof: 1,005 (98.6%)
  • With docstring: 54 (5.3%)
  • Libraries: 15

By type

Type Count
Instance 251
Definition 238
Lemma 129
Fixpoint 114
Theorem 62
Class 60
Notation 57
Inductive 46
Ltac 37
Record 11
Hypothesis 11
Coercion 2
CoInductive 1

Example

exp : Type
:=
| ConstI : nat -> exp
| ConstB : bool -> exp
| Plus : exp -> exp -> exp
| If : exp -> exp -> exp -> exp.
  • type: Inductive | symbolic_name: exp | examples/EvalWithExc.v

Use

Each declaration is split into a statement (signature/claim) and a proof (body) that are disjoint and together form the complete declaration, for proof modeling, autoformalization, retrieval, and dependency analysis via deps.

Citation

@misc{coq_extlib_dataset,
  title  = {Coq-ExtLib},
  author = {Norton, Charles},
  year   = {2026},
  note   = {Extracted from https://github.com/coq-community/coq-ext-lib, commit ddd03d257f6b},
  url    = {https://huggingface.co/datasets/phanerozoic/Coq-ExtLib}
}
Downloads last month
62

Collection including phanerozoic/Coq-ExtLib