Skip to content

Commit 293dbd1

Browse files
committed
Merge branch 'v8.8'
2 parents 0e58cc4 + a105855 commit 293dbd1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2083
-812
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
*.vo
22
*.glob
33
*.v.d
4+
*.cmi
5+
*.cmx
6+
*.cmxs
7+
*.native
8+
*.o
9+
*.aux
410
Makefile.coq
511
Makefile.opam.coq
612
*~

Makefile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
PROJECT_NAME=coq-ext-lib
2-
31
all: theories examples
42

5-
theories:
6-
$(MAKE) -C theories
3+
theories: Makefile.coq
4+
$(MAKE) -f Makefile.coq
5+
6+
Makefile.coq:
7+
$(COQBIN)coq_makefile -f _CoqProject -o Makefile.coq
78

8-
install:
9-
$(MAKE) -C theories install
9+
install: Makefile.coq
10+
$(MAKE) -f Makefile.coq install
1011

1112
examples: theories
1213
$(MAKE) -C examples
1314

1415
clean:
15-
$(MAKE) -C theories clean
16+
$(MAKE) -f Makefile.coq clean
1617
$(MAKE) -C examples clean
18+
@ rm Makefile.coq
1719

1820
uninstall:
19-
$(MAKE) -C theories uninstall
21+
$(MAKE) -f Makefile.coq uninstall
2022

2123

2224
dist:
2325
@ git archive --prefix coq-ext-lib/ HEAD -o $(PROJECT_NAME).tgz
2426

25-
.dir-locals.el: tools/dir-locals.el
26-
@ sed s,PWD,$(shell pwd -P),g tools/dir-locals.el > .dir-locals.el
27-
2827
.PHONY: all clean dist theories examples

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ A collection of theories and plugins that may be useful in other Coq development
55

66
Ideas
77
-----
8+
- Embrace new features, e.g. universe polymorphism, primitive projections, etc.
89
- Use modules for controlling namespaces.
9-
- Avoid functors in favor of type classes since type classes are more flexible
10-
b/c they are first-class.
10+
- Use first-class abstractions where appropriate, e.g. type classes, canonical structures, etc.
11+
- The library is mostly built around type clases
1112
- Notations should be hidden by modules that are explicitly opened.
1213
- This avoids clashes between precedence.
1314
- TB: Actually, this does not completely avoid clashes, if we have to open two modules at the same time (for instance, I often need to open Equality, to get dependent destruction, which conflicts with the rest of my development)
@@ -19,8 +20,6 @@ Ideas
1920

2021
File Structure
2122
--------------
22-
* plugins/
23-
- Base directory to the provided plugins
2423
* theories/
2524
- Base directory to the provided theories
2625

