Une nouvelle version du portail de gestion des comptes externes sera mise en production lundi 09 août. Elle permettra d'allonger la validité d'un compte externe jusqu'à 3 ans. Pour plus de détails sur cette version consulter : https://doc-si.inria.fr/x/FCeS

z3_432.drv 9.23 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
(** Why3 driver for Z3 >= 4.3.2 *)

(* Do not set any logic, let z3 choose by itself
   prelude "(set-logic AUFNIRA)"
*)

import "smt-libv2.drv"
import "discrimination.gen"

transformation "inline_trivial"
transformation "eliminate_builtin"
12
(* temporarily disabled
13
transformation "detect_polymorphism"
14
*)
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
transformation "eliminate_definition_if_poly"
transformation "eliminate_inductive"
transformation "eliminate_algebraic_if_poly"
transformation "eliminate_epsilon"

transformation "simplify_formula"
(*transformation "simplify_trivial_quantification"*)

transformation "discriminate_if_poly"
transformation "encoding_smt_if_poly"


(** Error messages specific to Z3 *)

outofmemory "(error \".*out of memory\")\\|Cannot allocate memory"
timeout "interrupted by timeout"

(** Extra theories supported by Z3 *)

(* div/mod of Z3 seems to be Euclidean Division *)
theory int.EuclideanDivision
   syntax function div "(div %1 %2)"
   syntax function mod "(mod %1 %2)"
   remove prop Mod_bound
   remove prop Div_mod
   remove prop Mod_1
   remove prop Div_1
end

theory real.FromInt
  syntax function from_int "(to_real %1)"
  remove prop Zero
  remove prop One
  remove prop Add
  remove prop Sub
  remove prop Mul
  remove prop Neg
end

(* does not work: Z3 segfaults
theory real.Trigonometry

  syntax function cos "(cos %1)"
  syntax function sin "(sin %1)"
  syntax function pi "pi"
  syntax function tan "(tan %1)"
  syntax function atan "(atan %1)"

end
*)
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327


(* bitvector modules, is not in smt-libv2.drv since cvc4 and z3 don't
   have the same name for the function to_int *)
theory bitvec.BitVector64
  syntax type t "(_ BitVec 64)"

  syntax function zero "#x00000000"
  syntax function ones "#xFFFFFFFF"
  syntax function bw_and "(bvand %1 %2)"
  syntax function bw_or "(bvor %1 %2)"
  syntax function bw_xor "(bvxor %1 %2)"
  syntax function bw_not "(bvnot %1)"

  syntax function add "(bvadd %1 %2)"
  syntax function sub "(bvsub %1 %2)"
  syntax function neg "(bvneg %1)"
  syntax function mul "(bvmul %1 %2)"
  syntax function udiv "(bvudiv %1 %2)"
  syntax function urem "(bvurem %1 %2)"

  syntax function lsr "(bvlshr %1 %2)"
  syntax function lsl "(bvshl %1 %2)"
  syntax function asr "(bvashr %1 %2)"
  syntax converter of_int "((_ int2bv 64) %1)"
  syntax function to_int "(bv2int %1)"
  remove prop to_int_of_int
  remove prop to_int_extensionality
  remove prop to_int_bounds
  syntax predicate eq "(= %1 %2)"
  remove prop Extensionality

  remove prop to_int_add
  remove prop to_int_sub
  remove prop to_int_neg
  remove prop to_int_mul
  remove prop to_int_udiv
  remove prop to_int_urem
  remove prop to_int_lsr
  remove prop to_int_lsl

  remove prop nth_ext
  remove prop Nth_zero
  remove prop Nth_ones
  remove prop Nth_bw_or
  remove prop Nth_bw_and
  remove prop Nth_bw_xor
  remove prop Nth_bw_not
  remove prop Nth_rotate_left
  remove prop Nth_rotate_right
  remove prop Lsr_nth_low
  remove prop Lsr_nth_high
  remove prop Asr_nth_low
  remove prop Asr_nth_high
  remove prop Lsl_nth_low
  remove prop Lsl_nth_high

  syntax predicate ult "(bvult %1 %2)"
  syntax predicate ule "(bvule %1 %2)"
  syntax predicate ugt "(bvugt %1 %2)"
  syntax predicate uge "(bvuge %1 %2)"

  syntax function nth
    "(not (= (bvand (bvlshr %1 %2) (_ bv1 64)) (_ bv0 64)))"

  syntax function rotate_left "(bvor (bvshl %1 (bvurem %2 (_ bv64 64))) (bvlshr %1 (bvsub (_ bv64 64) (bvurem %2 (_ bv64 64)))))"
  syntax function rotate_right "(bvor (bvlshr %1 (bvurem %2 (_ bv64 64))) (bvshl %1 (bvsub (_ bv64 64) (bvurem %2 (_ bv64 64)))))"
