void path_searcht::check_assertion( statet &state, const namespacet &ns) { // keep statistics number_of_VCCs++; const goto_programt::instructiont &instruction= *state.get_instruction(); irep_idt property_name=instruction.location.get_property_id(); property_entryt &property_entry=property_map[property_name]; if(property_entry.status==FAIL) return; // already failed else if(property_entry.status==NOT_REACHED) property_entry.status=PASS; // well, for now! // the assertion in SSA exprt assertion= state.read(instruction.guard); if(assertion.is_true()) return; // no error, trivially // keep statistics number_of_VCCs_after_simplification++; status() << "Checking property " << property_name << eom; // take the time absolute_timet sat_start_time=current_time(); satcheckt satcheck; bv_pointerst bv_pointers(ns, satcheck); satcheck.set_message_handler(get_message_handler()); bv_pointers.set_message_handler(get_message_handler()); if(!state.check_assertion(bv_pointers)) { build_goto_trace(state, bv_pointers, property_entry.error_trace); property_entry.status=FAIL; number_of_failed_properties++; } sat_time+=current_time()-sat_start_time; }
bool path_searcht::is_feasible(statet &state) { status() << "Feasibility check" << eom; // take the time absolute_timet sat_start_time=current_time(); satcheckt satcheck; bv_pointerst bv_pointers(ns, satcheck); satcheck.set_message_handler(get_message_handler()); bv_pointers.set_message_handler(get_message_handler()); bool result=state.is_feasible(bv_pointers); sat_time+=current_time()-sat_start_time; return result; }
bool termination_baset::bmc( concrete_modelt &model, fine_timet &modelchecker_time, fine_timet &unsafe_time, fine_timet &safe_time) { bool res=false; #if 0 std::ofstream out("model"); model.goto_functions.output(ns, out); out.close(); #endif fine_timet before=current_time(); symex_target_equationt equation(ns); custom_symext symex(ns, shadow_context, equation); satcheckt satcheck; bv_pointerst bv_pointers(ns, satcheck); symex.options.set_option("assertions", true); satcheck.set_verbosity(2); satcheck.set_message_handler(get_message_handler()); bv_pointers.set_verbosity(2); bv_pointers.set_message_handler(get_message_handler()); try { symex(model.goto_functions); bv_pointerst::resultt satres; if(!symex.has_remaining_claims()) satres=bv_pointerst::D_UNSATISFIABLE; else { equation.convert(bv_pointers); satres=bv_pointers.dec_solve(); } modelchecker_time+=current_time()-before; switch(satres) { case bv_pointerst::D_TAUTOLOGY: case bv_pointerst::D_SATISFIABLE: unsafe_time+=current_time()-before; res=false; break; case bv_pointerst::D_UNSATISFIABLE: safe_time+=current_time()-before; res=true; break; default: throw("SAT Solver error."); break; } } catch (const std::bad_alloc &s) { status(std::string("BMC Exception: Memory exhausted")); } catch (const std::string &s) { status(std::string("BMC Exception: ") + s); } catch (const char *s) { status(std::string("BMC Exception: ") + s); } catch (unsigned u) { status(std::string("BMC Exception: ") + i2string(u)); } return res; }