/* * Add t to the union-find structure: * - t must be uninterpreted * - this creates a new singleton class with t as root * and rank[t] is 0. */ static void partition_add(intern_tbl_t *tbl, term_t t) { type_t tau; assert(term_kind(tbl->terms, t) == UNINTERPRETED_TERM && ai32_read(&tbl->map, index_of(t)) == NULL_MAP); tau = term_type(tbl->terms, t); ai32_write(&tbl->type, index_of(t), tau); }
/* * Same thing but mark t as frozen */ static void partition_add_frozen(intern_tbl_t *tbl, term_t t) { type_t tau; assert(ai32_read(&tbl->map, index_of(t)) == NULL_MAP); tau = term_type(tbl->terms, t); ai32_write(&tbl->type, index_of(t), tau); au8_write(&tbl->rank, index_of(t), 255); }
/* * Add term t to the store: * - t is added as last element of store->terms[i] where i = index for type of t */ static void type_store_add_term(type_store_t *store, term_t t) { uint32_t i; type_t tau; assert(good_term(__yices_globals.terms, t)); tau = term_type(__yices_globals.terms, t); i = type_store_get_type(store, tau); ivector_push(store->terms + i, t); }
/* * Type of r's class (return the type of r if r is not in tbl) * - r must be a root (it may have negative polarity) */ type_t intern_tbl_type_of_root(intern_tbl_t *tbl, term_t r) { type_t tau; assert(intern_tbl_is_root(tbl, r)); tau = ai32_read(&tbl->type, index_of(r)); if (tau == NULL_TYPE) { tau = term_type(tbl->terms, r); } return tau; }
inline uint32_t term_type(const std::string &s){ return term_type(*(uint64_t *)s.data()); }