end

theory bitvec.BitVector32
  syntax type t "(_ BitVec 32)"

  syntax function zero "#x00000000"
  syntax function ones "#xFFFFFFFF"
  syntax function bw_and "(bvand %1 %2)"
  syntax function bw_or "(bvor %1 %2)"
  syntax function bw_xor "(bvxor %1 %2)"
  syntax function bw_not "(bvnot %1)"

  syntax function add "(bvadd %1 %2)"
  syntax function sub "(bvsub %1 %2)"
  syntax function neg "(bvneg %1)"
  syntax function mul "(bvmul %1 %2)"
  syntax function udiv "(bvudiv %1 %2)"
  syntax function urem "(bvurem %1 %2)"

  syntax function lsr "(bvlshr %1 %2)"
  syntax function lsl "(bvshl %1 %2)"
  syntax function asr "(bvashr %1 %2)"
  syntax converter of_int "((_ int2bv 32) %1)"
  syntax function to_int "(bv2int %1)"
  remove prop to_int_of_int
  remove prop to_int_extensionality
  remove prop to_int_bounds
  syntax predicate eq "(= %1 %2)"
  remove prop Extensionality

  remove prop to_int_add
  remove prop to_int_sub
  remove prop to_int_neg
  remove prop to_int_mul
  remove prop to_int_udiv
  remove prop to_int_urem
  remove prop to_int_lsr
  remove prop to_int_lsl

  remove prop nth_ext
  remove prop Nth_zero
  remove prop Nth_ones
  remove prop Nth_bw_or
  remove prop Nth_bw_and
  remove prop Nth_bw_xor
  remove prop Nth_bw_not
  remove prop Nth_rotate_left
  remove prop Nth_rotate_right
  remove prop Lsr_nth_low
  remove prop Lsr_nth_high
  remove prop Asr_nth_low
  remove prop Asr_nth_high
  remove prop Lsl_nth_low
  remove prop Lsl_nth_high

  syntax predicate ult "(bvult %1 %2)"
  syntax predicate ule "(bvule %1 %2)"
  syntax predicate ugt "(bvugt %1 %2)"
  syntax predicate uge "(bvuge %1 %2)"

  syntax function nth
    "(not (= (bvand (bvlshr %1 %2) (_ bv1 32)) (_ bv0 32)))"

  syntax function rotate_left "(bvor (bvshl %1 (bvurem %2 (_ bv32 32))) (bvlshr %1 (bvsub (_ bv32 32) (bvurem %2 (_ bv32 32)))))"
  syntax function rotate_right "(bvor (bvlshr %1 (bvurem %2 (_ bv32 32))) (bvshl %1 (bvsub (_ bv32 32) (bvurem %2 (_ bv32 32)))))"
end

