Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for synterp (Coq 8.18) #557

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: setup ocaml
uses: avsm/setup-ocaml@v1
with:
ocaml-version: 4.09.1
ocaml-version: 4.10.1
gares marked this conversation as resolved.
Show resolved Hide resolved

- name: install deps
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ jobs:
coq_version:
- '8.18'
ocaml_version:
- '4.09-flambda'
- '4.13-flambda'
- '4.14-flambda'
steps:
- uses: actions/checkout@v2
- uses: coq-community/docker-coq-action@v1
Expand Down
79 changes: 78 additions & 1 deletion .github/workflows/nix-action-coq-8.18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,81 @@ jobs:
name: Building/fetching current CI target
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18"
--argstr job "hierarchy-builder"
interval:
needs:
- coq
- coquelicot
- mathcomp-ssreflect
- mathcomp-fingroup
runs-on: ubuntu-latest
steps:
- name: Determine which commit to initially checkout
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{\
\ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha\
\ }}\" >> $GITHUB_ENV\nfi\n"
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ env.target_commit }}
- name: Determine which commit to test
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{\
\ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{\
\ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge\
\ | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha\
\ }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n\
\ if [ -z \"$merge_commit\" -o \"x$mergeable\" != \"x0\" ]; then\n echo\
\ \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n\
\ else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n fi\nfi\n"
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ env.tested_commit }}
- name: Cachix install
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Cachix setup coq-elpi
uses: cachix/cachix-action@v12
with:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
extraPullNames: coq, coq-community, math-comp
name: coq-elpi
- id: stepCheck
name: Checking presence of CI target interval
run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr\
\ bundle \"coq-8.18\" --argstr job \"interval\" \\\n --dry-run 2>&1 > /dev/null)\n\
echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\
s/.*/built/\") >> $GITHUB_OUTPUT\n"
- if: steps.stepCheck.outputs.status == 'built'
name: 'Building/fetching previous CI target: coq'
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18"
--argstr job "coq"
- if: steps.stepCheck.outputs.status == 'built'
name: 'Building/fetching previous CI target: bignums'
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18"
--argstr job "bignums"
- if: steps.stepCheck.outputs.status == 'built'
name: 'Building/fetching previous CI target: coquelicot'
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18"
--argstr job "coquelicot"
- if: steps.stepCheck.outputs.status == 'built'
name: 'Building/fetching previous CI target: flocq'
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18"
--argstr job "flocq"
- if: steps.stepCheck.outputs.status == 'built'
name: 'Building/fetching previous CI target: mathcomp-ssreflect'
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18"
--argstr job "mathcomp-ssreflect"
- if: steps.stepCheck.outputs.status == 'built'
name: 'Building/fetching previous CI target: mathcomp-fingroup'
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18"
--argstr job "mathcomp-fingroup"
- if: steps.stepCheck.outputs.status == 'built'
name: Building/fetching current CI target
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18"
--argstr job "interval"
mathcomp:
needs:
- coq
Expand Down Expand Up @@ -1424,8 +1499,10 @@ name: Nix CI for bundle coq-8.18
'on':
pull_request:
paths:
- .github/workflows/**
- .github/workflows/nix-action-coq-8.18.yml
pull_request_target:
paths-ignore:
- .github/workflows/nix-action-coq-8.18.yml
types:
- opened
- synchronize
Expand Down
5 changes: 4 additions & 1 deletion .nix/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
bundles = {

"coq-8.18".coqPackages = {
hierarchy-builder.override.version = "master";
coq.override.version = "8.18";

hierarchy-builder.override.version = "coq-elpi-2";
hierarchy-builder-shim.job = false;

coq-elpi.override.version = "fix-synterp";

mathcomp.override.version = "master";
mathcomp.job = true;

Expand Down
2 changes: 1 addition & 1 deletion .nix/coq-nix-toolbox.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"e7a39f47847edcde691d7bf8f423e4806a1b660f"
"68a4a68e689dca0d9c081a0f1b9a454379522d78"
73 changes: 73 additions & 0 deletions .nix/coq-overlays/coq-elpi/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{ lib, mkCoqDerivation, which, coq, version ? null }:

with builtins; with lib; let
elpi = coq.ocamlPackages.elpi.override (lib.switch coq.coq-version [
{ case = "8.11"; out = { version = "1.11.4"; };}
{ case = "8.12"; out = { version = "1.12.0"; };}
{ case = "8.13"; out = { version = "1.13.7"; };}
{ case = "8.14"; out = { version = "1.13.7"; };}
{ case = "8.15"; out = { version = "1.15.0"; };}
{ case = "8.16"; out = { version = "1.17.0"; };}
{ case = "8.17"; out = { version = "1.17.0"; };}
{ case = "8.18"; out = { version = "v1.18.1"; };}
] {} );
in mkCoqDerivation {
pname = "elpi";
repo = "coq-elpi";
owner = "LPCIC";
inherit version;
defaultVersion = lib.switch coq.coq-version [
{ case = "8.18"; out = "1.19.0"; }
{ case = "8.17"; out = "1.18.0"; }
{ case = "8.16"; out = "1.15.6"; }
{ case = "8.15"; out = "1.14.0"; }
{ case = "8.14"; out = "1.11.2"; }
{ case = "8.13"; out = "1.11.1"; }
{ case = "8.12"; out = "1.8.3_8.12"; }
{ case = "8.11"; out = "1.6.3_8.11"; }
] null;
release."1.19.0".sha256 = "sha256-kGoo61nJxeG/BqV+iQaV3iinwPStND+7+fYMxFkiKrQ=";
release."1.18.0".sha256 = "sha256-2fCOlhqi4YkiL5n8SYHuc3pLH+DArf9zuMH7IhpBc2Y=";
release."1.17.0".sha256 = "sha256-J8GatRKFU0ekNCG3V5dBI+FXypeHcLgC5QJYGYzFiEM=";
release."1.15.6".sha256 = "sha256-qc0q01tW8NVm83801HHOBHe/7H1/F2WGDbKO6nCXfno=";
release."1.15.1".sha256 = "sha256-NT2RlcIsFB9AvBhMxil4ZZIgx+KusMqDflj2HgQxsZg=";
release."1.14.0".sha256 = "sha256:1v2p5dlpviwzky2i14cj7gcgf8cr0j54bdm9fl5iz1ckx60j6nvp";
release."1.13.0".sha256 = "1j7s7dlnjbw222gnbrsjgmjck1yrx7h6hwm8zikcyxi0zys17w7n";
release."1.12.1".sha256 = "sha256-4mO6/co7NcIQSGIQJyoO8lNWXr6dqz+bIYPO/G0cPkY=";
release."1.11.2".sha256 = "0qk5cfh15y2zrja7267629dybd3irvxk1raz7z8qfir25a81ckd4";
release."1.11.1".sha256 = "10j076vc2hdcbm15m6s7b6xdzibgfcbzlkgjnlkr2vv9k13qf8kc";
release."1.10.1".sha256 = "1zsyx26dvj7pznfd2msl2w7zbw51q1nsdw0bdvdha6dga7ijf7xk";
release."1.9.7".sha256 = "0rvn12h9dpk9s4pxy32p8j0a1h7ib7kg98iv1cbrdg25y5vs85n1";
release."1.9.5".sha256 = "0gjdwmb6bvb5gh0a6ra48bz5fb3pr5kpxijb7a8mfydvar5i9qr6";
release."1.9.4".sha256 = "0nii7238mya74f9g6147qmpg6gv6ic9b54x5v85nb6q60d9jh0jq";
release."1.9.3".sha256 = "198irm800fx3n8n56vx1c6f626cizp1d7jfkrc6ba4iqhb62ma0z";
release."1.9.2".sha256 = "1rr2fr8vjkc0is7vh1461aidz2iwkigdkp6bqss4hhv0c3ijnn07";
release."1.8.3_8.12".sha256 = "15z2l4zy0qpw0ws7bvsmpmyv543aqghrfnl48nlwzn9q0v89p557";
release."1.8.3_8.12".version = "1.8.3";
release."1.8.2_8.12".sha256 = "1n6jwcdazvjgj8vsv2r9zgwpw5yqr5a1ndc2pwhmhqfl04b5dk4y";
release."1.8.2_8.12".version = "1.8.2";
release."1.8.1".sha256 = "1fbbdccdmr8g4wwpihzp4r2xacynjznf817lhijw6kqfav75zd0r";
release."1.8.0".sha256 = "13ywjg94zkbki22hx7s4gfm9rr87r4ghsgan23xyl3l9z8q0idd1";
release."1.7.0".sha256 = "1ws5cqr0xawv69prgygbl3q6dgglbaw0vc397h9flh90kxaqgyh8";
release."1.6.3_8.11".sha256 = "1j340cr2bv95clzzkkfmsjkklham1mj84cmiyprzwv20q89zr1hp";
release."1.6.3_8.11".version = "1.6.3";
release."1.6.2_8.11".sha256 = "06xrx0ljilwp63ik2sxxr7h617dgbch042xfcnfpy5x96br147rn";
release."1.6.2_8.11".version = "1.6.2";
release."1.6.1_8.11".sha256 = "0yyyh35i1nb3pg4hw7cak15kj4y6y9l84nwar9k1ifdsagh5zq53";
release."1.6.1_8.11".version = "1.6.1";
release."1.6.0_8.11".sha256 = "0ahxjnzmd7kl3gl38kyjqzkfgllncr2ybnw8bvgrc6iddgga7bpq";
release."1.6.0_8.11".version = "1.6.0";
release."1.6.0".sha256 = "0kf99i43mlf750fr7fric764mm495a53mg5kahnbp6zcjcxxrm0b";
releaseRev = v: "v${v}";

buildFlags = [ "OCAMLWARN=" ];

mlPlugin = true;
propagatedBuildInputs = [ coq.ocamlPackages.findlib elpi ];

meta = {
description = "Coq plugin embedding ELPI.";
maintainers = [ maintainers.cohencyril ];
license = licenses.lgpl21Plus;
};
}
35 changes: 35 additions & 0 deletions .nix/coq-overlays/hierarchy-builder/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ lib, mkCoqDerivation, which, coq, coq-elpi,
version ? null, shim ? false }:

with lib; mkCoqDerivation {
pname = "hierarchy-builder" + optionalString shim "-shim";
owner = "math-comp";
inherit version;
defaultVersion = with versions; switch coq.coq-version [
{ case = range "8.13" "8.14"; out = "1.2.0"; }
{ case = range "8.12" "8.13"; out = "1.1.0"; }
{ case = isEq "8.11"; out = "0.10.0"; }
] null;
release."1.2.0".sha256 = "0sk01rvvk652d86aibc8rik2m8iz7jn6mw9hh6xkbxlsvh50719d";
release."1.1.0".sha256 = "sha256-spno5ty4kU4WWiOfzoqbXF8lWlNSlySWcRReR3zE/4Q=";
release."1.0.0".sha256 = "0yykygs0z6fby6vkiaiv3azy1i9yx4rqg8xdlgkwnf2284hffzpp";
release."0.10.0".sha256 = "1a3vry9nzavrlrdlq3cys3f8kpq3bz447q8c4c7lh2qal61wb32h";
releaseRev = v: "v${v}";

nativeBuildInputs = [ which ];

propagatedBuildInputs = [ coq-elpi ];

mlPlugin = true;

buildPhase = "make build" + optionalString shim " -C shim";

installFlags = [ "DESTDIR=$(out)" "COQMF_COQLIB=lib/coq/${coq.coq-version}" ]
++ optional shim "-C shim";

meta = {
description = "High level commands to declare a hierarchy based on packed classes";
maintainers = with maintainers; [ cohencyril siraben ];
license = licenses.mit;
};
}
65 changes: 65 additions & 0 deletions .nix/ocaml-overlays/elpi/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{ lib
, buildDunePackage, camlp5
, ocaml
, menhir, menhirLib
, atdgen
, stdlib-shims
, re, perl, ncurses
, ppxlib, ppx_deriving
, coqPackages
, version ? if lib.versionAtLeast ocaml.version "4.08" then "1.17.0"
else if lib.versionAtLeast ocaml.version "4.07" then "1.15.2" else "1.14.1"
}:

let p5 = camlp5; in
let camlp5 = p5.override { legacy = true; }; in

let fetched = coqPackages.metaFetch ({
release."1.17.0".sha256 = "sha256-DTxE8CvYl0et20pxueydI+WzraI6UPHMNvxyp2gU/+w=";
release."1.16.5".sha256 = "sha256-tKX5/cVPoBeHiUe+qn7c5FIRYCwY0AAukN7vSd/Nz9A=";
release."1.15.2".sha256 = "sha256-XgopNP83POFbMNyl2D+gY1rmqGg03o++Ngv3zJfCn2s=";
release."1.15.0".sha256 = "sha256:1ngdc41sgyzyz3i3lkzjhnj66gza5h912virkh077dyv17ysb6ar";
release."1.14.1".sha256 = "sha256-BZPVL8ymjrE9kVGyf6bpc+GA2spS5JBpkUtZi04nPis=";
release."1.13.7".sha256 = "10fnwz30bsvj7ii1vg4l1li5pd7n0qqmwj18snkdr5j9gk0apc1r";
release."1.13.5".sha256 = "02a6r23mximrdvs6kgv6rp0r2dgk7zynbs99nn7lphw2c4189kka";
release."1.13.1".sha256 = "12a9nbdvg9gybpw63lx3nw5wnxfznpraprb0wj3l68v1w43xq044";
release."1.13.0".sha256 = "0dmzy058m1mkndv90byjaik6lzzfk3aaac7v84mpmkv6my23bygr";
release."1.12.0".sha256 = "1agisdnaq9wrw3r73xz14yrq3wx742i6j8i5icjagqk0ypmly2is";
release."1.11.4".sha256 = "1m0jk9swcs3jcrw5yyw5343v8mgax238cjb03s8gc4wipw1fn9f5";
releaseRev = v: "v${v}";
location = { domain = "github.com"; owner = "LPCIC"; repo = "elpi"; };
}) version;
in
buildDunePackage rec {
pname = "elpi";
inherit (fetched) version src;

patches = lib.optional (version == "1.16.5")
./atd_2_10.patch;

minimalOCamlVersion = "4.04";
duneVersion = "3";

# atdgen is both a library and executable
nativeBuildInputs = [ perl ]
++ [ (if lib.versionAtLeast version "1.15" || version == "dev" then menhir else camlp5) ]
++ lib.optional (lib.versionAtLeast version "1.16" || version == "dev") atdgen;
buildInputs = [ ncurses ]
++ lib.optional (lib.versionAtLeast version "1.16" || version == "dev") atdgen;

propagatedBuildInputs = [ re stdlib-shims ]
++ [ menhirLib ]
++ [ ppxlib ppx_deriving ]
;

meta = with lib; {
description = "Embeddable λProlog Interpreter";
license = licenses.lgpl21Plus;
maintainers = [ maintainers.vbgl ];
homepage = "https://github.com/LPCIC/elpi";
};

postPatch = ''
substituteInPlace elpi_REPL.ml --replace "tput cols" "${ncurses}/bin/tput cols"
'';
}
22 changes: 21 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Changelog

## Unreleased - 09/11/2023
## [2.0.0] - Unreleased

Requires Elpi 1.18.1 and Coq 8.18.

This major release accommodates for the separation of parsing from execution
of Coq 8.18 enabling Coq-Elpi programs to be run efficiently (and correctly)
under VSCoq 2.0.

### Documentation
- New section about parsing/execution separation in the [Writing commands in Elpi](https://lpcic.github.io/coq-elpi/tutorial_coq_elpi_command.html) tutorial

### Commands
- New `Elpi *` commands understand the `#[phase]` attribute, see the doc in
the [README](README.md#vernacular-commands) file, and the section
about the [separation of parsing from execution](README.md#separation-of-parsing-from-execution-of-vernacular-commands)
gares marked this conversation as resolved.
Show resolved Hide resolved
- New `Elpi Export` understands an `As` clause to rename or alias a program when exported

### API
- Change `coq.elpi.add-predicate` now locality can be changed
Expand All @@ -13,6 +28,11 @@
- New `coq.ltac.fresh-id` to generate fresh names in the proof context
- New `@no-tc!` attribute supported by `coq.ltac.call-ltac1`
- New `coq.TC.get-inst-prio` returns the `tc-priority` of an instance
- New `synterp-action` datatype
- New `coq.replay-all-missing-synterp-actions`
- New `coq.replay-synterp-action`
- New `coq.next-synterp-action`
- New `coq.synterp-actions` (parsing phase only)

### Apps
- New `tc` app providing an implementation of a type class solver written in elpi.
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,19 @@ doc: $(DOCDEP)

.PHONY: force build all test doc

Makefile.coq Makefile.coq.conf: src/coq_elpi_builtins_HOAS.ml src/coq_elpi_config.ml _CoqProject
Makefile.coq Makefile.coq.conf: src/coq_elpi_builtins_HOAS.ml src/coq_elpi_builtins_arg_HOAS.ml src/coq_elpi_config.ml _CoqProject
@$(COQBIN)/coq_makefile -f _CoqProject -o Makefile.coq
@$(MAKE) --no-print-directory -f Makefile.coq .merlin
Makefile.test.coq Makefile.test.coq.conf: _CoqProject.test
@$(COQBIN)/coq_makefile -f _CoqProject.test -o Makefile.test.coq
Makefile.examples.coq Makefile.examples.coq.conf: _CoqProject.examples
@$(COQBIN)/coq_makefile -f _CoqProject.examples -o Makefile.examples.coq
src/coq_elpi_builtins_arg_HOAS.ml: elpi/coq-arg-HOAS.elpi Makefile.coq.local
echo "(* Automatically generated from $<, don't edit *)" > $@
echo "(* Regenerate via 'make $@' *)" >> $@
echo "let code = {|" >> $@
cat $< >> $@
echo "|}" >> $@
src/coq_elpi_builtins_HOAS.ml: elpi/coq-HOAS.elpi Makefile.coq.local
echo "(* Automatically generated from $<, don't edit *)" > $@
echo "(* Regenerate via 'make $@' *)" >> $@
Expand Down
2 changes: 2 additions & 0 deletions Makefile.coq.local
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ install-extra::
df="`$(COQMKFILE) -destination-of theories/elpi.vo $(COQLIBS)`";\
install -m 0644 elpi-builtin.elpi "$(COQLIBINSTALL)/$$df";\
install -m 0644 coq-builtin.elpi "$(COQLIBINSTALL)/$$df";\
install -m 0644 coq-builtin-synterp.elpi "$(COQLIBINSTALL)/$$df";\
install -m 0644 elpi/coq-lib-common.elpi "$(COQLIBINSTALL)/$$df";\
install -m 0644 elpi/coq-lib.elpi "$(COQLIBINSTALL)/$$df";\
install -m 0644 elpi/elpi_elaborator.elpi "$(COQLIBINSTALL)/$$df"

Loading
Loading