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

Ported plugin to Coq 8.13 #43

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
25b372f
Move build to dune.
agrarpan Jul 20, 2023
60c6de8
Fixed type errors, still some remaining.
agrarpan Jul 20, 2023
6e33a0a
Fixed type errors, still some remaining.
agrarpan Jul 21, 2023
1ac2061
Fixed type errors, still some remaining.
agrarpan Jul 24, 2023
816cdee
Fixed type errors, still some remaining.
agrarpan Jul 24, 2023
858443e
Fixed type errors, still some remaining.
agrarpan Jul 25, 2023
19e5b26
Fixed type errors, still some remaining.
agrarpan Jul 25, 2023
7f0c7ec
Undoing some changes from previous commit, using annotR uniformly now.
agrarpan Jul 25, 2023
12f3ee5
Change typo in .gitignore
agrarpan Jul 27, 2023
1612ebc
Remove unsused function.
agrarpan Jul 27, 2023
d8a0d14
Renaming Globnames.global_reference to GlobRef.t
agrarpan Jul 27, 2023
e3076e5
Fixed the type in indutils
agrarpan Jul 28, 2023
0ebe46b
Fixed the type incompatibility in inference.ml
agrarpan Jul 31, 2023
fe44675
Refactored to maintain the original semantics.
agrarpan Aug 4, 2023
eadbabf
Refactored constutils to handle type change of UnivGen.fresh_instance
agrarpan Aug 7, 2023
0b4e99f
Refactored indutils to handle type changes to Declarations.universes
agrarpan Aug 7, 2023
b1064b3
Refactored indutils to handle type changes to Declarations.universes
agrarpan Aug 7, 2023
43813af
Refactored defutils to handle type changes in Lemmas.hook_type
agrarpan Aug 7, 2023
892b96c
Added mlg file
agrarpan Aug 7, 2023
7836367
Merged changes from another fork branch to fix errors.
SkySkimmer Aug 8, 2023
b3cd62c
Removed Makefile.local
agrarpan Aug 8, 2023
55c3363
Renamed plugin to match template, builds with dune currently.
agrarpan Aug 16, 2023
ffe7e16
Fixed warnings.
agrarpan Aug 18, 2023
b8af2c9
Fixed warnings.
agrarpan Aug 18, 2023
925fc08
Added error handling for SProp.
agrarpan Aug 30, 2023
9e874d3
Changed the Context.binder_name usage to remove calls to annotR to ha…
agrarpan Sep 28, 2023
233f21d
Changed the Context.binder_name usage to remove calls to annotR to ha…
agrarpan Sep 28, 2023
7e47d4d
Filter out SProp eliminators based on string match for sind.
agrarpan Oct 4, 2023
525f61e
Fixed bug that pushed the wrong name.
agrarpan Oct 23, 2023
6607968
Changed the arguments to declare_structure to reflect the API change.
agrarpan Oct 25, 2023
0082bd8
Filter out SProp sorts to prevent call to Indrec.lookup_eliminator.
agrarpan Oct 25, 2023
3a9de5d
Pulled in Max's changes from 8.11 branch of coq-plugin-lib
agrarpan Oct 26, 2023
0921f90
Made changes to the API to match Coq 8.12
agrarpan Dec 4, 2023
9fd5b6f
Changed the cumulative flag to false to fix test errors in fix-to-elim
agrarpan Dec 4, 2023
c1e4acd
First attempt at fixing declare_definition bug.
agrarpan Mar 27, 2024
fc53570
Passing false flag to EConstr.to_constr everywhere
agrarpan Mar 27, 2024
f063181
Using declare_entry instead of declare_definition.
agrarpan Mar 27, 2024
603abcc
Remove undefined evars before calling declare_definition.
agrarpan Apr 3, 2024
35de5ad
Removed filter for sind.
agrarpan Apr 11, 2024
3ff1c96
First batch of changes for coq 8.13
agrarpan Apr 15, 2024
25774f7
Removed the refresh flag from the define_term and define_canonical in…
agrarpan Apr 30, 2024
642f7ba
Call Typing.type_of in case tyopt is not None.
agrarpan Apr 30, 2024
48a735a
Preserve original typing call.
agrarpan Apr 30, 2024
7c7af85
Update README.md
agrarpan Jul 17, 2024
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ plugin/Makefile
plugin/.merlin
*.out
_opam
_build
/Makefile
/Makefile.conf
.merlin
/src/plibrary.ml
97 changes: 0 additions & 97 deletions _CoqProject

