Example #1
0
static void init_base_types(void) {
  base[0] = bool_type(&types);               // bool
  base[1] = bv_type(&types, 5);              // bv5
  base[2] = new_scalar_type(&types, 3);      // scalar3
  base[3] = new_scalar_type(&types, 1);      // scalar1
  base[4] = pair_type(base[0], base[2]);     // bool x scalar3
  base[5] = pair_type(base[3], base[0]);     // scalar1 x bool
  base[6] = fun_type1(base[0], base[2]);     // [bool -> scalar3]
  base[7] = fun_type1(base[0], base[3]);     // [bool -> scalar1]
  base[8] = fun_type1(base[2], base[0]);     // [scalar3 -> bool]
  base[9] = fun_type1(base[3], base[0]);     // [scalar1 -> bool]
  base[10] = fun_type1(base[0], base[0]);    // [bool -> bool]
  base[11] = fun_type1(base[10], base[0]);   // [[bool -> bool] -> bool]

  // some infinite types
  base[12] = new_uninterpreted_type(&types);
  base[13] = real_type(&types);
  base[14] = int_type(&types);
  base[15] = fun_type1(base[14], base[0]);          // [int -> bool]
  base[16] = fun_type2(base[0], base[0], base[14]); // [bool, bool -> int]

  // larger finite types
  base[17] = pair_type(base[1], base[1]);   // bv5 x bv5
  base[18] = bv_type(&types, 40);           // bv40

  // infinite domain, unit range
  base[19] = fun_type1(base[13], base[3]);  // [real -> scalar1]
}
Example #2
0
/*
 * Test2: elements of an uninterpreted type
 */
static void test2(void) {
  type_t tau;
  particle_t a, b, c;
  particle_t q[40], x;
  uint32_t n;

  printf("\n"
         "***********************\n"
	 "*       TEST 2        *\n"
         "***********************\n");

  tau = new_uninterpreted_type(&types);
  a = pstore_labeled_particle(&store, 100, tau);
  b = pstore_labeled_particle(&store, 102, tau);
  c = pstore_fresh_particle(&store, tau);

  printf("\nInitial objects of type tau!%"PRId32"\n", tau);
  print_particle_def(a);
  print_particle_def(b);
  print_particle_def(c);
  printf("\n");

  // Initial array: empty
  printf("Test array: ");
  print_particle_array(q, 0);
  printf("\n");

  // create new objects until that fails
  for (n = 0; n<40; n++) {
    x = get_distinct_particle(&store, tau, n, q);
    printf("New particle:");
    print_particle_def(x);
    q[n] = x;
  }

  printf("\nFinal set\n");
  print_particle_set(pstore_find_set_for_type(&store, tau));
  printf("\n\n");
}