| OR_TOK
| XOR_TOK
| AND_TOK
- | JOIN_TOK
- | PRODUCT_TOK
- | JOIN_IMAGE_TOK
;
comparison[CVC4::Expr& f]
unsigned minusCount = 0;
}
/* Unary minus */
- : (MINUS_TOK { ++minusCount; })+ bvBinaryOpTerm[f]
+ : (MINUS_TOK { ++minusCount; })* bvBinaryOpTerm[f]
{ while(minusCount > 0) { --minusCount; f = MK_EXPR(CVC4::kind::UMINUS, f); } }
- | bvBinaryOpTerm[f]
;
/** Parses bitvectors. Starts with binary operators @, &, and |. */
/* BV neg */
: BVNEG_TOK bvNegTerm[f]
{ f = f.getType().isSet() ? MK_EXPR(CVC4::kind::COMPLEMENT, f) : MK_EXPR(CVC4::kind::BITVECTOR_NOT, f); }
- | relationTerm[f]
+ | relationBinopTerm[f]
;
-relationTerm[CVC4::Expr& f]
- /* relation terms */
- : TRANSPOSE_TOK relationTerm[f]
- { f = MK_EXPR(CVC4::kind::TRANSPOSE, f); }
- | TRANSCLOSURE_TOK relationTerm[f]
- { f = MK_EXPR(CVC4::kind::TCLOSURE, f); }
- | TUPLE_TOK LPAREN relationTerm[f] RPAREN
- { std::vector<Type> types;
- std::vector<Expr> args;
- args.push_back(f);
- types.push_back(f.getType());
- DatatypeType t = EXPR_MANAGER->mkTupleType(types);
- const Datatype& dt = t.getDatatype();
- args.insert( args.begin(), dt[0].getConstructor() );
- f = MK_EXPR(kind::APPLY_CONSTRUCTOR, args);
- }
- | IDEN_TOK relationTerm[f]
- { f = MK_EXPR(CVC4::kind::IDEN, f); }
- | postfixTerm[f]
+relationBinop[unsigned& op]
+@init {
+ op = LT(1)->getType(LT(1));
+}
+ : JOIN_TOK
+ | PRODUCT_TOK
+ | JOIN_IMAGE_TOK
+ ;
+
+relationBinopTerm[CVC4::Expr& f]
+@init {
+ std::vector<CVC4::Expr> expressions;
+ std::vector<unsigned> operators;
+ unsigned op;
+}
+ : postfixTerm[f] { expressions.push_back(f); }
+ ( relationBinop[op] postfixTerm[f] { operators.push_back(op); expressions.push_back(f); } )*
+ { f = createPrecedenceTree(PARSER_STATE, EXPR_MANAGER, expressions, operators); }
;
/**
std::string id;
Type t;
}
- : ( bvTerm[f]
+ : ( relationTerm[f]
( /* array select / bitvector extract */
LBRACKET
( formula[f2] { extract = false; }
}
)?
;
-
+
+relationTerm[CVC4::Expr& f]
+ /* relation terms */
+ : TRANSPOSE_TOK LPAREN formula[f] RPAREN
+ { f = MK_EXPR(CVC4::kind::TRANSPOSE, f); }
+ | TRANSCLOSURE_TOK LPAREN formula[f] RPAREN
+ { f = MK_EXPR(CVC4::kind::TCLOSURE, f); }
+ | TUPLE_TOK LPAREN formula[f] RPAREN
+ { std::vector<Type> types;
+ std::vector<Expr> args;
+ args.push_back(f);
+ types.push_back(f.getType());
+ DatatypeType t = EXPR_MANAGER->mkTupleType(types);
+ const Datatype& dt = t.getDatatype();
+ args.insert( args.begin(), dt[0].getConstructor() );
+ f = MK_EXPR(kind::APPLY_CONSTRUCTOR, args);
+ }
+ | IDEN_TOK LPAREN formula[f] RPAREN
+ { f = MK_EXPR(CVC4::kind::IDEN, f); }
+ | bvTerm[f]
+ ;
+
bvTerm[CVC4::Expr& f]
@init {
Expr f2;
a : IntPair;
ASSERT a = (1,4);
-ASSERT r = (((TRANSPOSE x) JOIN y) JOIN z);
+ASSERT r = ((TRANSPOSE(x) JOIN y) JOIN z);
ASSERT NOT (a IS_IN r);
CHECKSAT;
ASSERT (1, 2, 3, 4) IS_IN z;
ASSERT NOT ((5, 9) IS_IN x);
ASSERT (3, 8) IS_IN y;
-ASSERT y = (TCLOSURE x);
+ASSERT y = TCLOSURE(x);
ASSERT NOT ((1, 2) IS_IN y);
CHECKSAT;
ASSERT (b > (d -1));
ASSERT (b < (d+1));
%ASSERT (2,3) IS_IN ((x JOIN x) JOIN x);
-%ASSERT NOT (2, 3) IS_IN (TCLOSURE x);
-ASSERT y = (TCLOSURE x);
+%ASSERT NOT (2, 3) IS_IN TCLOSURE(x);
+ASSERT y = TCLOSURE(x);
ASSERT NOT ((1, 1) IS_IN y);
CHECKSAT;
ASSERT (b, 1) IS_IN x;
ASSERT (b = d);
-ASSERT y = (TCLOSURE x);
+ASSERT y = TCLOSURE(x);
CHECKSAT;
IntPair: TYPE = [INT, INT];
x : SET OF IntPair;
y : SET OF IntPair;
-ASSERT y = ((TCLOSURE x) JOIN x);
+ASSERT y = (TCLOSURE(x) JOIN x);
ASSERT (1,2) IS_IN ((x JOIN x) JOIN x);
-ASSERT NOT (y <= TCLOSURE x);
+ASSERT NOT (y <= TCLOSURE(x));
CHECKSAT;
x : SET OF IntPair;
y : SET OF IntPair;
-ASSERT (2, 2) IS_IN (TCLOSURE x);
+ASSERT (2, 2) IS_IN TCLOSURE(x);
ASSERT x = {}::SET OF IntPair;
CHECKSAT;
ASSERT (1, 3) IS_IN x;
ASSERT ((2,3) IS_IN z OR (2,1) IS_IN z);
-ASSERT y = (TRANSPOSE x);
+ASSERT y = TRANSPOSE(x);
ASSERT NOT (1,2) IS_IN y;
ASSERT x = z;
-CHECKSAT;
\ No newline at end of file
+CHECKSAT;
ASSERT r = (x JOIN y);
ASSERT z IS_IN x;
ASSERT zt IS_IN y;
-ASSERT NOT (a IS_IN (TRANSPOSE r));
+ASSERT NOT (a IS_IN TRANSPOSE(r));
CHECKSAT;
ASSERT r = ((x JOIN y) JOIN z);
-ASSERT NOT (a IS_IN (TRANSPOSE r));
+ASSERT NOT (a IS_IN TRANSPOSE(r));
CHECKSAT;
a : IntPair;
ASSERT a = (4,1);
-ASSERT r = (((TRANSPOSE x) JOIN y) JOIN z);
-ASSERT NOT (a IS_IN (TRANSPOSE r));
+ASSERT r = ((TRANSPOSE(x) JOIN y) JOIN z);
+ASSERT NOT (a IS_IN TRANSPOSE(r));
CHECKSAT;
a : IntPair;
ASSERT a = (4,1);
-%ASSERT r = (((TRANSPOSE x) JOIN y) JOIN (w JOIN z));
-ASSERT NOT (a IS_IN (TRANSPOSE r));
+%ASSERT r = ((TRANSPOSE(x) JOIN y) JOIN (w JOIN z));
+ASSERT NOT (a IS_IN TRANSPOSE(r));
zz : SET OF IntPair;
-ASSERT zz = ((TRANSPOSE x) JOIN y);
+ASSERT zz = (TRANSPOSE(x) JOIN y);
ASSERT NOT ((1,3) IS_IN w);
ASSERT NOT ((1,3) IS_IN (w | zz) );
ASSERT r = ((x JOIN y) JOIN z);
-ASSERT NOT (a IS_IN (TRANSPOSE r));
+ASSERT NOT (a IS_IN TRANSPOSE(r));
CHECKSAT;
v : IntTup;
ASSERT v = (4,3,2,1);
-ASSERT r = (((TRANSPOSE x) JOIN y) PRODUCT z);
-ASSERT NOT (v IS_IN (TRANSPOSE r));
+ASSERT r = ((TRANSPOSE(x) JOIN y) PRODUCT z);
+ASSERT NOT (v IS_IN TRANSPOSE(r));
CHECKSAT;
ASSERT zt = (2,1);
ASSERT z IS_IN x;
-ASSERT NOT (zt IS_IN (TRANSPOSE x));
+ASSERT NOT (zt IS_IN TRANSPOSE(x));
-ASSERT y = (TRANSPOSE x);
+ASSERT y = TRANSPOSE(x);
CHECKSAT;
zt : IntTup;
ASSERT zt = (3,2,1);
ASSERT z IS_IN x;
-ASSERT NOT (zt IS_IN (TRANSPOSE x));
+ASSERT NOT (zt IS_IN TRANSPOSE(x));
CHECKSAT;
zt : IntTup;
ASSERT zt = (3,2,2);
ASSERT z IS_IN x;
-ASSERT zt IS_IN (TRANSPOSE x);
-ASSERT y = (TRANSPOSE x);
+ASSERT zt IS_IN TRANSPOSE(x);
+ASSERT y = TRANSPOSE(x);
CHECKSAT;
ASSERT zt = (2,1);
ASSERT (x = y);
ASSERT z IS_IN x;
-ASSERT NOT (zt IS_IN (TRANSPOSE y));
+ASSERT NOT (zt IS_IN TRANSPOSE(y));
CHECKSAT;
ASSERT z = (1,2);
ASSERT z IS_IN x;
-ASSERT NOT ((2, 1) IS_IN (TRANSPOSE x));
+ASSERT NOT ((2, 1) IS_IN TRANSPOSE(x));
CHECKSAT;
ASSERT NOT (zt IS_IN y);
ASSERT z IS_IN y;
-ASSERT NOT (zt IS_IN (TRANSPOSE y));
+ASSERT NOT (zt IS_IN TRANSPOSE(y));
CHECKSAT;
a : IntPair;
ASSERT a = (9,1);
-ASSERT r = (((TRANSPOSE x) JOIN y) JOIN z);
-ASSERT NOT (a IS_IN (TRANSPOSE r));
+ASSERT r = ((TRANSPOSE(x) JOIN y) JOIN z);
+ASSERT NOT (a IS_IN TRANSPOSE(r));
CHECKSAT;
ASSERT (1, c) IS_IN x;
ASSERT (2, d) IS_IN x;
ASSERT (a, 5) IS_IN y;
-ASSERT y = (TCLOSURE x);
+ASSERT y = TCLOSURE(x);
ASSERT ((2, 5) IS_IN y);
CHECKSAT;
ASSERT (b, 1) IS_IN x;
ASSERT (b = d);
ASSERT (2,b) IS_IN ((x JOIN x) JOIN x);
-ASSERT NOT (2, 1) IS_IN (TCLOSURE x);
+ASSERT NOT (2, 1) IS_IN TCLOSURE(x);
CHECKSAT;
x : SET OF IntPair;
y : SET OF IntPair;
z : SET OF IntPair;
-ASSERT y = ((TCLOSURE x) JOIN x);
-ASSERT NOT (y = TCLOSURE x);
+ASSERT y = (TCLOSURE(x) JOIN x);
+ASSERT NOT (y = TCLOSURE(x));
CHECKSAT;
IntPair: TYPE = [INT, INT];
x : SET OF IntPair;
y : SET OF IntPair;
-ASSERT y = (TCLOSURE x);
+ASSERT y = TCLOSURE(x);
ASSERT NOT ( y = ((x JOIN x) JOIN x));
CHECKSAT;
IntPair: TYPE = [INT, INT];
x : SET OF IntPair;
y : SET OF IntPair;
-ASSERT y = (TCLOSURE x);
+ASSERT y = TCLOSURE(x);
ASSERT NOT (((x JOIN x) JOIN x) <= y);
CHECKSAT;
z : SET OF IntPair;
w : SET OF IntPair;
-ASSERT z = (TCLOSURE x);
+ASSERT z = TCLOSURE(x);
ASSERT w = (x JOIN y);
ASSERT (2, 2) IS_IN z;
ASSERT (0,3) IS_IN y;
a : IntPair;
ASSERT a = (4,1);
-ASSERT r = (((TRANSPOSE x) JOIN y) JOIN z);
-ASSERT a IS_IN (TRANSPOSE r);
+ASSERT r = ((TRANSPOSE(x) JOIN y) JOIN z);
+ASSERT a IS_IN TRANSPOSE(r);
CHECKSAT;