theory bitvec.BitVector16
  syntax type t "(_ BitVec 16)"

  syntax function zero "#x0000"
  syntax function ones "#xFFFF"
  syntax function bw_and "(bvand %1 %2)"
  syntax function bw_or "(bvor %1 %2)"
  syntax function bw_xor "(bvxor %1 %2)"
  syntax function bw_not "(bvnot %1)"

  syntax function add "(bvadd %1 %2)"
  syntax function sub "(bvsub %1 %2)"
  syntax function neg "(bvneg %1)"
  syntax function mul "(bvmul %1 %2)"
  syntax function udiv "(bvudiv %1 %2)"
  syntax function urem "(bvurem %1 %2)"

  syntax function lsr "(bvlshr %1 %2)"
  syntax function lsl "(bvshl %1 %2)"
  syntax function asr "(bvashr %1 %2)"
  syntax converter of_int "((_ int2bv 16) %1)"
  syntax function to_int "(bv2int %1)"
  remove prop to_int_of_int
  remove prop to_int_extensionality
  remove prop to_int_bounds
  syntax predicate eq "(= %1 %2)"
  remove prop Extensionality

  remove prop to_int_add
  remove prop to_int_sub
  remove prop to_int_neg
  remove prop to_int_mul
  remove prop to_int_udiv
  remove prop to_int_urem
  remove prop to_int_lsr
  remove prop to_int_lsl

  remove prop nth_ext
  remove prop Nth_zero
  remove prop Nth_ones
  remove prop Nth_bw_or
  remove prop Nth_bw_and
  remove prop Nth_bw_xor
  remove prop Nth_bw_not
  remove prop Nth_rotate_left
  remove prop Nth_rotate_right
  remove prop Lsr_nth_low
  remove prop Lsr_nth_high
  remove prop Asr_nth_low
  remove prop Asr_nth_high
  remove prop Lsl_nth_low
  remove prop Lsl_nth_high

  syntax predicate ult "(bvult %1 %2)"
  syntax predicate ule "(bvule %1 %2)"
  syntax predicate ugt "(bvugt %1 %2)"
  syntax predicate uge "(bvuge %1 %2)"

  syntax function nth
    "(not (= (bvand (bvlshr %1 %2) (_ bv1 16)) (_ bv0 16)))"

  syntax function rotate_left "(bvor (bvshl %1 (bvurem %2 (_ bv16 16))) (bvlshr %1 (bvsub (_ bv16 16) (bvurem %2 (_ bv16 16)))))"
  syntax function rotate_right "(bvor (bvlshr %1 (bvurem %2 (_ bv16 16))) (bvshl %1 (bvsub (_ bv16 16) (bvurem %2 (_ bv16 16)))))"
end

theory bitvec.BitVector8
  syntax type t "(_ BitVec 8)"

  syntax function zero "#x00"
  syntax function ones "#xFF"
  syntax function bw_and "(bvand %1 %2)"
  syntax function bw_or "(bvor %1 %2)"
  syntax function bw_xor "(bvxor %1 %2)"
  syntax function bw_not "(bvnot %1)"

  syntax function add "(bvadd %1 %2)"
  syntax function sub "(bvsub %1 %2)"
  syntax function neg "(bvneg %1)"
  syntax function mul "(bvmul %1 %2)"
  syntax function udiv "(bvudiv %1 %2)"
  syntax function urem "(bvurem %1 %2)"

  syntax function lsr "(bvlshr %1 %2)"
  syntax function lsl "(bvshl %1 %2)"
  syntax function asr "(bvashr %1 %2)"
  syntax converter of_int "((_ int2bv 8) %1)"
  syntax function to_int "(bv2int %1)"
  remove prop to_int_of_int
  remove prop to_int_extensionality
  remove prop to_int_bounds
  syntax predicate eq "(= %1 %2)"
  remove prop Extensionality

  remove prop to_int_add
  remove prop to_int_sub
  remove prop to_int_neg
  remove prop to_int_mul
  remove prop to_int_udiv
  remove prop to_int_urem
  remove prop to_int_lsr
  remove prop to_int_lsl

  remove prop nth_ext
  remove prop Nth_zero
  remove prop Nth_ones
  remove prop Nth_bw_or
  remove prop Nth_bw_and
  remove prop Nth_bw_xor
  remove prop Nth_bw_not
  remove prop Nth_rotate_left
  remove prop Nth_rotate_right
  remove prop Lsr_nth_low
  remove prop Lsr_nth_high
  remove prop Asr_nth_low
  remove prop Asr_nth_high
  remove prop Lsl_nth_low
  remove prop Lsl_nth_high

  syntax predicate ult "(bvult %1 %2)"
  syntax predicate ule "(bvule %1 %2)"
  syntax predicate ugt "(bvugt %1 %2)"
  syntax predicate uge "(bvuge %1 %2)"

  syntax function nth
    "(not (= (bvand (bvlshr %1 %2) (_ bv1 8)) (_ bv0 8)))"

  syntax function rotate_left "(bvor (bvshl %1 (bvurem %2 (_ bv8 8))) (bvlshr %1 (bvsub (_ bv8 8) (bvurem %2 (_ bv8 8)))))"
  syntax function rotate_right "(bvor (bvlshr %1 (bvurem %2 (_ bv8 8))) (bvshl %1 (bvsub (_ bv8 8) (bvurem %2 (_ bv8 8)))))"
end