static term_t build_term(void) { char name[10]; term_t x[20]; term_t p[20]; type_t tau; uint32_t i, j; // create 20 uinterpreted integer terms called x0 ... x19 tau = yices_int_type(); for (i=0; i<20; i++) { x[i] = yices_new_uninterpreted_term(tau); snprintf(name, 10, "x%"PRIu32, i); yices_set_term_name(x[i], name); } // build p[i] = xi + x_{i+1} + 1 for (i=0; i<20; i++) { j = i+1; if (j >= 20) j = 0; p[i] = aux_sum(x[i], x[j]); } // build (and (p[0] >= 0) .... (p[19] >= 0)) for (i=0; i<20; i++) { p[i] = yices_arith_geq0_atom(p[i]); } return yices_and(20, p); }
static void smt_eval_mk_eq(tstack_t *stack, stack_elem_t *f, uint32_t n) { term_t *arg, last, first, t; uint32_t i; if (n == 2) { first = get_term(stack, f); last = get_term(stack, f+1); t = yices_eq(first, last); } else { arg = get_aux_buffer(stack, n); n --; last = get_term(stack, f+n); for (i=0; i<n; i++) { t = yices_eq(get_term(stack, f+i), last); check_term(stack, t); arg[i] = t; } t = yices_and(n, arg); } check_term(stack, t); tstack_pop_frame(stack); set_term_result(stack, t); }