Example #1
0
std::unique_ptr<cbmc_solverst::solvert> cbmc_solverst::get_bv_refinement()
{
  std::unique_ptr<propt> prop=[this]() -> std::unique_ptr<propt>
  {
    // We offer the option to disable the SAT preprocessor
    if(options.get_bool_option("sat-preprocessor"))
    {
      no_beautification();
      return util_make_unique<satcheckt>();
    }
    return util_make_unique<satcheck_no_simplifiert>();
  }();

  prop->set_message_handler(get_message_handler());

  bv_refinementt::infot info;
  info.ns=&ns;
  info.prop=prop.get();
  info.ui=ui;

  // we allow setting some parameters
  if(options.get_bool_option("max-node-refinement"))
    info.max_node_refinement=
      options.get_unsigned_int_option("max-node-refinement");

  info.refine_arrays=options.get_bool_option("refine-arrays");
  info.refine_arithmetic=options.get_bool_option("refine-arithmetic");

  return util_make_unique<solvert>(
    util_make_unique<bv_refinementt>(info),
    std::move(prop));
}
Example #2
0
cbmc_solverst::solvert* cbmc_solverst::get_bv_refinement()
{
  propt *prop;

  // We offer the option to disable the SAT preprocessor
  if(options.get_bool_option("sat-preprocessor"))
  {
    no_beautification();
    prop=new satcheckt();
  }
  else
    prop=new satcheck_no_simplifiert();

  prop->set_message_handler(get_message_handler());

  bv_refinementt *bv_refinement=new bv_refinementt(ns, *prop);
  bv_refinement->set_ui(ui);

  // we allow setting some parameters
  if(options.get_option("max-node-refinement")!="")
    bv_refinement->max_node_refinement =
      options.get_unsigned_int_option("max-node-refinement");

  bv_refinement->do_array_refinement =
    options.get_bool_option("refine-arrays");
  bv_refinement->do_arithmetic_refinement =
    options.get_bool_option("refine-arithmetic");

  return new solvert(bv_refinement, prop);
}
Example #3
0
cbmc_solverst::solvert* cbmc_solverst::get_dimacs()
{
  no_beautification();
  no_incremental_check();

  dimacs_cnft *prop=new dimacs_cnft();
  prop->set_message_handler(get_message_handler());

  std::string filename=options.get_option("outfile");

  return new solvert(new cbmc_dimacst(ns, *prop, filename), prop);
}
Example #4
0
std::unique_ptr<cbmc_solverst::solvert> cbmc_solverst::get_dimacs()
{
  no_beautification();
  no_incremental_check();

  auto prop=util_make_unique<dimacs_cnft>();
  prop->set_message_handler(get_message_handler());

  std::string filename=options.get_option("outfile");

  auto cbmc_dimacs=util_make_unique<cbmc_dimacst>(ns, *prop, filename);
  return util_make_unique<solvert>(std::move(cbmc_dimacs), std::move(prop));
}
Example #5
0
std::unique_ptr<cbmc_solverst::solvert> cbmc_solverst::get_smt2(
  smt2_dect::solvert solver)
{
  no_beautification();

  const std::string &filename=options.get_option("outfile");

  if(filename=="")
  {
    if(solver==smt2_dect::solvert::GENERIC)
    {
      error() << "please use --outfile" << eom;
      throw 0;
    }

    auto smt2_dec=
      util_make_unique<smt2_dect>(
        ns,
        "cbmc",
        "Generated by CBMC " CBMC_VERSION,
        "QF_AUFBV",
        solver);

    if(options.get_bool_option("fpa"))
      smt2_dec->use_FPA_theory=true;

    return util_make_unique<solvert>(std::move(smt2_dec));
  }
  else if(filename=="-")
  {
    auto smt2_conv=
      util_make_unique<smt2_convt>(
        ns,
        "cbmc",
        "Generated by CBMC " CBMC_VERSION,
        "QF_AUFBV",
        solver,
        std::cout);

    if(options.get_bool_option("fpa"))
      smt2_conv->use_FPA_theory=true;

    smt2_conv->set_message_handler(get_message_handler());

    return util_make_unique<solvert>(std::move(smt2_conv));
  }
  else
  {
    #ifdef _MSC_VER
    auto out=util_make_unique<std::ofstream>(widen(filename));
    #else
    auto out=util_make_unique<std::ofstream>(filename);
    #endif

    if(!*out)
    {
      error() << "failed to open " << filename << eom;
      throw 0;
    }

    auto smt2_conv=
      util_make_unique<smt2_convt>(
        ns,
        "cbmc",
        "Generated by CBMC " CBMC_VERSION,
        "QF_AUFBV",
        solver,
        *out);

    if(options.get_bool_option("fpa"))
      smt2_conv->use_FPA_theory=true;

    smt2_conv->set_message_handler(get_message_handler());

    return util_make_unique<solvert>(std::move(smt2_conv), std::move(out));
  }
}
Example #6
0
cbmc_solverst::solvert* cbmc_solverst::get_smt2(smt2_dect::solvert solver)
{
  no_beautification();

  const std::string &filename=options.get_option("outfile");

  if(filename=="")
  {
    if(solver==smt2_dect::solvert::GENERIC)
    {
      error() << "please use --outfile" << eom;
      throw 0;
    }

    smt2_dect *smt2_dec=
      new smt2_dect(
        ns,
        "cbmc",
        "Generated by CBMC " CBMC_VERSION,
        "QF_AUFBV",
        solver);

    if(options.get_bool_option("fpa"))
      smt2_dec->use_FPA_theory=true;

    return new solvert(smt2_dec);
  }
  else if(filename=="-")
  {
    smt2_convt *smt2_conv=
      new smt2_convt(
        ns,
        "cbmc",
        "Generated by CBMC " CBMC_VERSION,
        "QF_AUFBV",
        solver,
        std::cout);

    if(options.get_bool_option("fpa"))
      smt2_conv->use_FPA_theory=true;

    smt2_conv->set_message_handler(get_message_handler());

    return new solvert(smt2_conv);
  }
  else
  {
    #ifdef _MSC_VER
    std::ofstream *out=new std::ofstream(widen(filename));
    #else
    std::ofstream *out=new std::ofstream(filename);
    #endif

    if(!*out)
    {
      error() << "failed to open " << filename << eom;
      throw 0;
    }

    smt2_convt *smt2_conv=
      new smt2_convt(
        ns,
        "cbmc",
        "Generated by CBMC " CBMC_VERSION,
        "QF_AUFBV",
        solver,
        *out);

    if(options.get_bool_option("fpa"))
      smt2_conv->use_FPA_theory=true;

    smt2_conv->set_message_handler(get_message_handler());

    return new solvert(smt2_conv, out);
  }
}