_CoqProject

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
-Q theories ExtLib
2+
3+
theories/ExtLib.v
4+
theories/Tactics.v
5+
6+
theories/Core/Any.v
7+
theories/Core/CmpDec.v
8+
theories/Core/EquivDec.v
9+
theories/Core/RelDec.v
10+
theories/Core/Type.v
11+
12+
theories/Structures/Applicative.v
13+
theories/Structures/BinOps.v
14+
theories/Structures/CoFunctor.v
15+
theories/Structures/CoMonad.v
16+
theories/Structures/EqDep.v
17+
theories/Structures/Foldable.v
18+
theories/Structures/FunctorLaws.v
19+
theories/Structures/Functor.v
20+
theories/Structures/Identity.v
21+
theories/Structures/Maps.v
22+
theories/Structures/MonadCont.v
23+
theories/Structures/MonadExc.v
24+
theories/Structures/MonadFix.v
25+
theories/Structures/MonadLaws.v
26+
theories/Structures/MonadPlus.v
27+
theories/Structures/MonadReader.v
28+
theories/Structures/MonadState.v
29+
theories/Structures/Monads.v
30+
theories/Structures/MonadTrans.v
31+
theories/Structures/Monad.v
32+
theories/Structures/MonadWriter.v
33+
theories/Structures/MonadZero.v
34+
theories/Structures/Monoid.v
35+
theories/Structures/Proper.v
36+
theories/Structures/Reducible.v
37+
theories/Structures/Sets.v
38+
theories/Structures/Traversable.v
39+
40+
theories/Data/Bool.v
41+
theories/Data/Char.v
42+
theories/Data/Checked.v
43+
theories/Data/Eq.v
44+
theories/Data/Eq/UIP_trans.v
45+
theories/Data/Fin.v
46+
theories/Data/Fun.v
47+
theories/Data/HList.v
48+
theories/Data/LazyList.v
49+
theories/Data/Lazy.v
50+
theories/Data/ListFirstnSkipn.v
51+
theories/Data/ListNth.v
52+
theories/Data/List.v
53+
theories/Data/Member.v
54+
theories/Data/Nat.v
55+
theories/Data/N.v
56+
theories/Data/Option.v
57+
theories/Data/Pair.v
58+
theories/Data/Positive.v
59+
theories/Data/PreFun.v
60+
theories/Data/Prop.v
61+
theories/Data/SigT.v
62+
theories/Data/Stream.v
63+
theories/Data/String.v
64+
theories/Data/SumN.v
65+
theories/Data/Sum.v
66+
theories/Data/Tuple.v
67+
theories/Data/Unit.v
68+
theories/Data/Vector.v
69+
theories/Data/Z.v
70+
71+
theories/Data/POption.v
72+
theories/Data/PList.v
73+
theories/Data/PPair.v
74+
75+
76+
theories/Generic/Data.v
77+
theories/Generic/DerivingData.v
78+
theories/Generic/Func.v
79+
theories/Generic/Ind.v
80+
81+
theories/Programming/Eqv.v
82+
theories/Programming/Extras.v
83+
theories/Programming/Injection.v
84+
theories/Programming/Le.v
85+
theories/Programming/Show.v
86+
theories/Programming/With.v
87+
88+
theories/Recur/Facts.v
89+
theories/Recur/GenRec.v
90+
theories/Recur/Measure.v
91+
theories/Recur/Relation.v
92+
93+
theories/Relations/Compose.v
94+
theories/Relations/TransitiveClosure.v
95+
96+
theories/Tactics/BoolTac.v
97+
theories/Tactics/Cases.v
98+
theories/Tactics/Consider.v
99+
theories/Tactics/EqDep.v
100+
theories/Tactics/Equality.v
101+
theories/Tactics/Forward.v
102+
theories/Tactics/Injection.v
103+
theories/Tactics/MonadTac.v
104+
theories/Tactics/Parametric.v
105+
theories/Tactics/Reify.v
106+
theories/Tactics/TypeTac.v
107+
108+
theories/Data/Graph/BuildGraph.v
109+
theories/Data/Graph/GraphAdjList.v
110+
theories/Data/Graph/GraphAlgos.v
111+
theories/Data/Graph/Graph.v
112+
113+
theories/Data/Map/FMapAList.v
114+
theories/Data/Map/FMapPositive.v
115+
theories/Data/Map/FMapTwoThreeK.v
116+
117+
theories/Data/Monads/ContMonad.v
118+
theories/Data/Monads/EitherMonad.v
119+
theories/Data/Monads/FuelMonadLaws.v
120+
theories/Data/Monads/FuelMonad.v
121+
theories/Data/Monads/IdentityMonadLaws.v
122+
theories/Data/Monads/IdentityMonad.v
123+
theories/Data/Monads/ListMonad.v
124+
theories/Data/Monads/OptionMonadLaws.v
125+
theories/Data/Monads/OptionMonad.v
126+
theories/Data/Monads/ReaderMonadLaws.v
127+
theories/Data/Monads/ReaderMonad.v
128+
theories/Data/Monads/StateMonad.v
129+
theories/Data/Monads/WriterMonad.v
130+
theories/Data/Set/ListSet.v
131+
theories/Data/Set/SetMap.v
132+
theories/Data/Set/TwoThreeTrees.v

examples/ConsiderDemo.v

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
Require NPeano.
2+
Import NPeano.Nat.
13
Require Import ExtLib.Tactics.Consider.
4+
Require Import Coq.Bool.Bool.
5+
Require Import ExtLib.Data.Nat.
6+
7+
Require Import Coq.omega.Omega.
28

39
Set Implicit Arguments.
410
Set Strict Implicit.
511

612
(** Some tests *)
713
Section test.
8-
Require Import NPeano Coq.Bool.Bool.
9-
Require Import ExtLib.Data.Nat.
10-
11-
Require Import Omega.
1214
Goal forall x y z, (ltb x y && ltb y z) = true ->
1315
ltb x z = true.
1416
intros x y z.

examples/EvalWithExc.v

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
Require Import Coq.Strings.String.
12
(** Require the monad definitions **)
23
Require Import ExtLib.Structures.Monads.
34
(** Use the instances for exceptions **)
45
Require Import ExtLib.Data.Monads.EitherMonad.
56
(** Strings will be used for error messages **)
6-
Require Import String.
7+
Require Import ExtLib.Data.String.
78

