void bv_minimizet::operator()(const minimization_listt &symbols) { // build bit-wise objective function prop_minimizet prop_minimize(boolbv); prop_minimize.set_message_handler(get_message_handler()); for(minimization_listt::const_iterator l_it=symbols.begin(); l_it!=symbols.end(); l_it++) { add_objective(prop_minimize, *l_it); } // now solve prop_minimize(); }
void counterexample_beautificationt::operator()( bv_cbmct &bv_cbmc, const symex_target_equationt &equation, const namespacet &ns) { // find failed property failed=get_failed_property(bv_cbmc, equation); // lock the failed assertion bv_cbmc.set_to(literal_exprt(failed->cond_literal), false); { bv_cbmc.status() << "Beautifying counterexample (guards)" << messaget::eom; // compute weights for guards typedef std::map<literalt, unsigned> guard_countt; guard_countt guard_count; for(symex_target_equationt::SSA_stepst::const_iterator it=equation.SSA_steps.begin(); it!=equation.SSA_steps.end(); it++) { if(it->is_assignment() && it->assignment_type!=symex_targett::assignment_typet::HIDDEN) { if(!it->guard_literal.is_constant()) guard_count[it->guard_literal]++; } // reached failed assertion? if(it==failed) break; } // give to propositional minimizer prop_minimizet prop_minimize(bv_cbmc); prop_minimize.set_message_handler(bv_cbmc.get_message_handler()); for(const auto &g : guard_count) prop_minimize.objective(g.first, g.second); // minimize prop_minimize(); } { bv_cbmc.status() << "Beautifying counterexample (values)" << messaget::eom; // get symbols we care about minimization_listt minimization_list; get_minimization_list(bv_cbmc, equation, minimization_list); // minimize bv_minimizet bv_minimize(bv_cbmc); bv_minimize.set_message_handler(bv_cbmc.get_message_handler()); bv_minimize(minimization_list); } }