Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
7db0eb0
working on plugin extraction
gmalecha Apr 1, 2019
5325467
typo
gmalecha Apr 1, 2019
ea3f49a
working on some of the extraction pieces
gmalecha Apr 2, 2019
c53fe15
checkpoint. giving up on trying to do native extraction.
gmalecha Apr 5, 2019
92ff62c
fixing run_extractable.
gmalecha Apr 5, 2019
d76a82f
did rel, var, and cast cases of to_constr. WIP: universes.
aa755 Apr 8, 2019
a682153
fix up an annotation.
gmalecha Apr 8, 2019
622b96c
looking at functorizing denote
gmalecha Apr 8, 2019
94d5e8f
fixing up the _CoqProject.
gmalecha Apr 8, 2019
496e99a
just a start
gmalecha Apr 8, 2019
a755b91
missing file.
gmalecha Apr 8, 2019
7f48a3f
hacky rules to build the plugin.
gmalecha Apr 8, 2019
c2c0315
denote_term function now has no errors. there is another error:
aa755 Apr 8, 2019
8fabea1
Merge branch 'plugin-tm-interp-functor-denote' of github:metacoq/meta…
aa755 Apr 8, 2019
8940433
fixed many compilation errors. 1 remains:
aa755 Apr 8, 2019
d7d38b2
fixed the compiler error in denote_term. provided instance of Denoter
aa755 Apr 8, 2019
be56a76
reducde code duplication
aa755 Apr 8, 2019
49077dc
implementing a few more pieces of run_extractable.
gmalecha Apr 8, 2019
d52c136
implementation of `of_mib`
gmalecha Apr 8, 2019
23d5788
support for ConstantEntry
gmalecha Apr 8, 2019
4f25d92
fixing the _CoqProject.
gmalecha Apr 8, 2019
747f84a
WIP:Extraction denoter instance. compiles, but many items are failwith
aa755 Apr 8, 2019
039c112
things should now compile.
gmalecha Apr 8, 2019
7e4e366
implemented inspect_term
aa755 Apr 8, 2019
46cd3fd
Merge branch 'plugin-tm-interp-functor-denote' of github:metacoq/meta…
aa755 Apr 9, 2019
1e95445
get rid of the gen-src directory
gmalecha Apr 9, 2019
f57000c
implemented all of denoter instance except unquote univ instance
aa755 Apr 9, 2019
8af86ad
Merge branch 'plugin-tm-interp-functor-denote' of github:metacoq/meta…
aa755 Apr 9, 2019
2ffbe2a
Merge branch 'plugin-tm-interp-functor-denote-wip' into plugin-tm-int…
aa755 Apr 9, 2019
ac2f74f
some fixes for compilation
aa755 Apr 9, 2019
b5460d6
an almost working plugin
gmalecha Apr 9, 2019
7a7de9c
added a second phase compilation/mlpack for extraction-based plugin
aa755 Apr 9, 2019
3c9df84
.o files seem to be building now for _PluginProject
aa755 Apr 9, 2019
32b38f0
making the template-coq directory compile.
gmalecha Apr 9, 2019
22053fd
Merge branch 'plugin-tm-interp-functor-denote' of github.com:MetaCoq/…
gmalecha Apr 9, 2019
dc9c3d7
a plugin that works!
gmalecha Apr 9, 2019
83ed27b
implemented Ast_denoter.unquote_universe_instance
aa755 Apr 9, 2019
760fc80
implemented to_constr_ev and unquote reduction strategy
aa755 Apr 9, 2019
dceb975
now template-coq builds
gmalecha Apr 9, 2019
819f7c0
everything seems to work except the linker is droppign a symbol
gmalecha Apr 9, 2019
b3adfca
working build of demo-plugin.
gmalecha Apr 9, 2019
9a95c3d
lift clean_name and split_name
gmalecha Apr 9, 2019
355b7cf
capitalization fix. need to run to-lower before copying from template…
aa755 Apr 9, 2019
b96bc51
removed more name clashes by blacklisting. error remains:
aa755 Apr 9, 2019
13e414a
propagated the renaming in HEAD^ to other files. eg. Common -> Common0
aa755 Apr 9, 2019
9afb9bb
removed the redundant to-lower. it is now done in template-coq/gen-src
aa755 Apr 9, 2019
98cb234
some fixes
gmalecha Apr 9, 2019
c393b65
a simple README for the plugin-demo
gmalecha Apr 9, 2019
bcb71da
partial implementation of to_kernname. can now test quoting
aa755 Apr 9, 2019
cbaaf66
Merge branch 'plugin-tm-build' into tempmerge
aa755 Apr 9, 2019
2db0ac3
fixing the checker plugin
gmalecha Apr 9, 2019
2144ae2
Merge branch 'plugin-tm-build' into tempmerge
aa755 Apr 10, 2019
3bef645
fixing some Makefiles
gmalecha Apr 10, 2019
4e68062
Merge branch 'plugin-tm-build' into plugin-tm-interp-functor-denote
aa755 Apr 10, 2019
c9525ad
ported genLensN to TM.Extractable
aa755 Apr 10, 2019
38b1608
cleaned up the lens example to not require other libs. removed admits
aa755 Apr 10, 2019
416c796
ran the lens example, it segfaulted
aa755 Apr 10, 2019
35ff66b
the error seems to happen in the extracted code. will simplify
aa755 Apr 10, 2019
79e610b
just quoting and printing segfaults
aa755 Apr 10, 2019
490c873
just quoting constant segfaults
aa755 Apr 10, 2019
926d39c
now showoff just does tmDefinition. Not_found error
aa755 Apr 10, 2019
80bb4fa
some debugging.
gmalecha Apr 10, 2019
2234271
bug fixes for extraction.
gmalecha Apr 14, 2019
f658282
Merge remote-tracking branch 'origin/coq-8.8' into plugin-tm-interp
gmalecha Apr 14, 2019
d90a97f
toying with Makefile rules.
gmalecha Apr 14, 2019
bdcf898
some more Makefile fixes.
gmalecha Apr 15, 2019
8f6eaaa
unneeded import.
gmalecha Apr 15, 2019
829b109
genLensN returns the error "failed to get info"
aa755 Apr 24, 2019
2151065
removing unused imports.
gmalecha Apr 24, 2019
675d556
trying something to fix the import problem in pcuic
gmalecha Apr 24, 2019
b2ed26c
it seems that tmQuoteInductiveR succeeds and getFields fails
aa755 Apr 24, 2019
24feefb
Merge branch 'plugin-tm-interp' of github:metacoq/metacoq into plugin…
aa755 Apr 24, 2019
2cd7a03
manually added prints in the extract of getFields:
aa755 Apr 24, 2019
febdaf0
again segfault, with:
aa755 Apr 24, 2019
d7f380e
put the segfault generator in Gallina now. so just make should trigger
aa755 Apr 24, 2019
2a4f710
some bug fixes.
gmalecha Apr 24, 2019
d951c12
working gen-lens
gmalecha Apr 24, 2019
3b4b6f9
cleanup the implementation of genLens
gmalecha Apr 24, 2019
8bd1423
removing some debug printing.
gmalecha Apr 24, 2019
6d37f6f
updating the extraction makefile.
gmalecha Apr 24, 2019
1ac2b63
type annotation.
gmalecha Apr 25, 2019
0b1da95
Merge remote-tracking branch 'origin/coq-8.8' into plugin-tm-interp
gmalecha Apr 25, 2019
c42168a
Merge remote-tracking branch 'origin/coq-8.8' into plugin-tm-interp
gmalecha Apr 29, 2019
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: 2 additions & 0 deletions template-coq/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Makefile.plugin
Makefile.plugin.conf
18 changes: 15 additions & 3 deletions template-coq/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
all: Makefile.coq
all: coq plugin

