This is an experimental extension of smt2.
*/
termAtomic[cvc5::api::Term& atomTerm]
@init {
- cvc5::api::Sort type;
- cvc5::api::Sort type2;
+ cvc5::api::Sort t;
std::string s;
std::vector<uint64_t> numerals;
}
std::string hexStr = AntlrInput::tokenTextSubstr($HEX_LITERAL, 2);
atomTerm = PARSER_STATE->mkCharConstant(hexStr);
}
+ | FMF_CARD_TOK sortSymbol[t,CHECK_DECLARED] INTEGER_LITERAL
+ {
+ uint32_t ubound = AntlrInput::tokenToUnsigned($INTEGER_LITERAL);
+ atomTerm = SOLVER->mkCardinalityConstraint(t, ubound);
+ }
| sym=SIMPLE_SYMBOL nonemptyNumeralList[numerals]
{
atomTerm =
CHAR_TOK : { PARSER_STATE->isTheoryEnabled(theory::THEORY_STRINGS) }? 'char';
TUPLE_CONST_TOK: { PARSER_STATE->isTheoryEnabled(theory::THEORY_DATATYPES) }? 'tuple';
TUPLE_PROJECT_TOK: { PARSER_STATE->isTheoryEnabled(theory::THEORY_DATATYPES) }? 'tuple_project';
+FMF_CARD_TOK: { !PARSER_STATE->strictModeEnabled() && PARSER_STATE->hasCardinalityConstraints() }? 'fmf.card';
HO_ARROW_TOK : { PARSER_STATE->isHoEnabled() }? '->';
HO_LAMBDA_TOK : { PARSER_STATE->isHoEnabled() }? 'lambda';
bool Smt2::isHoEnabled() const { return d_logic.isHigherOrder(); }
+bool Smt2::hasCardinalityConstraints() const { return d_logic.hasCardinalityConstraints(); }
+
bool Smt2::logicIsSet() {
return d_logicSet;
}
if(d_logic.isTheoryEnabled(theory::THEORY_UF)) {
Parser::addOperator(api::APPLY_UF);
-
- if (!strictModeEnabled() && d_logic.hasCardinalityConstraints())
- {
- addOperator(api::CARDINALITY_CONSTRAINT, "fmf.card");
- }
}
if(d_logic.isTheoryEnabled(theory::THEORY_ARITH)) {
* @return true if higher-order support is enabled, false otherwise
*/
bool isHoEnabled() const;
+ /**
+ * @return true if cardinality constraints are enabled, false otherwise
+ */
+ bool hasCardinalityConstraints() const;
bool logicIsSet() override;
; generated by Nunchaku
(declare-sort i_ 0)
(declare-fun __nun_card_witness_0_ () i_)
-(assert (fmf.card __nun_card_witness_0_ 2))
+(assert (_ fmf.card i_ 2))
(declare-fun i2_ () i_)
(declare-fun i1_ () i_)
(declare-fun i3_ () i_)
(declare-fun a () U)
(declare-fun c () U)
-(assert (fmf.card c 2))
-(assert (not (fmf.card a 4)))
+(assert (_ fmf.card U 2))
+(assert (not (_ fmf.card U 4)))
(check-sat)
(assert (not (= d e)))
(assert (not (= e a)))
-(assert (fmf.card c 2))
+(assert (_ fmf.card U 2))
-(check-sat)
\ No newline at end of file
+(check-sat)
(declare-fun b () U)
(declare-fun c () U)
-(assert (not (fmf.card a 2)))
+(assert (not (_ fmf.card U 2)))
(assert (forall ((x U)) (or (= x a) (= x b))))
-(check-sat)
\ No newline at end of file
+(check-sat)
(set-info :status sat)
(declare-sort a 0)
(declare-fun b () a)
-(assert (not (fmf.card b 1)))
+(assert (not (_ fmf.card a 1)))
(check-sat)
(set-info :status sat)
(declare-sort S0 0)
(declare-const S0-0 S0)
-(assert (fmf.card S0-0 1))
-(assert (fmf.card S0-0 4))
+(assert (_ fmf.card S0 1))
+(assert (_ fmf.card S0 4))
(check-sat)
(set-info :status sat)
(declare-sort a 0)
(declare-fun b () a)
-(assert (fmf.card b 2))
+(assert (_ fmf.card a 2))
(check-sat)
(set-logic UFC)
(declare-sort a 0)
(declare-fun b () a)
-(assert (not (fmf.card b 1)))
-(check-sat)
\ No newline at end of file
+(assert (not (_ fmf.card a 1)))
+(check-sat)
(declare-fun h () H)
; pigeonhole using native cardinality constraints
-(assert (fmf.card p 19))
-(assert (not (fmf.card p 18)))
-(assert (fmf.card h 18))
-(assert (not (fmf.card h 17)))
+(assert (_ fmf.card P 19))
+(assert (not (_ fmf.card P 18)))
+(assert (_ fmf.card H 18))
+(assert (not (_ fmf.card H 17)))
; each pigeon has different holes
(declare-fun f (P) H)
(assert (forall ((p1 P) (p2 P)) (=> (not (= p1 p2)) (not (= (f p1) (f p2))))))
-(check-sat)
\ No newline at end of file
+(check-sat)