| 1 |
# frama-c -wp [...] |
| 2 |
[kernel] Parsing inductive.i (no preprocessing) |
| 3 |
[wp] Running WP plugin... |
| 4 |
[wp] 3 goals scheduled |
| 5 |
--------------------------------------------- |
| 6 |
--- Context 'typed' Cluster 'Compound' |
| 7 |
--------------------------------------------- |
| 8 |
theory Compound |
| 9 |
(* use why3.BuiltIn.BuiltIn *) |
| 10 |
|
| 11 |
(* use bool.Bool *) |
| 12 |
|
| 13 |
(* use int.Int *) |
| 14 |
|
| 15 |
(* use int.ComputerDivision *) |
| 16 |
|
| 17 |
(* use real.RealInfix *) |
| 18 |
|
| 19 |
(* use frama_c_wp.qed.Qed *) |
| 20 |
|
| 21 |
(* use map.Map *) |
| 22 |
|
| 23 |
(* use frama_c_wp.memory.Memory *) |
| 24 |
|
| 25 |
function shift_sint32 (p:addr) (k:int) : addr = shift p k |
| 26 |
|
| 27 |
function shiftfield_F1__list_next (p:addr) : addr = shift p 1 |
| 28 |
end |
| 29 |
[wp:print-generated] |
| 30 |
theory WP |
| 31 |
(* use why3.BuiltIn.BuiltIn *) |
| 32 |
|
| 33 |
(* use bool.Bool *) |
| 34 |
|
| 35 |
(* use int.Int *) |
| 36 |
|
| 37 |
(* use int.ComputerDivision *) |
| 38 |
|
| 39 |
(* use real.RealInfix *) |
| 40 |
|
| 41 |
(* use frama_c_wp.qed.Qed *) |
| 42 |
|
| 43 |
(* use map.Map *) |
| 44 |
|
| 45 |
inductive P_is_gcd int int int = |
| 46 |
| Q_gcd_zero : forall n:int. P_is_gcd n 0 n |
| 47 |
| Q_gcd_succ : |
| 48 |
forall a:int, b:int, d:int. P_is_gcd b (mod a b) d -> P_is_gcd a b d |
| 49 |
|
| 50 |
lemma Q_test_no_label : |
| 51 |
forall a:int, b:int, d:int. P_is_gcd a b d -> not P_is_gcd b d a |
| 52 |
|
| 53 |
(* use frama_c_wp.memory.Memory *) |
| 54 |
|
| 55 |
(* use Compound *) |
| 56 |
|
| 57 |
inductive P_reachable (int -> int) (addr -> addr) addr addr = |
| 58 |
| Q_root_reachable : |
| 59 |
forall malloc:int -> int, mptr:addr -> addr, root:addr. |
| 60 |
P_reachable malloc mptr root root |
| 61 |
| Q_next_reachable : |
| 62 |
forall malloc:int -> int, mptr:addr -> addr, root:addr, node:addr. |
| 63 |
valid_rw malloc root 2 -> |
| 64 |
P_reachable malloc mptr (get mptr (shiftfield_F1__list_next root)) |
| 65 |
node -> P_reachable malloc mptr root node |
| 66 |
|
| 67 |
goal wp_goal : |
| 68 |
forall t:int -> int, t1:addr -> addr, t2:int -> int, t3:addr -> addr, a: |
| 69 |
addr, a1:addr. P_reachable t2 t3 a a1 -> not P_reachable t t1 a a1 |
| 70 |
end |
| 71 |
[wp:print-generated] |
| 72 |
theory WP1 |
| 73 |
(* use why3.BuiltIn.BuiltIn *) |
| 74 |
|
| 75 |
(* use bool.Bool *) |
| 76 |
|
| 77 |
(* use int.Int *) |
| 78 |
|
| 79 |
(* use int.ComputerDivision *) |
| 80 |
|
| 81 |
(* use real.RealInfix *) |
| 82 |
|
| 83 |
(* use frama_c_wp.qed.Qed *) |
| 84 |
|
| 85 |
(* use map.Map *) |
| 86 |
|
| 87 |
inductive P_is_gcd1 int int int = |
| 88 |
| Q_gcd_zero1 : forall n:int. P_is_gcd1 n 0 n |
| 89 |
| Q_gcd_succ1 : |
| 90 |
forall a:int, b:int, d:int. |
| 91 |
P_is_gcd1 b (mod a b) d -> P_is_gcd1 a b d |
| 92 |
|
| 93 |
goal wp_goal : |
| 94 |
forall i:int, i1:int, i2:int. P_is_gcd1 i i1 i2 -> not P_is_gcd1 i1 i2 i |
| 95 |
end |
| 96 |
[wp:print-generated] |
| 97 |
theory WP2 |
| 98 |
(* use why3.BuiltIn.BuiltIn *) |
| 99 |
|
| 100 |
(* use bool.Bool *) |
| 101 |
|
| 102 |
(* use int.Int *) |
| 103 |
|
| 104 |
(* use int.ComputerDivision *) |
| 105 |
|
| 106 |
(* use real.RealInfix *) |
| 107 |
|
| 108 |
(* use frama_c_wp.qed.Qed *) |
| 109 |
|
| 110 |
(* use map.Map *) |
| 111 |
|
| 112 |
(* use frama_c_wp.memory.Memory *) |
| 113 |
|
| 114 |
(* use Compound *) |
| 115 |
|
| 116 |
inductive P_reachable1 (int -> int) (addr -> addr) addr addr = |
| 117 |
| Q_root_reachable1 : |
| 118 |
forall malloc:int -> int, mptr:addr -> addr, root:addr. |
| 119 |
P_reachable1 malloc mptr root root |
| 120 |
| Q_next_reachable1 : |
| 121 |
forall malloc:int -> int, mptr:addr -> addr, root:addr, node:addr. |
| 122 |
valid_rw malloc root 2 -> |
| 123 |
P_reachable1 malloc mptr (get mptr (shiftfield_F1__list_next root)) |
| 124 |
node -> P_reachable1 malloc mptr root node |
| 125 |
|
| 126 |
lemma Q_test_one_label : |
| 127 |
forall malloc:int -> int, mptr:addr -> addr, malloc1:int -> int, mptr1: |
| 128 |
addr -> addr, l1:addr, l2:addr. |
| 129 |
P_reachable1 malloc1 mptr1 l1 l2 -> not P_reachable1 malloc mptr l1 l2 |
| 130 |
|
| 131 |
inductive P_is_gcd2 int int int = |
| 132 |
| Q_gcd_zero2 : forall n:int. P_is_gcd2 n 0 n |
| 133 |
| Q_gcd_succ2 : |
| 134 |
forall a:int, b:int, d:int. |
| 135 |
P_is_gcd2 b (mod a b) d -> P_is_gcd2 a b d |
| 136 |
|
| 137 |
lemma Q_test_no_label1 : |
| 138 |
forall a:int, b:int, d:int. P_is_gcd2 a b d -> not P_is_gcd2 b d a |
| 139 |
|
| 140 |
predicate P_same_array (mint:addr -> int) (mint1:addr -> int) (a:addr) (b: |
| 141 |
addr) (begin1:int) (end1:int) = |
| 142 |
forall i:int. |
| 143 |
begin1 <= i -> |
| 144 |
i < end1 -> get mint1 (shift_sint32 a i) = get mint (shift_sint32 b i) |
| 145 |
|
| 146 |
predicate P_swap (mint:addr -> int) (mint1:addr -> int) (a:addr) (b:addr) |
| 147 |
(begin1:int) (i:int) (j:int) (end1:int) = |
| 148 |
((((get mint1 (shift_sint32 a i) = get mint (shift_sint32 b j) /\ |
| 149 |
get mint1 (shift_sint32 a j) = get mint (shift_sint32 b i)) /\ |
| 150 |
begin1 <= i) /\ |
| 151 |
i < j) /\ |
| 152 |
j < end1) /\ |
| 153 |
(forall i1:int. |
| 154 |
not i1 = i -> |
| 155 |
not j = i1 -> |
| 156 |
begin1 <= i1 -> |
| 157 |
i1 < end1 -> |
| 158 |
get mint1 (shift_sint32 a i1) = get mint (shift_sint32 b i1)) |
| 159 |
|
| 160 |
inductive P_same_elements (addr -> int) (addr -> int) addr addr int int = |
| 161 |
| Q_refl : |
| 162 |
forall mint:addr -> int, mint1:addr -> int, a:addr, b:addr, begin1: |
| 163 |
int, end1:int. |
| 164 |
P_same_array mint mint1 a b begin1 end1 -> |
| 165 |
P_same_elements mint mint1 a b begin1 end1 |
| 166 |
| Q_swap : |
| 167 |
forall mint:addr -> int, mint1:addr -> int, a:addr, b:addr, begin1: |
| 168 |
int, i:int, j:int, end1:int. |
| 169 |
P_swap mint mint1 a b begin1 i j end1 -> |
| 170 |
P_same_elements mint mint1 a b begin1 end1 |
| 171 |
| Q_trans : |
| 172 |
forall mint:addr -> int, mint1:addr -> int, mint2:addr -> int, a: |
| 173 |
addr, b:addr, c:addr, begin1:int, end1:int. |
| 174 |
P_same_elements mint mint1 b c begin1 end1 -> |
| 175 |
P_same_elements mint1 mint2 a b begin1 end1 -> |
| 176 |
P_same_elements mint mint2 a c begin1 end1 |
| 177 |
|
| 178 |
goal wp_goal : |
| 179 |
forall t:addr -> int, t1:addr -> int, t2:addr -> int, a:addr, a1:addr, i: |
| 180 |
int, i1:int, i2:int, i3:int. |
| 181 |
P_same_elements t1 t2 a a1 i i2 -> not P_same_elements t t1 a1 a i1 i3 |
| 182 |
end |
| 183 |
[wp] 3 goals generated |
| 184 |
------------------------------------------------------------ |
| 185 |
Global |
| 186 |
------------------------------------------------------------ |
| 187 |
|
| 188 |
Lemma test_multilabel: |
| 189 |
Assume: 'test_one_label' 'test_no_label' |
| 190 |
Prove: (P_same_elements Mint_1 Mint_2 a_0 b_0 b1_0 e1_0) |
| 191 |
-> (not (P_same_elements Mint_0 Mint_1 b_0 a_0 b2_0 e2_0)) |
| 192 |
|
| 193 |
------------------------------------------------------------ |
| 194 |
|
| 195 |
Lemma test_no_label: |
| 196 |
Prove: (P_is_gcd a_0 b_0 d_0) -> (not (P_is_gcd b_0 d_0 a_0)) |
| 197 |
|
| 198 |
------------------------------------------------------------ |
| 199 |
|
| 200 |
Lemma test_one_label: |
| 201 |
Assume: 'test_no_label' |
| 202 |
Prove: (P_reachable Malloc_1 Mptr_1 l1_0 l2_0) |
| 203 |
-> (not (P_reachable Malloc_0 Mptr_0 l1_0 l2_0)) |
| 204 |
|
| 205 |
------------------------------------------------------------ |