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
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 #ifndef _CVC3_TRUSTED_
00069 #warning "This file should be included only by TRUSTED code. Define _CVC3_TRUSTED_ before including this file."
00070 #endif
00071
00072 #ifndef _cvc3__theorem_producer_h_
00073 #define _cvc3__theorem_producer_h_
00074
00075 #include "theorem.h"
00076 #include "theorem_manager.h"
00077 #include "exception.h"
00078
00079
00080
00081
00082
00083 #define CHECK_SOUND(cond, msg) if(!(cond)) \
00084 soundError(__FILE__, __LINE__, #cond, msg)
00085
00086
00087 #define CHECK_PROOFS *d_checkProofs
00088
00089 namespace CVC3 {
00090
00091 class TheoremProducer {
00092
00093 protected:
00094 TheoremManager* d_tm;
00095 ExprManager* d_em;
00096
00097
00098 const bool* d_checkProofs;
00099
00100 Op d_pfOp;
00101
00102 Expr d_hole;
00103
00104
00105
00106
00107 Theorem newTheorem(const Expr& thm,
00108 const Assumptions& assump,
00109 const Proof& pf) {
00110 IF_DEBUG(if(!thm.isEq() && !thm.isIff()) {
00111 TRACE("newTheorem", "newTheorem(", thm, ")");
00112 debugger.counter("newTheorem() called on equality")++;
00113 });
00114 return Theorem(d_tm, thm, assump, pf);
00115 }
00116
00117
00118 Theorem newRWTheorem(const Expr& lhs, const Expr& rhs,
00119 const Assumptions& assump,
00120 const Proof& pf) {
00121 return Theorem(d_tm, lhs, rhs, assump, pf);
00122 }
00123
00124
00125 Theorem newReflTheorem(const Expr& e) {
00126 return Theorem(e);
00127 }
00128
00129 Theorem newAssumption(const Expr& thm, const Proof& pf, int scope = -1) {
00130 return Theorem(d_tm, thm, Assumptions::emptyAssump(), pf, true, scope);
00131 }
00132
00133 Theorem3 newTheorem3(const Expr& thm,
00134 const Assumptions& assump,
00135 const Proof& pf) {
00136 IF_DEBUG(if(!thm.isEq() && !thm.isIff()) {
00137 TRACE("newTheorem", "newTheorem3(", thm, ")");
00138 debugger.counter("newTheorem3() called on equality")++;
00139 });
00140 return Theorem3(d_tm, thm, assump, pf);
00141 }
00142
00143 Theorem3 newRWTheorem3(const Expr& lhs, const Expr& rhs,
00144 const Assumptions& assump,
00145 const Proof& pf) {
00146 return Theorem3(d_tm, lhs, rhs, assump, pf);
00147 }
00148
00149 void soundError(const std::string& file, int line,
00150 const std::string& cond, const std::string& msg);
00151
00152 public:
00153
00154 TheoremProducer(TheoremManager *tm);
00155
00156 virtual ~TheoremProducer() { }
00157
00158
00159 bool withProof() { return d_tm->withProof(); }
00160
00161
00162 bool withAssumptions() { return d_tm->withAssumptions(); }
00163
00164
00165 Proof newLabel(const Expr& e);
00166
00167
00168
00169
00170
00171
00172 Proof newPf(const std::string& name);
00173 Proof newPf(const std::string& name, const Expr& e);
00174 Proof newPf(const std::string& name, const Proof& pf);
00175 Proof newPf(const std::string& name, const Expr& e1, const Expr& e2);
00176 Proof newPf(const std::string& name, const Expr& e, const Proof& pf);
00177 Proof newPf(const std::string& name, const Expr& e1,
00178 const Expr& e2, const Expr& e3);
00179 Proof newPf(const std::string& name, const Expr& e1,
00180 const Expr& e2, const Proof& pf);
00181
00182
00183
00184
00185
00186
00187 Proof newPf(const std::string& name,
00188 Expr::iterator begin, const Expr::iterator &end);
00189 Proof newPf(const std::string& name, const Expr& e,
00190 Expr::iterator begin, const Expr::iterator &end);
00191 Proof newPf(const std::string& name,
00192 Expr::iterator begin, const Expr::iterator &end,
00193 const std::vector<Proof>& pfs);
00194
00195
00196 Proof newPf(const std::string& name, const std::vector<Expr>& args);
00197 Proof newPf(const std::string& name, const Expr& e,
00198 const std::vector<Expr>& args);
00199 Proof newPf(const std::string& name, const Expr& e,
00200 const std::vector<Proof>& pfs);
00201 Proof newPf(const std::string& name, const Expr& e1, const Expr& e2,
00202 const std::vector<Proof>& pfs);
00203 Proof newPf(const std::string& name, const std::vector<Proof>& pfs);
00204 Proof newPf(const std::string& name, const std::vector<Expr>& args,
00205 const Proof& pf);
00206 Proof newPf(const std::string& name, const std::vector<Expr>& args,
00207 const std::vector<Proof>& pfs);
00208
00209
00210
00211
00212 Proof newPf(const Proof& label, const Expr& frm, const Proof& pf);
00213
00214
00215
00216 Proof newPf(const Proof& label, const Proof& pf);
00217
00218
00219
00220 Proof newPf(const std::vector<Proof>& labels,
00221 const std::vector<Expr>& frms,
00222 const Proof& pf);
00223
00224 Proof newPf(const std::vector<Proof>& labels,
00225 const Proof& pf);
00226
00227 };
00228
00229 };
00230 #endif