验证构建脚本中的coq定理?

时间:2014-05-10 05:14:28

标签: command-line automation coq

我正在使用coq来研究编程语言的元理论。

在IDE中以交互方式编写和验证定理一切都很好,但我需要自动化(重新)验证。我看到了手册页,但我没有看到这个用例在任何地方拼写出来。

如何将coq验证合并到构建脚本中?

1 个答案:

答案 0 :(得分:1)

如果我们有metatheory/hello_world.v

$ cat metatheory/hello_world.v
Theorem hello_world : forall a b:Prop, a /\ b -> b /\ a.
intros a b H.
split.
destruct H as [H1 H2].
exact H1. (* A bug: We actually need H2 here. *)
intuition.

然后我们可以看到错误(退出代码失败):

$ coqtop -batch -silent -l metatheory/hello_world.v
Error while reading metatheory/hello_world.v:
File "/vagrant/metatheory/hello_world.v", line 5, characters 6-8:
Error: In environment
a : Prop
b : Prop
H1 : a
H2 : b
The term "H1" has type "a" while it is expected to have type
"b".

如果我们解决问题:

$ coqtop -batch -silent -l metatheory/hello_world.v

..成功退出代码。

相关问题