Coq: manage LoadPath in project with subdirectories -


i have coq project libraries organised subdirectories, like:

…/myproj/auxiliary/aux.v …/myproj/main/main.v  (imports auxiliary/aux.v) 

when compile files, expect working directory myproj (via makefile). want work on files using proof general/coqtop, in case working directory default directory in file lives.

but means loadpath different between 2 contexts, , logical path needed library import different. how set coqc invocation, loadpath, , import declarations work in both contexts?

each approach have tried, goes wrong. instance, if compile aux.v invoking

coqc -r "." "myproj" auxiliary/aux.v 

and import in main.v as

require import myproj.auxiliary.aux. 

then works when compile main.v with

coqc -r "." "myproj" main/main.v 

but fails in coqtop, error: cannot find library myproj.auxiliary.aux in loadpath. on other hand, if before require import add

add loadpath ".." myproj. 

then works in coqtop, fails under coqc -r "." "myproj" main/main.v, with

error: file […]/myproj/auxiliary/aux.vo contains library 

myproj.auxiliary.aux , not library myproj.myproj.auxiliary.aux

i’m looking solution that’s robust library that’s shared collaborators (and users), in particular can’t use absolute file paths. best have found add emacs local variables set loadpath when proof general invokes coqtop:

((coq-mode . ((coq-prog-args . ("-r" ".." "myproj" "-emacs"))))) 

but (a) seems little hacky, , (b) works proof general, not in coqide or plain coqtop. there better solution?

i know explicitly asked works across different platforms, there's proof-general-specific solution less hacky 1 have. proof general has special variable called coq-load-path can set local variables, did coq-prog-args. advantage don't have worry other arguments need passed coqtop (such -emacs in example). thus, .dir-locals.el file have line this:

((coq-mode . ((coq-load-path . ((".." "myproj")))))) 

unfortunately, not aware of works across platforms, although i'm pretty sure specific coqide must exist. if case, maybe set script keep these configuration files updated across different platforms?


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -