在试图用wp插件证明以下程序时,我遇到了一个非常简单的循环不变量的问题:
void f() {
unsigned int i = 0;
/*@
loop assigns i;
loop invariant 0 <= i <= 2;
loop variant 2 - i;
*/
for (;i < 2;++i);
}产出如下:
[kernel] preprocessing with "gcc -C -E -I. t.c"
[wp] Running WP plugin...
[wp] Collecting axiomatic usage
[wp] warning: Missing RTE guards
[wp] 5 goals scheduled
[wp] [Qed] Goal typed_f_loop_inv_established : Valid
[wp] [Qed] Goal typed_f_loop_assign : Valid
[wp] [Qed] Goal typed_f_loop_term_decrease : Valid (4ms)
[wp] [Qed] Goal typed_f_loop_term_positive : Valid
[wp] [Alt-Ergo] Goal typed_f_loop_inv_preserved : Failed
Error: Alt-Ergo exits with status [127]当使用键wp-print执行frama-c时,它会打印与失败目标有关的下列信息:
Goal Preservation of Invariant (file t.c, line 5):
Assume {
(* Domain *)
Type: (is_uint32 i_1) /\ (is_uint32 (1+i_1)).
(* Invariant (file t.c, line 5) *)
(* t.c:8: Invariant: *)
Have: (0<=i_1) /\ (i_1<=2).
(* t.c:8: Then *)
Have: i_1<=1.
}
Prove: -1<=i_1.
Prover Alt-Ergo returns Failed
Error: Alt-Ergo exits with status [127]发布于 2015-10-17 09:20:58
在您的配置中,Alt可能配置错误或丢失(返回代码127)。
您的代码在我的机器上工作,没有任何问题:
[wp] [Qed] Goal typed_f_loop_inv_established : Valid
[wp] [Qed] Goal typed_f_loop_assign : Valid
[wp] [Qed] Goal typed_f_loop_term_decrease : Valid
[wp] [Qed] Goal typed_f_loop_term_positive : Valid
[wp] [Alt-Ergo] Goal typed_f_loop_inv_preserved : Valid (40ms) (7)
[wp] Proved goals: 5 / 5
Qed: 4
Alt-Ergo: 1 (40ms-40ms) (7)什么给了alt-ergo -version?
向你问好,大卫
https://stackoverflow.com/questions/33184363
复制相似问题