1 /********************* */
4 ** Original author: cconway
5 ** Major contributors: none
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 prototype.
8 ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys)
9 ** Courant Institute of Mathematical Sciences
10 ** New York University
11 ** See the file COPYING in the top-level source directory for licensing
12 ** information.\endverbatim
14 ** \brief Definitions of SMT2 constants.
16 ** Definitions of SMT2 constants.
19 #include "parser/parser.h"
20 #include "parser/smt/smt.h"
21 #include "parser/smt2/smt2.h"
26 Smt2::Smt2(ExprManager
* exprManager
, Input
* input
, bool strictMode
) :
27 Parser(exprManager
,input
,strictMode
),
29 if( !strictModeEnabled() ) {
30 addTheory(Smt2::THEORY_CORE
);
34 void Smt2::addArithmeticOperators() {
35 addOperator(kind::PLUS
);
36 addOperator(kind::MINUS
);
37 addOperator(kind::UMINUS
);
38 addOperator(kind::MULT
);
39 addOperator(kind::LT
);
40 addOperator(kind::LEQ
);
41 addOperator(kind::GT
);
42 addOperator(kind::GEQ
);
46 * Add theory symbols to the parser state.
48 * @param parser the CVC4 Parser object
49 * @param theory the theory to open (e.g., Core, Ints)
51 void Smt2::addTheory(Theory theory
) {
54 defineType("Bool", getExprManager()->booleanType());
55 defineVar("true", getExprManager()->mkConst(true));
56 defineVar("false", getExprManager()->mkConst(false));
57 addOperator(kind::AND
);
58 addOperator(kind::EQUAL
);
59 addOperator(kind::IFF
);
60 addOperator(kind::IMPLIES
);
61 addOperator(kind::ITE
);
62 addOperator(kind::NOT
);
63 addOperator(kind::OR
);
64 addOperator(kind::XOR
);
67 case THEORY_REALS_INTS
:
68 defineType("Real", getExprManager()->realType());
69 // falling-through on purpose, to add Ints part of RealsInts
72 defineType("Int", getExprManager()->integerType());
73 addArithmeticOperators();
77 defineType("Real", getExprManager()->realType());
78 addArithmeticOperators();
86 bool Smt2::logicIsSet() {
91 * Sets the logic for the current benchmark. Declares any logic and theory symbols.
93 * @param parser the CVC4 Parser object
94 * @param name the name of the logic (e.g., QF_UF, AUFLIA)
96 void Smt2::setLogic(const std::string
& name
) {
98 d_logic
= Smt::toLogic(name
);
100 // Core theory belongs to every logic
101 addTheory(THEORY_CORE
);
105 /* No extra symbols necessary */
111 addTheory(THEORY_INTS
);
116 addTheory(THEORY_REALS
);
120 addTheory(THEORY_INTS
);
121 // falling-through on purpose, to add UF part of UFIDL
124 addOperator(kind::APPLY_UF
);
138 void Smt2::setInfo(const std::string
& flag
, const SExpr
& sexpr
) {
142 }/* CVC4::parser namespace */
143 }/* CVC4 namespace */