00001 // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), 00002 // département Systèmes Répartis Coopératifs (SRC), Université Pierre 00003 // et Marie Curie. 00004 // 00005 // This file is part of Spot, a model checking library. 00006 // 00007 // Spot is free software; you can redistribute it and/or modify it 00008 // under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // Spot is distributed in the hope that it will be useful, but WITHOUT 00013 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00014 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00015 // License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with Spot; see the file COPYING. If not, write to the Free 00019 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00020 // 02111-1307, USA. 00021 00022 #ifndef SPOT_TGBAALGOS_GTEC_GTEC_HH 00023 # define SPOT_TGBAALGOS_GTEC_GTEC_HH 00024 00025 #include "status.hh" 00026 00027 namespace spot 00028 { 00070 class emptiness_check 00071 { 00072 public: 00073 emptiness_check(const tgba* a, 00074 const numbered_state_heap_factory* nshf 00075 = numbered_state_heap_hash_map_factory::instance()); 00076 virtual ~emptiness_check(); 00077 00079 virtual bool check(); 00080 00089 const emptiness_check_status* result() const; 00090 00091 protected: 00092 emptiness_check_status* ecs_; 00098 void remove_component(const state* start_delete); 00099 }; 00100 00105 class emptiness_check_shy : public emptiness_check 00106 { 00107 public: 00108 emptiness_check_shy(const tgba* a, 00109 const numbered_state_heap_factory* nshf 00110 = numbered_state_heap_hash_map_factory::instance()); 00111 virtual ~emptiness_check_shy(); 00112 00113 virtual bool check(); 00114 00115 protected: 00116 struct successor { 00117 bdd acc; 00118 const spot::state* s; 00119 successor(bdd acc, const spot::state* s): acc(acc), s(s) {} 00120 }; 00121 00122 // We use five main data in this algorithm: 00123 // * emptiness_check::root, a stack of strongly connected components (SCC), 00124 // * emptiness_check::h, a hash of all visited nodes, with their order, 00125 // (it is called "Hash" in Couvreur's paper) 00126 // * arc, a stack of acceptance conditions between each of these SCC, 00127 std::stack<bdd> arc; 00128 // * num, the number of visited nodes. Used to set the order of each 00129 // visited node, 00130 int num; 00131 // * todo, the depth-first search stack. This holds pairs of the 00132 // form (STATE, SUCCESSORS) where SUCCESSORS is a list of 00133 // (ACCEPTANCE_CONDITIONS, STATE) pairs. 00134 typedef std::list<successor> succ_queue; 00135 typedef std::pair<const state*, succ_queue> pair_state_successors; 00136 std::stack<pair_state_successors> todo; 00137 00138 virtual int* find_state(const state* s); 00139 }; 00140 00141 } 00142 00143 #endif // SPOT_TGBAALGOS_GTEC_GTEC_HH