如何在Mac上使用VScode运行Prover9
背景:mac上安装不了可视化Prover9,使用命令行又操作繁琐,于是乎另辟蹊径——使用VScode运行.p9文件。
操作步骤
1.下载Prover9(LADR-2009-11A.tar.gz)
链接:https://www.cs.unm.edu/~mccune/prover9/download/
解压并放入此路径下:Users/这里填你的用户名/
2.打开终端(terminal)
cd 到 Users/你的用户名/LADR-2009-11A
即Navigate to the unzipped folder and then use the ‘make all’ command to compile the files
然后依次输入以下命令:
- make all
- make test1
- make test2
- make test3
Once done compiling, it will prompt you to run the software tests (to make sure everything is ok).
3.仍是终端(terminal)
输入以下命令:
- open ~/.bash_profile
- 在文件中添加export PATH="/Users/这里填你的用户名/LADR-2009-11A/bin:$PATH",然后保存
- source ~/.bash_profile
- open ~/.zshrc
- 在文件中添加export PATH="/Users/这里填你的用户名/LADR-2009-11A/bin:$PATH",然后保存
- source ~/.zshrc
4.配置VScode
- 下载并安装VScode,链接:https://code.visualstudio.com/Download
- 打开vscode,点击1图标,然后搜索框中搜索2中的两个扩展
- 点击左下角设置突变,然后点击菜单栏第一条(蓝色)
- 搜索框搜setting,选择图示item
11.将以下代码拷贝进去(全替换),注意:.p9的路径改成你自己的路径!然后保存文件
{
"code-runner.executorMapByFileExtension": {
".p9":"export PATH=$PATH:/Users/这里填你的用户名/LADR-2009-11A/BIN && prover9 -f $fullFileName | prooftrans renumber | tee > $fileNameWithoutExt.txt | open $fileNameWithoutExt.txt",
".vb": "cd $dir && vbc /nologo $fileName && $dir$fileNameWithoutExt",
".vbs": "cscript //Nologo",
".scala": "scala",
".jl": "julia",
".cr": "crystal",
".ml": "ocaml",
".exs": "elixir",
".hx": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
".rkt": "racket",
".scm": "csi -script",
".ahk": "autohotkey",
".au3": "autoit3",
".kt": "cd $dir && kotlinc $fileName -include-runtime -d $fileNameWithoutExt.jar && java -jar $fileNameWithoutExt.jar",
".kts": "kotlinc -script",
".dart": "dart",
".pas": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
".pp": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
".d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
".hs": "runhaskell",
".nim": "nim compile --verbosity:0 --hints:off --run",
".csproj": "dotnet run --project",
".fsproj": "dotnet run --project",
".lisp": "sbcl --script",
".kit": "kitc --run",
".v": "v run",
".vsh": "v run",
".sass": "sass --style expanded",
".cu": "cd $dir && nvcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
".ring": "ring"
},
"code-runner.clearPreviousOutput": true,
"code-runner.saveAllFilesBeforeRun": true
}
- 新建一个.p9文件或者打开一个.p9文件,运行即可
参考链接:
https://www.youtube.com/watch?v=2Wdj3xsZ-ro&t=304s
https://gist.github.com/carmenchui/88da001d96ad7e3f73ffc2623a418f07
https://www.cs.unm.edu/~mccune/prover9/manual/2009-11A/