Exemplo n.º 1
0
decision_proceduret::resultt smt1_dect::dec_solve()
{
  post_process();

  // this closes the SMT benchmark
  smt1_prop.finalize();
  temp_out.close();

  temp_result_filename=
    get_temporary_file("smt1_dec_result_", "");

  std::string command;

  switch(solver)
  {
  case CVC3:
    command = "cvc3 +model -lang smtlib -output-lang smtlib "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case BOOLECTOR:
    command = "boolector --smt "
            + temp_out_filename
            + " -fm --output "
            + temp_result_filename;
    break;

  case OPENSMT:
    command = "todo "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case YICES:
    command = "yices -smt -e "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case Z3:
    command = "z3 -m "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  default:
    assert(false);
  }

  #if defined(__LINUX__) || defined(__APPLE__)
  command+=" 2>&1";
  #endif

  system(command.c_str());

  std::ifstream in(temp_result_filename.c_str());

  switch(solver)
  {
  case BOOLECTOR:
    return read_result_boolector(in);

  case CVC3:
    return read_result_cvc3(in);

  case OPENSMT:
    return read_result_opensmt(in);

  case YICES:
    return read_result_yices(in);

  case Z3:
    return read_result_z3(in);

  default:
    assert(false);
  }
}
Exemplo n.º 2
0
decision_proceduret::resultt smt1_dect::dec_solve()
{
  // SMT1 is really not incremental
  assert(!dec_solve_was_called);
  dec_solve_was_called=true;

  post_process();

  // this closes the SMT benchmark
  smt1_prop.finalize();
  temp_out.close();

  temp_result_filename=
    get_temporary_file("smt1_dec_result_", "");

  std::string command;

  switch(solver)
  {
  case CVC3:
    command = "cvc3 +model -lang smtlib -output-lang smtlib "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case BOOLECTOR:
    // –rwl0 disables rewriting, which makes things slower,
    // but in return values for arrays appear
    command = "boolector -rwl0 --smt "
            + temp_out_filename
            + " -fm --output "
            + temp_result_filename;
    break;

  case OPENSMT:
    command = "todo "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case YICES:
    command = "yices -smt -e "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case MATHSAT:
    command = "mathsat -model -input=smt"
              " < "+temp_out_filename
            + " > "+temp_result_filename;
    break;

  case Z3:
    command = "z3 -m "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  default:
    assert(false);
  }

  #if defined(__LINUX__) || defined(__APPLE__)
  command+=" 2>&1";
  #endif

  system(command.c_str());

  std::ifstream in(temp_result_filename.c_str());

  switch(solver)
  {
  case BOOLECTOR:
    return read_result_boolector(in);

  case CVC3:
    return read_result_cvc3(in);

  case OPENSMT:
    return read_result_opensmt(in);

  case YICES:
    return read_result_yices(in);

  case MATHSAT:
    return read_result_mathsat(in);

  case Z3:
    return read_result_z3(in);

  default:
    assert(false);
  }
}
Exemplo n.º 3
0
decision_proceduret::resultt smt1_dect::dec_solve()
{
  // SMT1 is really not incremental
  assert(!dec_solve_was_called);
  dec_solve_was_called=true;

  // this closes the SMT benchmark
  write_footer();
  temp_out.close();

  temp_result_filename=
    get_temporary_file("smt1_dec_result_", "");

  std::string command;

  switch(solver)
  {
  case BOOLECTOR:
    // -rwl0 disables rewriting, which makes things slower,
    // but in return values for arrays appear
    // command = "boolector -rwl0 --smt "
    // Removed as not necessarily needed on newer versions
    command = "boolector --smt "
            + temp_out_filename
            + " --model --output "
            + temp_result_filename;
    break;

  case CVC3:
    command = "cvc3 +model -lang smtlib -output-lang smtlib "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case CVC4:
    command = "cvc4 -L smt1 "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case MATHSAT:
    command = "mathsat -model -input=smt"
              " < "+temp_out_filename
            + " > "+temp_result_filename;
    break;

  case OPENSMT:
    command = "opensmt "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case YICES:
    //    command = "yices -smt -e "   // Calling convention for older versions
    command = "yices-smt --full-model "  //  Calling for 2.2.1
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  case Z3:
    command = "z3 -smt "
            + temp_out_filename
            + " > "
            + temp_result_filename;
    break;

  default:
    assert(false);
  }

  #if defined(__linux__) || defined(__APPLE__)
  command+=" 2>&1";
  #endif

  int res=system(command.c_str());
  if(res<0)
  {
    error() << "error running SMT1 solver" << eom;
    return decision_proceduret::D_ERROR;
  }

  std::ifstream in(temp_result_filename.c_str());

  switch(solver)
  {
  case BOOLECTOR:
    return read_result_boolector(in);

  case CVC3:
    return read_result_cvc3(in);

  case CVC4:
    error() << "no support for CVC4 with SMT1, use SMT2 instead" << eom;
    return decision_proceduret::D_ERROR;

  case MATHSAT:
    return read_result_mathsat(in);

  case OPENSMT:
    return read_result_opensmt(in);

  case YICES:
    return read_result_yices(in);

  case Z3:
    return read_result_z3(in);

  case GENERIC:
  default:
    error() << "Generic solver can't solve" << eom;
    return decision_proceduret::D_ERROR;
  }
}