void functionst::add_function_constraints(const function_infot &info) { // Do Ackermann's function reduction. // This is quadratic, slow, and needs to be modernized. for(std::set<function_application_exprt>::const_iterator it1=info.applications.begin(); it1!=info.applications.end(); it1++) { for(std::set<function_application_exprt>::const_iterator it2=info.applications.begin(); it2!=it1; it2++) { exprt arguments_equal_expr= arguments_equal(it1->arguments(), it2->arguments()); implies_exprt implication(arguments_equal_expr, equal_exprt(*it1, *it2)); prop_conv.set_to_true(implication); } } }
exprt ranking_synthesis_qbf_bitwiset::instantiate(void) { find_largest_constant(body.body_relation); binary_relation_exprt implication(ID_implies); implication.lhs() = body.body_relation; // that's R(x,x') implication.rhs() = (function_class==F_AFFINE) ? instantiate_affine() : (function_class==F_DISJUNCTIVE) ? instantiate_disjunctive() : (function_class==F_CONJUNCTIVE) ? instantiate_conjunctive() : (function_class==F_PROJECTIONS) ? instantiate_projections() : instantiate_nothing(); // save the relation for later rank_relation = implication.rhs(); return implication; }
void symex_target_equationt::convert_assertions( prop_convt &prop_conv) { // we find out if there is only _one_ assertion, // which allows for a simpler formula unsigned number_of_assertions=count_assertions(); if(number_of_assertions==0) return; if(number_of_assertions==1) { for(auto & it : SSA_steps) { if(it.is_assert()) { prop_conv.set_to_false(it.cond_expr); it.cond_literal=const_literal(false); return; // prevent further assumptions! } else if(it.is_assume()) prop_conv.set_to_true(it.cond_expr); } assert(false); // unreachable } // We do (NOT a1) OR (NOT a2) ... // where the a's are the assertions or_exprt::operandst disjuncts; disjuncts.reserve(number_of_assertions); exprt assumption=true_exprt(); for(auto & it : SSA_steps) { if(it.is_assert()) { implies_exprt implication( assumption, it.cond_expr); // do the conversion it.cond_literal=prop_conv.convert(implication); // store disjunct disjuncts.push_back(literal_exprt(!it.cond_literal)); } else if(it.is_assume()) { // the assumptions have been converted before // avoid deep nesting of ID_and expressions if(assumption.id()==ID_and) assumption.copy_to_operands(literal_exprt(it.cond_literal)); else assumption= and_exprt(assumption, literal_exprt(it.cond_literal)); } } // the below is 'true' if there are no assertions prop_conv.set_to_true(disjunction(disjuncts)); }