break;
default:
{
- if ((kind == AND || kind == OR|| kind == XOR) && n.Degree() != 2)
+ if ((kind == AND || kind == OR|| kind == XOR) && n.Degree() == 1)
{
- FatalError("Wrong number of arguments to operation (must be two).", n);
+ FatalError("Wrong number of arguments to operation (must be >1).", n);
}
// SMT-LIB only allows these functions to have two parameters.
- if ((BVPLUS == kind || kind == BVOR || kind == BVAND) && n.Degree() > 2)
+ if ((kind == AND || kind == OR|| kind == XOR || BVPLUS == kind || kind == BVOR || kind == BVAND) && n.Degree() > 2)
{
string close = "";
// Outputs in the SMTLIB format. If you want something that can be parsed by other tools call
// SMTLIB_PrintBack(). SMTLIB_Print() prints just an expression.
-// Wierdly is seems that only terms, not formulas can be LETized.
namespace printer
{
break;
default:
{
- if ((kind == AND || kind == OR|| kind == XOR) && n.Degree() != 2)
+ if ((kind == AND || kind == OR|| kind == XOR) && n.Degree() == 1)
{
- FatalError("Wrong number of arguments to operation (must be two).", n);
+ FatalError("Wrong number of arguments to operation (must be >1).", n);
}
// SMT-LIB only allows these functions to have two parameters.
- if ((BVPLUS == kind || kind == BVOR || kind == BVAND) && n.Degree() > 2)
+ if ((kind == AND || kind == OR|| kind == XOR || BVPLUS == kind || kind == BVOR || kind == BVAND) && n.Degree() > 2)
{
string close = "";
//pass 1: letize the node
{
ASTNodeSet PLPrintNodeSet;
- LetizeNode(n, PLPrintNodeSet);
+ LetizeNode(n, PLPrintNodeSet, smtlib1);
}
//pass 2:
return os;
}
- void LetizeNode(const ASTNode& n, ASTNodeSet& PLPrintNodeSet)
+ void LetizeNode(const ASTNode& n, ASTNodeSet& PLPrintNodeSet, bool smtlib1)
{
const Kind kind = n.GetKind();
//
//2. Letize its childNodes
PLPrintNodeSet.insert(ccc);
- LetizeNode(ccc, PLPrintNodeSet);
+ LetizeNode(ccc, PLPrintNodeSet, smtlib1);
}
else
{
//
//2. if no, then create a new var and add it to the
//2. NodeLetVarMap
- if (ccc.GetType() == BITVECTOR_TYPE && NodeLetVarMap.find(ccc)
+ if ((!smtlib1 || ccc.GetType() == BITVECTOR_TYPE) && NodeLetVarMap.find(ccc)
== NodeLetVarMap.end())
{
//Create a new symbol. Get some name. if it conflicts with a
string functionToSMTLIBName(const Kind k, bool smtlib1);
- void LetizeNode(const ASTNode& n, BEEV::ASTNodeSet& PLPrintNodeSet);
+ void LetizeNode(const ASTNode& n, BEEV::ASTNodeSet& PLPrintNodeSet, bool smtlib1);
ostream& SMTLIB_Print(ostream &os, const ASTNode n, const int indentation, void (*SMTLIB_Print1)(ostream&, const ASTNode , int , bool ), bool smtlib1);