CVC3
|
00001 #ifndef LFSC_OBJ_H_ 00002 #define LFSC_OBJ_H_ 00003 00004 #include "Object.h" 00005 #include "Util.h" 00006 00007 class LFSCPrinter; 00008 00009 class LFSCObj : public Obj 00010 { 00011 public: 00012 LFSCObj(){} 00013 static void initialize( const Expr& pf_expr, int lfscm ); 00014 protected: 00015 //the printer object 00016 static LFSCPrinter* printer; 00017 //counters 00018 static int formula_i; 00019 static int trusted_i; 00020 static int term_i; 00021 static int tnorm_i; 00022 //options for the conversion 00023 static int lfsc_mode; 00024 static bool debug_conv; 00025 static bool debug_var; 00026 static bool cvc3_mimic; 00027 static bool cvc3_mimic_input; 00028 //null rational 00029 static Rational nullRat; 00030 //get number of nodes 00031 static ExprMap< int > nnode_map; 00032 static int getNumNodes( const Expr& pf, bool recount = false ); 00033 //cascade expr 00034 static ExprMap< Expr > cas_map; 00035 static Expr cascade_expr( const Expr& e ); 00036 //skolem variables 00037 static ExprMap< Expr > skolem_vars; //with the expr they point to 00038 static ExprMap< bool > temp_visited; 00039 static void define_skolem_vars( const Expr& e ); 00040 //is variable 00041 static bool isVar( const Expr& e ); 00042 //collect free variables 00043 static void collect_vars( const Expr& e, bool readPred = true ); 00044 protected: 00045 // this is actually the M map <formula, int> where M = {v_i -> non-negated formula} 00046 static ExprMap<int> d_formulas; 00047 //trusted formulas 00048 static ExprMap<int> d_trusted; 00049 // this is the M_t map <term, int> where M_t = { v_i -> term } 00050 static ExprMap<int> d_pn; 00051 //this is the equations that will use the d_pn map. They are mapped to the index of the pn_i they will use 00052 static ExprMap<int> d_pn_form; 00053 //similar to m, but with terms 00054 static ExprMap<int> d_terms; 00055 //input variables 00056 static ExprMap<bool> input_vars; 00057 //input predicates 00058 static ExprMap<bool> input_preds; 00059 //pnt that are needed to print 00060 static std::map< int, bool > pntNeeded; 00061 //atoms that must be printed 00062 static ExprMap<bool> d_formulas_printed; 00063 //original proof expression 00064 static Expr d_pf_expr; 00065 //assumptions 00066 static ExprMap<bool> d_assump_map; 00067 protected: 00068 //eliminate not not 00069 static Expr queryElimNotNot(const Expr& expr); 00070 //get base will get you the base formula, i.e. ~( a = b ) returns ( a = b ) 00071 //get base = false will get you the equivalent atomic, i.e. ~( a = b ) returns ( b != a ) 00072 static Expr queryAtomic(const Expr& expr, bool getBase = false ); 00073 //returns a integer v, +v means M( v ) = expr, -v means M( v ) = expr', where expr := NOT expr' 00074 //add is whether or not to add it to M, or just query 00075 static int queryM(const Expr& expr, bool add = true, bool trusted = false); 00076 //returns an integer v, where M_t( v ) = expr 00077 static int queryMt(const Expr& expr); 00078 //similar to m, but this time it is with terms 00079 static int queryT( const Expr& e ); 00080 //get Y 00081 static bool getY( const Expr& e, Expr& pe, bool doIff = true, bool doLogic = true ); 00082 //is this expr a formula 00083 static bool isFormula( const Expr& e ); 00084 //can this expr be polynomial normalized 00085 static bool can_pnorm( const Expr& e ); 00086 //what is proven 00087 static bool what_is_proven( const Expr& pf, Expr& pe ); 00088 protected: 00089 // differentiate between variables and rules 00090 static ExprMap<bool> d_rules; 00091 // boolean resultion rules 00092 static Expr d_bool_res_str; 00093 static Expr d_assump_str; 00094 // arithmetic rules 00095 static Expr d_iff_mp_str; 00096 static Expr d_impl_mp_str; 00097 static Expr d_iff_trans_str; 00098 static Expr d_real_shadow_str; 00099 static Expr d_cycle_conflict_str; 00100 static Expr d_real_shadow_eq_str; 00101 static Expr d_basic_subst_op_str; 00102 static Expr d_mult_ineqn_str; 00103 static Expr d_right_minus_left_str; 00104 static Expr d_eq_trans_str; 00105 static Expr d_eq_symm_str; 00106 static Expr d_canon_plus_str; 00107 static Expr d_refl_str; 00108 static Expr d_cnf_convert_str; 00109 static Expr d_learned_clause_str; 00110 static Expr d_minus_to_plus_str; 00111 static Expr d_plus_predicate_str; 00112 static Expr d_negated_inequality_str; 00113 static Expr d_flip_inequality_str; 00114 static Expr d_optimized_subst_op_str; 00115 static Expr d_iff_true_elim_str; 00116 static Expr d_basic_subst_op1_str; 00117 static Expr d_basic_subst_op0_str; 00118 static Expr d_canon_mult_str; 00119 static Expr d_canon_invert_divide_str; 00120 static Expr d_iff_true_str; 00121 static Expr d_mult_eqn_str; 00122 static Expr d_rewrite_eq_symm_str; 00123 static Expr d_implyWeakerInequality_str; 00124 static Expr d_implyWeakerInequalityDiffLogic_str; 00125 static Expr d_imp_mp_str; 00126 static Expr d_rewrite_implies_str; 00127 static Expr d_rewrite_or_str; 00128 static Expr d_rewrite_and_str; 00129 static Expr d_rewrite_iff_symm_str; 00130 static Expr d_iff_not_false_str; 00131 static Expr d_iff_false_str; 00132 static Expr d_iff_false_elim_str; 00133 static Expr d_not_to_iff_str; 00134 static Expr d_not_not_elim_str; 00135 static Expr d_const_predicate_str; 00136 static Expr d_rewrite_not_not_str; 00137 static Expr d_rewrite_not_true_str; 00138 static Expr d_rewrite_not_false_str; 00139 static Expr d_if_lift_rule_str; 00140 static Expr d_CNFITE_str; 00141 static Expr d_var_intro_str; 00142 static Expr d_int_const_eq_str; 00143 static Expr d_rewrite_eq_refl_str; 00144 static Expr d_iff_symm_str; 00145 static Expr d_rewrite_iff_str; 00146 static Expr d_implyNegatedInequality_str; 00147 static Expr d_uminus_to_mult_str; 00148 static Expr d_lessThan_To_LE_rhs_rwr_str; 00149 static Expr d_rewrite_ite_same_str; 00150 static Expr d_andE_str; 00151 static Expr d_implyEqualities_str; 00152 static Expr d_addInequalities_str; 00153 //CNF rules 00154 static Expr d_CNF_str; 00155 static Expr d_cnf_add_unit_str; 00156 static Expr d_minisat_proof_str; 00157 //reasons for CNF 00158 static Expr d_or_final_s; 00159 static Expr d_and_final_s; 00160 static Expr d_ite_s; 00161 static Expr d_iff_s; 00162 static Expr d_imp_s; 00163 static Expr d_or_mid_s; 00164 static Expr d_and_mid_s; 00165 }; 00166 00167 #endif