This file was deleted.

2 changes: 0 additions & 2 deletions build.sh

This file was deleted.

3 changes: 3 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 3.6)
(using coq 0.6)
(name my-plugin)
Empty file added my-plugin.opam
Empty file.
29 changes: 18 additions & 11 deletions src/coq/constants/equtils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let coq_init_logic =

(* equality *)
let eq : types =
mkInd (MutInd.make1 (KerName.make2 coq_init_logic (Label.make "eq")), 0)
mkInd (MutInd.make1 (KerName.make coq_init_logic (Label.make "eq")), 0)

(* Constructor for quality *)
let eq_refl : types =
Expand Down Expand Up @@ -70,8 +70,9 @@ let apply_eq (app : eq_app) : types =
* Deconstruct an eq type
*)
let dest_eq (trm : types) : eq_app =
let [at_type; trm1; trm2] = unfold_args trm in
{ at_type; trm1; trm2 }
match unfold_args trm with
| [at_type; trm1; trm2] -> { at_type; trm1; trm2 }
| _ -> assert false

(*
* An application of eq_sym
Expand All @@ -93,10 +94,12 @@ let apply_eq_sym (app : eq_sym_app) : types =
* Deconstruct an eq type
*)
let dest_eq_sym (trm : types) : eq_sym_app =
let [at_type; trm1; trm2; eq_proof] = unfold_args trm in
let eq_typ = { at_type; trm1; trm2 } in
{ eq_typ; eq_proof }

match unfold_args trm with
| [at_type; trm1; trm2; eq_proof] ->
let eq_typ = { at_type; trm1; trm2 } in
{ eq_typ; eq_proof }
| _ -> assert false

(*
* An application of eq_ind
*)
Expand All @@ -120,8 +123,10 @@ let apply_eq_ind (app : eq_ind_app) : types =
* Deconstruct an eq_ind
*)
let dest_eq_ind (trm : types) : eq_ind_app =
let [at_type; trm1; p; b; trm2; h] = unfold_args trm in
{ at_type; trm1; p; b; trm2; h }
match unfold_args trm with
| [at_type; trm1; p; b; trm2; h] ->
{ at_type; trm1; p; b; trm2; h }
| _ -> assert false

(*
* An application of eq_refl
Expand All @@ -142,8 +147,10 @@ let apply_eq_refl (app : eq_refl_app) : types =
* Deconstruct an eq_refl
*)
let dest_eq_refl (trm : types) : eq_refl_app =
let [typ; trm] = unfold_args trm in
{ typ; trm }
match unfold_args trm with
| [typ; trm] ->
{ typ; trm }
| _ -> assert false

(*
* Deconstruct an eq_refl.
Expand Down
3 changes: 1 addition & 2 deletions src/coq/constants/idutils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

open Constr
open Names
open Environ
open Evd

let coq_init_datatypes =
Expand All @@ -27,7 +26,7 @@ let id_typ : types =
let identity_term env sigma typ : evar_map * types =
let sigma, sort_family = Inference.infer_sort env sigma typ in
match sort_family with
| InProp ->
| Sorts.InProp ->
(sigma, mkApp (id_prop, Array.make 1 typ))
| _ ->
(sigma, mkApp (id_typ, Array.make 1 typ))
Expand Down
24 changes: 15 additions & 9 deletions src/coq/constants/produtils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let coq_init_data =

(* prod types *)
let prod : types =
mkInd (MutInd.make1 (KerName.make2 coq_init_data (Label.make "prod")), 0)
mkInd (MutInd.make1 (KerName.make coq_init_data (Label.make "prod")), 0)

(* Introduction for sigma types *)
let pair : constr =
Expand Down Expand Up @@ -55,9 +55,11 @@ let apply_pair (app : pair_app) =
* Deconsruct a sigT type from a type
*)
let dest_pair (trm : constr) =
let [typ1; typ2; trm1; trm2] = unfold_args trm in
{ typ1; typ2; trm1; trm2 }

