Exemplo n.º 1
0
void safety_verify_configt::process(const candidatet &candidate)
{
  program=original_program;
  quantifiers.clear();
  const safety_programt &prog=program;
  const invariant_programt::const_invariant_loopst loops(prog.get_loops());
  assert(!loops.empty());
  const size_t offset(
      program.x0_choices.size() + loops.front()->skolem_choices.size());
  invariant_insert_constraint(quantifiers, program, create_safety_constraint,
      offset);
  safety_insert_candidate(program, candidate);
  program.gf.update();
}
Exemplo n.º 2
0
void safety_verify_configt::convert(counterexamplest &counterexamples,
    const goto_tracet &trace)
{
  counterexamples.push_back(counterexamplet());
  counterexamplet &new_ce=counterexamples.back();
  invariant_extract_counterexample(new_ce.x0, trace, program.x0_choices);
  counterexamplet::assignments_per_loopt &x=new_ce.x;
  // TODO: Implement for multiple loops (change constraint, instrumentation)
  x.push_back(counterexamplet::assignmentst());
  counterexamplet::assignmentst &ass=x.back();
  ass.clear();
  invariant_extract_counterexample(ass, trace, quantifiers);
  const safety_programt &prog=program;
  const invariant_programt::const_invariant_loopst loops(prog.get_loops());
  assert(!loops.empty());
  // TODO: Implement for multiple loops (change constraint, instrumentation)
  invariant_extract_counterexample(ass, trace, loops.front()->skolem_choices);
}
Exemplo n.º 3
0
void safety_learn_configt::process(const size_t max_solution_size)
{
  constraint_varst ce_vars;
  get_invariant_constraint_vars(ce_vars, original_program);
  const typet type(invariant_meta_type());  // XXX: Currently single data type
  const exprt zero(gen_zero(type));
  counterexamplet dummy_ce;
  dummy_ce.x.push_back(counterexamplet::assignmentst());
  counterexamplet::assignmentst &x=dummy_ce.x.front();
  for (const symbol_exprt &var : ce_vars)
    x.insert(std::make_pair(var.get_identifier(), zero));
  // TODO: Implement for multiple loops (change constraint, instrumentation)
  const safety_programt &prog=original_program;
  const invariant_programt::const_invariant_loopst loops=prog.get_loops();
  assert(!loops.empty());
  // XXX: We might have to handle skolem choices explicitly at some point
  for (const goto_programt::targett &skolem_choice : loops.front()->skolem_choices)
    x.insert(std::make_pair(get_affected_variable(*skolem_choice), zero));
  counterexamplet::assignmentst &x0=dummy_ce.x0;
  for (const goto_programt::targett &x0_choice : original_program.x0_choices)
    x0.insert(std::make_pair(get_affected_variable(*x0_choice), zero));
  counterexamplest empty(1, dummy_ce);
  process(empty, max_solution_size);
}