}
// Get the name from a symbol (char *). It's an error if kind != SYMBOL
- const char * const ASTNode::GetName() const
+ const char * /**const**/ ASTNode::GetName() const
{
if (GetKind() != SYMBOL)
FatalError("GetName: Called GetName on a non-symbol: ", *this);
}
// Get the value of bvconst from a bvconst. It's an error if kind != BVCONST
- CBV const ASTNode::GetBVConst() const
+ // Treat the result as const (the compiler can't enforce it).
+ CBV /**const**/ ASTNode::GetBVConst() const
{
if (GetKind() != BVCONST)
FatalError("GetBVConst: non bitvector-constant: ", *this);
case SYMBOL:
return true;
case EQ:
- case NEQ:
if (!(n[0].GetValueWidth() == n[1].GetValueWidth() && n[0].GetIndexWidth() == n[1].GetIndexWidth()))
{
cerr << "valuewidth of lhs of EQ: " << n[0].GetValueWidth() << endl;
bool isAtomic(Kind kind)
{
if (TRUE == kind || FALSE == kind ||
- EQ == kind || NEQ == kind ||
+ EQ == kind ||
BVLT == kind || BVLE == kind ||
BVGT == kind || BVGE == kind ||
BVSLT == kind || BVSLE == kind ||
#include "ASTUtil.h"
#include "ASTKind.h"
#include <stdint.h>
-#include "../sat/core/Solver.h"
-//#include "../sat/simp/SimpSolver.h"
-//#include "../sat/unsound/UnsoundSimpSolver.h"
-#include "../sat/core/SolverTypes.h"
#include <stdlib.h>
#include "../constantbv/constantbv.h"
+namespace MINISAT
+{
+ class Solver;
+ typedef int Var;
+}
+
/*****************************************************************************
* LIST OF CLASSES DECLARED IN THIS FILE:
*
;
// Get the name from a symbol (char *). It's an error if kind != SYMBOL
- const char * const GetName() const;
+ // The result should be treated as const.
+ const char * /**const**/ GetName() const;
//Get the BVCONST value
- const CBV GetBVConst() const;
+ // The result should be treated as const.
+ /*const*/ CBV GetBVConst() const;
/*ASTNode is of type BV <==> ((indexwidth=0)&&(valuewidth>0))
*
types GetType(void) const;
// Hash is pointer value of _int_node_ptr.
- const size_t Hash() const
+ /* const */ size_t Hash() const
{
return (size_t) _int_node_ptr;
//return GetNodeNum();
// table entry so it can be deleted without looking it up again.
void DecRef();
- virtual const Kind GetKind() const
+ // Treat the result as const pleases
+ virtual /**const**/ Kind GetKind() const
{
return _kind;
}
return (strcmp(sym1._name, sym2._name) == 0);
}
- const char * const GetName() const
+ const char * /**const**/ GetName() const
{
return _name;
}
//looksup a MINISAT var from the minisat-var memo-table. if none
//exists, then creates one.
- const MINISAT::Var LookupOrCreateSATVar(MINISAT::Solver& S, const ASTNode& n);
+ // Treat the result as const.
+ /**const**/ MINISAT::Var LookupOrCreateSATVar(MINISAT::Solver& S, const ASTNode& n);
// Memo table for CheckBBandCNF debugging function
ASTNodeMap CheckBBandCNFMemo;
BVSGT 2 2 Form
BVSGE 2 2 Form
EQ 2 2 Form
-NEQ 2 2 Form
FALSE 0 0 Form
TRUE 0 0 Form
NOT 1 1 Form
break;
}
- case NEQ:
- {
- ASTNode bbkid = BBForm(CreateNode(EQ, form.GetChildren()));
- result = CreateSimpNot(bbkid);
- break;
- }
case EQ:
{
#include "AST.h"
#include "../simplifier/bvsolver.h"
+#include "../sat/sat.h"
namespace BEEV
{
result = true;
break;
}
- case NEQ:
- {
- result = true;
- break;
- }
default:
{
result = false;
#include "AST.h"
#include "ASTUtil.h"
#include "../simplifier/bvsolver.h"
-#include <math.h>
+#include <cmath>
+#include "../sat/sat.h"
namespace BEEV
{
* lookup or create new MINISAT Vars from the global MAP
* _ASTNode_to_SATVar.
*/
- const MINISAT::Var BeevMgr::LookupOrCreateSATVar(MINISAT::Solver& newS, const ASTNode& n)
+ /**const**/ MINISAT::Var BeevMgr::LookupOrCreateSATVar(MINISAT::Solver& newS, const ASTNode& n)
{
ASTtoSATMap::iterator it;
MINISAT::Var v;
output = ASTFalse;
break;
case EQ:
- case NEQ:
case BVLT:
case BVLE:
case BVGT:
#include "AST.h"
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cassert>
+
namespace BEEV
{
case BVSLE:
case BVSGT:
case BVSGE:
- case NEQ:
{
ASTVec c;
c.push_back(TransformTerm(simpleForm[0]));
#include "../AST.h"
#include "AssortedPrinters.h"
#include "printers.h"
+#include "../../sat/sat.h"
+
+// to get the PRIu64 macro from inttypes, this needs to be defined.
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+#undef __STDC_FORMAT_MACROS
namespace BEEV
{
return;
double cpu_time = MINISAT::cpuTime();
uint64_t mem_used = MINISAT::memUsed();
- reportf("restarts : %llu\n", s.starts);
- reportf("conflicts : %llu (%.0f /sec)\n", s.conflicts , s.conflicts /cpu_time);
- reportf("decisions : %llu (%.0f /sec)\n", s.decisions , s.decisions /cpu_time);
- reportf("propagations : %llu (%.0f /sec)\n", s.propagations, s.propagations/cpu_time);
- reportf("conflict literals : %llu (%4.2f %% deleted)\n", s.tot_literals,
+ reportf("restarts : %"PRIu64"\n", s.starts);
+ reportf("conflicts : %"PRIu64" (%.0f /sec)\n", s.conflicts , s.conflicts /cpu_time);
+ reportf("decisions : %"PRIu64" (%.0f /sec)\n", s.decisions , s.decisions /cpu_time);
+ reportf("propagations : %"PRIu64" (%.0f /sec)\n", s.propagations, s.propagations/cpu_time);
+ reportf("conflict literals : %"PRIu64" (%4.2f %% deleted)\n", s.tot_literals,
(s.max_literals - s.tot_literals)*100 / (double)s.max_literals);
if (mem_used != 0)
reportf("Memory used : %.2f MB\n", mem_used / 1048576.0);
#include "printers.h"
+#include <cassert>
namespace printer
{
}
break;
- case NEQ:
- C_Print1(os, c[0], indentation, letize);
- os << " != ";
- C_Print1(os, c[1], indentation, letize);
- os << endl;
- break;
case AND:
case OR:
case NAND:
PL_Print1(os, c[1], indentation, letize);
os << endl;
break;
- case NEQ:
- PL_Print1(os, c[0], indentation, letize);
- os << " /= ";
- PL_Print1(os, c[1], indentation, letize);
- os << endl;
- break;
case AND:
case OR:
case NAND:
#include "printers.h"
+#include <cassert>
namespace printer
{
#include "../AST/AST.h"
#include "../AST/ASTUtil.h"
+#include <cassert>
+
namespace BEEV
{
else
OutputNode = ASTFalse;
break;
- case NEQ:
- if (!CONSTANTBV::BitVector_equal(tmp0, tmp1))
- OutputNode = ASTTrue;
- else
- OutputNode = ASTFalse;
- break;
case BVLT:
if (-1 == CONSTANTBV::BitVector_Lexicompare(tmp0, tmp1))
OutputNode = ASTTrue;
}
| Expr NEQ_TOK Expr
{
- BEEV::ASTNode * n = new BEEV::ASTNode(BEEV::globalBeevMgr_for_parser->CreateNode(BEEV::NEQ, *$1, *$3));
+ BEEV::ASTNode * n = new BEEV::ASTNode(BEEV::globalBeevMgr_for_parser->CreateNode(BEEV::NOT, BEEV::globalBeevMgr_for_parser->CreateNode(BEEV::EQ, *$1, *$3)));
BEEV::globalBeevMgr_for_parser->BVTypeCheck(*n);
$$ = n;
delete $1;
for(BEEV::ASTVec::const_iterator it=terms.begin(),itend=terms.end();
it!=itend; it++) {
for(ASTVec::const_iterator it2=it+1; it2!=itend; it2++) {
- BEEV::ASTNode * n = new BEEV::ASTNode(BEEV::globalBeevMgr_for_parser->CreateNode(BEEV::NEQ, *it, *it2));
+ BEEV::ASTNode * n = new BEEV::ASTNode(BEEV::globalBeevMgr_for_parser->CreateNode(BEEV::NOT, BEEV::globalBeevMgr_for_parser->CreateNode(BEEV::EQ, *it, *it2)));
globalBeevMgr_for_parser->BVTypeCheck(*n);
#include "../AST/AST.h"
#include "../AST/ASTUtil.h"
+#include <cassert>
+
namespace BEEV
{
output = pushNeg ? CreateNode(NOT, output) : output;
break;
}
- case NEQ:
- {
- output = CreateSimplifiedEQ(left, right);
- output = LhsMinusRhs(output);
- if (output == ASTTrue)
- output = pushNeg ? ASTTrue : ASTFalse;
- else if (output == ASTFalse)
- output = pushNeg ? ASTFalse : ASTTrue;
- else
- output = pushNeg ? output : CreateNode(NOT, output);
- break;
- }
case BVLT:
case BVLE:
case BVGT: