@@ -72,6 +72,9 @@ enum arith_op_kind {
72
72
OP_ATANH,
73
73
// Bit-vector functions
74
74
OP_ARITH_BAND,
75
+ OP_ARITH_SHL,
76
+ OP_ARITH_ASHR,
77
+ OP_ARITH_LSHR,
75
78
// constants
76
79
OP_PI,
77
80
OP_E,
@@ -150,6 +153,8 @@ class arith_decl_plugin : public decl_plugin {
150
153
151
154
bool m_convert_int_numerals_to_real;
152
155
156
+ symbol bv_symbol (decl_kind k) const ;
157
+
153
158
func_decl * mk_func_decl (decl_kind k, bool is_real);
154
159
void set_manager (ast_manager * m, family_id id) override ;
155
160
decl_kind fix_kind (decl_kind k, unsigned arity);
@@ -233,6 +238,14 @@ class arith_decl_plugin : public decl_plugin {
233
238
executed in different threads.
234
239
*/
235
240
class arith_recognizers {
241
+ bool is_arith_op (expr const * n, decl_kind k, unsigned & sz, expr*& x, expr*& y) {
242
+ if (!is_app_of (n, arith_family_id, k))
243
+ return false ;
244
+ x = to_app (n)->get_arg (0 );
245
+ y = to_app (n)->get_arg (1 );
246
+ sz = to_app (n)->get_parameter (0 ).get_int ();
247
+ return true ;
248
+ }
236
249
public:
237
250
family_id get_family_id () const { return arith_family_id; }
238
251
@@ -296,14 +309,13 @@ class arith_recognizers {
296
309
bool is_int_real (expr const * n) const { return is_int_real (n->get_sort ()); }
297
310
298
311
bool is_band (expr const * n) const { return is_app_of (n, arith_family_id, OP_ARITH_BAND); }
299
- bool is_band (expr const * n, unsigned & sz, expr*& x, expr*& y) {
300
- if (!is_band (n))
301
- return false ;
302
- x = to_app (n)->get_arg (0 );
303
- y = to_app (n)->get_arg (1 );
304
- sz = to_app (n)->get_parameter (0 ).get_int ();
305
- return true ;
306
- }
312
+ bool is_band (expr const * n, unsigned & sz, expr*& x, expr*& y) { return is_arith_op (n, OP_ARITH_BAND, sz, x, y); }
313
+ bool is_shl (expr const * n) const { return is_app_of (n, arith_family_id, OP_ARITH_SHL); }
314
+ bool is_shl (expr const * n, unsigned & sz, expr*& x, expr*& y) { return is_arith_op (n, OP_ARITH_SHL, sz, x, y); }
315
+ bool is_lshr (expr const * n) const { return is_app_of (n, arith_family_id, OP_ARITH_LSHR); }
316
+ bool is_lshr (expr const * n, unsigned & sz, expr*& x, expr*& y) { return is_arith_op (n, OP_ARITH_LSHR, sz, x, y); }
317
+ bool is_ashr (expr const * n) const { return is_app_of (n, arith_family_id, OP_ARITH_ASHR); }
318
+ bool is_ashr (expr const * n, unsigned & sz, expr*& x, expr*& y) { return is_arith_op (n, OP_ARITH_ASHR, sz, x, y); }
307
319
308
320
bool is_sin (expr const * n) const { return is_app_of (n, arith_family_id, OP_SIN); }
309
321
bool is_cos (expr const * n) const { return is_app_of (n, arith_family_id, OP_COS); }
@@ -487,6 +499,9 @@ class arith_util : public arith_recognizers {
487
499
app * mk_power0 (expr* arg1, expr* arg2) { return m_manager.mk_app (arith_family_id, OP_POWER0, arg1, arg2); }
488
500
489
501
app* mk_band (unsigned n, expr* arg1, expr* arg2) { parameter p (n); expr* args[2 ] = { arg1, arg2 }; return m_manager.mk_app (arith_family_id, OP_ARITH_BAND, 1 , &p, 2 , args); }
502
+ app* mk_shl (unsigned n, expr* arg1, expr* arg2) { parameter p (n); expr* args[2 ] = { arg1, arg2 }; return m_manager.mk_app (arith_family_id, OP_ARITH_SHL, 1 , &p, 2 , args); }
503
+ app* mk_ashr (unsigned n, expr* arg1, expr* arg2) { parameter p (n); expr* args[2 ] = { arg1, arg2 }; return m_manager.mk_app (arith_family_id, OP_ARITH_ASHR, 1 , &p, 2 , args); }
504
+ app* mk_lshr (unsigned n, expr* arg1, expr* arg2) { parameter p (n); expr* args[2 ] = { arg1, arg2 }; return m_manager.mk_app (arith_family_id, OP_ARITH_LSHR, 1 , &p, 2 , args); }
490
505
491
506
app * mk_sin (expr * arg) { return m_manager.mk_app (arith_family_id, OP_SIN, arg); }
492
507
app * mk_cos (expr * arg) { return m_manager.mk_app (arith_family_id, OP_COS, arg); }
0 commit comments