#include <tgba/tgbareduc.hh>
Public Types | |
typedef std::list< transition * > | state |
Public Member Functions | |
tgba_reduc (const tgba *a) | |
~tgba_reduc () | |
void | quotient_state (direct_simulation_relation *rel) |
void | quotient_state (delayed_simulation_relation *rel) |
void | delete_transitions (simulation_relation *rel) |
Delete some transitions with help of a simulation relation. | |
virtual std::string | format_state (const spot::state *state) const |
Add the SCC index to the display of the state state. | |
void | display_rel_sim (simulation_relation *rel, std::ostream &os) |
void | display_scc (std::ostream &os) |
virtual state * | add_default_init () |
Add a default initial state. | |
bool | has_state (const std::string &name) |
const std::string & | get_label (const tgba_explicit::state *s) const |
const std::string & | get_label (const spot::state *s) const |
state * | add_state (const std::string &name) |
state * | set_init_state (const std::string &state) |
transition * | create_transition (state *source, const state *dest) |
transition * | create_transition (const std::string &source, const std::string &dest) |
void | complement_all_acceptance_conditions () |
void | declare_acceptance_condition (const ltl::formula *f) |
void | merge_transitions () |
void | add_condition (transition *t, const ltl::formula *f) |
void | add_conditions (transition *t, bdd f) |
This assumes that all variables in f are known from dict. | |
void | copy_acceptance_conditions_of (const tgba *a) |
Copy the acceptance conditions of a tgba. | |
void | set_acceptance_conditions (bdd acc) |
The the acceptance conditions. | |
bool | has_acceptance_condition (const ltl::formula *f) const |
void | add_acceptance_condition (transition *t, const ltl::formula *f) |
void | add_acceptance_conditions (transition *t, bdd f) |
This assumes that all acceptance conditions in f are known from dict. | |
virtual spot::state * | get_init_state () const |
Get the initial state of the automaton. | |
virtual tgba_succ_iterator * | succ_iter (const spot::state *local_state, const spot::state *global_state=0, const tgba *global_automaton=0) const |
Get an iterator over the successors of local_state. | |
virtual bdd_dict * | get_dict () const |
Get the dictionary associated to the automaton. | |
virtual bdd | all_acceptance_conditions () const |
Return the set of all acceptance conditions used by this automaton. | |
virtual bdd | neg_acceptance_conditions () const |
Return the conjuction of all negated acceptance variables. | |
bdd | support_conditions (const state *state) const |
Get a formula that must hold whatever successor is taken. | |
bdd | support_variables (const state *state) const |
Get the conjunctions of variables tested by the outgoing transitions of state. | |
virtual std::string | transition_annotation (const tgba_succ_iterator *t) const |
Return a possible annotation for the transition pointed to by the iterator. | |
virtual state * | project_state (const state *s, const tgba *t) const |
Project a state on an automaton. | |
virtual unsigned int | number_of_acceptance_conditions () const |
The number of acceptance conditions. | |
virtual void | add_state (const state *s) |
virtual const state * | next_state () |
Called by run() to obtain the next state to process. | |
void | run () |
Iterate over all reachable states of a spot::tgba. | |
virtual bool | want_state (const state *s) const |
virtual void | process_link (const state *in_s, int in, const state *out_s, int out, const tgba_succ_iterator *si) |
Protected Types | |
typedef Sgi::hash_map< const tgba_explicit::state *, std::list< state * > *, ptr_hash < tgba_explicit::state > > | sp_map |
typedef std::string | label_t |
typedef Sgi::hash_map < std::string, tgba_explicit::state *, string_hash > | ns_map |
typedef Sgi::hash_map< const tgba_explicit::state *, std::string, ptr_hash < tgba_explicit::state > > | sn_map |
typedef Sgi::hash_map< const state *, int, state_ptr_hash, state_ptr_equal > | seen_map |
Protected Member Functions | |
void | start () |
Called by run() before starting its iteration. | |
void | end () |
Called by run() once all states have been explored. | |
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) |
transition * | create_transition (const spot::state *source, const spot::state *dest) |
Create a transition using two state of a TGBA. | |
void | redirect_transition (const spot::state *s, const spot::state *simul) |
void | remove_predecessor_state (const state *s, const state *p) |
Remove p of the predecessor of s. | |
void | remove_state (const spot::state *s) |
void | merge_state (const spot::state *s1, const spot::state *s2) |
void | merge_state_delayed (const spot::state *s1, const spot::state *s2) |
void | delete_scc () |
bool | is_terminal (const spot::state *s, int n=-1) |
bool | is_not_accepting (const spot::state *s, int n=-1) |
void | remove_acc (const spot::state *s) |
void | remove_scc (spot::state *s) |
Remove all the state which belong to the same scc that s. | |
void | remove_component (const spot::state *from) |
Same as remove_scc but more efficient. | |
int | nb_set_acc_cond () const |
virtual bdd | compute_support_conditions (const spot::state *state) const |
Do the actual computation of tgba::support_conditions(). | |
virtual bdd | compute_support_variables (const spot::state *state) const |
Do the actual computation of tgba::support_variables(). | |
bdd | get_acceptance_condition (const ltl::formula *f) |
Protected Attributes | |
sp_map | state_predecessor_map_ |
ns_map | name_state_map_ |
sn_map | state_name_map_ |
bdd_dict * | dict_ |
tgba_explicit::state * | init_ |
bdd | all_acceptance_conditions_ |
bdd | neg_acceptance_conditions_ |
bool | all_acceptance_conditions_computed_ |
std::deque< const state * > | todo |
A queue of states yet to explore. | |
const tgba * | automata_ |
The spot::tgba to explore. | |
seen_map | seen |
States already seen. |
Explicit automata used in reductions.
typedef std::string spot::tgba_explicit_labelled< std::string , string_hash >::label_t [protected, inherited] |
typedef Sgi::hash_map<std::string , tgba_explicit::state*, string_hash > spot::tgba_explicit_labelled< std::string , string_hash >::ns_map [protected, inherited] |
typedef Sgi::hash_map<const state*, int, state_ptr_hash, state_ptr_equal> spot::tgba_reachable_iterator::seen_map [protected, inherited] |
typedef Sgi::hash_map<const tgba_explicit::state*, std::string , ptr_hash<tgba_explicit::state> > spot::tgba_explicit_labelled< std::string , string_hash >::sn_map [protected, inherited] |
typedef Sgi::hash_map<const tgba_explicit::state*, std::list<state*>*, ptr_hash<tgba_explicit::state> > spot::tgba_reduc::sp_map [protected] |
typedef std::list<transition*> spot::tgba_explicit::state [inherited] |
spot::tgba_reduc::tgba_reduc | ( | const tgba * | a | ) |
spot::tgba_reduc::~tgba_reduc | ( | ) |
void spot::tgba_explicit::add_acceptance_condition | ( | transition * | t, | |
const ltl::formula * | f | |||
) | [inherited] |
void spot::tgba_explicit::add_acceptance_conditions | ( | transition * | t, | |
bdd | f | |||
) | [inherited] |
This assumes that all acceptance conditions in f are known from dict.
void spot::tgba_explicit::add_condition | ( | transition * | t, | |
const ltl::formula * | f | |||
) | [inherited] |
void spot::tgba_explicit::add_conditions | ( | transition * | t, | |
bdd | f | |||
) | [inherited] |
This assumes that all variables in f are known from dict.
virtual state* spot::tgba_explicit_string::add_default_init | ( | ) | [virtual, inherited] |
Add a default initial state.
Implements spot::tgba_explicit.
virtual void spot::tgba_reachable_iterator_breadth_first::add_state | ( | const state * | s | ) | [virtual, inherited] |
Implements spot::tgba_reachable_iterator.
state* spot::tgba_explicit_labelled< std::string , string_hash >::add_state | ( | const std::string & | name | ) | [inline, inherited] |
Return the tgba_explicit::state for name, creating the state if it does not exist.
References spot::tgba_explicit::init_, spot::tgba_explicit_labelled< label, label_hash >::name_state_map_, and spot::tgba_explicit_labelled< label, label_hash >::state_name_map_.
virtual bdd spot::tgba_explicit::all_acceptance_conditions | ( | ) | const [virtual, inherited] |
Return the set of all acceptance conditions used by this automaton.
The goal of the emptiness check is to ensure that a strongly connected component walks through each of these acceptiong conditions. I.e., the union of the acceptiong conditions of all transition in the SCC should be equal to the result of this function.
Implements spot::tgba.
Referenced by spot::tgba_explicit_labelled< std::string, string_hash >::complement_all_acceptance_conditions().
void spot::tgba_explicit_labelled< std::string , string_hash >::complement_all_acceptance_conditions | ( | ) | [inline, inherited] |
virtual bdd spot::tgba_explicit::compute_support_conditions | ( | const spot::state * | state | ) | const [protected, virtual, inherited] |
Do the actual computation of tgba::support_conditions().
Implements spot::tgba.
virtual bdd spot::tgba_explicit::compute_support_variables | ( | const spot::state * | state | ) | const [protected, virtual, inherited] |
Do the actual computation of tgba::support_variables().
Implements spot::tgba.
void spot::tgba_explicit::copy_acceptance_conditions_of | ( | const tgba * | a | ) | [inherited] |
Copy the acceptance conditions of a tgba.
If used, this function should be called before creating any transition.
transition* spot::tgba_explicit_labelled< std::string , string_hash >::create_transition | ( | const std::string & | source, | |
const std::string & | dest | |||
) | [inline, inherited] |
transition* spot::tgba_explicit_labelled< std::string , string_hash >::create_transition | ( | state * | source, | |
const state * | dest | |||
) | [inline, inherited] |
Reimplemented from spot::tgba_explicit.
References spot::tgba_explicit_labelled< label, label_hash >::create_transition().
transition* spot::tgba_reduc::create_transition | ( | const spot::state * | source, | |
const spot::state * | dest | |||
) | [protected] |
Create a transition using two state of a TGBA.
void spot::tgba_explicit_labelled< std::string , string_hash >::declare_acceptance_condition | ( | const ltl::formula * | f | ) | [inline, inherited] |
void spot::tgba_reduc::delete_scc | ( | ) | [protected] |
Remove all the scc which are terminal and doesn't contains all the acceptance conditions.
void spot::tgba_reduc::delete_transitions | ( | simulation_relation * | rel | ) |
Delete some transitions with help of a simulation relation.
void spot::tgba_reduc::display_rel_sim | ( | simulation_relation * | rel, | |
std::ostream & | os | |||
) |
void spot::tgba_reduc::display_scc | ( | std::ostream & | os | ) |
void spot::tgba_reduc::end | ( | ) | [protected, virtual] |
Called by run() once all states have been explored.
Reimplemented from spot::tgba_reachable_iterator.
virtual std::string spot::tgba_reduc::format_state | ( | const spot::state * | state | ) | const [virtual] |
Add the SCC index to the display of the state state.
Reimplemented from spot::tgba_explicit_string.
bdd spot::tgba_explicit::get_acceptance_condition | ( | const ltl::formula * | f | ) | [protected, inherited] |
virtual bdd_dict* spot::tgba_explicit::get_dict | ( | ) | const [virtual, inherited] |
Get the dictionary associated to the automaton.
State are represented as BDDs. The dictionary allows to map BDD variables back to formulae, and vice versa. This is useful when dealing with several automata (which may use the same BDD variable for different formula), or simply when printing.
Implements spot::tgba.
virtual spot::state* spot::tgba_explicit::get_init_state | ( | ) | const [virtual, inherited] |
Get the initial state of the automaton.
The state has been allocated with new
. It is the responsability of the caller to delete
it when no longer needed.
Implements spot::tgba.
const std::string & spot::tgba_explicit_labelled< std::string , string_hash >::get_label | ( | const spot::state * | s | ) | const [inline, inherited] |
const std::string & spot::tgba_explicit_labelled< std::string , string_hash >::get_label | ( | const tgba_explicit::state * | s | ) | const [inline, inherited] |
bool spot::tgba_explicit::has_acceptance_condition | ( | const ltl::formula * | f | ) | const [inherited] |
bool spot::tgba_explicit_labelled< std::string , string_hash >::has_state | ( | const std::string & | name | ) | [inline, inherited] |
bool spot::tgba_reduc::is_not_accepting | ( | const spot::state * | s, | |
int | n = -1 | |||
) | [protected] |
bool spot::tgba_reduc::is_terminal | ( | const spot::state * | s, | |
int | n = -1 | |||
) | [protected] |
Return true if the scc which contains s is an fixed-formula alpha-ball. this is explain in
/// @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} /// } ///
void spot::tgba_reduc::merge_state | ( | const spot::state * | s1, | |
const spot::state * | s2 | |||
) | [protected] |
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 spot::tgba_reduc::merge_state_delayed | ( | const spot::state * | s1, | |
const spot::state * | s2 | |||
) | [protected] |
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 spot::tgba_explicit_labelled< std::string , string_hash >::merge_transitions | ( | ) | [inline, inherited] |
int spot::tgba_reduc::nb_set_acc_cond | ( | ) | const [protected] |
virtual bdd spot::tgba_explicit::neg_acceptance_conditions | ( | ) | const [virtual, inherited] |
Return the conjuction of all negated acceptance variables.
For instance if the automaton uses variables Acc[a]
, Acc[b]
and Acc[c]
to describe acceptance sets, this function should return !Acc[a]&!Acc[b]&!Acc[c]
.
This is useful when making products: each operand's condition set should be augmented with the neg_acceptance_conditions() of the other operand.
Implements spot::tgba.
virtual const state* spot::tgba_reachable_iterator_breadth_first::next_state | ( | ) | [virtual, inherited] |
Called by run() to obtain the next state to process.
Implements spot::tgba_reachable_iterator.
virtual unsigned int spot::tgba::number_of_acceptance_conditions | ( | ) | const [virtual, inherited] |
The number of acceptance conditions.
virtual void spot::tgba_reachable_iterator::process_link | ( | const state * | in_s, | |
int | in, | |||
const state * | out_s, | |||
int | out, | |||
const tgba_succ_iterator * | si | |||
) | [virtual, inherited] |
Called by run() to process a transition.
in_s | The source state | |
in | The source state number. | |
out_s | The destination state | |
out | The destination state number. | |
si | The spot::tgba_succ_iterator positionned on the current transition. |
The in_s and out_s states are owned by the spot::tgba_reachable_iterator instance and destroyed when the instance is destroyed.
void spot::tgba_reduc::process_link | ( | int | in, | |
int | out, | |||
const tgba_succ_iterator * | si | |||
) | [protected] |
void spot::tgba_reduc::process_state | ( | const spot::state * | s, | |
int | n, | |||
tgba_succ_iterator * | si | |||
) | [protected, virtual] |
Called by run() to process a state.
s | The current state. | |
n | A unique number assigned to s. | |
si | The spot::tgba_succ_iterator for s. |
Reimplemented from spot::tgba_reachable_iterator.
virtual state* spot::tgba::project_state | ( | const state * | s, | |
const tgba * | t | |||
) | const [virtual, inherited] |
Project a state on an automaton.
This converts s, into that corresponding spot::state for t. This is useful when you have the state of a product, and want restrict this state to a specific automata occuring in the product.
It goes without saying that s and t should be compatible (i.e., s is a state of t).
state*
(the projected state) that must be deleted by the caller. Reimplemented in spot::tgba_product, spot::tgba_scc, spot::tgba_tba_proxy, and spot::tgba_union.
void spot::tgba_reduc::quotient_state | ( | delayed_simulation_relation * | rel | ) |
Build the quotient automata. Call this method when use to a delayed simulation relation.
void spot::tgba_reduc::quotient_state | ( | direct_simulation_relation * | rel | ) |
Reduce the automata using a relation simulation Do not call this method with a delayed simulation relation.
void spot::tgba_reduc::redirect_transition | ( | const spot::state * | s, | |
const spot::state * | simul | |||
) | [protected] |
Remove all the transition from the state q, predecessor of both s and simul, which can be removed.
void spot::tgba_reduc::remove_acc | ( | const spot::state * | s | ) | [protected] |
If a scc maximal do not contains all the acceptance conditions we can remove all the acceptance conditions in this scc.
void spot::tgba_reduc::remove_component | ( | const spot::state * | from | ) | [protected] |
Same as remove_scc but more efficient.
For compute_scc.
Remove p of the predecessor of s.
void spot::tgba_reduc::remove_scc | ( | spot::state * | s | ) | [protected] |
Remove all the state which belong to the same scc that s.
void spot::tgba_reduc::remove_state | ( | const spot::state * | s | ) | [protected] |
Remove all the transition leading to s. s is then unreachable and can be consider as remove.
void spot::tgba_reachable_iterator::run | ( | ) | [inherited] |
Iterate over all reachable states of a spot::tgba.
This is a template method that will call add_state(), next_state(), start(), end(), process_state(), and process_link(), while it iterates over states.
void spot::tgba_explicit::set_acceptance_conditions | ( | bdd | acc | ) | [inherited] |
The the acceptance conditions.
state* spot::tgba_explicit_labelled< std::string , string_hash >::set_init_state | ( | const std::string & | state | ) | [inline, inherited] |
void spot::tgba_reduc::start | ( | ) | [protected, virtual] |
Called by run() before starting its iteration.
Reimplemented from spot::tgba_reachable_iterator.
virtual tgba_succ_iterator* spot::tgba_explicit::succ_iter | ( | const spot::state * | local_state, | |
const spot::state * | global_state = 0 , |
|||
const tgba * | global_automaton = 0 | |||
) | const [virtual, inherited] |
Get an iterator over the successors of local_state.
The iterator has been allocated with new
. It is the responsability of the caller to delete
it when no longer needed.
During synchornized products, additional informations are passed about the entire product and its state. Recall that products can be nested, forming a tree of spot::tgba where most values are computed on demand. global_automaton designate the root spot::tgba, and global_state its state. This two objects can be used by succ_iter() to restrict the set of successors to compute.
local_state | The state whose successors are to be explored. This pointer is not adopted in any way by succ_iter , and it is still the caller's responsability to delete it when appropriate (this can be done during the lifetime of the iterator). | |
global_state | In a product, the state of the global product automaton. Otherwise, 0. Like locale_state, global_state is not adopted by succ_iter . | |
global_automaton | In a product, the global product automaton. Otherwise, 0. |
Implements spot::tgba.
bdd spot::tgba::support_conditions | ( | const state * | state | ) | const [inherited] |
Get a formula that must hold whatever successor is taken.
This can be as simple as bddtrue
, or more completely the disjunction of the condition of all successors. This is used as an hint by succ_iter()
to reduce the number of successor to compute in a product.
Sub classes should implement compute_support_conditions(), this function is just a wrapper that will cache the last return value for efficiency.
bdd spot::tgba::support_variables | ( | const state * | state | ) | const [inherited] |
Get the conjunctions of variables tested by the outgoing transitions of state.
All variables tested by outgoing transitions must be returned. This is mandatory.
This is used as an hint by some succ_iter()
to reduce the number of successor to compute in a product.
Sub classes should implement compute_support_variables(), this function is just a wrapper that will cache the last return value for efficiency.
virtual std::string spot::tgba::transition_annotation | ( | const tgba_succ_iterator * | t | ) | const [virtual, inherited] |
Return a possible annotation for the transition pointed to by the iterator.
Implementing this function is optional; the default annotation it the empty string.
t | a non-done tgba_succ_iterator for this automata |
Reimplemented in spot::tgba_product, spot::tgba_scc, and spot::tgba_tba_proxy.
virtual bool spot::tgba_reachable_iterator::want_state | ( | const state * | s | ) | const [virtual, inherited] |
Called by add_state or next_states implementations to filter states. Default implementation always return true.
bdd spot::tgba_explicit::all_acceptance_conditions_ [mutable, protected, inherited] |
bool spot::tgba_explicit::all_acceptance_conditions_computed_ [mutable, protected, inherited] |
const tgba* spot::tgba_reachable_iterator::automata_ [protected, inherited] |
The spot::tgba to explore.
bdd_dict* spot::tgba_explicit::dict_ [protected, inherited] |
tgba_explicit::state* spot::tgba_explicit::init_ [protected, inherited] |
ns_map spot::tgba_explicit_labelled< std::string , string_hash >::name_state_map_ [protected, inherited] |
bdd spot::tgba_explicit::neg_acceptance_conditions_ [protected, inherited] |
seen_map spot::tgba_reachable_iterator::seen [protected, inherited] |
States already seen.
sn_map spot::tgba_explicit_labelled< std::string , string_hash >::state_name_map_ [protected, inherited] |
sp_map spot::tgba_reduc::state_predecessor_map_ [protected] |
std::deque<const state*> spot::tgba_reachable_iterator_breadth_first::todo [protected, inherited] |
A queue of states yet to explore.