gen-src/Extraction.vo: coq gen-src/Extraction.v
$(COQPATH)coqc -I src -Q theories Template gen-src/Extraction.v

plugin: coq Makefile.plugin
$(MAKE) -f Makefile.plugin

coq: Makefile.coq
$(MAKE) -f Makefile.coq

.PHONY: all install html clean mrproper
Expand All @@ -9,14 +17,18 @@ install: Makefile.coq
html: all
$(MAKE) -f Makefile.coq html

clean: Makefile.coq
clean: Makefile.coq Makefile.plugin
$(MAKE) -f Makefile.coq clean
$(MAKE) -f Makefile.plugin clean

mrproper: clean
rm -f Makefile.coq
rm -f Makefile.coq Makefile.plugin

Makefile.coq: _CoqProject
coq_makefile -f _CoqProject -o Makefile.coq

Makefile.plugin: coq _PluginProject
$(COQPATH)coq_makefile -f _PluginProject -o Makefile.plugin

.merlin: Makefile.coq
$(MAKE) -f Makefile.coq .merlin
13 changes: 9 additions & 4 deletions template-coq/_CoqProject
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-I src
-I gen-src
-R theories Template

# the MetaCoq plugin
src/tm_util.ml
# src/quoter.mli
src/quoter.ml
Expand All @@ -14,8 +16,8 @@ src/template_coq.mlpack
src/template_monad.ml
src/run_template_monad.mli
src/run_template_monad.ml
src/pluginCore.mli
src/pluginCore.ml
src/plugin_core.mli
src/plugin_core.ml

