1 /********************* */
2 /*! \file theory_arith.cpp
4 ** Original author: Tim King
5 ** Major contributors: Morgan Deters
6 ** Minor contributors (to current version): Andrew Reynolds, Martin Brain <>, Tianyi Liang, Dejan Jovanovic
7 ** This file is part of the CVC4 project.
8 ** Copyright (c) 2009-2014 New York University and The University of Iowa
9 ** See the file COPYING in the top-level source directory for licensing
10 ** information.\endverbatim
12 ** \brief [[ Add one-line brief description here ]]
14 ** [[ Add lengthier description here ]]
15 ** \todo document this file
18 #include "theory/arith/theory_arith.h"
20 #include "options/smt_options.h"
21 #include "theory/arith/infer_bounds.h"
22 #include "theory/arith/theory_arith_private.h"
25 using namespace CVC4::kind
;
31 TheoryArith::TheoryArith(context::Context
* c
, context::UserContext
* u
,
32 OutputChannel
& out
, Valuation valuation
,
33 const LogicInfo
& logicInfo
, SmtGlobals
* globals
)
34 : Theory(THEORY_ARITH
, c
, u
, out
, valuation
, logicInfo
, globals
)
35 , d_internal(new TheoryArithPrivate(*this, c
, u
, out
, valuation
, logicInfo
))
38 TheoryArith::~TheoryArith(){
42 void TheoryArith::preRegisterTerm(TNode n
){
43 d_internal
->preRegisterTerm(n
);
46 Node
TheoryArith::expandDefinition(LogicRequest
&logicRequest
, Node node
) {
47 return d_internal
->expandDefinition(logicRequest
, node
);
50 void TheoryArith::setMasterEqualityEngine(eq::EqualityEngine
* eq
) {
51 d_internal
->setMasterEqualityEngine(eq
);
54 void TheoryArith::setQuantifiersEngine(QuantifiersEngine
* qe
) {
55 this->Theory::setQuantifiersEngine(qe
);
56 d_internal
->setQuantifiersEngine(qe
);
59 void TheoryArith::addSharedTerm(TNode n
){
60 d_internal
->addSharedTerm(n
);
63 Node
TheoryArith::ppRewrite(TNode atom
) {
64 CodeTimer
timer(d_ppRewriteTimer
, /* allow_reentrant = */ true);
65 return d_internal
->ppRewrite(atom
);
68 Theory::PPAssertStatus
TheoryArith::ppAssert(TNode in
, SubstitutionMap
& outSubstitutions
) {
69 return d_internal
->ppAssert(in
, outSubstitutions
);
72 void TheoryArith::ppStaticLearn(TNode n
, NodeBuilder
<>& learned
) {
73 d_internal
->ppStaticLearn(n
, learned
);
76 void TheoryArith::check(Effort effortLevel
){
77 getOutputChannel().spendResource(options::theoryCheckStep());
78 d_internal
->check(effortLevel
);
81 Node
TheoryArith::explain(TNode n
) {
82 return d_internal
->explain(n
);
85 void TheoryArith::propagate(Effort e
) {
86 d_internal
->propagate(e
);
89 void TheoryArith::collectModelInfo( TheoryModel
* m
, bool fullModel
){
90 d_internal
->collectModelInfo(m
, fullModel
);
93 void TheoryArith::notifyRestart(){
94 d_internal
->notifyRestart();
97 void TheoryArith::presolve(){
98 d_internal
->presolve();
101 EqualityStatus
TheoryArith::getEqualityStatus(TNode a
, TNode b
) {
102 return d_internal
->getEqualityStatus(a
,b
);
105 Node
TheoryArith::getModelValue(TNode var
) {
106 return d_internal
->getModelValue( var
);
110 std::pair
<bool, Node
> TheoryArith::entailmentCheck (TNode lit
,
111 const EntailmentCheckParameters
* params
,
112 EntailmentCheckSideEffects
* out
)
114 const ArithEntailmentCheckParameters
* aparams
= NULL
;
116 ArithEntailmentCheckParameters
* def
= new ArithEntailmentCheckParameters();
117 def
->addLookupRowSumAlgorithms();
120 AlwaysAssert(params
->getTheoryId() == getId());
121 aparams
= dynamic_cast<const ArithEntailmentCheckParameters
*>(params
);
123 Assert(aparams
!= NULL
);
125 ArithEntailmentCheckSideEffects
* ase
= NULL
;
127 ase
= new ArithEntailmentCheckSideEffects();
129 AlwaysAssert(out
->getTheoryId() == getId());
130 ase
= dynamic_cast<ArithEntailmentCheckSideEffects
*>(out
);
134 std::pair
<bool, Node
> res
= d_internal
->entailmentCheck(lit
, *aparams
, *ase
);
146 }/* CVC4::theory::arith namespace */
147 }/* CVC4::theory namespace */
148 }/* CVC4 namespace */