我正在Windows环境中尝试使用cvc4
插件通过Frama-c wp
插件Why3
。我的系统上安装了frama-c
和why3
。 Why3已正确配置为包含cvc4作为证明者:
$ why3 --list-provers
Known provers:
Alt-Ergo (0.95.2)
CVC4 (1.4)
我使用frama-c Wp插件使用以下命令生成与我的.c文件(带有ACSL规范的C源文件)对应的why3格式(.why)文件:
frama-c -wp -wp-print -wp-proof-trace -wp-out C:/Users/user/temp -wp-prover cvc4 swap.c
以上命令在swap_Why3_ide.why
目录中生成文件C:/Users/user/temp/typed
。
当我尝试使用swap_Why3_ide.why
使用why3
作为证明来证明生成的cvc4
文件中的理论时,它失败并出现以下错误:
$ why3 prove -P cvc4 -L C:/cygwin/usr/local/share/frama-c/wp/why3 temp/typed/swap_Why3_ide.why
temp/typed/swap_Why3_ide.why VCswap_post WP : HighFailure (0.02s)
Prover exit status: exited with status 1
Prover output:
/usr/local/lib/why3/why3-cpulimit: Error: failed when launching <"/cygdrive/c/cvc4-1.4-win32-opt.exe" "--lang=smt2" "/tmp/why_29ba75_swap_Why3_ide-T-WP.smt2">
Fatal: CreateProcess failed with error 0: The operation completed successfully.
我在linux环境中执行了相同的步骤,why3
能够执行证明器:
why3 prove -P cvc4 -L /usr/local/share/frama-c/wp/why3/ temp/typed/swap_Why3_ide.why
temp/typed/swap_Why3_ide.why VCswap_post WP : Valid (0.05s)
有人可以建议如何在Windows上执行Why3吗?
答案 0 :(得分:2)
似乎没有人在Windows上使用why3。但无论如何,对于将来尝试在Windows上使用Why3的任何人来说,这里是为了在.why文件中运行证据而执行的步骤:
1)在Windows上,即使安装了证明文件,执行why3 config --detect
也不会添加证明文件。因此,在执行why3 config --detect --add-prover cvc4 path_to_executable_in_Windows_format
时,请确保可执行文件的路径是Windows格式(例如C:\ provers \ cvc4-1.4-win32-opt.exe)
如果path不是Windows格式,则抛出以下错误:
/usr/local/lib/why3/why3-cpulimit: Error: failed when launching <"/cygdrive/c/cvc4-1.4-win32-opt.exe" "--lang=smt2" "/tmp/why_29ba75_swap_Why3_ide-T-WP.smt2">
Fatal: CreateProcess failed with error 0: The operation completed successfully.
2)在正确设置路径后,尝试执行why3,如下所示:
why3 prove -P cvc4 -L C:/cygwin/usr/local/share/frama-c/wp/why3 C:/temp/typed/swap_Why3_ide.why
这会抛出以下错误:
C:/temp/typed/swap_Why3_ide.why VCswap_post WP : HighFailure (0.03s)
Prover exit status: exited with status 1
Prover output:
(error "Couldn't open file: /tmp/why_727ef8_swap_Why3_ide-T-WP.smt2")
why3cpulimit cpu time: 0.015625s wall time: 0.015625s
发生此错误是因为为什么3在cygwin tmp目录(/tmp
)中生成* .smt2文件,并且在通过这些文件调用证明文件时,未提供这些文件的完整路径,并且证明者证明它{{1} }
要解决此问题,我必须更新执行的命令以在Couldn't open file /tmp/XX.smt2
中运行证明,如下所示:
.why3.conf
请注意,我将文件格式从[prover]
command = "%l/why3-cpulimit %t %m -s C:/provers/cvc4-1.4-win32-opt.exe --lang=smt2 C:/cygwin%f
driver = "/usr/local/share/why3/drivers/cvc4.drv"
editor = ""
in_place = false
interactive = false
name = "CVC4"
shortcut = "cvc4"
version = "1.4"
更改为%f
,这是C:/cygwin%f
目录的Windows路径