match unfold_args trm with
| [typ1; typ2; trm1; trm2] ->
{ typ1; typ2; trm1; trm2 }
| _ -> assert false

(*
* An application of prod
*)
Expand All @@ -77,8 +79,10 @@ let apply_prod (app : prod_app) : types =
* Deconstruct a prod
*)
let dest_prod (trm : types) : prod_app =
let [typ1; typ2] = unfold_args trm in
{ typ1; typ2 }
match unfold_args trm with
| [typ1; typ2] ->
{ typ1; typ2 }
| _ -> assert false

(*
* An application of prod_rect
Expand Down Expand Up @@ -106,9 +110,11 @@ let elim_prod (app : prod_elim) =
* Deconstruct an application of prod
*)
let dest_prod_elim (trm : constr) =
let [typ1; typ2; p; proof; arg] = unfold_args trm in
let to_elim = { typ1; typ2 } in
{ to_elim; p; proof; arg }
match unfold_args trm with
| [typ1; typ2; p; proof; arg] ->
let to_elim = { typ1; typ2 } in
{ to_elim; p; proof; arg }
| _ -> assert false

(*
* First projection of a prod
Expand Down
5 changes: 2 additions & 3 deletions src/coq/constants/proputils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

open Constr
open Names
open Apputils

let coq_init_logic =
ModPath.MPfile
Expand All @@ -14,7 +13,7 @@ let coq_init_logic =

(* Logical or *)
let logical_or : types =
mkInd (MutInd.make1 (KerName.make2 coq_init_logic (Label.make "or")), 0)
mkInd (MutInd.make1 (KerName.make coq_init_logic (Label.make "or")), 0)

(* left constructor of \/ *)
let or_introl : types =
Expand All @@ -27,7 +26,7 @@ let or_intror : types =

(* Logical and *)
let logical_and : types =
mkInd (MutInd.make1 (KerName.make2 coq_init_logic (Label.make "and")), 0)
mkInd (MutInd.make1 (KerName.make coq_init_logic (Label.make "and")), 0)

(* constructor of /\ *)
let conj : types =
Expand Down
22 changes: 14 additions & 8 deletions src/coq/constants/sigmautils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let coq_init_specif =

(* sigma types *)
let sigT : types =
mkInd (MutInd.make1 (KerName.make2 coq_init_specif (Label.make "sigT")), 0)
mkInd (MutInd.make1 (KerName.make coq_init_specif (Label.make "sigT")), 0)

(* Introduction for sigma types *)
let existT : types =
Expand Down Expand Up @@ -55,8 +55,10 @@ let pack_existT (app : existT_app) : types =
* Deconstruct an existT term
*)
let dest_existT (trm : types) : existT_app =
let [index_type; packer; index; unpacked] = unfold_args trm in
{ index_type; packer; index; unpacked }
match unfold_args trm with
| [index_type; packer; index; unpacked] ->
{ index_type; packer; index; unpacked }
| _ -> assert false

(*
* An application of sigT
Expand All @@ -77,8 +79,10 @@ let pack_sigT (app : sigT_app) =
* Deconsruct a sigT type from a type
*)
let dest_sigT (typ : types) =
let [index_type; packer] = unfold_args typ in
{ index_type; packer }
match unfold_args typ with
| [index_type; packer] ->
{ index_type; packer }
| _ -> assert false

(*
* Build the eta-expansion of a term known to have a sigma type.
Expand Down Expand Up @@ -116,9 +120,11 @@ let elim_sigT (app : sigT_elim) =
* Deconstruct an application of sigT_rect
*)
let dest_sigT_elim (trm : types) =
let [index_type; packer; packed_type; unpacked; arg] = unfold_args trm in
let to_elim = { index_type ; packer } in
{ to_elim; packed_type; unpacked; arg }
match unfold_args trm with
| [index_type; packer; packed_type; unpacked; arg] ->
let to_elim = { index_type ; packer } in
{ to_elim; packed_type; unpacked; arg }
| _ -> assert false

(*
* Left projection of a sigma type
Expand Down
Loading