spot
0.9.1
|
00001 // Copyright (C) 2011, 2012 Laboratoire de Recherche et Developpement 00002 // de l'Epita (LRDE). 00003 // 00004 // This file is part of Spot, a model checking library. 00005 // 00006 // Spot is free software; you can redistribute it and/or modify it 00007 // under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // Spot is distributed in the hope that it will be useful, but WITHOUT 00012 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00013 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00014 // License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with Spot; see the file COPYING. If not, write to the Free 00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00019 // 02111-1307, USA. 00020 00021 #ifndef SPOT_LTLVISIT_SIMPLIFY_HH 00022 # define SPOT_LTLVISIT_SIMPLIFY_HH 00023 00024 #include "ltlast/formula.hh" 00025 #include "bdd.h" 00026 #include "tgba/bdddict.hh" 00027 #include <iosfwd> 00028 00029 namespace spot 00030 { 00031 namespace ltl 00032 { 00033 class ltl_simplifier_options 00034 { 00035 public: 00036 ltl_simplifier_options(bool basics = true, 00037 bool synt_impl = true, 00038 bool event_univ = true, 00039 bool containment_checks = false, 00040 bool containment_checks_stronger = false, 00041 bool nenoform_stop_on_boolean = false, 00042 bool reduce_size_strictly = false) 00043 : reduce_basics(basics), 00044 synt_impl(synt_impl), 00045 event_univ(event_univ), 00046 containment_checks(containment_checks), 00047 containment_checks_stronger(containment_checks_stronger), 00048 nenoform_stop_on_boolean(nenoform_stop_on_boolean), 00049 reduce_size_strictly(reduce_size_strictly) 00050 { 00051 } 00052 00053 bool reduce_basics; 00054 bool synt_impl; 00055 bool event_univ; 00056 bool containment_checks; 00057 bool containment_checks_stronger; 00058 // If true, Boolean subformulae will not be put into 00059 // negative normal form. 00060 bool nenoform_stop_on_boolean; 00061 // If true, some rules that produce slightly larger formulae 00062 // will be disabled. Those larger formulae are normally easier 00063 // to translate, so we recommend to set this to false. 00064 bool reduce_size_strictly; 00065 }; 00066 00067 // fwd declaration to hide technical details. 00068 class ltl_simplifier_cache; 00069 00072 class ltl_simplifier 00073 { 00074 public: 00075 ltl_simplifier(bdd_dict* dict = 0); 00076 ltl_simplifier(ltl_simplifier_options& opt, bdd_dict* dict = 0); 00077 ~ltl_simplifier(); 00078 00081 const formula* simplify(const formula* f); 00082 00091 const formula* 00092 negative_normal_form(const formula* f, bool negated = false); 00093 00113 bool syntactic_implication(const formula* f, const formula* g); 00119 bool syntactic_implication_neg(const formula* f, const formula* g, 00120 bool right); 00121 00126 bool are_equivalent(const formula* f, const formula* g); 00127 00132 bdd as_bdd(const formula* f); 00133 00143 void clear_as_bdd_cache(); 00144 00146 bdd_dict* get_dict() const; 00147 00149 const formula* star_normal_form(const formula* f); 00150 00152 void print_stats(std::ostream& os) const; 00153 00154 private: 00155 ltl_simplifier_cache* cache_; 00156 // Copy disallowed. 00157 ltl_simplifier(const ltl_simplifier&); 00158 bool owndict; 00159 }; 00160 } 00161 00162 } 00163 00164 #endif // SPOT_LTLVISIT_SIMPLIFY_HH