00001 // Copyright (C) 2003 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_MAGIC_HH 00023 # define SPOT_TGBAALGOS_MAGIC_HH 00024 00025 #include "misc/hash.hh" 00026 #include <list> 00027 #include <utility> 00028 #include <ostream> 00029 #include "tgba/tgbatba.hh" 00030 00031 namespace spot 00032 { 00056 struct magic_search 00057 { 00059 magic_search(const tgba_tba_proxy *a); 00060 ~magic_search(); 00061 00069 bool check(); 00070 00075 std::ostream& print_result(std::ostream& os, 00076 const tgba* restrict = 0) const; 00077 00078 private: 00079 00080 // The names "stack", "h", and "x", are those used in the paper. 00081 00084 struct magic 00085 { 00086 bool seen_without : 1; 00087 bool seen_with : 1; 00088 }; 00089 00091 struct magic_state 00092 { 00093 const state* s; 00094 bool m; 00095 }; 00096 00097 typedef std::pair<magic_state, tgba_succ_iterator*> state_iter_pair; 00098 typedef std::list<state_iter_pair> stack_type; 00099 stack_type stack; 00100 00101 typedef std::list<bdd> tstack_type; 00105 tstack_type tstack; 00106 00107 typedef Sgi::hash_map<const state*, magic, 00108 state_ptr_hash, state_ptr_equal> hash_type; 00109 hash_type h; 00110 00112 void push(const state* s, bool m); 00114 bool has(const state* s, bool m) const; 00115 00116 const tgba_tba_proxy* a; 00117 00118 const state* x; 00119 }; 00120 00121 00122 } 00123 00124 #endif // SPOT_TGBAALGOS_MAGIC_HH