00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CVC_lite__arith_theorem_producer_h_
00031 #define _CVC_lite__arith_theorem_producer_h_
00032
00033 #include "arith_proof_rules.h"
00034 #include "theorem_producer.h"
00035 #include "theory_arith.h"
00036
00037 namespace CVCL {
00038 class TheoryArith;
00039
00040 class ArithTheoremProducer: public ArithProofRules, public TheoremProducer {
00041 TheoryArith* d_theoryArith;
00042 private:
00043
00044
00045
00046
00047
00048 Rational modEq(const Rational& i, const Rational& m);
00049
00050 Expr create_t(const Expr& eqn);
00051
00052 Expr create_t2(const Expr& lhs, const Expr& rhs, const Expr& t);
00053
00054 Expr create_t3(const Expr& lhs, const Expr& rhs, const Expr& t);
00055
00056
00057
00058
00059
00060 void sumModM(std::vector<Expr>& summands, const Expr& sum,
00061 const Rational& m, const Rational& divisor);
00062 Expr monomialModM(const Expr& e,
00063 const Rational& m, const Rational& divisor);
00064 void sumMulF(std::vector<Expr>& summands, const Expr& sum,
00065 const Rational& m, const Rational& divisor);
00066 Expr monomialMulF(const Expr& e,
00067 const Rational& m, const Rational& divisor);
00068
00069 Rational f(const Rational& i, const Rational& m);
00070 Expr substitute(const Expr& term, ExprMap<Expr>& eMap);
00071
00072 public:
00073
00074 ArithTheoremProducer(TheoremManager* tm, TheoryArith* theoryArith):
00075 TheoremProducer(tm), d_theoryArith(theoryArith) { }
00076
00077
00078 Expr rat(Rational r) { return d_em->newRatExpr(r); }
00079 Type realType() { return d_theoryArith->realType(); }
00080 Type intType() { return d_theoryArith->intType(); }
00081
00082 Expr darkShadow(const Expr& lhs, const Expr& rhs) {
00083 return d_theoryArith->darkShadow(lhs, rhs);
00084 }
00085
00086
00087
00088 Expr grayShadow(const Expr& v, const Expr& e,
00089 const Rational& c1, const Rational& c2) {
00090 return d_theoryArith->grayShadow(v, e, c1, c2);
00091 }
00092
00093
00094
00095
00096
00097
00098 virtual Theorem uMinusToMult(const Expr& e);
00099
00100
00101 virtual Theorem minusToPlus(const Expr& x, const Expr& y);
00102
00103
00104 virtual Theorem canonUMinusToDivide(const Expr& e);
00105
00106
00107
00108 virtual Theorem canonDivideConst(const Expr& c, const Expr& d);
00109
00110 virtual Theorem canonDivideMult(const Expr& cx, const Expr& d);
00111
00112
00113
00114
00115 virtual Theorem canonDividePlus(const Expr& e, const Expr& d);
00116
00117 virtual Theorem canonDivideVar(const Expr& e, const Expr& e);
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 static bool greaterthan(const Expr &, const Expr &);
00131 virtual Expr simplifiedMultExpr(std::vector<Expr> & mulKids);
00132 virtual Expr canonMultConstMult(const Expr & c, const Expr & e);
00133 virtual Expr canonMultConstPlus(const Expr & e1, const Expr & e2);
00134 virtual Expr canonMultPowPow(const Expr & e1, const Expr & e2);
00135 virtual Expr canonMultPowLeaf(const Expr & e1, const Expr & e2);
00136 virtual Expr canonMultLeafLeaf(const Expr & e1, const Expr & e2);
00137 virtual Expr canonMultLeafOrPowMult(const Expr & e1, const Expr & e2);
00138 virtual Expr canonCombineLikeTerms(const std::vector<Expr> & sumExprs);
00139 virtual Expr
00140 canonMultLeafOrPowOrMultPlus(const Expr & e1, const Expr & e2);
00141 virtual Expr canonMultPlusPlus(const Expr & e1, const Expr & e2);
00142 virtual Theorem canonMultMtermMterm(const Expr& e);
00143 virtual Theorem canonPlus(const Expr & e);
00144 virtual Theorem canonMult(const Expr & e);
00145 virtual Theorem canonInvertConst(const Expr & e);
00146 virtual Theorem canonInvertLeaf(const Expr & e);
00147 virtual Theorem canonInvertPow(const Expr & e);
00148 virtual Theorem canonInvertMult(const Expr & e);
00149 virtual Theorem canonInvert(const Expr & e);
00150 virtual Theorem canonDivide(const Expr & e);
00151
00152
00153
00154 virtual Theorem canonMultTermConst(const Expr& c, const Expr& t);
00155
00156 virtual Theorem canonMultTerm1Term2(const Expr& t1, const Expr& t2);
00157
00158 virtual Theorem canonMultZero(const Expr& e);
00159
00160 virtual Theorem canonMultOne(const Expr& e);
00161
00162 virtual Theorem canonMultConstConst(const Expr& c1, const Expr& c2);
00163
00164 virtual Theorem
00165 canonMultConstTerm(const Expr& c1, const Expr& c2, const Expr&t);
00166
00167 virtual Theorem canonMultConstSum(const Expr& c1, const Expr& sum);
00168
00169 virtual Theorem canonPowConst(const Expr& pow);
00170
00171
00172
00173 virtual Theorem canonFlattenSum(const Expr& e);
00174
00175
00176
00177 virtual Theorem canonComboLikeTerms(const Expr& e);
00178
00179
00180
00181 virtual Theorem constPredicate(const Expr& e);
00182
00183
00184 virtual Theorem rightMinusLeft(const Expr& e);
00185
00186
00187 virtual Theorem plusPredicate(const Expr& x,
00188 const Expr& y,
00189 const Expr& z, int kind);
00190
00191
00192 virtual Theorem multEqn(const Expr& x, const Expr& y, const Expr& z);
00193
00194
00195
00196 virtual Theorem multIneqn(const Expr& e, const Expr& z);
00197
00198
00199 virtual Theorem flipInequality(const Expr& e);
00200
00201
00202
00203
00204
00205 Theorem negatedInequality(const Expr& e);
00206
00207 Theorem realShadow(const Theorem& alphaLTt, const Theorem& tLTbeta);
00208 Theorem realShadowEq(const Theorem& alphaLEt, const Theorem& tLEalpha);
00209 Theorem finiteInterval(const Theorem& aLEt, const Theorem& tLEac,
00210 const Theorem& isInta, const Theorem& isIntt);
00211
00212 Theorem darkGrayShadow2ab(const Theorem& betaLEbx,
00213 const Theorem& axLEalpha,
00214 const Theorem& isIntAlpha,
00215 const Theorem& isIntBeta,
00216 const Theorem& isIntx);
00217
00218 Theorem darkGrayShadow2ba(const Theorem& betaLEbx,
00219 const Theorem& axLEalpha,
00220 const Theorem& isIntAlpha,
00221 const Theorem& isIntBeta,
00222 const Theorem& isIntx);
00223
00224 Theorem expandDarkShadow(const Theorem& darkShadow);
00225 Theorem expandGrayShadow0(const Theorem& grayShadow);
00226 Theorem splitGrayShadow(const Theorem& grayShadow);
00227 Theorem expandGrayShadow(const Theorem& grayShadow);
00228 Theorem expandGrayShadowConst(const Theorem& grayShadow);
00229 Theorem grayShadowConst(const Theorem& g);
00230
00231
00232
00233
00234
00235 Rational constRHSGrayShadow(const Rational& c,
00236 const Rational& b,
00237 const Rational& a);
00238
00239 Theorem lessThanToLE(const Theorem& less, const Theorem& isIntLHS,
00240 const Theorem& isIntRHS, bool changeRight);
00241
00242 Theorem intVarEqnConst(const Expr& eqn, const Theorem& isIntx);
00243
00244 Theorem eqElimIntRule(const Theorem& eqn, const Theorem& isIntx,
00245 const std::vector<Theorem>& isIntVars);
00246
00247 Theorem isIntConst(const Expr& e);
00248
00249 Theorem equalLeaves1(const Theorem& e);
00250 Theorem equalLeaves2(const Theorem& e);
00251 Theorem equalLeaves3(const Theorem& e);
00252 Theorem equalLeaves4(const Theorem& e);
00253
00254 Theorem diseqToIneq(const Theorem& diseq);
00255 };
00256
00257 }
00258
00259 #endif