theories/LibHypsNaming.v
theories/utils.v theories/config.v theories/kernel/univ.v
Expand All @@ -26,12 +28,15 @@ theories/LiftSubst.v theories/UnivSubst.v theories/Typing.v
theories/TypingWf.v theories/Generation.v theories/WeakeningEnv.v
theories/Closed.v theories/Weakening.v theories/Substitution.v
theories/MetaTheory.v theories/Checker.v theories/WcbvEval.v
theories/Retyping.v theories/All.v theories/Extraction.v
theories/Retyping.v theories/All.v

# the Template monad
theories/TemplateMonad.v
theories/TemplateMonad/Common.v
theories/TemplateMonad/Core.v
theories/TemplateMonad/Extractable.v
theories/TemplateMonad/Monad.v
theories/monad_utils.v
theories/monad_utils.v

# for Extraction
gen-src/Extraction.v
87 changes: 87 additions & 0 deletions template-coq/_PluginProject
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
-I src
-I gen-src
-Q theories Template

gen-src/Ascii.ml
gen-src/Ascii.mli
gen-src/Ast0.ml
gen-src/Ast0.mli
gen-src/AstUtils.ml
gen-src/AstUtils.mli
gen-src/BasicAst.ml
gen-src/BasicAst.mli
gen-src/Basics.ml
gen-src/Basics.mli
gen-src/BinInt.ml
gen-src/BinInt.mli
gen-src/BinNat.ml
gen-src/BinNat.mli
gen-src/BinNums.ml
gen-src/BinNums.mli
gen-src/BinPosDef.ml
gen-src/BinPosDef.mli
gen-src/BinPos.ml
gen-src/BinPos.mli
gen-src/Bool.ml
gen-src/Bool.mli
gen-src/Checker0.ml
gen-src/Checker0.mli
gen-src/Common.ml
gen-src/Common.mli
gen-src/config0.ml
gen-src/config0.mli
gen-src/Datatypes.ml
gen-src/Datatypes.mli
gen-src/DecidableType.ml
gen-src/DecidableType.mli
gen-src/Decimal.ml
gen-src/Decimal.mli
gen-src/Equalities.ml
gen-src/Equalities.mli
gen-src/Extractable.ml
gen-src/Extractable.mli
gen-src/FMapWeakList.ml
gen-src/FMapWeakList.mli
gen-src/LiftSubst.ml
gen-src/LiftSubst.mli
gen-src/List0.ml
gen-src/List0.mli
gen-src/Logic.ml
gen-src/Logic.mli
gen-src/monad_utils.ml
gen-src/monad_utils.mli
gen-src/MSetWeakList.ml
gen-src/MSetWeakList.mli
gen-src/Nat0.ml
gen-src/Nat0.mli
gen-src/OrderedType0.ml
gen-src/OrderedType0.mli
gen-src/Orders.ml
gen-src/Orders.mli
gen-src/OrdersTac.ml
gen-src/OrdersTac.mli
gen-src/PeanoNat.ml
gen-src/PeanoNat.mli
gen-src/Retyping0.ml
gen-src/Retyping0.mli
gen-src/Specif.ml
gen-src/Specif.mli
gen-src/String0.ml
gen-src/String0.mli
gen-src/Typing0.ml
gen-src/Typing0.mli
gen-src/TypingWf.ml
gen-src/TypingWf.mli
gen-src/uGraph0.ml
gen-src/uGraph0.mli
gen-src/univ0.ml
gen-src/univ0.mli
gen-src/UnivSubst0.ml
gen-src/UnivSubst0.mli
gen-src/utils.ml
gen-src/utils.mli
gen-src/Wf.ml
gen-src/Wf.mli

gen-src/run_extractable.ml
gen-src/meta_coq_plugin.mlpack
2 changes: 2 additions & 0 deletions template-coq/gen-src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.mli
*.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Extraction Blacklist config uGraph univ Ast String List Nat Int
UnivSubst Typing Checker Retyping OrderedType.
Set Warnings "-extraction-opaque-accessed".

