//REGEXP_EMPTY_TOK
//REGEXP_SIGMA_TOK
+ SETS_CARD_TOK = 'CARD';
FMF_CARD_TOK = 'HAS_CARD';
case GEQ_TOK:
case GT_TOK:
case MEMBER_TOK:
+ case SETS_CARD_TOK:
case FMF_CARD_TOK: return 25;
case EQUAL_TOK:
case DISEQUAL_TOK: return 26;
case LT_TOK: return kind::LT;
case LEQ_TOK: return kind::LEQ;
case MEMBER_TOK: return kind::MEMBER;
+ case SETS_CARD_TOK: return kind::CARD;
case FMF_CARD_TOK: return kind::CARDINALITY_CONSTRAINT;
// arithmeticBinop
| str[s]
{ f = MK_CONST(CVC4::String(s)); }
+ | setsTerm[f]
+ ;
+
+setsTerm[CVC4::Expr& f]
+@init {
+}
+ /* Sets prefix operators */
+ : SETS_CARD_TOK LPAREN formula[f] RPAREN
+ { f = MK_EXPR(CVC4::kind::CARD, f); }
| simpleTerm[f]
;
+
/** Parses a simple term. */
simpleTerm[CVC4::Expr& f]
d_set_eqc_list[eqc].push_back( n );
}else if( n.getKind()==kind::CARD ){
d_card_enabled = true;
+ TypeNode tn = n[0].getType().getSetElementType();
+ if( tn.isInterpretedFinite() ){
+ std::stringstream ss;
+ ss << "ERROR: cannot use cardinality on sets with finite element type." << std::endl;
+ throw LogicException(ss.str());
+ //TODO: extend approach for this case
+ }
Node r = d_equalityEngine.getRepresentative( n[0] );
if( d_eqc_to_card_term.find( r )==d_eqc_to_card_term.end() ){
d_eqc_to_card_term[ r ] = n;