* Previously the "if_then_else" function not the "ite" function handled "then" and "else"'s which were propositional. Now the "ite" does both.
* Remove deprecation warnings.. Will fix later.
* Fix the BVTypecheck for ITEs.
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@81
e59a4935-1847-0410-ae03-
e826735625c1
case SYMBOL:
return;
case ITE:
- if(BOOLEAN_TYPE != n[0].GetType() &&
- BITVECTOR_TYPE != n[1].GetType() &&
- BITVECTOR_TYPE != n[2].GetType())
+ if (BOOLEAN_TYPE != n[0].GetType() || (n[1].GetType() != n[2].GetType()))
FatalError("BVTypeCheck: The term t does not typecheck, where t = \n",n);
if(n[1].GetValueWidth() != n[2].GetValueWidth())
FatalError("BVTypeCheck: length of THENbranch != length of ELSEbranch in the term t = \n",n);
ASTNode CreateSimplifiedEQ(const ASTNode& t1, const ASTNode& t2);
ASTNode ITEOpt_InEqs(const ASTNode& in1);
ASTNode CreateSimplifiedTermITE(const ASTNode& t1, const ASTNode& t2, const ASTNode& t3);
+ ASTNode CreateSimplifiedFormulaITE(const ASTNode& in0, const ASTNode& in1, const ASTNode& in2);
ASTNode CreateSimplifiedINEQ(Kind k, const ASTNode& a0, const ASTNode& a1, bool pushNeg);
ASTNode SimplifyNotFormula(const ASTNode& a, bool pushNeg);
ASTNode SimplifyAndOrFormula(const ASTNode& a, bool pushNeg);
#OPTIMIZE = -g # Debugging
OPTIMIZE = -O3 # Maximum optimization
-CFLAGS_BASE = $(OPTIMIZE) $(OPTIONS1) $(OPTIONS2)
+CFLAGS_BASE = $(OPTIMIZE) $(OPTIONS1) $(OPTIONS2)
# You can compile using make STATIC=true to compile a statically linked executable
# Note that you should execute liblinks.sh first.
ifdef STATIC
CFLAGS = $(CFLAGS_BASE)
endif
-CXXFLAGS = $(CFLAGS) -Wall -DEXT_HASH_MAP
+CXXFLAGS = $(CFLAGS) -Wall -DEXT_HASH_MAP -Wno-deprecated
#CXXFLAGS = $(CFLAGS) -Wall -DTR1_UNORDERED_MAP
#CXXFLAGS = $(CFLAGS) -Wall
#LDFLAGS= -lstdc++
"not" { return NOT_TOK; }
"implies" { return IMPLIES_TOK; }
"ite" { return ITE_TOK;}
-"if_then_else" { return IF_THEN_ELSE_TOK; }
"and" { return AND_TOK; }
"or" { return OR_TOK; }
"xor" { return XOR_TOK; }
%token NOT_TOK
%token IMPLIES_TOK
%token ITE_TOK
-%token IF_THEN_ELSE_TOK
%token AND_TOK
%token OR_TOK
%token XOR_TOK
delete $3;
delete $4;
}
- | LPAREN_TOK IF_THEN_ELSE_TOK an_formula an_formula an_formula RPAREN_TOK
+ | LPAREN_TOK ITE_TOK an_formula an_formula an_formula RPAREN_TOK
{
- $$ = new BEEV::ASTNode(BEEV::globalBeevMgr_for_parser->CreateNode(BEEV::ITE, *$3, *$4, *$5));
+ $$ = new BEEV::ASTNode(BEEV::globalBeevMgr_for_parser->CreateSimplifiedFormulaITE(*$3, *$4, *$5));
delete $3;
delete $4;
delete $5;
return CreateTerm(ITE,t1.GetValueWidth(),t0,t1,t2);
}
+ASTNode BeevMgr::CreateSimplifiedFormulaITE(const ASTNode& in0, const ASTNode& in1, const ASTNode& in2) {
+ ASTNode t0 = in0;
+ ASTNode t1 = in1;
+ ASTNode t2 = in2;
+ CountersAndStats("CreateSimplifiedFormulaITE");
+
+ if (optimize) {
+ if (t0 == ASTTrue)
+ return t1;
+ if (t0 == ASTFalse)
+ return t2;
+ if (t1 == t2)
+ return t1;
+ if (CheckAlwaysTrueFormMap(t0)) {
+ return t1;
+ }
+ if (CheckAlwaysTrueFormMap(CreateNode(NOT, t0)) || (NOT == t0.GetKind() && CheckAlwaysTrueFormMap(t0[0]))) {
+ return t2;
+ }
+ }
+ ASTNode result = CreateNode(ITE, t0, t1, t2);
+ BVTypeCheck(result);
+ return result;
+}
+
+
ASTNode BeevMgr::SimplifyAndOrFormula(const ASTNode& a, bool pushNeg) {
ASTNode output;
//cerr << "input:\n" << a << endl;