spot
0.8.1
|
00001 // Copyright (C) 2008, 2009, 2011 Laboratoire de Recherche et Développement 00002 // de l'Epita (LRDE). 00003 // Copyright (C) 2004, 2005, 2006 Laboratoire d'Informatique de 00004 // Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), 00005 // Université Pierre et Marie Curie. 00006 // 00007 // This file is part of Spot, a model checking library. 00008 // 00009 // Spot is free software; you can redistribute it and/or modify it 00010 // under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation; either version 2 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // Spot is distributed in the hope that it will be useful, but WITHOUT 00015 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00016 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00017 // License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with Spot; see the file COPYING. If not, write to the Free 00021 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00022 // 02111-1307, USA. 00023 00024 #ifndef SPOT_TGBA_TGBAREDUC_HH 00025 # define SPOT_TGBA_TGBAREDUC_HH 00026 00027 #include "tgbaexplicit.hh" 00028 #include "tgbaalgos/reachiter.hh" 00029 00030 #include <list> 00031 #include <vector> 00032 00033 namespace spot 00034 { 00035 typedef std::pair<const spot::state*, const spot::state*> state_couple; 00036 typedef std::vector<state_couple*> simulation_relation; 00037 00038 /* 00039 typedef std::vector<state_couple*> direct_simulation_relation; 00040 typedef std::vector<state_couple*> delayed_simulation_relation; 00041 */ 00042 00043 class direct_simulation_relation: public simulation_relation 00044 { 00045 }; 00046 class delayed_simulation_relation: public simulation_relation 00047 { 00048 }; 00049 00050 00053 class tgba_reduc: 00054 public tgba_explicit_string, public tgba_reachable_iterator_breadth_first 00055 { 00056 public: 00057 tgba_reduc(const tgba* a); 00058 00059 ~tgba_reduc(); 00060 00063 void quotient_state(direct_simulation_relation* rel); 00064 00067 void quotient_state(delayed_simulation_relation* rel); 00068 00071 void delete_transitions(simulation_relation* rel); 00072 00073 // For Debug 00074 void display_rel_sim(simulation_relation* rel, std::ostream& os); 00075 void display_scc(std::ostream& os); 00076 00077 protected: 00078 typedef Sgi::hash_map<const tgba_explicit::state*, 00079 std::list<state*>*, 00080 ptr_hash<tgba_explicit::state> > sp_map; 00081 sp_map state_predecessor_map_; 00082 00083 // Interface of tgba_reachable_iterator_breadth_first 00084 void process_state(const spot::state* s, int n, tgba_succ_iterator* si); 00085 00087 transition* create_transition(const spot::state* source, 00088 const spot::state* dest); 00089 00090 00093 void redirect_transition(const spot::state* s, 00094 const spot::state* simul); 00095 00097 void remove_predecessor_state(const state* s, const state* p); 00098 00101 void remove_state(const spot::state* s); 00102 00106 void merge_state(const spot::state* s1, 00107 const spot::state* s2); 00108 00112 void merge_state_delayed(const spot::state* s1, 00113 const spot::state* s2); 00114 00117 void delete_scc(); 00118 00136 // bool is_alpha_ball(const spot::state* s, 00137 // bdd label = bddfalse, 00138 // int n = -1); 00139 00140 // Return true if we can't reach a state with 00141 // an other value of scc. 00142 bool is_terminal(const spot::state* s, 00143 int n = -1); 00144 00145 // Return false if the scc contains all the acceptance conditions. 00146 bool is_not_accepting(const spot::state* s, 00147 int n = -1); 00148 00151 void remove_acc(const spot::state* s); 00152 00154 void remove_scc(spot::state* s); 00155 00157 // void remove_scc_depth_first(spot::state* s, int n = -1); 00158 00160 void remove_component(const spot::state* from); 00161 00162 int nb_set_acc_cond() const; 00163 00164 }; 00165 } 00166 00167 #endif // SPOT_TGBA_TGBAREDUC_HH