如何frama-c -wp
验证wp 手册中的示例- 一个简单的swap
函数 (swap.c):
/* @ requires \valid(a) && \valid(b);
@ ensures A: *a == \old(*b);
@ ensures B: *b == \old(*a);
@ assigns *a,*b;
@*/
void swap(int * a, int * b);
void swap(int * a, int * b) {
int tmp = * a;
*a = *b;
*b = tmp;
return ;
}
调用
$ frama-c -wp -wp-rte swap.c
给出:
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing swap.c (with preprocessing)
[wp] Running WP plugin...
[wp] Collecting axiomatic usage
[rte] annotating function swap
[wp] 4 goals scheduled
[wp] [Alt-Ergo] Goal typed_swap_assert_rte_mem_access_4 : Unknown (174ms)
[wp] [Alt-Ergo] Goal typed_swap_assert_rte_mem_access_2 : Unknown (160ms)
[wp] [Alt-Ergo] Goal typed_swap_assert_rte_mem_access : Unknown (154ms)
[wp] [Alt-Ergo] Goal typed_swap_assert_rte_mem_access_3 : Unknown (220ms)
[wp] Proved goals: 0 / 4
Alt-Ergo: 0 (unknown: 4)
我想知道为什么
- 我的尝试与手册中的目标数量不同(4 对 9)?
- Alt-Ergo(事实上,没有一个
cvc3
,gappa
,simplify
,verit
,yices
,z3
)不能放弃这 4 个证明义务中的任何一个?
我使用最新的 OPAM 安装:
frama-c
: 钠-20150201alt-ergo
:0.95.2(来自 ubuntu 14.04 主存储库包alt-ergo
)why3
: 0.86.1
一个证明义务的例子,传递alt-ergo
给wp
:
goal swap_assert_rte_mem_access:
forall t : int farray.
forall a_1,a : addr.
linked(t) ->
(region(a.base) <= 0) ->
(region(a_1.base) <= 0) ->
valid_rd(t, a, 1)