| 1 |
# frama-c -wp [...] |
| 2 |
[kernel] Parsing float_compare.i (no preprocessing) |
| 3 |
[wp] Running WP plugin... |
| 4 |
[wp] Warning: Missing RTE guards |
| 5 |
------------------------------------------------------------ |
| 6 |
Global |
| 7 |
------------------------------------------------------------ |
| 8 |
|
| 9 |
Lemma finite_32_64: |
| 10 |
Assume: 'test_double_compare_greater' 'test_float_compare_greater' |
| 11 |
'test_double_compare' 'test_float_compare' |
| 12 |
Prove: (is_finite_f32 x_0) -> (is_finite_f64 (to_f64 (of_f32 x_0))) |
| 13 |
|
| 14 |
------------------------------------------------------------ |
| 15 |
|
| 16 |
Lemma finite_32_64_real: |
| 17 |
Assume: 'finite_32_64' 'test_double_compare_greater' |
| 18 |
'test_float_compare_greater' 'test_double_compare' 'test_float_compare' |
| 19 |
Prove: let r_0 = (of_f32 x_0) in |
| 20 |
(is_finite_f32 x_0) -> ((of_f64 (to_f64 r_0))=r_0) |
| 21 |
|
| 22 |
------------------------------------------------------------ |
| 23 |
|
| 24 |
Lemma test_double_compare: |
| 25 |
Assume: 'test_float_compare' |
| 26 |
Prove: (is_finite_f64 x_0) -> (is_finite_f64 y_0) -> (le_f64 x_0 y_0) |
| 27 |
-> ((eq_f64 x_0 y_0) \/ (lt_f64 x_0 y_0)) |
| 28 |
|
| 29 |
------------------------------------------------------------ |
| 30 |
|
| 31 |
Lemma test_double_compare_greater: |
| 32 |
Assume: 'test_float_compare_greater' 'test_double_compare' |
| 33 |
'test_float_compare' |
| 34 |
Prove: (is_finite_f64 x_0) -> (is_finite_f64 y_0) -> (le_f64 y_0 x_0) |
| 35 |
-> ((eq_f64 x_0 y_0) \/ (lt_f64 y_0 x_0)) |
| 36 |
|
| 37 |
------------------------------------------------------------ |
| 38 |
|
| 39 |
Lemma test_float_compare: |
| 40 |
Prove: (is_finite_f32 x_0) -> (is_finite_f32 y_0) -> (le_f32 x_0 y_0) |
| 41 |
-> ((eq_f32 x_0 y_0) \/ (lt_f32 x_0 y_0)) |
| 42 |
|
| 43 |
------------------------------------------------------------ |
| 44 |
|
| 45 |
Lemma test_float_compare_greater: |
| 46 |
Assume: 'test_double_compare' 'test_float_compare' |
| 47 |
Prove: (is_finite_f32 x_0) -> (is_finite_f32 y_0) -> (le_f32 y_0 x_0) |
| 48 |
-> ((eq_f32 x_0 y_0) \/ (lt_f32 y_0 x_0)) |
| 49 |
|
| 50 |
------------------------------------------------------------ |
| 51 |
------------------------------------------------------------ |
| 52 |
Function cmp_dd |
| 53 |
------------------------------------------------------------ |
| 54 |
|
| 55 |
Goal Post-condition 'DEF' in 'cmp_dd': |
| 56 |
Assume { (* Pre-condition *) Have: is_finite_f64(a) /\ is_finite_f64(b). } |
| 57 |
Prove: (if lt_f64b(a, b) then 1 else 0) |
| 58 |
= (if (of_f64(a) < of_f64(b)) then 1 else 0). |
| 59 |
|
| 60 |
------------------------------------------------------------ |
| 61 |
|
| 62 |
Goal Post-condition 'REL1' in 'cmp_dd': |
| 63 |
Assume { (* Pre-condition *) Have: is_finite_f64(a) /\ is_finite_f64(b). } |
| 64 |
Prove: lt_f64(a, b) <-> (of_f64(a) < of_f64(b)). |
| 65 |
|
| 66 |
------------------------------------------------------------ |
| 67 |
|
| 68 |
Goal Post-condition 'REL2' in 'cmp_dd': |
| 69 |
Assume { (* Pre-condition *) Have: is_finite_f64(a) /\ is_finite_f64(b). } |
| 70 |
Prove: lt_f64(a, b) <-> (of_f64(a) < of_f64(b)). |
| 71 |
|
| 72 |
------------------------------------------------------------ |
| 73 |
------------------------------------------------------------ |
| 74 |
Function cmp_fd |
| 75 |
------------------------------------------------------------ |
| 76 |
|
| 77 |
Goal Post-condition 'DEF' in 'cmp_fd': |
| 78 |
Let r = of_f32(a). |
| 79 |
Let a_1 = to_f64(r). |
| 80 |
Assume { |
| 81 |
(* Pre-condition *) |
| 82 |
Have: is_finite_f32(a) /\ is_finite_f64(b). |
| 83 |
(* Assertion *) |
| 84 |
Have: is_finite_f64(a_1). |
| 85 |
(* Assertion *) |
| 86 |
Have: of_f64(a_1) = r. |
| 87 |
} |
| 88 |
Prove: (if lt_f64b(a_1, b) then 1 else 0) |
| 89 |
= (if (r < of_f64(b)) then 1 else 0). |
| 90 |
|
| 91 |
------------------------------------------------------------ |
| 92 |
|
| 93 |
Goal Post-condition 'REL1' in 'cmp_fd': |
| 94 |
Let r = of_f32(a). |
| 95 |
Let a_1 = to_f64(r). |
| 96 |
Assume { |
| 97 |
(* Pre-condition *) |
| 98 |
Have: is_finite_f32(a) /\ is_finite_f64(b). |
| 99 |
(* Assertion *) |
| 100 |
Have: is_finite_f64(a_1). |
| 101 |
(* Assertion *) |
| 102 |
Have: of_f64(a_1) = r. |
| 103 |
} |
| 104 |
Prove: lt_f64(a_1, b) <-> (r < of_f64(b)). |
| 105 |
|
| 106 |
------------------------------------------------------------ |
| 107 |
|
| 108 |
Goal Post-condition 'REL2' in 'cmp_fd': |
| 109 |
Let r = of_f32(a). |
| 110 |
Let a_1 = to_f64(r). |
| 111 |
Assume { |
| 112 |
(* Pre-condition *) |
| 113 |
Have: is_finite_f32(a) /\ is_finite_f64(b). |
| 114 |
(* Assertion *) |
| 115 |
Have: is_finite_f64(a_1). |
| 116 |
(* Assertion *) |
| 117 |
Have: of_f64(a_1) = r. |
| 118 |
} |
| 119 |
Prove: lt_f64(a_1, b) <-> (r < of_f64(b)). |
| 120 |
|
| 121 |
------------------------------------------------------------ |
| 122 |
|
| 123 |
Goal Assertion (file float_compare.i, line 63): |
| 124 |
Assume { (* Pre-condition *) Have: is_finite_f32(a) /\ is_finite_f64(b). } |
| 125 |
Prove: is_finite_f64(to_f64(of_f32(a))). |
| 126 |
|
| 127 |
------------------------------------------------------------ |
| 128 |
|
| 129 |
Goal Assertion (file float_compare.i, line 64): |
| 130 |
Let r = of_f32(a). |
| 131 |
Let a_1 = to_f64(r). |
| 132 |
Assume { |
| 133 |
(* Pre-condition *) |
| 134 |
Have: is_finite_f32(a) /\ is_finite_f64(b). |
| 135 |
(* Assertion *) |
| 136 |
Have: is_finite_f64(a_1). |
| 137 |
} |
| 138 |
Prove: of_f64(a_1) = r. |
| 139 |
|
| 140 |
------------------------------------------------------------ |
| 141 |
------------------------------------------------------------ |
| 142 |
Function cmp_ff |
| 143 |
------------------------------------------------------------ |
| 144 |
|
| 145 |
Goal Post-condition 'DEF' in 'cmp_ff': |
| 146 |
Assume { (* Pre-condition *) Have: is_finite_f32(a) /\ is_finite_f32(b). } |
| 147 |
Prove: (if lt_f32b(a, b) then 1 else 0) |
| 148 |
= (if (of_f32(a) < of_f32(b)) then 1 else 0). |
| 149 |
|
| 150 |
------------------------------------------------------------ |
| 151 |
|
| 152 |
Goal Post-condition 'REL1' in 'cmp_ff': |
| 153 |
Assume { (* Pre-condition *) Have: is_finite_f32(a) /\ is_finite_f32(b). } |
| 154 |
Prove: lt_f32(a, b) <-> (of_f32(a) < of_f32(b)). |
| 155 |
|
| 156 |
------------------------------------------------------------ |
| 157 |
|
| 158 |
Goal Post-condition 'REL2' in 'cmp_ff': |
| 159 |
Assume { (* Pre-condition *) Have: is_finite_f32(a) /\ is_finite_f32(b). } |
| 160 |
Prove: lt_f32(a, b) <-> (of_f32(a) < of_f32(b)). |
| 161 |
|
| 162 |
------------------------------------------------------------ |
| 163 |
------------------------------------------------------------ |
| 164 |
Function cmp_fnan |
| 165 |
------------------------------------------------------------ |
| 166 |
|
| 167 |
Goal Post-condition 'POS' in 'cmp_fnan': |
| 168 |
Prove: true. |
| 169 |
|
| 170 |
------------------------------------------------------------ |
| 171 |
|
| 172 |
Goal Post-condition 'NEG' in 'cmp_fnan': |
| 173 |
Prove: true. |
| 174 |
|
| 175 |
------------------------------------------------------------ |