* src/tgbatest/ltl2tgba.cc: Add some option for the reduction of
automata. * src/tgbatest/spotlbtt.test, src/tgbatest/Makefile.am: Add some test for reduction of automata. * src/tgbaalgos/reductgba_sim_del.cc, src/tgbaalgos/reductgba_sim.cc, src/tgbaalgos/reductgba_sim.hh: Compute some simulation relation to reduce a tgba. * src/tgba/tgbareduc.cc, src/tgba/tgbareduc.hh: A implementation of tgba for the reduction. * src/tgbaalgos/Makefile.am, src/tgba/Makefile.am: Add the reduction of automata. * src/ltlvisit/syntimpl.cc, src/ltlvisit/basereduc.cc: Lot of mistake are corrected. * src/ltlvisit/syntimpl.hh, src/ltlvisit/reducform.cc, src/ltlvisit/reducform.hh, src/ltltest/reduc.cc: Adjust. * src/ltltest/equals.cc, src/ltltest/reduccmp.test, src/ltltest/Makefile.am: Add a test for reduction.
This commit is contained in:
parent
383f7e170a
commit
8d3606ff07
20 changed files with 3155 additions and 133 deletions
160
src/tgba/tgbareduc.hh
Normal file
160
src/tgba/tgbareduc.hh
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
// Spot is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_TGBA_REDUC_HH
|
||||
# define SPOT_TGBA_REDUC_HH
|
||||
|
||||
#include "tgbaexplicit.hh"
|
||||
#include "tgbaalgos/reachiter.hh"
|
||||
#include "tgbaalgos/gtec/explscc.hh"
|
||||
#include "tgbaalgos/gtec/status.hh"
|
||||
|
||||
#include <list>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
typedef Sgi::pair<const spot::state*, const spot::state*> state_couple;
|
||||
typedef Sgi::vector<state_couple*> simulation_relation;
|
||||
|
||||
class tgba_reduc: public tgba_explicit,
|
||||
public tgba_reachable_iterator_breadth_first
|
||||
{
|
||||
public:
|
||||
tgba_reduc(const tgba* a,
|
||||
const numbered_state_heap_factory* nshf
|
||||
= numbered_state_heap_hash_map_factory::instance());
|
||||
|
||||
~tgba_reduc();
|
||||
|
||||
/// Reduce the automata using a relation simulation
|
||||
/// Do not call this method with a delayed simulation relation.
|
||||
void prune_automata(simulation_relation* rel);
|
||||
|
||||
/// Build the quotient automata. Call this method
|
||||
/// when use to a delayed simulation relation.
|
||||
void quotient_state(simulation_relation* rel);
|
||||
|
||||
/// Remove all state which not lead to an accepting cycle.
|
||||
void prune_scc();
|
||||
|
||||
/// Compute the maximal SCC of the automata.
|
||||
void compute_scc();
|
||||
|
||||
/// Add the SCC index to the display of the state \a state.
|
||||
virtual std::string format_state(const spot::state* state) const;
|
||||
|
||||
/// Obsolete.
|
||||
int get_nb_state();
|
||||
int get_nb_transition();
|
||||
|
||||
// Just for Debug !!
|
||||
void display_rel_sim(simulation_relation* rel, std::ostream& os);
|
||||
void display_scc(std::ostream& os);
|
||||
|
||||
protected:
|
||||
bool scc_computed_;
|
||||
scc_stack root_;
|
||||
numbered_state_heap* h_;
|
||||
|
||||
std::stack<const spot::state*> state_scc_;
|
||||
Sgi::hash_map<int, const spot::state*> state_scc_v_;
|
||||
|
||||
typedef Sgi::hash_map<const tgba_explicit::state*,
|
||||
std::list<state*>*,
|
||||
ptr_hash<tgba_explicit::state> > sp_map;
|
||||
sp_map state_predecessor_map_;
|
||||
|
||||
typedef Sgi::hash_map<const spot::state*, int,
|
||||
state_ptr_hash, state_ptr_equal> seen_map;
|
||||
seen_map si_;
|
||||
seen_map* seen_;
|
||||
bdd acc_;
|
||||
|
||||
// Interface of tgba_reachable_iterator_breadth_first
|
||||
void start();
|
||||
void end();
|
||||
void process_state(const spot::state* s, int n, tgba_succ_iterator* si);
|
||||
void process_link(int in, int out, const tgba_succ_iterator* si);
|
||||
|
||||
/// Create a transition using two state of a TGBA.
|
||||
transition* create_transition(const spot::state* source,
|
||||
const spot::state* dest);
|
||||
|
||||
|
||||
/// Remove all the transition from the state q, predecessor
|
||||
/// of both \a s and \a simul, which can be removed.
|
||||
void redirect_transition(const spot::state* s,
|
||||
const spot::state* simul);
|
||||
|
||||
/// Remove p of the predecessor of s.
|
||||
void remove_predecessor_state(const state* s, const state* p);
|
||||
|
||||
/// Remove all the transition leading to s.
|
||||
/// s is then unreachable and can be consider as remove.
|
||||
void remove_state(const spot::state* s);
|
||||
|
||||
/// Redirect all transition leading to s1 to s2.
|
||||
/// Note that we can do the reverse because
|
||||
/// s1 and s2 belong to a co-simulate relation.
|
||||
void merge_state(const spot::state* s1,
|
||||
const spot::state* s2);
|
||||
|
||||
/// Remove all the scc which are terminal and doesn't
|
||||
/// contains all the acceptance conditions.
|
||||
void delete_scc();
|
||||
|
||||
/// Return true if the scc which contains \a s
|
||||
/// is an fixed-formula alpha-ball.
|
||||
/// this is explain in
|
||||
/// \verbatim
|
||||
/// @InProceedings{ etessami.00.concur,
|
||||
/// author = {Kousha Etessami and Gerard J. Holzmann},
|
||||
/// title = {Optimizing {B\"u}chi Automata},
|
||||
/// booktitle = {Proceedings of the 11th International Conference on
|
||||
/// Concurrency Theory (Concur'2000)},
|
||||
/// pages = {153--167},
|
||||
/// year = {2000},
|
||||
/// editor = {C. Palamidessi},
|
||||
/// volume = {1877},
|
||||
/// series = {Lecture Notes in Computer Science},
|
||||
/// publisher = {Springer-Verlag}
|
||||
/// }
|
||||
/// \endverbatim
|
||||
bool is_alpha_ball(const spot::state* s,
|
||||
int n = -1);
|
||||
|
||||
// Return true if we can't reach a state with
|
||||
// an other value of scc.
|
||||
bool is_terminal(const spot::state* s,
|
||||
int n = -1);
|
||||
|
||||
/// For compute_scc.
|
||||
void remove_component(const spot::state* from);
|
||||
|
||||
/// Remove all the state which belong to the same scc that s.
|
||||
void remove_scc(spot::state* s);
|
||||
|
||||
/// Same as remove_scc but more efficient.
|
||||
void remove_scc_depth_first(spot::state* s, int n = -1);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBA_REDUC_HH
|
||||
Loading…
Add table
Add a link
Reference in a new issue