28 if (expr.is_quantifier())
35 z3::func_decl function = expr.decl();
38 switch (function.decl_kind()) {
41 case Z3_OP_CONST_ARRAY: {
42 node = this->astCtxt->array(function.range().array_domain().bv_size());
47 if (expr.num_args() != 2)
49 node = this->astCtxt->equal(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
53 case Z3_OP_DISTINCT: {
54 if (expr.num_args() < 2)
56 node = this->astCtxt->distinct(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
58 node = this->astCtxt->distinct(node, this->convert(expr.arg(i)));
63 if (expr.num_args() != 2)
65 node = this->astCtxt->iff(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
70 if (expr.num_args() != 3)
72 node = this->astCtxt->ite(this->
convert(expr.arg(0)), this->convert(expr.arg(1)), this->convert(expr.arg(2)));
77 if (expr.num_args() < 2)
80 std::vector<SharedAbstractNode> args;
82 args.push_back(this->
convert(expr.arg(i)));
85 node = this->astCtxt->land(args);
90 if (expr.num_args() < 2)
93 std::vector<SharedAbstractNode> args;
95 args.push_back(this->
convert(expr.arg(i)));
98 node = this->astCtxt->lor(args);
103 if (expr.num_args() != 2)
105 node = this->astCtxt->lxor(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
110 if (expr.num_args() != 1)
112 node = this->astCtxt->lnot(this->
convert(expr.arg(0)));
117 std::string stringValue = Z3_get_numeral_string(expr.ctx(), expr);
119 node = this->astCtxt->bv(intValue, expr.get_sort().bv_size());
124 if (expr.num_args() != 1)
126 node = this->astCtxt->bvneg(this->
convert(expr.arg(0)));
131 if (expr.num_args() < 2)
133 node = this->astCtxt->bvadd(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
135 node = this->astCtxt->bvadd(node, this->convert(expr.arg(i)));
140 if (expr.num_args() < 2)
142 node = this->astCtxt->bvsub(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
144 node = this->astCtxt->bvsub(node, this->convert(expr.arg(i)));
149 if (expr.num_args() < 2)
151 node = this->astCtxt->bvmul(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
153 node = this->astCtxt->bvmul(node, this->convert(expr.arg(i)));
159 if (expr.num_args() < 2)
161 node = this->astCtxt->bvsdiv(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
163 node = this->astCtxt->bvsdiv(node, this->convert(expr.arg(i)));
169 if (expr.num_args() < 2)
171 node = this->astCtxt->bvudiv(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
173 node = this->astCtxt->bvudiv(node, this->convert(expr.arg(i)));
179 if (expr.num_args() < 2)
181 node = this->astCtxt->bvsrem(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
183 node = this->astCtxt->bvsrem(node, this->convert(expr.arg(i)));
189 if (expr.num_args() < 2)
191 node = this->astCtxt->bvurem(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
193 node = this->astCtxt->bvurem(node, this->convert(expr.arg(i)));
199 if (expr.num_args() < 2)
201 node = this->astCtxt->bvsmod(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
203 node = this->astCtxt->bvsmod(node, this->convert(expr.arg(i)));
208 if (expr.num_args() < 2)
210 node = this->astCtxt->bvule(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
212 node = this->astCtxt->bvule(node, this->convert(expr.arg(i)));
217 if (expr.num_args() < 2)
219 node = this->astCtxt->bvsle(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
221 node = this->astCtxt->bvsle(node, this->convert(expr.arg(i)));
226 if (expr.num_args() < 2)
228 node = this->astCtxt->bvuge(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
230 node = this->astCtxt->bvuge(node, this->convert(expr.arg(i)));
235 if (expr.num_args() < 2)
237 node = this->astCtxt->bvsge(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
239 node = this->astCtxt->bvsge(node, this->convert(expr.arg(i)));
244 if (expr.num_args() < 2)
246 node = this->astCtxt->bvult(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
248 node = this->astCtxt->bvult(node, this->convert(expr.arg(i)));
253 if (expr.num_args() < 2)
255 node = this->astCtxt->bvslt(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
257 node = this->astCtxt->bvslt(node, this->convert(expr.arg(i)));
262 if (expr.num_args() < 2)
264 node = this->astCtxt->bvugt(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
266 node = this->astCtxt->bvugt(node, this->convert(expr.arg(i)));
271 if (expr.num_args() < 2)
273 node = this->astCtxt->bvsgt(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
275 node = this->astCtxt->bvsgt(node, this->convert(expr.arg(i)));
280 if (expr.num_args() < 2)
282 node = this->astCtxt->bvand(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
284 node = this->astCtxt->bvand(node, this->convert(expr.arg(i)));
289 if (expr.num_args() < 2)
291 node = this->astCtxt->bvor(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
293 node = this->astCtxt->bvor(node, this->convert(expr.arg(i)));
298 if (expr.num_args() != 1)
300 node = this->astCtxt->bvnot(this->
convert(expr.arg(0)));
305 if (expr.num_args() < 2)
307 node = this->astCtxt->bvxor(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
309 node = this->astCtxt->bvxor(node, this->convert(expr.arg(i)));
314 if (expr.num_args() < 2)
316 node = this->astCtxt->bvnand(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
318 node = this->astCtxt->bvnand(node, this->convert(expr.arg(i)));
323 if (expr.num_args() < 2)
325 node = this->astCtxt->bvnor(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
327 node = this->astCtxt->bvnor(node, this->convert(expr.arg(i)));
332 if (expr.num_args() < 2)
334 node = this->astCtxt->bvxnor(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
336 node = this->astCtxt->bvxnor(node, this->convert(expr.arg(i)));
341 if (expr.num_args() < 2)
344 std::vector<SharedAbstractNode> args;
346 args.push_back(this->
convert(expr.arg(i)));
349 node = this->astCtxt->concat(args);
353 case Z3_OP_SIGN_EXT: {
354 if (expr.num_args() != 1)
356 node = this->astCtxt->sx(expr.hi(), this->convert(expr.arg(0)));
360 case Z3_OP_ZERO_EXT: {
361 if (expr.num_args() != 1)
363 node = this->astCtxt->zx(expr.hi(), this->convert(expr.arg(0)));
367 case Z3_OP_EXTRACT: {
368 if (expr.num_args() != 1)
370 node = this->astCtxt->extract(expr.hi(), expr.lo(), this->convert(expr.arg(0)));
375 if (expr.num_args() < 2)
377 node = this->astCtxt->bvshl(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
379 node = this->astCtxt->bvshl(node, this->convert(expr.arg(i)));
384 if (expr.num_args() < 2)
386 node = this->astCtxt->bvlshr(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
388 node = this->astCtxt->bvlshr(node, this->convert(expr.arg(i)));
393 if (expr.num_args() < 2)
395 node = this->astCtxt->bvashr(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
397 node = this->astCtxt->bvashr(node, this->convert(expr.arg(i)));
401 case Z3_OP_ROTATE_LEFT: {
402 if (expr.num_args() != 1)
404 node = this->astCtxt->bvrol(this->
convert(expr.arg(0)), expr.hi());
408 case Z3_OP_ROTATE_RIGHT: {
409 if (expr.num_args() != 1)
411 node = this->astCtxt->bvror(this->
convert(expr.arg(0)), expr.hi());
416 if (expr.num_args() != 2)
418 node = this->astCtxt->select(this->
convert(expr.arg(0)), this->convert(expr.arg(1)));
423 if (expr.num_args() != 3)
425 node = this->astCtxt->store(this->
convert(expr.arg(0)), this->convert(expr.arg(1)), this->convert(expr.arg(2)));
431 node = this->astCtxt->equal(this->astCtxt->bvtrue(), this->astCtxt->bvtrue());
437 node = this->astCtxt->equal(this->astCtxt->bvtrue(), this->astCtxt->bvfalse());
442 case Z3_OP_UNINTERPRETED: {
443 std::string name = function.name().str();
445 node = this->astCtxt->getVariableNode(name);
446 if (node ==
nullptr) {
447 node = this->astCtxt->string(name);