Skip to content

Commit 1ed6c4e

Browse files
authored
Merge pull request #579 from proux01/no_primitive
Don't Require PrimInt63 and PrimFloat by default
2 parents ac73738 + 8ad13ee commit 1ed6c4e

File tree

10 files changed

+91
-19
lines changed

10 files changed

+91
-19
lines changed

.github/workflows/nix-action-coq-8.19.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ jobs:
314314
- coq
315315
- mathcomp-classical
316316
- mathcomp-field
317+
- mathcomp-bigenough
317318
- hierarchy-builder
318319
runs-on: ubuntu-latest
319320
steps:
@@ -368,6 +369,10 @@ jobs:
368369
name: 'Building/fetching previous CI target: mathcomp-field'
369370
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19"
370371
--argstr job "mathcomp-field"
372+
- if: steps.stepCheck.outputs.status == 'built'
373+
name: 'Building/fetching previous CI target: mathcomp-bigenough'
374+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19"
375+
--argstr job "mathcomp-bigenough"
371376
- if: steps.stepCheck.outputs.status == 'built'
372377
name: 'Building/fetching previous CI target: hierarchy-builder'
373378
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19"
@@ -376,6 +381,63 @@ jobs:
376381
name: Building/fetching current CI target
377382
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19"
378383
--argstr job "mathcomp-analysis"
384+
mathcomp-bigenough:
385+
needs:
386+
- coq
387+
- mathcomp-ssreflect
388+
runs-on: ubuntu-latest
389+
steps:
390+
- name: Determine which commit to initially checkout
391+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{\
392+
\ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha\
393+
\ }}\" >> $GITHUB_ENV\nfi\n"
394+
- name: Git checkout
395+
uses: actions/checkout@v3
396+
with:
397+
fetch-depth: 0
398+
ref: ${{ env.target_commit }}
399+
- name: Determine which commit to test
400+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{\
401+
\ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{\
402+
\ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge\
403+
\ | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha\
404+
\ }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n\
405+
\ if [ -z \"$merge_commit\" -o \"x$mergeable\" != \"x0\" ]; then\n echo\
406+
\ \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n\
407+
\ else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n fi\nfi\n"
408+
- name: Git checkout
409+
uses: actions/checkout@v3
410+
with:
411+
fetch-depth: 0
412+
ref: ${{ env.tested_commit }}
413+
- name: Cachix install
414+
uses: cachix/install-nix-action@v20
415+
with:
416+
nix_path: nixpkgs=channel:nixpkgs-unstable
417+
- name: Cachix setup coq-elpi
418+
uses: cachix/cachix-action@v12
419+
with:
420+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
421+
extraPullNames: coq, coq-community, math-comp
422+
name: coq-elpi
423+
- id: stepCheck
424+
name: Checking presence of CI target mathcomp-bigenough
425+
run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr\
426+
\ bundle \"coq-8.19\" --argstr job \"mathcomp-bigenough\" \\\n --dry-run\
427+
\ 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep\
428+
\ \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n"
429+
- if: steps.stepCheck.outputs.status == 'built'
430+
name: 'Building/fetching previous CI target: coq'
431+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19"
432+
--argstr job "coq"
433+
- if: steps.stepCheck.outputs.status == 'built'
434+
name: 'Building/fetching previous CI target: mathcomp-ssreflect'
435+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19"
436+
--argstr job "mathcomp-ssreflect"
437+
- if: steps.stepCheck.outputs.status == 'built'
438+
name: Building/fetching current CI target
439+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19"
440+
--argstr job "mathcomp-bigenough"
379441
mathcomp-character:
380442
needs:
381443
- coq

.nix/config.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
odd-order.override.version = "master";
1717
odd-order.job = true;
1818

19-
mathcomp-analysis.override.version = "hierarchy-builder";
19+
mathcomp-analysis.override.version = "master";
2020
mathcomp-analysis.job = true;
2121

2222
mathcomp-finmap.override.version = "master";
2323
mathcomp-finmap.job = true;
2424

25-
mathcomp-classical.override.version = "hierarchy-builder";
25+
mathcomp-classical.override.version = "master";
2626
mathcomp-classical.job = true;
2727

2828
mathcomp-single-planB-src.job = false;

apps/derive/theories/derive/eq.v

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ From Coq Require Import Bool.
99
From elpi Require Import elpi.
1010
From elpi.apps Require Import derive.
1111

12+
From Coq Require Import PrimInt63 PrimFloat.
13+
1214
Register Coq.Numbers.Cyclic.Int63.PrimInt63.eqb as elpi.derive.eq_unit63.
1315
Register Coq.Floats.PrimFloat.eqb as elpi.derive.eq_float64.
1416

1517
Elpi Db derive.eq.db lp:{{
1618

1719
% full resolution (composes with eq functions for parameters)
1820
type eq-db term -> term -> term -> prop.
19-
eq-db {{ lib:elpi.uint63 }} {{ lib:elpi.uint63 }} {{ lib:elpi.derive.eq_unit63 }} :- !.
20-
eq-db {{ lib:elpi.float64 }} {{ lib:elpi.float64 }} {{ lib:elpi.derive.eq_float64 }} :- !.
21+
eq-db {{ lib:num.int63.type }} {{ lib:num.int63.type }} {{ lib:elpi.derive.eq_unit63 }} :- !.
22+
eq-db {{ lib:num.float.type }} {{ lib:num.float.type }} {{ lib:elpi.derive.eq_float64 }} :- !.
2123

2224
:name "eq-db:fail"
2325
eq-db A B F :-

apps/derive/theories/derive/eqType_ast.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
From elpi Require Import elpi.
2+
From Coq Require Import PrimInt63 PrimFloat.
23
From elpi.apps Require Import derive.
34

45
From elpi.apps.derive Extra Dependency "eqType.elpi" as eqType.

apps/derive/theories/derive/eqcorrect.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Register uint63_eq_correct as elpi.derive.uint63_eq_correct.
2222
Elpi Db derive.eqcorrect.db lp:{{
2323
type eqcorrect-db gref -> term -> prop.
2424

25-
eqcorrect-db X {{ lib:elpi.derive.uint63_eq_correct }} :- {{ lib:elpi.uint63 }} = global X, !.
26-
eqcorrect-db X _ :- {{ lib:elpi.float64 }} = global X, !, stop "float64 comparison is not syntactic".
25+
eqcorrect-db X {{ lib:elpi.derive.uint63_eq_correct }} :- {{ lib:num.int63.type }} = global X, !.
26+
eqcorrect-db X _ :- {{ lib:num.float.type }} = global X, !, stop "float64 comparison is not syntactic".
2727

2828
:name "eqcorrect-db:fail"
2929
eqcorrect-db T _ :-

apps/derive/theories/derive/param1.v

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Class reali {X : Type} {XR : X -> Type} (x : X) (xR : XR x) := Reali {}.
4040

4141
Register store_reali as param1.store_reali.
4242

43+
From Coq Require Import PrimInt63 PrimFloat.
44+
4345
Inductive is_uint63 : PrimInt63.int -> Type := uint63 (i : PrimInt63.int) : is_uint63 i.
4446
Register is_uint63 as elpi.derive.is_uint63.
4547

@@ -55,8 +57,8 @@ pred reali-done i:gref.
5557
:index(3)
5658
pred reali i:term, o:term.
5759

58-
reali {{ lib:elpi.uint63 }} {{ lib:elpi.derive.is_uint63 }} :- !.
59-
reali {{ lib:elpi.float64 }} {{ lib:elpi.derive.is_float64 }} :- !.
60+
reali {{ lib:num.int63.type }} {{ lib:elpi.derive.is_uint63 }} :- !.
61+
reali {{ lib:num.float.type }} {{ lib:elpi.derive.is_float64 }} :- !.
6062

6163
:name "reali:fail"
6264
reali X _ :-
@@ -66,8 +68,8 @@ reali X _ :-
6668

6769
type realiR term -> term -> prop.
6870

69-
realiR {{ lib:elpi.uint63 }} {{ lib:elpi.derive.is_uint63 }} :- !.
70-
realiR {{ lib:elpi.float64 }} {{ lib:elpi.derive.is_float64 }} :- !.
71+
realiR {{ lib:num.int63.type }} {{ lib:elpi.derive.is_uint63 }} :- !.
72+
realiR {{ lib:num.float.type }} {{ lib:elpi.derive.is_float64 }} :- !.
7173

7274
:name "realiR:fail"
7375
realiR T TR :-

elpi/elpi_elaborator.elpi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ of (global GR as X) T X :- coq.env.typeof GR T1, unify-leq T1 T.
308308
of (pglobal GR I as X) T X :-
309309
@uinstance! I => coq.env.typeof GR T1, unify-leq T1 T.
310310

311-
of (primitive (uint63 _) as X) T X :- unify-leq {{ lib:elpi.uint63 }} T.
312-
of (primitive (float64 _) as X) T X :- unify-leq {{ lib:elpi.float64 }} T.
311+
of (primitive (uint63 _) as X) T X :- unify-leq {{ lib:num.int63.type }} T.
312+
of (primitive (float64 _) as X) T X :- unify-leq {{ lib:num.float.type }} T.
313313

314314
of (uvar as X) T Y :- !, evar X T Y.
315315

src/coq_elpi_vernacular_syntax.mlg

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ let warning_legacy_accumulate_gen =
5959
let warning_legacy_accumulate ?loc () = warning_legacy_accumulate_gen ?loc true
6060
let warning_legacy_accumulate2 ?loc () = warning_legacy_accumulate_gen ?loc false
6161

62+
let lib_ref id =
63+
let id = String.concat "." (snd id) in
64+
try Coqlib.lib_ref id
65+
with Coqlib.NotFoundRef _ ->
66+
CErrors.user_err
67+
Pp.(str "Global reference not found: lib:" ++ str id
68+
++ str " (you may need to require some .v file with \
69+
`Register ... as " ++ str id ++ str ".`).")
70+
6271
}
6372
GRAMMAR EXTEND Gram
6473
GLOBAL: term;
@@ -84,11 +93,11 @@ GRAMMAR EXTEND Gram
8493

8594
term: LEVEL "0"
8695
[ [ "lib"; ":"; id = qualified_name -> {
87-
let ref = Coqlib.lib_ref (String.concat "." (snd id)) in
96+
let ref = lib_ref id in
8897
let path = Nametab.path_of_global ref in
8998
CAst.make ~loc Constrexpr.(CRef (Libnames.qualid_of_path ~loc:(fst id) path,None)) }
9099
| "lib"; ":"; "@"; id = qualified_name -> {
91-
let ref = Coqlib.lib_ref (String.concat "." (snd id)) in
100+
let ref = lib_ref id in
92101
let path = Nametab.path_of_global ref in
93102
let f = Libnames.qualid_of_path ~loc:(fst id) path in
94103
CAst.make ~loc Constrexpr.(CAppExpl((f,None),[])) } ] ]

tests/test_elaborator.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
From unreleased Extra Dependency "elpi_elaborator.elpi" as elab.
22

3+
From Coq Require Import PrimInt63 PrimFloat.
34
From elpi Require Import elpi.
45

56
Elpi Command test.refiner.

theories/elpi.v

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,3 @@ From Coq Require Bool.
4545
Register Coq.Bool.Bool.reflect as elpi.reflect.
4646
Register Coq.Bool.Bool.ReflectF as elpi.ReflectF.
4747
Register Coq.Bool.Bool.ReflectT as elpi.ReflectT.
48-
49-
From Coq Require PrimFloat PrimInt63.
50-
51-
Register Coq.Floats.PrimFloat.float as elpi.float64.
52-
Register Coq.Numbers.Cyclic.Int63.PrimInt63.int as elpi.uint63.

0 commit comments

Comments
 (0)