Ejemplo n.º 1
0
literalt smt1_propt::land(literalt a, literalt b)
{
  if(a==const_literal(true))
    return b;
  if(b==const_literal(true))
    return a;
  if(a==const_literal(false))
    return const_literal(false);
  if(b==const_literal(false))
    return const_literal(false);
  if(a==b)
    return a;

  out << "\n";

  literalt l=new_variable();

  out << ":assumption ; land" << "\n";
  out << " (iff " << smt1_literal(l) << " (and";
  out << " " << smt1_literal(a);
  out << " " << smt1_literal(b);
  out << "))" << "\n";

  return l;
}
Ejemplo n.º 2
0
literalt smt1_propt::lselect(literalt a, literalt b, literalt c)
{
  if(a==const_literal(true))
    return b;
  if(a==const_literal(false))
    return c;
  if(b==c)
    return b;

  if(a==const_literal(false))
    return b;
  if(b==const_literal(false))
    return a;
  if(a==const_literal(true))
    return !b;
  if(b==const_literal(true))
    return !a;

  out << "\n";

  literalt l=new_variable();

  out << ":assumption ; lselect" << "\n";
  out << " (iff " << smt1_literal(l) << "(if_then_else "
      << smt1_literal(a) << " " << smt1_literal(b) << " "
      << smt1_literal(c) << ")" << "\n";

  return l;
}
Ejemplo n.º 3
0
literalt smt1_propt::land(const bvt &bv)
{
  out << std::endl;

  literalt l=new_variable();

  out << ":assumption ; land" << std::endl;
  out << " (iff " << smt1_literal(l) << " (and";
  
  forall_literals(it, bv)
    out << " " << smt1_literal(*it);

  out << "))" << std::endl;

  return l;
}
Ejemplo n.º 4
0
literalt smt1_propt::lor(const bvt &bv)
{
  out << "\n";

  literalt l=new_variable();

  out << ":assumption ; lor" << "\n";
  out << " (iff " << smt1_literal(l) << " (or";

  forall_literals(it, bv)
    out << " " << smt1_literal(*it);

  out << "))" << "\n";

  return l;
}
Ejemplo n.º 5
0
literalt smt1_propt::new_variable()
{
  literalt l;
  l.set(_no_variables, false);
  _no_variables++;
  
  out << ":extrapreds((" << smt1_literal(l) << "))" << std::endl;

  return l;
}
Ejemplo n.º 6
0
literalt smt1_propt::lxor(literalt a, literalt b)
{
  if(a==const_literal(false)) return b;
  if(b==const_literal(false)) return a;
  if(a==const_literal(true)) return lnot(b);
  if(b==const_literal(true)) return lnot(a);

  out << std::endl;

  literalt l=new_variable();

  out << ":assumption ; lxor" << std::endl;
  out << " (iff " << smt1_literal(l) << " (xor";
  out << " " << smt1_literal(a);
  out << " " << smt1_literal(b);
  out << "))" << std::endl;

  return l;
}
Ejemplo n.º 7
0
literalt smt1_propt::lxor(const bvt &bv)
{
  if(bv.size()==0) return const_literal(false);
  if(bv.size()==1) return bv[0];

  out << std::endl;

  literalt l=new_variable();

  out << ":assumption ; lxor" << std::endl;
  out << " (iff " << smt1_literal(l) << " (xor";

  forall_literals(it, bv)
    out << " " << smt1_literal(*it);

  out << "))" << std::endl;

  return l;
}
Ejemplo n.º 8
0
void smt1_propt::lcnf(const bvt &bv)
{
  out << std::endl;
  out << ":assumption ; lcnf" << std::endl;
  out << " ";

  if(bv.empty())
    out << "false ; the empty clause";
  else if(bv.size()==1)
    out << smt1_literal(bv.front());
  else
  {
    out << "(or";
    
    for(bvt::const_iterator it=bv.begin(); it!=bv.end(); it++)
      out << " " << smt1_literal(*it);

    out << ")";
  }

  out << std::endl;
}