#include "util/output.h"
#include "util/dump.h"
#include "util/sexpr.h"
+#include "util/util_model.h"
#include "expr/node.h"
#include "printer/printer.h"
}
}
+/* Model is private to the library -- for now
Model* GetModelCommand::getResult() const throw() {
return d_result;
}
+*/
void GetModelCommand::printResult(std::ostream& out) const throw() {
if(! ok()) {
#include "util/sexpr.h"
#include "util/datatype.h"
#include "util/proof.h"
-#include "util/util_model.h"
namespace CVC4 {
class SmtEngine;
class Command;
class CommandStatus;
+class Model;
std::ostream& operator<<(std::ostream&, const Command&) throw() CVC4_PUBLIC;
std::ostream& operator<<(std::ostream&, const Command*) throw() CVC4_PUBLIC;
GetModelCommand() throw();
~GetModelCommand() throw() {}
void invoke(SmtEngine* smtEngine) throw();
- Model* getResult() const throw();
+ // Model is private to the library -- for now
+ //Model* getResult() const throw();
void printResult(std::ostream& out) const throw();
Command* exportTo(ExprManager* exprManager, ExprManagerMapCollection& variableMap);
Command* clone() const;
** Major contributors: mdeters
** Minor contributors (to current version): none
** This file is part of the CVC4 prototype.
- ** Copyright (c) 2009, 2010, 2011 The Analysis of Computer Systems Group (ACSys)
+ ** Copyright (c) 2009-2012 The Analysis of Computer Systems Group (ACSys)
** Courant Institute of Mathematical Sciences
** New York University
** See the file COPYING in the top-level source directory for licensing
}/* CVC4 namespace */
#endif /* __CVC4__INTERACTIVE_SHELL_H */
-
case INTDIV_TOK: return kind::INTS_DIVISION;
case MOD_TOK: return kind::INTS_MODULUS;
case DIV_TOK: return kind::DIVISION;
- case EXP_TOK: break;
+ case EXP_TOK: return kind::POW;
// bvBinop
case CONCAT_TOK: return kind::BITVECTOR_CONCAT;
{ std::string s = AntlrInput::tokenText($IDENTIFIER);
if(s == "benchmark") {
PARSER_STATE->parseError("In CVC4 presentation language mode, but SMT-LIBv1 format detected. Use --lang smt1 for SMT-LIBv1 support.");
- } else if(s == "set" || s == "get") {
- PARSER_STATE->parseError("In CVC4 presentation language mode, but SMT-LIBv2 format detected. Use --lang smt2 for SMT-LIBv2 support.");
+ } else if(s == "set" || s == "get" || s == "declare" ||
+ s == "define" || s == "assert") {
+ PARSER_STATE->parseError("In CVC4 presentation language mode, but SMT-LIB format detected. Use --lang smt for SMT-LIB support.");
} else {
PARSER_STATE->parseError("A CVC4 presentation language command cannot begin with a parenthesis; expected command name.");
}
CVC4::Rational r;
}
: INTEGER_LITERAL
- { sexpr = SExpr(AntlrInput::tokenToInteger($INTEGER_LITERAL)); }
+ { sexpr = SExpr(Integer(AntlrInput::tokenText($INTEGER_LITERAL))); }
+ | MINUS_TOK INTEGER_LITERAL
+ { sexpr = SExpr(-Integer(AntlrInput::tokenText($INTEGER_LITERAL))); }
| DECIMAL_LITERAL
{ sexpr = SExpr(AntlrInput::tokenToRational($DECIMAL_LITERAL)); }
| HEX_LITERAL
/* BV sign extension */
| SX_TOK LPAREN formula[f] COMMA k=numeral RPAREN
{ unsigned n = BitVectorType(f.getType()).getSize();
- // Sign extension in TheoryBitVector is defined as in SMT-LIBv2
+ // Sign extension in TheoryBitVector is defined as in SMT-LIB
// which is different than in the CVC language
// SX(BITVECTOR(k), n) in CVC language extends to n bits
- // In SMT-LIBv2, such a thing expands to k + n bits
+ // In SMT-LIB, such a thing expands to k + n bits
f = MK_EXPR(MK_CONST(BitVectorSignExtend(k - n)), f); }
/* BV zero extension */
| BVZEROEXTEND_TOK LPAREN formula[f] COMMA k=numeral RPAREN
{ unsigned n = BitVectorType(f.getType()).getSize();
- // Zero extension in TheoryBitVector is defined as in SMT-LIBv2
+ // Zero extension in TheoryBitVector is defined as in SMT-LIB
// which is the same as in CVC3, but different than SX!
// SX(BITVECTOR(k), n) in CVC language extends to n bits
// BVZEROEXTEND(BITVECTOR(k), n) in CVC language extends to k + n bits
** Major contributors: mdeters
** Minor contributors (to current version): taking
** This file is part of the CVC4 prototype.
- ** Copyright (c) 2009, 2010, 2011 The Analysis of Computer Systems Group (ACSys)
+ ** Copyright (c) 2009-2012 The Analysis of Computer Systems Group (ACSys)
** Courant Institute of Mathematical Sciences
** New York University
** See the file COPYING in the top-level source directory for licensing
@header {
/**
** This file is part of the CVC4 prototype.
- ** Copyright (c) 2009, 2010, 2011 The Analysis of Computer Systems Group (ACSys)
+ ** Copyright (c) 2009-2012 The Analysis of Computer Systems Group (ACSys)
** Courant Institute of Mathematical Sciences
** New York University
** See the file COPYING in the top-level source directory for licensing
using namespace CVC4;
using namespace CVC4::parser;
-/* These need to be macros so they can refer to the PARSER macro, which will be defined
- * by ANTLR *after* this section. (If they were functions, PARSER would be undefined.) */
+/* These need to be macros so they can refer to the PARSER macro, which
+ * will be defined by ANTLR *after* this section. (If they were functions,
+ * PARSER would be undefined.) */
#undef PARSER_STATE
#define PARSER_STATE ((Smt2*)PARSER->super)
#undef EXPR_MANAGER
/**
* Parses an expression.
- * @return the parsed expression, or the Null Expr if we've reached the end of the input
+ * @return the parsed expression, or the Null Expr if we've reached the
+ * end of the input
*/
parseExpr returns [CVC4::parser::smt2::myExpr expr]
@declarations {
;
/**
- * Parse the internal portion of the command, ignoring the surrounding parentheses.
+ * Parse the internal portion of the command, ignoring the surrounding
+ * parentheses.
*/
command returns [CVC4::Command* cmd = NULL]
@declarations {
std::string s;
}
: INTEGER_LITERAL
- { sexpr = SExpr(AntlrInput::tokenToInteger($INTEGER_LITERAL)); }
+ { sexpr = SExpr(Integer(AntlrInput::tokenText($INTEGER_LITERAL))); }
| DECIMAL_LITERAL
{ sexpr = SExpr(AntlrInput::tokenToRational($DECIMAL_LITERAL)); }
| str[s]
#include "expr/expr.h"
#include "expr/expr_manager.h"
#include "util/proof.h"
-#include "util/util_model.h"
#include "smt/modal_exception.h"
#include "util/hash.h"
#include "options/options.h"
class NodeHashFunction;
class Command;
+class GetModelCommand;
class SmtEngine;
class DecisionEngine;
class TheoryEngine;
+class Model;
class StatisticsRegistry;
namespace context {
friend ::CVC4::StatisticsRegistry* ::CVC4::stats::getStatisticsRegistry(SmtEngine*);
friend void ::CVC4::smt::beforeSearch(std::string, bool, SmtEngine*) throw(ModalException);
// to access d_modelCommands
- friend size_t ::CVC4::Model::getNumCommands() const;
- friend const Command* ::CVC4::Model::getCommand(size_t) const;
+ friend class ::CVC4::Model;
+ // to access getModel(), which is private (for now)
+ friend class GetModelCommand;
StatisticsRegistry* d_statisticsRegistry;
*/
void addToModelCommand(Command* c);
+ /**
+ * Get the model (only if immediately preceded by a SAT
+ * or INVALID query). Only permitted if CVC4 was built with model
+ * support and produce-models is on.
+ */
+ Model* getModel() throw(ModalException);
+
public:
/**
*/
CVC4::SExpr getAssignment() throw(ModalException);
- /**
- * Get the model (only if immediately preceded by a SAT
- * or INVALID query). Only permitted if CVC4 was built with model
- * support and produce-models is on.
- */
- Model* getModel() throw(ModalException);
-
/**
* Get the last proof (only if immediately preceded by an UNSAT
* or VALID query). Only permitted if CVC4 was built with proof
** \brief Model class
**/
-#include "cvc4_public.h"
+#include "cvc4_private.h"
-#ifndef __CVC4__MODEL_H
-#define __CVC4__MODEL_H
+#ifndef __CVC4__UTIL_MODEL_H
+#define __CVC4__UTIL_MODEL_H
#include <iostream>
#include <vector>
namespace CVC4 {
-class CVC4_PUBLIC Command;
-class CVC4_PUBLIC SmtEngine;
-class CVC4_PUBLIC Model;
+class Command;
+class SmtEngine;
+class Model;
-std::ostream& operator<<(std::ostream&, Model&) CVC4_PUBLIC;
+std::ostream& operator<<(std::ostream&, Model&);
-class CVC4_PUBLIC Model {
+class Model {
friend std::ostream& operator<<(std::ostream&, Model&);
protected:
size_t getNumCommands() const;
/** get command */
const Command* getCommand(size_t i) const;
+
public:
/** get value for expression */
virtual Expr getValue(Expr expr) = 0;
virtual Cardinality getCardinality(Type t) = 0;
};/* class Model */
-class ModelBuilder
-{
+class ModelBuilder {
public:
- ModelBuilder(){}
- virtual ~ModelBuilder(){}
- virtual void buildModel( Model* m, bool fullModel ) = 0;
+ ModelBuilder() { }
+ virtual ~ModelBuilder() { }
+ virtual void buildModel(Model* m, bool fullModel) = 0;
};/* class ModelBuilder */
}/* CVC4 namespace */
-#endif /* __CVC4__MODEL_H */
+#endif /* __CVC4__UTIL_MODEL_H */
-% COMMAND-LINE: --parse-only
-% EXPECT:
-% EXIT: 0
+% EXPECT: valid
+% EXIT: 20
A : [0..0];
B : [ -5 .. 8];
H : [-1 ..1];
I : [0..10];
J : [-10..-9];
-J : [-10..-10];
+K : [-10..-10];
QUERY TRUE;