// -*- c++ -*-
/********************************************************************
- * AUTHORS: Vijay Ganesh, David L. Dill
+ * AUTHORS: Vijay Ganesh
*
* BEGIN DATE: November, 2005
*
//'value' for the same 'key'
(*ParamToCurrentValMap)[parameter] = CreateBVConst(32,paramCurrentValue);
} //end of While
- }
+ } //end of recursion FORs
ASTVec forloopFormulaVector;
//Expand the leaf level FOR-construct completely
//Check the currentformula against the model, and add it to the
//SAT solver if it is false against the model
- if(ASTFalse == ComputeFormulaUsingModel(currentFormula)) {
- forloopFormulaVector.push_back(currentFormula);
- ASTNode forloopFormulas =
- (forloopFormulaVector.size() != 1) ?
- CreateNode(AND, forloopFormulaVector) : forloopFormulaVector[0];
-
- SOLVER_RETURN_TYPE result =
- CallSAT_ResultCheck(SatSolver, forloopFormulas, original_input);
- if(result != SOLVER_UNDECIDED)
- {
- return result;
- }
- }
+ if(ASTFalse == ComputeFormulaUsingModel(currentFormula))
+ {
+ forloopFormulaVector.push_back(currentFormula);
+ ASTNode forloopFormulas =
+ (forloopFormulaVector.size() != 1) ?
+ CreateNode(AND, forloopFormulaVector) : forloopFormulaVector[0];
+
+ SOLVER_RETURN_TYPE result =
+ CallSAT_ResultCheck(SatSolver, forloopFormulas, original_input);
+ if(result != SOLVER_UNDECIDED)
+ {
+ return result;
+ }
+ }
//Update ParamToCurrentValMap with parameter and its current
//value
//FIXME: Possible leak since I am not freeing the previous
//'value' for the same 'key'
(*ParamToCurrentValMap)[parameter] = CreateBVConst(32,paramCurrentValue);
- }
+ } //end of expanding the FOR loop
+
return SOLVER_UNDECIDED;
} //end of the SATBased_FiniteLoop_Refinement()
clean:
rm -rf *.o *~ bbtest asttest cnftest *.a ASTKind.h ASTKind.cpp .#*
- rm -rf printer/*.o
+ rm -rf printer/*.o printer/*~
depend:
makedepend -Y -- $(CFLAGS) -- $(SRCS)
* LICENSE: Please view LICENSE file in the home dir of this Program
********************************************************************/
// -*- c++ -*-
+
#include "../AST.h"
#include "AssortedPrinters.h"
#include "printers.h"
// to get the PRIu64 macro from inttypes, this needs to be defined.
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
-#undef __STDC_FORMAT_MACROS
+//#undef __STDC_FORMAT_MACROS
namespace BEEV
{
{
os << "ASSERT( ";
f.PL_Print(os,0);
- os << " = ";
+ if(BOOLEAN_TYPE == f.GetType())
+ {
+ os << "<=>";
+ }
+ else
+ {
+ os << " = ";
+ }
if (BITVECTOR_TYPE == se.GetType())
{
TermToConstTermUsingModel(se, false).PL_Print(os, 0);
// -*- c++ -*-
/********************************************************************
- * AUTHORS: Vijay Ganesh, David L. Dill
+ * AUTHORS: Vijay Ganesh
*
* BEGIN DATE: November, 2005
*
+/********************************************************************
+ * AUTHORS: Vijay Ganesh
+ *
+ * BEGIN DATE: November, 2005
+ *
+ * LICENSE: Please view LICENSE file in the home dir of this Program
+ ********************************************************************/
+// -*- c++ -*-
+
#include "printers.h"
#include <cassert>
+/********************************************************************
+ * AUTHORS: Vijay Ganesh
+ *
+ * BEGIN DATE: November, 2005
+ *
+ * LICENSE: Please view LICENSE file in the home dir of this Program
+ ********************************************************************/
+// -*- c++ -*-
+
#include "printers.h"
namespace printer
+// -*- c++ -*-
+/********************************************************************
+ * AUTHORS: Vijay Ganesh
+ *
+ * BEGIN DATE: November, 2005
+ *
+ * LICENSE: Please view LICENSE file in the home dir of this Program
+ ********************************************************************/
+
#include "printers.h"
namespace printer
PL_Print1(os, c[2], indentation, letize);
os << endl << "ENDIF";
break;
+ case FOR:
+ os << "FOR(";
+ PL_Print1(os, c[0], indentation, letize);
+ os << ";";
+ PL_Print1(os, c[1], indentation, letize);
+ os << ";";
+ PL_Print1(os, c[2], indentation, letize);
+ os << ";";
+ PL_Print1(os, c[3], indentation, letize);
+ os << "){ \n";
+ PL_Print1(os, c[4], indentation, letize);
+ os << "} \n";
+ break;
case BVLT:
case BVLE:
case BVGT:
+/********************************************************************
+ * AUTHORS: Vijay Ganesh
+ *
+ * BEGIN DATE: November, 2005
+ *
+ * LICENSE: Please view LICENSE file in the home dir of this Program
+ ********************************************************************/
+// -*- c++ -*-
+
#include "printers.h"
#include <cassert>
+/********************************************************************
+ * AUTHORS: Vijay Ganesh
+ *
+ * BEGIN DATE: November, 2005
+ *
+ * LICENSE: Please view LICENSE file in the home dir of this Program
+ ********************************************************************/
+// -*- c++ -*-
+
#include "printers.h"
/*
+/********************************************************************
+ * AUTHORS: Vijay Ganesh
+ *
+ * BEGIN DATE: November, 2005
+ *
+ * LICENSE: Please view LICENSE file in the home dir of this Program
+ ********************************************************************/
+// -*- c++ -*-
+
#ifndef PRINTERS_H_
#define PRINTERS_H_
delete $1;
delete $3;
}
- | FOR_TOK '(' Formula ';' Formula ';' Formula ')' '{' Formula '}'
+ | FOR_TOK '(' TERMID_TOK ';' BVCONST_TOK ';' BVCONST_TOK ';' BVCONST_TOK ')' '{' Formula '}'
{
//Allows a compact representation of
- //parameterized set of formulas
+ //parameterized set of formulas (bounded
+ //universal quantification)
//
- //$1 is the initialization (this is an AND of
- //formulas of the form var = constant)
+ //parameter name (a variable)
//
- //$2 is the constant bounding (this is an AND
- //of formulas of the form var < constant).
+ //initial value (BVCONST)
//
- //$3 is the increment (this is an AND of
- //formulas of the form var = var + constant).
+ //limit value (BVCONST)
//
- //$4 is the parameterized formula
+ //increment value (BVCONST)
+ //
+ //formula (it can be a nested forloop)
+ BEEV::ASTVec vec;
+ vec.push_back(*$3);
+ vec.push_back(*$5);
+ vec.push_back(*$7);
+ vec.push_back(*$9);
+ vec.push_back(*$12);
+ BEEV::ASTNode * n = new BEEV::ASTNode(BEEV::globalBeevMgr_for_parser->CreateNode(BEEV::FOR,vec));
+ BEEV::globalBeevMgr_for_parser->BVTypeCheck(*n);
+ $$ = n;
+ delete $3;
+ delete $5;
+ delete $7;
+ delete $9;
+ delete $12;
}
| NOT_TOK Formula
{