2 (* Why3 driver for CVC3 *)
4 prelude "%%% this is a prelude for CVC3 "
7 filename "%f-%t-%g.cvc"
9 (* 'fail' must be before 'valid'; otherwise it is ignored *)
10 fail "Parse Error: \\(.*\\)" "\\1"
12 unknown "Unknown\\." ""
13 outofmemory "Out of memory\\|std::bad_alloc\\|GNU MP: Cannot allocate memory"
14 timeout "self-timeout"
15 time "why3cpulimit time : %s s"
17 (* Performed introductions depending on whether counterexamples are
18 requested, as said by the meta "get_counterexmp". When this meta
19 set, this transformation introduces the model variables that are
20 still embedded in the goal. When it is not set, it removes all
21 these unused-ce-related variables, even in the context. *)
22 transformation "counterexamples_dependent_intros"
24 transformation "inline_trivial"
25 transformation "eliminate_builtin"
26 transformation "eliminate_definition"
27 transformation "eliminate_inductive"
28 transformation "eliminate_epsilon"
29 transformation "eliminate_algebraic"
30 transformation "eliminate_literal"
32 transformation "simplify_formula"
33 (*transformation "simplify_trivial_quantification"*)
35 transformation "discriminate"
36 transformation "encoding_smt"
40 syntax type real "REAL"
41 syntax predicate (=) "(%1 = %2)"
43 meta "encoding:kept" type int
48 prelude "%%% this is a prelude for CVC3 integer arithmetic"
50 syntax function zero "0"
51 syntax function one "1"
53 syntax function (+) "(%1 + %2)"
54 syntax function (-) "(%1 - %2)"
55 syntax function (*) "(%1 * %2)"
56 syntax function (-_) "(- %1)"
58 syntax predicate (<=) "(%1 <= %2)"
59 syntax predicate (<) "(%1 < %2)"
60 syntax predicate (>=) "(%1 >= %2)"
61 syntax predicate (>) "(%1 > %2)"
63 remove prop MulComm.Comm
64 remove prop MulAssoc.Assoc
65 remove prop Unit_def_l
66 remove prop Unit_def_r
70 remove prop Mul_distr_l
71 remove prop Mul_distr_r
78 remove prop NonTrivialRing
79 remove prop CompatOrderAdd
80 remove prop ZeroLessOne
87 prelude "%%% this is a prelude for CVC3 real arithmetic"
89 prelude "div_by_zero: (REAL) -> REAL;"
91 syntax function zero "0"
92 syntax function one "1"
94 syntax function (+) "(%1 + %2)"
95 syntax function (-) "(%1 - %2)"
96 syntax function (*) "(%1 * %2)"
97 syntax function (/) "(IF (%2 = 0) THEN (div_by_zero(%1)) ELSE (%1 / %2) ENDIF)"
98 syntax function (-_) "(- %1)"
99 syntax function inv "(IF (%1 = 0) THEN (div_by_zero(1)) ELSE (1 / %1) ENDIF)"
101 syntax predicate (<=) "(%1 <= %2)"
102 syntax predicate (<) "(%1 < %2)"
103 syntax predicate (>=) "(%1 >= %2)"
104 syntax predicate (>) "(%1 > %2)"
106 remove prop MulComm.Comm
107 remove prop MulAssoc.Assoc
108 remove prop Unit_def_l
109 remove prop Unit_def_r
110 remove prop Inv_def_l
111 remove prop Inv_def_r
113 remove prop Mul_distr_l
114 remove prop Mul_distr_r
122 remove prop NonTrivialRing
123 remove prop CompatOrderAdd
124 remove prop ZeroLessOne
126 meta "encoding:kept" type real
132 syntax function from_int "%1"
144 syntax type bool "BITVECTOR(1)"
145 syntax function True "0bin1"
146 syntax function False "0bin0"
148 meta "encoding:kept" type bool
152 syntax function andb "(%1 & %2)"
153 syntax function orb "(%1 | %2)"
154 syntax function xorb "(BVXOR(%1,%2))"
155 syntax function notb "(~ %1)"
159 syntax type (->) "(ARRAY %1 OF %2)"
160 syntax function (@) "(%1[%2])"
162 meta "encoding:lskept" function (@)
166 syntax function get "(%1[%2])"
167 syntax function set "(%1 WITH [%2] := %3)"
169 meta "encoding:lskept" function get
170 meta "encoding:lskept" function set
173 import "discrimination.gen"