Recursive Extraction Library TypingWf.
Recursive Extraction Library Checker.
Recursive Extraction Library Retyping.
Require Import Template.Ast.

Cd "gen-src".

Require Import Template.TemplateMonad.Extractable.

Recursive Extraction Library Extractable.

Cd "..".
88 changes: 88 additions & 0 deletions template-coq/gen-src/coq_constr.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
open Plugin_core
open Constr

type name = Names.Name.t
type id = Names.Id.t
type universe = Univ.Universe.t
type universe_instance = unit
type projection = Names.Projection.t
type 'a mfixpoint = 'a BasicAst.mfixpoint
type nat = int

let tRel (n : nat) =
failwith "tRel"
let tVar (i : id) : Constr.t =
Constr.mkVar i

let tMeta (n : nat) : Constr.t =
failwith "tMeta"

let tEvar (n : nat) (ls : Constr.t list) : Constr.t =
failwith "tEvar is not supported"

let tSort (u : Univ.Universe.t) : Constr.t =
failwith "tSort"

let tCast (a : Constr.t) (b : Constr.cast_kind) (c : Constr.t) : Constr.t =
Constr.mkCast (a, b, c)

let tProd (n : name) (a : Constr.t) (b : Constr.t) : Constr.t =
Constr.mkProd (n, a, b)

let tLambda (n : name) (a : Constr.t) (b : Constr.t) : Constr.t =
Constr.mkLambda (n, a, b)

let tLetIn (n : name) (t : Constr.t) (b : Constr.t) (c : Constr.t) : Constr.t =
Constr.mkLetIn (n, t, b, c)

let tApp (f : Constr.t) (ls : Constr.t list) : Constr.t =
Constr.mkApp (f, Array.of_list ls)

let tConst (kn : 'a) : 'a =
failwith "tConst"

let tConstruct (kn : 'a) : 'a =
failwith "tConstruct"

let tCase (_ : 'a) : 'a =
failwith "tCase"

let tProj (_ : BasicAst.projection) (_ : Constr.t) : Constr.t =
failwith "tProj"

let constr_match
(rel : nat -> 'a)
(var : ident -> 'a)
(meta : nat -> 'a)
(evar : nat -> term list -> 'a)
(sort : universe -> 'a)
(cast : term -> Constr.cast_kind -> term -> 'a)
(prod : name -> term -> term -> 'a)
(lambda : name -> term -> term -> 'a)
(letin : name -> term -> term -> term -> 'a)
(app : term -> term list -> 'a)
(const : kername -> universe_instance -> 'a)
(construct : Names.inductive -> nat -> universe_instance -> 'a)
(case : Names.inductive * nat * term -> term -> (nat * term) list -> 'a)
(proj : projection -> term -> 'a)
(fix : term mfixpoint -> nat -> 'a)
(cofix : term mfixpoint -> nat -> 'a)
(t : term) : 'a =
match Constr.kind t with
| Constr.Rel n -> rel n
| Constr.Var id -> var id
| Constr.Meta m -> meta m
| Constr.Evar (a,b) -> evar (Evar.repr a) (Array.to_list b)
| Constr.Sort s -> sort s
| Constr.Cast (a,b,c) -> cast a b c
| Constr.Prod (a,b,c) -> prod a b c
| Constr.Lambda (a,b,c) -> lambda a b c
| Constr.LetIn (a,b,c,d) -> letin a b c d
| Constr.App (f, xs) -> app f (Array.to_list xs)
| Constr.Const _
| Constr.Ind _
| Constr.Construct _
| Constr.Case _
| Constr.Fix _
| Constr.CoFix _
| Constr.Proj _ -> failwith "not implemented"
47 changes: 47 additions & 0 deletions template-coq/gen-src/meta_coq_plugin.mlpack
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Utils
Ascii
Ast0
Univ0
AstUtils
BasicAst
Basics
BinInt
BinNat
BinNums
BinPosDef
BinPos
Bool
Common
Config0
Datatypes
DecidableType
Decimal
Equalities
Extractable
FMapWeakList
List0
Logic
MSetWeakList
Nat0
OrderedType0
Orders
OrdersTac
PeanoNat
Specif
String0
UGraph0





Tm_util
Quoter
Constr_quoter
Template_monad
Denote
Plugin_core

Extractable

Run_extractable
Loading