89
Set Implicit Arguments.
910
Set Strict Implicit.
@@ -27,16 +28,16 @@ Section monadic.
2728
Variable m : Type -> Type.
2829
Context {Monad_m : Monad m}.
2930
Context {MonadExc_m : MonadExc string m}.
30-
31+
3132
(** Use the notation for monads **)
3233
Import MonadNotation.
3334
Local Open Scope monad_scope.
34-
35+
3536
(** Functions that get [nat] or [bool] values from a [value] **)
3637
Definition asInt (v : value) : m nat :=
3738
match v with
38-
| Int n => ret n
39-
| _ =>
39+
| Int n => ret n
40+
| _ =>
4041
(** if we don't have an integer, signal an error using
4142
** [raise] from the MoandExc instance
4243
**)
@@ -54,7 +55,7 @@ Section monadic.
5455
**)
5556
Fixpoint eval' (e : exp) : m value :=
5657
match e with
57-
(** when there is no error, we can just return (i.e. [ret])
58+
(** when there is no error, we can just return (i.e. [ret])
5859
** the answer
5960
**)
6061
| ConstI i => ret (Int i)
@@ -72,7 +73,7 @@ Section monadic.
7273
t <- eval' t ;;
7374
t <- asBool t ;;
7475
(** case split and perform the appropriate recursion **)
75-
if t then
76+
if (t : bool) then
7677
eval' tr
7778
else
7879
eval' fa
@@ -83,7 +84,7 @@ End monadic.
8384
(** Wrap the [eval] function up with the monad instance that we
8485
** want to use
8586
**)
86-
Definition eval : exp -> string + value :=
87+
Definition eval : exp -> string + value :=
8788
eval' (m := sum string).
8889

8990
(** Some tests **)

examples/Makefile

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,9 @@
1-
MODULES := $(patsubst %.v,%,$(wildcard *.v))
2-
TESTS :=
3-
VS := $(MODULES:%=%.v)
4-
TVS := $(TESTS:%=%.v)
5-
6-
ARGS :=-R ../theories ExtLib
7-
8-
.PHONY: coq clean admit depgraph toplevel whitespace
9-
101
coq: Makefile.coq
112
$(MAKE) -f Makefile.coq
123

13-
Makefile.coq: Makefile $(VS)
14-
coq_makefile $(ARGS) $(VS) \
15-
| sed -re 's/-R ([^ ]+) ExtLib/-I \1 -as ExtLib/g' \
16-
> Makefile.coq
17-
18-
Makefile.test.coq: Makefile $(TVS)
19-
coq_makefile $(ARGS) $(TVS) \
20-
| sed -re 's/-R ([^ ]+) ExtLib/-I \1 -as ExtLib/g' \
21-
> Makefile.coq
22-
23-
test: coq Makefile.test.coq
24-
$(MAKE) -f Makefile.test.coq
25-
26-
clean:: Makefile.coq
4+
clean: Makefile.coq
275
$(MAKE) -f Makefile.coq clean
28-
rm -f Makefile.coq .depend
29-
30-
whitespace:
31-
@ ./../tools/whitespace.sh $(MODULES:%=%.v)
32-
33-
admit:
34-
@ grep -n -e 'admit' -e 'Admitted' ${VS}
35-
36-
depgraph: Makefile.coq
37-
@ echo Generating dependency graph to ../deps.pdf
38-
@ ./../tools/deps.py $(MODULES:%=%.v.d) > ../deps.dot
39-
@ ./../tools/deps.py $(MODULES:%=%.v.d) | dot -Tpdf -o ../deps.pdf
6+
rm Makefile.coq
407

41-
toplevel: coq
42-
coqtop.opt $(ARGS)
8+
Makefile.coq: Makefile _CoqProject
9+
$(COQBIN)coq_makefile -f _CoqProject -o Makefile.coq

examples/MonadReasoning.v

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Require Import ExtLib.Data.Fun.
77
Set Implicit Arguments.
88
Set Strict Implicit.
99

10+
(** Currently not ported due to universes *)
11+
12+
(*
1013
Section with_m.
1114
Variable m : Type -> Type.
1215
Variable Monad_m : Monad m.
@@ -53,4 +56,5 @@ Section with_m.
5356
eapply equiv_prefl; eauto. }
5457
Qed.
5558
56-
End with_m.
59+
End with_m.
60+
*)

examples/Printing.v

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Require Import Coq.Strings.String.
22
Require Import ExtLib.Structures.MonadWriter.
3+
Require Import ExtLib.Data.PPair.
34
Require Import ExtLib.Data.Monads.WriterMonad.
45
Require Import ExtLib.Data.Monads.IdentityMonad.
56
Require Import ExtLib.Programming.Show.
@@ -16,11 +17,14 @@ Definition printString (str : string) : PrinterMonad unit :=
1617
(@show_exact str _ show_inj (@show_mon _ ShowScheme_string_compose)).
1718

1819
Definition runPrinter {T : Type} (c : PrinterMonad T) : T * string :=
19-
let '(val,str) := unIdent (runWriterT c) in
20+
let '(ppair val str) := unIdent (runWriterT c) in
2021
(val, str ""%string).
2122

2223

23-
Eval compute in runPrinter (Monad.bind (print 1) (fun _ => print 2)).
24+
Eval compute in
25+
runPrinter (Monad.bind (print 1) (fun _ => print 2)).
2426

25-
Eval compute in runPrinter (Monad.bind (print "hello "%string) (fun _ => print 2)).
26-
Eval compute in runPrinter (Monad.bind (printString "hello "%string) (fun _ => print 2)).
27+
Eval compute in
28+
runPrinter (Monad.bind (print "hello "%string) (fun _ => print 2)).
29+
Eval compute in
30+
runPrinter (Monad.bind (printString "hello "%string) (fun _ => print 2)).

0 commit comments

Comments
 (0)