00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _cvc3__arith_theorem_producer_h_
00023 #define _cvc3__arith_theorem_producer_h_
00024
00025 #include "arith_proof_rules.h"
00026 #include "theorem_producer.h"
00027 #include "theory_arith_new.h"
00028
00029 namespace CVC3 {
00030 class TheoryArithNew;
00031
00032 class ArithTheoremProducer: public ArithProofRules, public TheoremProducer {
00033 TheoryArithNew* d_theoryArith;
00034 private:
00035
00036
00037
00038
00039
00040 Rational modEq(const Rational& i, const Rational& m);
00041
00042 Expr create_t(const Expr& eqn);
00043
00044 Expr create_t2(const Expr& lhs, const Expr& rhs, const Expr& t);
00045
00046 Expr create_t3(const Expr& lhs, const Expr& rhs, const Expr& t);
00047
00048
00049
00050
00051
00052 void sumModM(std::vector<Expr>& summands, const Expr& sum,
00053 const Rational& m, const Rational& divisor);
00054 Expr monomialModM(const Expr& e,
00055 const Rational& m, const Rational& divisor);
00056 void sumMulF(std::vector<Expr>& summands, const Expr& sum,
00057 const Rational& m, const Rational& divisor);
00058 Expr monomialMulF(const Expr& e,
00059 const Rational& m, const Rational& divisor);
00060
00061 Rational f(const Rational& i, const Rational& m);
00062 Expr substitute(const Expr& term, ExprMap<Expr>& eMap);
00063
00064
00065 public:
00066
00067 ArithTheoremProducer(TheoremManager* tm, TheoryArithNew* theoryArith):
00068 TheoremProducer(tm), d_theoryArith(theoryArith) { }
00069
00070
00071 Expr rat(Rational r) { return d_em->newRatExpr(r); }
00072 Type realType() { return d_theoryArith->realType(); }
00073 Type intType() { return d_theoryArith->intType(); }
00074
00075 Expr darkShadow(const Expr& lhs, const Expr& rhs) {
00076 return d_theoryArith->darkShadow(lhs, rhs);
00077 }
00078
00079
00080
00081 Expr grayShadow(const Expr& v, const Expr& e,
00082 const Rational& c1, const Rational& c2) {
00083 return d_theoryArith->grayShadow(v, e, c1, c2);
00084 }
00085
00086
00087
00088
00089
00090
00091 virtual Theorem varToMult(const Expr& e);
00092
00093
00094 virtual Theorem uMinusToMult(const Expr& e);
00095
00096
00097 virtual Theorem minusToPlus(const Expr& x, const Expr& y);
00098
00099
00100 virtual Theorem canonUMinusToDivide(const Expr& e);
00101
00102
00103
00104 virtual Theorem canonDivideConst(const Expr& c, const Expr& d);
00105
00106 virtual Theorem canonDivideMult(const Expr& cx, const Expr& d);
00107
00108
00109
00110
00111 virtual Theorem canonDividePlus(const Expr& e, const Expr& d);
00112
00113 virtual Theorem canonDivideVar(const Expr& e1, const Expr& e2);
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 static bool greaterthan(const Expr &, const Expr &);
00127 virtual Expr simplifiedMultExpr(std::vector<Expr> & mulKids);
00128 virtual Expr canonMultConstMult(const Expr & c, const Expr & e);
00129 virtual Expr canonMultConstPlus(const Expr & e1, const Expr & e2);
00130 virtual Expr canonMultPowPow(const Expr & e1, const Expr & e2);
00131 virtual Expr canonMultPowLeaf(const Expr & e1, const Expr & e2);
00132 virtual Expr canonMultLeafLeaf(const Expr & e1, const Expr & e2);
00133 virtual Expr canonMultLeafOrPowMult(const Expr & e1, const Expr & e2);
00134 virtual Expr canonCombineLikeTerms(const std::vector<Expr> & sumExprs);
00135 virtual Expr
00136 canonMultLeafOrPowOrMultPlus(const Expr & e1, const Expr & e2);
00137 virtual Expr canonMultPlusPlus(const Expr & e1, const Expr & e2);
00138 virtual Theorem canonMultMtermMterm(const Expr& e);
00139 virtual Theorem canonPlus(const Expr & e);
00140 virtual Theorem canonInvertConst(const Expr & e);
00141 virtual Theorem canonInvertLeaf(const Expr & e);
00142 virtual Theorem canonInvertPow(const Expr & e);
00143 virtual Theorem canonInvertMult(const Expr & e);
00144 virtual Theorem canonInvert(const Expr & e);
00145
00146
00147
00148
00149
00150
00151
00152
00153 virtual Theorem moveSumConstantRight(const Expr& e);
00154
00155
00156 virtual Theorem canonDivide(const Expr & e);
00157
00158
00159 virtual Theorem canonMult(const Expr & e);
00160
00161
00162 virtual Theorem canonMultTermConst(const Expr& c, const Expr& t);
00163
00164 virtual Theorem canonMultTerm1Term2(const Expr& t1, const Expr& t2);
00165
00166 virtual Theorem canonMultZero(const Expr& e);
00167
00168 virtual Theorem canonMultOne(const Expr& e);
00169
00170 virtual Theorem canonMultConstConst(const Expr& c1, const Expr& c2);
00171
00172 virtual Theorem
00173 canonMultConstTerm(const Expr& c1, const Expr& c2, const Expr&t);
00174
00175 virtual Theorem canonMultConstSum(const Expr& c1, const Expr& sum);
00176
00177 virtual Theorem canonPowConst(const Expr& pow);
00178
00179
00180
00181 virtual Theorem canonFlattenSum(const Expr& e);
00182
00183
00184
00185 virtual Theorem canonComboLikeTerms(const Expr& e);
00186
00187
00188 virtual Theorem multEqZero(const Expr& expr);
00189
00190
00191
00192 virtual Theorem powEqZero(const Expr& expr);
00193
00194
00195
00196 virtual Theorem elimPower(const Expr& expr);
00197
00198
00199
00200 virtual Theorem elimPowerConst(const Expr& expr, const Rational& root);
00201
00202
00203 virtual Theorem evenPowerEqNegConst(const Expr& expr);
00204
00205
00206 virtual Theorem intEqIrrational(const Expr& expr, const Theorem& isInt);
00207
00208
00209
00210 virtual Theorem constPredicate(const Expr& e);
00211
00212
00213 virtual Theorem rightMinusLeft(const Expr& e);
00214
00215
00216 virtual Theorem leftMinusRight(const Expr& e);
00217
00218
00219 virtual Theorem plusPredicate(const Expr& x,
00220 const Expr& y,
00221 const Expr& z, int kind);
00222
00223
00224 virtual Theorem multEqn(const Expr& x, const Expr& y, const Expr& z);
00225
00226
00227 virtual Theorem divideEqnNonConst(const Expr& x, const Expr& y, const Expr& z);
00228
00229
00230
00231 virtual Theorem multIneqn(const Expr& e, const Expr& z);
00232
00233
00234 virtual Theorem eqToIneq(const Expr& e);
00235
00236
00237 virtual Theorem flipInequality(const Expr& e);
00238
00239
00240
00241
00242
00243 Theorem negatedInequality(const Expr& e);
00244
00245 Theorem realShadow(const Theorem& alphaLTt, const Theorem& tLTbeta);
00246 Theorem realShadowEq(const Theorem& alphaLEt, const Theorem& tLEalpha);
00247 Theorem finiteInterval(const Theorem& aLEt, const Theorem& tLEac,
00248 const Theorem& isInta, const Theorem& isIntt);
00249
00250 Theorem darkGrayShadow2ab(const Theorem& betaLEbx,
00251 const Theorem& axLEalpha,
00252 const Theorem& isIntAlpha,
00253 const Theorem& isIntBeta,
00254 const Theorem& isIntx);
00255
00256 Theorem darkGrayShadow2ba(const Theorem& betaLEbx,
00257 const Theorem& axLEalpha,
00258 const Theorem& isIntAlpha,
00259 const Theorem& isIntBeta,
00260 const Theorem& isIntx);
00261
00262 Theorem expandDarkShadow(const Theorem& darkShadow);
00263 Theorem expandGrayShadow0(const Theorem& grayShadow);
00264 Theorem splitGrayShadow(const Theorem& grayShadow);
00265 Theorem splitGrayShadowSmall(const Theorem& grayShadow);
00266 Theorem expandGrayShadow(const Theorem& grayShadow);
00267 Theorem expandGrayShadowConst(const Theorem& grayShadow);
00268 Theorem grayShadowConst(const Theorem& g);
00269
00270
00271
00272
00273
00274 Rational constRHSGrayShadow(const Rational& c,
00275 const Rational& b,
00276 const Rational& a);
00277
00278 Theorem lessThanToLE(const Theorem& less, const Theorem& isIntLHS,
00279 const Theorem& isIntRHS, bool changeRight);
00280
00281 Theorem lessThanToLERewrite(const Expr& ineq, const Theorem& isIntLHS,
00282 const Theorem& isIntRHS, bool changeRight);
00283
00284 Theorem intVarEqnConst(const Expr& eqn, const Theorem& isIntx);
00285
00286 Theorem IsIntegerElim(const Theorem& isIntx);
00287 Theorem eqElimIntRule(const Theorem& eqn, const Theorem& isIntx,
00288 const std::vector<Theorem>& isIntVars);
00289
00290 Theorem isIntConst(const Expr& e);
00291
00292 Theorem equalLeaves1(const Theorem& e);
00293 Theorem equalLeaves2(const Theorem& e);
00294 Theorem equalLeaves3(const Theorem& e);
00295 Theorem equalLeaves4(const Theorem& e);
00296
00297 Theorem diseqToIneq(const Theorem& diseq);
00298
00299 Theorem dummyTheorem(const Expr& e);
00300
00301 Theorem oneElimination(const Expr& x);
00302
00303 Theorem clashingBounds(const Theorem& lowerBound, const Theorem& upperBound);
00304
00305 Theorem addInequalities(const Theorem& thm1, const Theorem& thm2);
00306 Theorem addInequalities(const std::vector<Theorem>& thms);
00307
00308 Theorem implyWeakerInequality(const Expr& expr1, const Expr& expr2);
00309
00310 Theorem implyNegatedInequality(const Expr& expr1, const Expr& expr2);
00311
00312 Theorem integerSplit(const Expr& intVar, const Rational& intPoint);
00313
00314 Theorem trustedRewrite(const Expr& expr1, const Expr& expr2);
00315
00316 Theorem rafineStrictInteger(const Theorem& isIntConstrThm, const Expr& constr);
00317
00318 Theorem simpleIneqInt(const Expr& ineq, const Theorem& isIntRHS);
00319
00320 Theorem intEqualityRationalConstant(const Theorem& isIntConstrThm, const Expr& constr);
00321
00322 Theorem cycleConflict(const std::vector<Theorem>& inequalitites);
00323
00324 Theorem implyEqualities(const std::vector<Theorem>& inequalities);
00325
00326 Theorem implyWeakerInequalityDiffLogic(const std::vector<Theorem>& antecedentThms, const Expr& implied);
00327
00328 Theorem implyNegatedInequalityDiffLogic(const std::vector<Theorem>& antecedentThms, const Expr& implied);
00329
00330 Theorem expandGrayShadowRewrite(const Expr& theShadow);
00331
00332 Theorem compactNonLinearTerm(const Expr& nonLinear);
00333
00334 Theorem nonLinearIneqSignSplit(const Theorem& ineqThm);
00335
00336 Theorem implyDiffLogicBothBounds(const Expr& x, std::vector<Theorem>& c1_le_x, Rational c1,
00337 std::vector<Theorem>& x_le_c2, Rational c2);
00338
00339 Theorem powerOfOne(const Expr& e);
00340
00341 };
00342
00343 }
00344
00345 #endif