Exemple #1
0
/*
 * Print the terms of uninterpreted type in array a
 * - n = size of the array
 */
static void eval_print_constant_assignments(FILE *f, evaluator_t *eval, term_t *a, uint32_t n) {
  model_t *model;
  term_table_t *terms;
  char *name;
  value_unint_t *d;
  uint32_t i;
  term_t t;
  value_t c;
  type_kind_t tau;

  model = eval->model;
  terms = model->terms;

  for (i=0; i<n; i++) {
    t = a[i];
    tau = term_type_kind(terms, t);
    if (tau == UNINTERPRETED_TYPE || tau == SCALAR_TYPE) {
      c = eval_in_model(eval, t);
      d = vtbl_unint(&model->vtbl, c);
      name = term_name(terms, t);
      assert(name != NULL);
      if (d->name == NULL || strcmp(name, d->name) != 0) {
        fprintf(f, "(= %s ", name);
        vtbl_print_object(f, &model->vtbl, c);
        fputs(")\n", f);
      }
    }
  }
}
Exemple #2
0
/*
 * Print the terms of uninterpreted type in array a
 * - n = size of the array
 */
static void eval_pp_constant_assignments(yices_pp_t *printer, evaluator_t *eval, term_t *a, uint32_t n) {
  model_t *model;
  term_table_t *terms;
  char *name;
  value_unint_t *d;
  uint32_t i;
  term_t t;
  value_t c;
  type_kind_t tau;

  model = eval->model;
  terms = model->terms;

  for (i=0; i<n; i++) {
    t = a[i];
    tau = term_type_kind(terms, t);
    if (tau == UNINTERPRETED_TYPE || tau == SCALAR_TYPE) {
      c = eval_in_model(eval, t);
      d = vtbl_unint(&model->vtbl, c);
      name = term_name(terms, t);
      assert(name != NULL);
      if (d->name == NULL || strcmp(name, d->name) != 0) {
        pp_open_block(printer, PP_OPEN_EQ);
        pp_string(printer, name);
        vtbl_pp_object(printer, &model->vtbl, c);
        pp_close_block(printer, true);
      }
    }
  }
}
Exemple #3
0
static term_t convert_unint(term_table_t *terms, value_table_t *vtbl, value_t v) {
  value_unint_t *u;

  u = vtbl_unint(vtbl, v);
  return constant_term(terms, u->type, u->index);
}