coqide - can't load modules from same folder

后端 未结 4 1199
陌清茗
陌清茗 2020-12-03 10:32

I can\'t load modules that are in same folder in CoqIde.

I\'m trying to load sources from Software Foundations, I\'m running coqide in folder that contains SF source

相关标签:
4条回答
  • 2020-12-03 11:27

    To be able to load a source file in coqtop, coqc, CoqIDE, or Proof General there are several ways, one method is as follows:

    Suppose you have downloaded code files for the book titled Certified Programming with Dependent Types written by Adam Chlipala that are available here and extract them in a path we call CODEHOME. As you can see there are this first line in any source files Require Import Bool Arith List Cpdt.CpdtTactics.

    First type coqc -v in a cli (command line interface), the output would be something like The Coq Proof Assistant, version 8.4pl4 ...., then create a file named coqrc.8.4pl4, the file extension should be in accord with the version of the coq you are using, in $HOME/.config/coq directory if it does not exist and write this line in it Add LoadPath "CODEHOME/cpdt/src" as Cpdt . and that's it.

    0 讨论(0)
  • 2020-12-03 11:31

    You need to compile the .v files into .vo files and add their directory to your load path if you're going to require them. To compile them, run coqc <file-path> in the command prompt. To add the files' directory to your load path in CoqIde, you can insert the line Add LoadPath "<directory-path>". at the beginning of the .v files.

    0 讨论(0)
  • 2020-12-03 11:31

    I realize this is an old thread, however there are not many resources on this problem. I just spent some time solving it so I figured it would be good to post it on the first topic I got from googling. I'm using Coq 8.4p16 compiled with no additional configuration on Arch Linux.

    So, the manual says variables like $COQPATH, ${XDG_DATA_DIRS}/coq/ and ${XDG_DATA_HOME}/coq/ are checked, however I've had no luck with those.

    I also tried putting coqc -I /folder/path the Edit->Preferences->Externals of CoqIde, however, still no luck there.

    I write these as they may work for someone.

    The only GLOBAL way which works for me is writing a coqrc file with Add LoadPath "<directory-path>". in it. On Linux the file needs to be in the home folder.

    Hope this saves someone some time.

    0 讨论(0)
  • 2020-12-03 11:31

    If you started your file.v with Module file. just get rid of it (Also get rid of the End file.) and your problem is solved.

    0 讨论(0)
提交回复
热议问题