PrettyCheckArgument(isResolved(), this, "this datatype is not yet resolved");
ExprManagerScope ems(d_self);
+ Debug("datatypes") << "mkGroundTerm of type " << t << std::endl;
// is this already in the cache ?
std::map< Type, Expr >::iterator it = d_ground_term.find( t );
}
Expr Datatype::computeGroundTerm( Type t, std::vector< Type >& processing ) const throw(IllegalArgumentException) {
- if( std::find( processing.begin(), processing.end(), d_self )==processing.end() ){
- processing.push_back( d_self );
+ if( std::find( processing.begin(), processing.end(), t )==processing.end() ){
+ processing.push_back( t );
for( unsigned r=0; r<2; r++ ){
for(const_iterator i = begin(), i_end = end(); i != i_end; ++i) {
//do nullary constructors first
}
processing.pop_back();
}else{
- Debug("datatypes") << "...already processing " << t << std::endl;
+ Debug("datatypes") << "...already processing " << t << " " << d_self << std::endl;
}
return Expr();
}
break;
case output::LANG_SMTLIB_V2_0:
case output::LANG_SMTLIB_V2_5:
+ case output::LANG_SMTLIB_V2_6:
d_historyFilename = string(getenv("HOME")) + "/.cvc4_history_smtlib2";
commandsBegin = smt2_commands;
commandsEnd = smt2_commands + sizeof(smt2_commands) / sizeof(*smt2_commands);
goto restart;
} catch(ParserException& pe) {
if(d_options.getOutputLanguage() == output::LANG_SMTLIB_V2_0 ||
- d_options.getOutputLanguage() == output::LANG_SMTLIB_V2_5) {
+ d_options.getOutputLanguage() == output::LANG_SMTLIB_V2_5 ||
+ d_options.getOutputLanguage() == output::LANG_SMTLIB_V2_6) {
d_out << "(error \"" << pe << "\")" << endl;
} else {
d_out << pe << endl;
*opts.getOut() << "unknown" << endl;
#endif
if(opts.getOutputLanguage() == output::LANG_SMTLIB_V2_0 ||
- opts.getOutputLanguage() == output::LANG_SMTLIB_V2_5) {
+ opts.getOutputLanguage() == output::LANG_SMTLIB_V2_5 ||
+ opts.getOutputLanguage() == output::LANG_SMTLIB_V2_6) {
*opts.getOut() << "(error \"" << e << "\")" << endl;
} else {
*opts.getErr() << "CVC4 Error:" << endl << e << endl;
case output::LANG_SMTLIB_V1:
case output::LANG_SMTLIB_V2_0:
case output::LANG_SMTLIB_V2_5:
+ case output::LANG_SMTLIB_V2_6:
case output::LANG_TPTP:
case output::LANG_CVC4:
case output::LANG_Z3STR:
case input::LANG_SMTLIB_V1:
case input::LANG_SMTLIB_V2_0:
case input::LANG_SMTLIB_V2_5:
+ case input::LANG_SMTLIB_V2_6:
case input::LANG_TPTP:
case input::LANG_CVC4:
case input::LANG_Z3STR:
} else if(language == "smtlib2.5" || language == "smt2.5" ||
language == "LANG_SMTLIB_V2_5") {
return output::LANG_SMTLIB_V2_5;
+ } else if(language == "smtlib2.6" || language == "smt2.6" ||
+ language == "LANG_SMTLIB_V2_6") {
+ return output::LANG_SMTLIB_V2_6;
} else if(language == "tptp" || language == "LANG_TPTP") {
return output::LANG_TPTP;
} else if(language == "z3str" || language == "z3-str" ||
} else if(language == "smtlib2.5" || language == "smt2.5" ||
language == "LANG_SMTLIB_V2_5") {
return input::LANG_SMTLIB_V2_5;
+ } else if(language == "smtlib2.6" || language == "smt2.6" ||
+ language == "LANG_SMTLIB_V2_6") {
+ return input::LANG_SMTLIB_V2_6;
} else if(language == "tptp" || language == "LANG_TPTP") {
return input::LANG_TPTP;
} else if(language == "z3str" || language == "z3-str" ||
LANG_SMTLIB_V2_0,
/** The SMTLIB v2.5 input language */
LANG_SMTLIB_V2_5,
+ /** The SMTLIB v2.6 input language */
+ LANG_SMTLIB_V2_6,
/** Backward-compatibility for enumeration naming */
- LANG_SMTLIB_V2 = LANG_SMTLIB_V2_5,
+ LANG_SMTLIB_V2 = LANG_SMTLIB_V2_6,
/** The TPTP input language */
LANG_TPTP,
/** The CVC4 input language */
case LANG_SMTLIB_V2_5:
out << "LANG_SMTLIB_V2_5";
break;
+ case LANG_SMTLIB_V2_6:
+ out << "LANG_SMTLIB_V2_6";
+ break;
case LANG_TPTP:
out << "LANG_TPTP";
break;
LANG_SMTLIB_V2_0 = input::LANG_SMTLIB_V2_0,
/** The SMTLIB v2.5 output language */
LANG_SMTLIB_V2_5 = input::LANG_SMTLIB_V2_5,
+ /** The SMTLIB v2.6 output language */
+ LANG_SMTLIB_V2_6 = input::LANG_SMTLIB_V2_6,
/** Backward-compatibility for enumeration naming */
LANG_SMTLIB_V2 = input::LANG_SMTLIB_V2,
/** The TPTP output language */
%rename(INPUT_LANG_SMTLIB_V2) CVC4::language::input::LANG_SMTLIB_V2;
%rename(INPUT_LANG_SMTLIB_V2_0) CVC4::language::input::LANG_SMTLIB_V2_0;
%rename(INPUT_LANG_SMTLIB_V2_5) CVC4::language::input::LANG_SMTLIB_V2_5;
+%rename(INPUT_LANG_SMTLIB_V2_6) CVC4::language::input::LANG_SMTLIB_V2_6;
%rename(INPUT_LANG_TPTP) CVC4::language::input::LANG_TPTP;
%rename(INPUT_LANG_CVC4) CVC4::language::input::LANG_CVC4;
%rename(INPUT_LANG_MAX) CVC4::language::input::LANG_MAX;
%rename(OUTPUT_LANG_SMTLIB_V2) CVC4::language::output::LANG_SMTLIB_V2;
%rename(OUTPUT_LANG_SMTLIB_V2_0) CVC4::language::output::LANG_SMTLIB_V2_0;
%rename(OUTPUT_LANG_SMTLIB_V2_5) CVC4::language::output::LANG_SMTLIB_V2_5;
+%rename(OUTPUT_LANG_SMTLIB_V2_6) CVC4::language::output::LANG_SMTLIB_V2_6;
%rename(OUTPUT_LANG_TPTP) CVC4::language::output::LANG_TPTP;
%rename(OUTPUT_LANG_CVC4) CVC4::language::output::LANG_CVC4;
%rename(OUTPUT_LANG_AST) CVC4::language::output::LANG_AST;
smt | smtlib | smt2 |\n\
smt2.0 | smtlib2 | smtlib2.0 SMT-LIB format 2.0\n\
smt2.5 | smtlib2.5 SMT-LIB format 2.5\n\
+ smt2.6 | smtlib2.6 SMT-LIB format 2.6\n\
tptp TPTP format (cnf and fof)\n\
sygus SyGuS format\n\
\n\
smt | smtlib | smt2 |\n\
smt2.0 | smtlib2.0 | smtlib2 SMT-LIB format 2.0\n\
smt2.5 | smtlib2.5 SMT-LIB format 2.5\n\
+ smt2.6 | smtlib2.6 SMT-LIB format 2.6\n\
tptp TPTP format\n\
z3str SMT-LIB 2.0 with Z3-str string constraints\n\
ast internal format (simple syntax trees)\n\
case LANG_SMTLIB_V2_0:
case LANG_SMTLIB_V2_5:
+ case LANG_SMTLIB_V2_6:
input = new Smt2Input(inputStream, lang);
break;
/* BV neg */
: BVNEG_TOK bvNegTerm[f]
{ f = MK_EXPR(CVC4::kind::BITVECTOR_NOT, f); }
- | NOT_TOK bvNegTerm[f]
+ | relationTerm[f]
+ ;
+
+relationTerm[CVC4::Expr& f]
+ /* relation terms */
+ : NOT_TOK relationTerm[f]
{ f = MK_EXPR(CVC4::kind::COMPLEMENT, f); }
- | TRANSPOSE_TOK bvNegTerm[f]
+ | TRANSPOSE_TOK relationTerm[f]
{ f = MK_EXPR(CVC4::kind::TRANSPOSE, f); }
- | TRANSCLOSURE_TOK bvNegTerm[f]
+ | TRANSCLOSURE_TOK relationTerm[f]
{ f = MK_EXPR(CVC4::kind::TCLOSURE, f); }
- | TUPLE_TOK LPAREN bvNegTerm[f] RPAREN
+ | TUPLE_TOK LPAREN relationTerm[f] RPAREN
{ std::vector<Type> types;
std::vector<Expr> args;
args.push_back(f);
- types.push_back(f.getType());
+ types.push_back(f.getType());
DatatypeType t = EXPR_MANAGER->mkTupleType(types);
const Datatype& dt = t.getDatatype();
args.insert( args.begin(), dt[0].getConstructor() );
break;
case language::input::LANG_SMTLIB_V2_0:
case language::input::LANG_SMTLIB_V2_5:
+ case language::input::LANG_SMTLIB_V2_6:
parser = new Smt2(d_exprManager, input, d_strictMode, d_parseOnly);
break;
case language::input::LANG_SYGUS:
sexpr.getRationalValue() == Rational(5, 2)) ||
sexpr.getValue() == "2.5" ) {
PARSER_STATE->setLanguage(language::input::LANG_SMTLIB_V2_5);
+ } else if( (sexpr.isRational() &&
+ sexpr.getRationalValue() == Rational(13, 5)) ||
+ sexpr.getValue() == "2.6" ) {
+ PARSER_STATE->setLanguage(language::input::LANG_SMTLIB_V2_6);
}
}
PARSER_STATE->setInfo(name.c_str() + 1, sexpr);
}
/* Extended SMT-LIB set of commands syntax, not permitted in
* --smtlib2 compliance mode. */
- : DECLARE_DATATYPES_TOK datatypesDefCommand[false, cmd]
+ : DECLARE_DATATYPES_2_5_TOK datatypes_2_5_DefCommand[false, cmd]
+ | DECLARE_CODATATYPES_2_5_TOK datatypes_2_5_DefCommand[true, cmd]
+ | DECLARE_DATATYPES_TOK datatypesDefCommand[false, cmd]
| DECLARE_CODATATYPES_TOK datatypesDefCommand[true, cmd]
| rewriterulesCommand[cmd]
;
-datatypesDefCommand[bool isCo, CVC4::PtrCloser<CVC4::Command>* cmd]
+datatypes_2_5_DefCommand[bool isCo, CVC4::PtrCloser<CVC4::Command>* cmd]
@declarations {
std::vector<CVC4::Datatype> dts;
std::string name;
RPAREN_TOK
LPAREN_TOK ( LPAREN_TOK datatypeDef[isCo, dts, sorts] RPAREN_TOK )+ RPAREN_TOK
{ PARSER_STATE->popScope();
- cmd->reset(new DatatypeDeclarationCommand(
- PARSER_STATE->mkMutualDatatypeTypes(dts)));
+ cmd->reset(new DatatypeDeclarationCommand(PARSER_STATE->mkMutualDatatypeTypes(dts)));
+ }
+ ;
+
+datatypesDefCommand[bool isCo, CVC4::PtrCloser<CVC4::Command>* cmd]
+@declarations {
+ std::vector<CVC4::Datatype> dts;
+ std::vector<Type> types;
+ std::string name;
+ std::vector<std::string> dnames;
+ std::vector<unsigned> arities;
+ std::vector<Type> params;
+}
+ : { PARSER_STATE->checkThatLogicIsSet(); PARSER_STATE->pushScope(true); }
+ LPAREN_TOK /* sorts */
+ ( LPAREN_TOK symbol[name,CHECK_UNDECLARED,SYM_SORT] n=INTEGER_LITERAL RPAREN_TOK
+ { unsigned arity = AntlrInput::tokenToUnsigned(n);
+ //Type type;
+ //if(arity == 0) {
+ // type = PARSER_STATE->mkSort(name);
+ //} else {
+ // type = PARSER_STATE->mkSortConstructor(name, arity);
+ //}
+ Debug("parser-dt") << "Datatype : " << name << ", arity = " << arity << std::endl;
+ //types.push_back(type);
+ dnames.push_back(name);
+ arities.push_back( arity );
+ }
+ )*
+ RPAREN_TOK
+ LPAREN_TOK
+ ( LPAREN_TOK {
+ params.clear();
+ Debug("parser-dt") << "Processing datatype #" << dts.size() << std::endl;
+ if( dts.size()>=dnames.size() ){
+ PARSER_STATE->parseError("Too many datatypes defined in this block.");
+ }
+ }
+ ( PAR_TOK { PARSER_STATE->pushScope(true); } LPAREN_TOK
+ ( symbol[name,CHECK_UNDECLARED,SYM_SORT]
+ { params.push_back( PARSER_STATE->mkSort(name) ); }
+ )*
+ RPAREN_TOK {
+ if( params.size()!=arities[dts.size()] ){
+ PARSER_STATE->parseError("Wrong number of parameters for datatype.");
+ }
+ Debug("parser-dt") << params.size() << " parameters for " << dnames[dts.size()] << std::endl;
+ dts.push_back(Datatype(dnames[dts.size()],params,isCo));
+ }
+ LPAREN_TOK
+ ( LPAREN_TOK constructorDef[dts.back()] RPAREN_TOK )+
+ RPAREN_TOK { PARSER_STATE->popScope(); }
+ | { if( 0!=arities[dts.size()] ){
+ PARSER_STATE->parseError("No parameters given for datatype.");
+ }
+ Debug("parser-dt") << params.size() << " parameters for " << dnames[dts.size()] << std::endl;
+ dts.push_back(Datatype(dnames[dts.size()],params,isCo));
+ }
+ ( LPAREN_TOK constructorDef[dts.back()] RPAREN_TOK )+
+ )
+ RPAREN_TOK
+ )+
+ RPAREN_TOK
+ { PARSER_STATE->popScope();
+ cmd->reset(new DatatypeDeclarationCommand(PARSER_STATE->mkMutualDatatypeTypes(dts)));
}
;
| LPAREN_TOK
( /* An indexed function application */
- indexedFunctionName[op] termList[args,expr] RPAREN_TOK
- { expr = MK_EXPR(op, args);
+ indexedFunctionName[op, kind] termList[args,expr] RPAREN_TOK
+ {
+ if( kind!=kind::NULL_EXPR ){
+ expr = MK_EXPR( kind, op, args );
+ }else{
+ expr = MK_EXPR(op, args);
+ }
PARSER_STATE->checkOperator(expr.getKind(), args.size());
}
| /* Array constant (in Z3 syntax) */
/**
* Matches a bit-vector operator (the ones parametrized by numbers)
*/
-indexedFunctionName[CVC4::Expr& op]
+indexedFunctionName[CVC4::Expr& op, CVC4::Kind& kind]
+@init {
+ Expr expr;
+ Expr expr2;
+}
: LPAREN_TOK INDEX_TOK
( 'extract' n1=INTEGER_LITERAL n2=INTEGER_LITERAL
{ op = MK_CONST(BitVectorExtract(AntlrInput::tokenToUnsigned($n1),
{ op = MK_CONST(FloatingPointToUBV(AntlrInput::tokenToUnsigned($m))); }
| FP_TO_SBV_TOK m=INTEGER_LITERAL
{ op = MK_CONST(FloatingPointToSBV(AntlrInput::tokenToUnsigned($m))); }
+ | TESTER_TOK term[expr, expr2] {
+ if( !expr.getType().isConstructor() ){
+ PARSER_STATE->parseError("Bad syntax for test (_ is X), X must be a constructor.");
+ }
+ op = Datatype::datatypeOf(expr)[Datatype::indexOf(expr)].getTester();
+ kind = CVC4::kind::APPLY_TESTER;
+ }
| badIndexedFunctionName
)
RPAREN_TOK
GET_PROOF_TOK : 'get-proof';
GET_UNSAT_CORE_TOK : 'get-unsat-core';
EXIT_TOK : 'exit';
-RESET_TOK : { PARSER_STATE->v2_5() }? 'reset';
+RESET_TOK : { PARSER_STATE->v2_5(false) }? 'reset';
RESET_ASSERTIONS_TOK : 'reset-assertions';
ITE_TOK : 'ite';
LET_TOK : 'let';
CONST_TOK : 'const';
// extended commands
-DECLARE_DATATYPES_TOK : 'declare-datatypes';
-DECLARE_CODATATYPES_TOK : 'declare-codatatypes';
+DECLARE_DATATYPE_TOK : { PARSER_STATE->v2_6() }? 'declare-datatype';
+DECLARE_DATATYPES_2_5_TOK : { !PARSER_STATE->v2_6() }?'declare-datatypes';
+DECLARE_DATATYPES_TOK : { PARSER_STATE->v2_6() }?'declare-datatypes';
+DECLARE_CODATATYPES_2_5_TOK : { !PARSER_STATE->v2_6() }?'declare-codatatypes';
+DECLARE_CODATATYPES_TOK : { PARSER_STATE->v2_6() }?'declare-codatatypes';
+PAR_TOK : { PARSER_STATE->v2_6() }?'par';
+TESTER_TOK : { PARSER_STATE->v2_6() }?'is';
GET_MODEL_TOK : 'get-model';
ECHO_TOK : 'echo';
REWRITE_RULE_TOK : 'assert-rewrite';
* will be part of the token text. Use the str[] parser rule instead.
*/
STRING_LITERAL_2_5
- : { PARSER_STATE->v2_5() || PARSER_STATE->sygus() }?=>
+ : { PARSER_STATE->v2_5(false) || PARSER_STATE->sygus() }?=>
'"' (~('"') | '""')* '"'
;
bool v2_0() const {
return getInput()->getLanguage() == language::input::LANG_SMTLIB_V2_0;
}
- bool v2_5() const {
- return getInput()->getLanguage() == language::input::LANG_SMTLIB_V2_5;
+ // 2.6 is a superset of 2.5, use exact=false to query whether smt lib 2.5 or above
+ bool v2_5( bool exact = true ) const {
+ return exact ? getInput()->getLanguage() == language::input::LANG_SMTLIB_V2_5 :
+ ( getInput()->getLanguage() >= language::input::LANG_SMTLIB_V2_5 &&
+ getInput()->getLanguage() <= language::input::LANG_SMTLIB_V2 );
+ }
+ bool v2_6() const {
+ return getInput()->getLanguage() == language::input::LANG_SMTLIB_V2_6;
}
bool sygus() const {
return getInput()->getLanguage() == language::input::LANG_SYGUS;
void Smt2Input::setLanguage(InputLanguage lang) {
CheckArgument(lang == language::input::LANG_SMTLIB_V2_0 ||
- lang == language::input::LANG_SMTLIB_V2_5, lang);
+ lang == language::input::LANG_SMTLIB_V2_5 ||
+ lang == language::input::LANG_SMTLIB_V2_6, lang);
d_lang = lang;
}
case LANG_SMTLIB_V2_5:
return new printer::smt2::Smt2Printer();
+
+ case LANG_SMTLIB_V2_6:
+ return new printer::smt2::Smt2Printer(printer::smt2::smt2_6_variant);
case LANG_TPTP:
return new printer::tptp::TptpPrinter();
tmp.replace(pos, 8, "::");
}
out << tmp;
- }else if( n.getKind()==kind::APPLY_TESTER ){
+ }else if( n.getKind()==kind::APPLY_TESTER ){
unsigned cindex = Datatype::indexOf(n.getOperator().toExpr());
const Datatype& dt = Datatype::datatypeOf(n.getOperator().toExpr());
- out << "is-";
- toStream(out, Node::fromExpr(dt[cindex].getConstructor()), toDepth < 0 ? toDepth : toDepth - 1, types);
+ if( d_variant==smt2_6_variant ){
+ out << "(_ is ";
+ toStream(out, Node::fromExpr(dt[cindex].getConstructor()), toDepth < 0 ? toDepth : toDepth - 1, types);
+ out << ")";
+ }else{
+ out << "is-";
+ toStream(out, Node::fromExpr(dt[cindex].getConstructor()), toDepth < 0 ? toDepth : toDepth - 1, types);
+ }
}else{
toStream(out, n.getOperator(), toDepth < 0 ? toDepth : toDepth - 1, types);
}
tryToStream<GetInfoCommand>(out, c) ||
tryToStream<SetOptionCommand>(out, c) ||
tryToStream<GetOptionCommand>(out, c) ||
- tryToStream<DatatypeDeclarationCommand>(out, c) ||
+ tryToStream<DatatypeDeclarationCommand>(out, c, d_variant) ||
tryToStream<CommentCommand>(out, c, d_variant) ||
tryToStream<EmptyCommand>(out, c) ||
tryToStream<EchoCommand>(out, c, d_variant)) {
const std::map< TypeNode, std::vector< Node > >& type_reps = tm.d_rep_set.d_type_reps;
std::map< TypeNode, std::vector< Node > >::const_iterator tn_iterator = type_reps.find( tn );
- if( options::modelUninterpDtEnum() && tn.isSort() && tn_iterator != type_reps.end() ){
- out << "(declare-datatypes () ((" << dynamic_cast<const DeclareTypeCommand*>(c)->getSymbol() << " ";
-
+ if( options::modelUninterpDtEnum() && tn.isSort() && tn_iterator != type_reps.end() ){
+ if(d_variant == smt2_6_variant) {
+ out << "(declare-datatypes ((" << dynamic_cast<const DeclareTypeCommand*>(c)->getSymbol() << " 0)) (";
+ }else{
+ out << "(declare-datatypes () ((" << dynamic_cast<const DeclareTypeCommand*>(c)->getSymbol() << " ";
+ }
for( size_t i=0, N = tn_iterator->second.size(); i < N; i++ ){
out << "(" << (*tn_iterator).second[i] << ")";
}
out << "(get-option :" << c->getFlag() << ")";
}
-static void toStream(std::ostream& out, const DatatypeDeclarationCommand* c) throw() {
+static void toStream(std::ostream& out, const Datatype & d) {
+ for(Datatype::const_iterator ctor = d.begin(), ctor_end = d.end();
+ ctor != ctor_end; ++ctor){
+ if( ctor!=d.begin() ) out << " ";
+ out << "(" << maybeQuoteSymbol(ctor->getName());
+
+ for(DatatypeConstructor::const_iterator arg = ctor->begin(), arg_end = ctor->end();
+ arg != arg_end; ++arg){
+ out << " (" << arg->getSelector() << " "
+ << static_cast<SelectorType>(arg->getType()).getRangeType() << ")";
+ }
+ out << ")";
+ }
+}
+
+static void toStream(std::ostream& out, const DatatypeDeclarationCommand* c, Variant v) throw() {
const vector<DatatypeType>& datatypes = c->getDatatypes();
- out << "(declare-datatypes () (";
- for(vector<DatatypeType>::const_iterator i = datatypes.begin(),
- i_end = datatypes.end();
- i != i_end;
- ++i) {
-
- const Datatype & d = i->getDatatype();
-
- out << "(" << maybeQuoteSymbol(d.getName()) << " ";
- for(Datatype::const_iterator ctor = d.begin(), ctor_end = d.end();
- ctor != ctor_end; ++ctor){
- if( ctor!=d.begin() ) out << " ";
- out << "(" << maybeQuoteSymbol(ctor->getName());
-
- for(DatatypeConstructor::const_iterator arg = ctor->begin(), arg_end = ctor->end();
- arg != arg_end; ++arg){
- out << " (" << arg->getSelector() << " "
- << static_cast<SelectorType>(arg->getType()).getRangeType() << ")";
- }
- out << ")";
+ out << "(declare-";
+ Assert( !datatypes.empty() );
+ if( datatypes[0].getDatatype().isCodatatype() ){
+ out << "co";
+ }
+ out << "datatypes";
+ if(v == smt2_6_variant) {
+ out << " (";
+ for(vector<DatatypeType>::const_iterator i = datatypes.begin(),
+ i_end = datatypes.end();
+ i != i_end; ++i) {
+ const Datatype & d = i->getDatatype();
+ out << "(" << maybeQuoteSymbol(d.getName());
+ out << " " << d.getNumParameters() << ")";
}
- out << ")" << endl;
+ out << ") ";
+ for(vector<DatatypeType>::const_iterator i = datatypes.begin(),
+ i_end = datatypes.end();
+ i != i_end; ++i) {
+ const Datatype & d = i->getDatatype();
+ out << "(";
+ toStream( out, d );
+ out << ")" << endl;
+ }
+ }else{
+ out << " () (";
+ for(vector<DatatypeType>::const_iterator i = datatypes.begin(),
+ i_end = datatypes.end();
+ i != i_end; ++i) {
+ const Datatype & d = i->getDatatype();
+ out << "(" << maybeQuoteSymbol(d.getName()) << " ";
+ toStream( out, d );
+ out << ")" << endl;
+ }
+ out << ")";
}
- out << "))";
+ out << ")";
}
static void toStream(std::ostream& out, const CommentCommand* c, Variant v) throw() {
enum Variant {
no_variant,
smt2_0_variant, // old-style 2.0 syntax, when it makes a difference
+ smt2_6_variant, // new-style 2.6 syntax, when it makes a difference
z3str_variant, // old-style 2.0 and also z3str syntax
sygus_variant // variant for sygus
};/* enum Variant */
value.getValue() == "2.0" ) {
// supported SMT-LIB version
if(!options::outputLanguage.wasSetByUser() &&
- options::outputLanguage() == language::output::LANG_SMTLIB_V2_5) {
+ ( options::outputLanguage() == language::output::LANG_SMTLIB_V2_5 || options::outputLanguage() == language::output::LANG_SMTLIB_V2_6 )) {
options::outputLanguage.set(language::output::LANG_SMTLIB_V2_0);
*options::out() << language::SetLanguage(language::output::LANG_SMTLIB_V2_0);
}
*options::out() << language::SetLanguage(language::output::LANG_SMTLIB_V2_5);
}
return;
+ } else if( (value.isRational() && value.getRationalValue() == Rational(13, 5)) ||
+ value.getValue() == "2.6" ) {
+ // supported SMT-LIB version
+ if(!options::outputLanguage.wasSetByUser() &&
+ options::outputLanguage() == language::output::LANG_SMTLIB_V2_0) {
+ options::outputLanguage.set(language::output::LANG_SMTLIB_V2_6);
+ *options::out() << language::SetLanguage(language::output::LANG_SMTLIB_V2_6);
+ }
+ return;
}
Warning() << "Warning: unsupported smt-lib-version: " << value << endl;
throw UnrecognizedOptionException();
switch (language) {
case language::output::LANG_SMTLIB_V2_0:
case language::output::LANG_SMTLIB_V2_5:
+ case language::output::LANG_SMTLIB_V2_6:
case language::output::LANG_SYGUS:
case language::output::LANG_Z3STR:
toStreamSmt2(out);
case language::output::LANG_SMTLIB_V1:
case language::output::LANG_SMTLIB_V2_0:
case language::output::LANG_SMTLIB_V2_5:
+ case language::output::LANG_SMTLIB_V2_6:
case language::output::LANG_SYGUS:
case language::output::LANG_TPTP:
case language::output::LANG_Z3STR:
dt-param-card4-bool-sat.smt2 \
bug604.smt2 \
bug597-rbt.smt2 \
- example-dailler-min.smt2
+ example-dailler-min.smt2 \
+ dt-2.6.smt2 \
+ dt-sel-2.6.smt2 \
+ dt-param-2.6.smt2
FAILING_TESTS = \
datatype-dump.cvc
--- /dev/null
+; COMMAND-LINE: --lang=smt2.6
+; EXPECT: sat
+(set-logic ALL)
+(set-info :status sat)
+(declare-datatypes ((IntList 0)) (
+((empty) (insert ( head Int ) ( tail IntList ) ))
+))
+
+(declare-fun x () IntList)
+(declare-fun y () IntList)
+(declare-fun z () IntList)
+
+(assert (distinct x y z))
+
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --lang=smt2.6
+; EXPECT: sat
+(set-logic ALL)
+(set-info :status sat)
+(declare-datatypes ( ( Tree 1) ( TreeList 1) ) (
+(par ( X ) ( ( node ( value X ) ( children ( TreeList X )) )))
+(par ( Y ) ( ( empty ) ( insert ( head ( Tree Y )) ( tail ( TreeList Y ))) ))
+))
+
+
+(declare-fun x () (Tree Int))
+(declare-fun y () (Tree Int))
+(declare-fun z () (Tree Int))
+
+
+(assert (distinct x y z))
+(assert (= (value x) 5))
+(assert ((_ is insert) (children y)))
+(assert (= (value (head (children y))) 7))
+
+(declare-sort U 0)
+(declare-fun a () (Tree U))
+(declare-fun b () (Tree U))
+(declare-fun c () (Tree U))
+
+(assert (distinct a b c))
+
+(assert ((_ is insert) (children a)))
+
+
+(declare-fun d () (Tree (Tree Int)))
+(declare-fun e () (Tree (Tree Int)))
+(declare-fun f () (Tree (Tree Int)))
+
+(assert (distinct d e f))
+
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --lang=smt2.6
+; EXPECT: unsat
+(set-logic ALL)
+(set-info :status unsat)
+(declare-datatypes ((IntList 0)) (
+((empty) (insert ( head Int ) ( tail IntList ) ))
+))
+
+(declare-fun x () IntList)
+(declare-fun y () IntList)
+(declare-fun z () IntList)
+
+(assert (distinct x y z))
+
+(assert (not ((_ is insert) x)))
+(assert (not ((_ is insert) y)))
+
+(check-sat)
error "benchmark \`$benchmark' must be *.cvc or *.smt or *.smt2 or *.p or *.sy"
fi
-command_line="${command_line:+$command_line }--lang=$lang"
+command_line="--lang=$lang ${command_line:+$command_line }"
gettemp expoutfile cvc4_expect_stdout.$$.XXXXXXXXXX
gettemp experrfile cvc4_expect_stderr.$$.XXXXXXXXXX