【发布时间】:2015-10-17 17:20:58
【问题描述】:
在尝试使用 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]
【问题讨论】:
标签: frama-c