Skip to content

Commit a39e6e4

Browse files
committed
[build] Add support for building a lessons coq-pkg package
Note: this is still not working due to version mismatches with the SDK.
1 parent aacdbdb commit a39e6e4

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
node_modules
88
*.html
99
coqdoc.css
10+
coq-pkgs

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all clean serve
1+
.PHONY: all clean serve docker-setup
22

33
COQDOC_AUTO=coqdoc.css
44

@@ -11,13 +11,21 @@ all: $(FILES_HTML)
1111
./jscoqdoc $<
1212

1313
%.glob: %.v
14-
coqc $<
14+
npx jscoq sdk coqc -R . MyCourse $<
1515

1616
clean:
1717
rm -f *.vo *.vok .*.aux *.glob *.vos $(FILES_HTML) $(COQDOC_AUTO)
1818

1919
node_modules: package.json package-lock.json
2020
npm i
2121

22-
serve: node_modules
22+
serve: node_modules coq-pkgs/my_course.coq-pkg
2323
./node_modules/.bin/http-server .
24+
25+
coq-pkgs/my_course.coq-pkg: $(FILES_HTML) docker-setup
26+
npx jscoq build . --top MyCourse --package $@
27+
cp -a coq-pkgs/* node_modules/wacoq-bin/bin/coq/
28+
29+
docker-setup:
30+
docker pull jscoq/jscoq:v8.16-sdk
31+
docker tag jscoq/jscoq:v8.16-sdk jscoq:sdk

jscoq-agent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var jscoq_opts = {
3131
// editor: { mode: { 'company-coq': true }, className: 'jscoq code-tight' },
3232
editor: { className: 'jscoq code-tight' },
3333
init_pkgs: ['init'],
34-
all_pkgs: { '+': ['coq', 'mathcomp'] },
34+
all_pkgs: { '+': ['coq', 'mathcomp', 'my_course'] },
3535
init_import: ['utf8'],
3636
implicit_libs: true
3737
};

lesson_1.v

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ In this course, we will use a mature Coq library, "The Mathematical
1111
Components Library" which will provide us with a rich theory on data
1212
types and mathematics. *)
1313

14-
From mathcomp Require Import all_ssreflect.
14+
From Coq Require Import ssreflect.
15+
16+
(* Not working due to the SDK not including math-comp yet, will fix *)
17+
(* From mathcomp Require Import all_ssreflect. *)
1518

1619
Set Implicit Arguments.
1720
Unset Strict Implicit.

lesson_2.v

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
(** * Lesson 2: Data Structures and Class Hierarchies *)
2-
From mathcomp Require Import all_ssreflect.
2+
From Coq Require Import ssreflect.
3+
4+
(* From mathcomp Require Import all_ssreflect. *)
35

46
Set Implicit Arguments.
57
Unset Strict Implicit.
68
Unset Printing Implicit Defensive.
79

10+
From MyCourse Require Import lesson_1.
11+
812
Definition sorry {T} : T. Admitted.
913
(** ** Reflection and proving with computation
1014
@@ -24,23 +28,24 @@ Coq Standard library vs as it is defined in math-comp: *)
2428
About le.
2529
Print le.
2630

27-
About leq.
28-
Print leq.
31+
(* About leq. *)
32+
(* Print leq. *)
2933

3034
Lemma le_1 : 100 <= 200.
3135
Proof. Admitted.
3236

3337
Print le_1.
3438

35-
Lemma le_2 : (100 <= 200)%coq_nat.
36-
Proof. Admitted.
39+
(* Lemma le_2 : (100 <= 200)%coq_nat. *)
40+
(* Proof. Admitted. *)
3741

38-
Print le_2.
42+
(* Print le_2. *)
3943

4044
Lemma lt_1 n : ~~ (n < n).
4145
Proof. Admitted.
4246

43-
Lemma lt_2 n : ~ (n < n)%coq_nat.
44-
Proof. Admitted.
47+
(* Lemma lt_2 n : ~ (n < n)%coq_nat. *)
48+
(* Proof. Admitted. *)
49+
4550
(** Moreover, the math-comp version, by virtue of being in [bool],
4651
inherits some nice properties, like decidability, for free. *)

0 commit comments

Comments
 (0)