spot 2.3.4

- Main Page
- Related Pages
- Modules
- Classes
- Files

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Classes | Functions
Miscellaneous algorithms on TωA
TωA (Transition-based ω-Automata) » TωA algorithms

## Classes
class | spot::bfs_steps
| Make a BFS in a spot::tgba to compute a twa_run::steps. More...
struct | spot::twa_statistics
struct | spot::twa_sub_statistics
class | spot::printable_formula
class | spot::printable_scc_info
class | spot::stat_printer
| prints various statistics about a TGBA More...

## Functions
bool | spot::isomorphism_checker::is_isomorphic (const const_twa_graph_ptr aut)
| Check whether an automaton is isomorphic to the one passed to the constructor. More...
static bool | spot::isomorphism_checker::are_isomorphic (const const_twa_graph_ptr ref, const const_twa_graph_ptr aut)
| Check whether two automata are isomorphic. More...
twa_graph_ptr | spot::canonicalize (twa_graph_ptr aut)
| Reorder the states and transitions of aut in a way that will be the same for every isomorphic automata. More...
twa_graph_ptr | spot::copy (const const_twa_ptr &aut, twa::prop_set p, bool preserve_names=false, unsigned max_states=-1U)
| Build an explicit automaton from all states of aut,. More...
twa_graph_ptr | spot::degeneralize (const const_twa_graph_ptr &a, bool use_z_lvl=true, bool use_cust_acc_orders=false, int use_lvl_cache=1, bool skip_levels=true, bool ignaccsl=false)
| Degeneralize a spot::tgba into an equivalent sba with only one acceptance condition. More...
unsigned | spot::count_nondet_states (const const_twa_graph_ptr &aut)
| Count the number of non-deterministic states in aut. More...
bool | spot::is_deterministic (const const_twa_graph_ptr &aut)
| Return true iff aut is deterministic. More...
void | spot::highlight_nondet_states (twa_graph_ptr &aut, unsigned color)
| Highlight nondeterministic states. More...
void | spot::highlight_nondet_edges (twa_graph_ptr &aut, unsigned color)
| Highlight nondeterministic edges. More...
bool | spot::is_unambiguous (const const_twa_graph_ptr &aut)
| Whether the automaton aut is unambiguous. More...
bool | spot::check_unambiguous (const twa_graph_ptr &aut)
| Like is_unambiguous(), but also sets the property in the twa. More...
bool | spot::scc_has_rejecting_cycle (scc_info &map, unsigned scc)
| Whether the SCC number scc in map has a rejecting cycle. More...
bool | spot::is_inherently_weak_scc (scc_info &map, unsigned scc)
| Whether the SCC number scc in map is inherently weak. More...
bool | spot::is_weak_scc (scc_info &map, unsigned scc)
| Whether the SCC number scc in map is weak. More...
bool | spot::is_complete_scc (scc_info &map, unsigned scc)
| Whether the SCC number scc in map is complete. More...
bool | spot::is_terminal_scc (scc_info &map, unsigned scc)
| Whether the SCC number scc in map is terminal. More...
twa_graph_ptr | spot::random_graph (int n, float d, const atomic_prop_set *ap, const bdd_dict_ptr &dict, unsigned n_accs=0, float a=0.1, float t=0.5, bool deterministic=false, bool state_acc=false, bool colored=false)
| Construct a twa randomly. More...
twa_statistics | spot::stats_reachable (const const_twa_ptr &g)
| Compute statistics for an automaton. More...
twa_sub_statistics | spot::sub_stats_reachable (const const_twa_ptr &g)
| Compute sub statistics for an automaton. More...
void | spot::strip_acceptance_here (twa_graph_ptr a)
| Remove all acceptance sets from a twa_graph. More...
twa_graph_ptr | spot::tgba_powerset (const const_twa_graph_ptr &aut, power_map &pm, bool merge=true)
| Build a deterministic automaton, ignoring acceptance conditions. More...
twa_graph_ptr | spot::tgba_powerset (const const_twa_graph_ptr &aut)
| Build a deterministic automaton, ignoring acceptance conditions. More...

## Detailed Description

## Function Documentation

static bool spot::isomorphism_checker::are_isomorphic | ( | const const_twa_graph_ptr | ref,
|  | const const_twa_graph_ptr | aut
| ) |  |
| static

`#include <spot/twaalgos/are_isomorphic.hh>`

Check whether two automata are isomorphic.

twa_graph_ptr spot::canonicalize | ( | twa_graph_ptr | aut | ) |

`#include <spot/twaalgos/canonicalize.hh>`

Reorder the states and transitions of aut in a way that will be the same for every isomorphic automata.

bool spot::check_unambiguous | ( | const twa_graph_ptr & | aut | ) |

`#include <spot/twaalgos/isunamb.hh>`

Like is_unambiguous(), but also sets the property in the twa.

twa_graph_ptr spot::copy | ( | const const_twa_ptr & | aut,
|  | twa::prop_set | p,
|  | bool | preserve_names = `false`,
|  | unsigned | max_states = `-1U`
| ) |  |

`#include <spot/twaalgos/copy.hh>`

Build an explicit automaton from all states of aut,.

This works using the abstract interface for automata. If you have a twa_graph that you want to copy, it is more efficient to call make_twa_graph() instead.

unsigned spot::count_nondet_states | ( | const const_twa_graph_ptr & | aut | ) |

`#include <spot/twaalgos/isdet.hh>`

Count the number of non-deterministic states in aut.

The automaton is deterministic if it has 0 nondeterministic states, but it is more efficient to call is_deterministic() if you do not care about the number of nondeterministic states.

twa_graph_ptr spot::degeneralize | ( | const const_twa_graph_ptr & | a,
|  | bool | use_z_lvl = `true`,
|  | bool | use_cust_acc_orders = `false`,
|  | int | use_lvl_cache = `1`,
|  | bool | skip_levels = `true`,
|  | bool | ignaccsl = `false`
| ) |  |

`#include <spot/twaalgos/degen.hh>`

Degeneralize a spot::tgba into an equivalent sba with only one acceptance condition.

This algorithms will build a new explicit automaton that has at most (N+1) times the number of states of the original automaton.

When use_z_lvl is set, the level of the degeneralized automaton is reset everytime an SCC is exited. If use_cust_acc_orders is set, the degeneralization will compute a custom acceptance order for each SCC (this option is disabled by default because our benchmarks show that it usually does more harm than good). If use_lvl_cache is set, everytime an SCC is entered on a state that as already been associated to some level elsewhere, reuse that level (set it to 2 to keep the smallest number, 3 to keep the largest level, and 1 to keep the first level found). If ignaccsl is set, we do not directly jump to the accepting level if the entering state has an accepting self-loop.

Any of these three options will cause the SCCs of the automaton a to be computed prior to its actual degeneralization.

The degeneralize_tba() variant produce a degeneralized automaton with transition-based acceptance. @{

void spot::highlight_nondet_edges | ( | twa_graph_ptr & | aut,
|  | unsigned | color
| ) |  |

`#include <spot/twaalgos/isdet.hh>`

Highlight nondeterministic edges.

An edge is nondeterministic if there exist another edge leaving the same source state, with a compatible label (i.e., the conjunction of the two labels is not false).

Parameters

  aut | the automaton to process
  color | the color to give to nondeterministic edges.

void spot::highlight_nondet_states | ( | twa_graph_ptr & | aut,
|  | unsigned | color
| ) |  |

`#include <spot/twaalgos/isdet.hh>`

Highlight nondeterministic states.

A state is nondeterministic if it has two outgoing edges whose labels are not incompatibles.

Parameters

  aut | the automaton to process
  color | the color to give to nondeterministic states.

bool spot::is_complete_scc | ( | scc_info & | map,
|  | unsigned | scc
| ) |  |

`#include <spot/twaalgos/isweakscc.hh>`

Whether the SCC number scc in map is complete.

An SCC is complete iff for all states and all label there exists a transition that stays into this SCC.

bool spot::is_deterministic | ( | const const_twa_graph_ptr & | aut | ) |

`#include <spot/twaalgos/isdet.hh>`

Return true iff aut is deterministic.

This function is more efficient than count_nondet_states() when the automaton is nondeterministic, because it can return before the entire automaton has been explored.

In addition to returning the result as a Boolean, this will set the prop_deterministic() property of the automaton as a side-effect, so further calls will return in constant-time.

bool spot::is_inherently_weak_scc | ( | scc_info & | map,
|  | unsigned | scc
| ) |  |

`#include <spot/twaalgos/isweakscc.hh>`

Whether the SCC number scc in map is inherently weak.

An SCC is inherently weak if either its cycles are all accepting, or they are all non-accepting.

Note the terminal SCCs are also inherently weak with that definition.

bool spot::isomorphism_checker::is_isomorphic | ( | const const_twa_graph_ptr | aut | ) |

`#include <spot/twaalgos/are_isomorphic.hh>`

Check whether an automaton is isomorphic to the one passed to the constructor.

Two automata are considered isomorphic if there exists a bijection f between the states of a1 and the states of a2 such that for any pair of states (s1, s2) of a1, there is a transition from s1 to s2 with condition c and acceptance set A iff there is a transition with condition c and acceptance set A between f(s1) and f(s2) in a2. This can be done simply by checking if canonicalize(aut1) == canonicalize(aut2), but is_isomorphic can do some optimizations in some cases.

bool spot::is_terminal_scc | ( | scc_info & | map,
|  | unsigned | scc
| ) |  |

`#include <spot/twaalgos/isweakscc.hh>`

Whether the SCC number scc in map is terminal.

An SCC is terminal if it is weak, complete, and accepting.

bool spot::is_unambiguous | ( | const const_twa_graph_ptr & | aut | ) |

`#include <spot/twaalgos/isunamb.hh>`

Whether the automaton aut is unambiguous.

An automaton is unambiguous if each accepted word is recognized by only one path.

We check unambiguousity by synchronizing the automaton with itself, and then making sure that the co-reachable part of the squared automaton has the same size as the co-reachable part of the original automaton.

bool spot::is_weak_scc | ( | scc_info & | map,
|  | unsigned | scc
| ) |  |

`#include <spot/twaalgos/isweakscc.hh>`

Whether the SCC number scc in map is weak.

An SCC is weak if its non-accepting, or if all its transition are fully accepting (i.e., the belong to all acceptance sets).

Note that terminal SCCs are also weak with that definition.

twa_graph_ptr spot::random_graph | ( | int | n,
|  | float | d,
|  | const atomic_prop_set * | ap,
|  | const bdd_dict_ptr & | dict,
|  | unsigned | n_accs = `0`,
|  | float | a = `0.1`,
|  | float | t = `0.5`,
|  | bool | deterministic = `false`,
|  | bool | state_acc = `false`,
|  | bool | colored = `false`
| ) |  |

`#include <spot/twaalgos/randomgraph.hh>`

Construct a twa randomly.

Parameters

  n | The number of states wanted in the automata (>0). All states will be connected, and there will be no dead state.
  d | The density of the automata. This is the probability (between 0.0 and 1.0), to add a transition between two states. All states have at least one outgoing transition, so d is considered only when adding the remaining transition. A density of 1 means all states will be connected to each other.
  ap | The list of atomic property that should label the transition.
  dict | The bdd_dict to used for this automata.
  n_accs | The number of acceptance sets to use. If this number is non null, then there is no guarantee that the generated graph contains an accepting cycle (raise the value of a to improve the chances).
  a | The probability (between 0.0 and 1.0) that a transition belongs to an acceptance set.
  t | The probability (between 0.0 and 1.0) that an atomic proposition is true.
  deterministic | build a complete and deterministic automaton
  state_acc | build an automaton with state-based acceptance
  colored | build an automaton in which each transition (or state) belongs to a single acceptance set.

This algorithms is adapted from the one in Fig 6.2 page 48 of

    @TechReport{          tauriainen.00.a66,
      author        = {Heikki Tauriainen},
      title   = {Automated Testing of {B\"u}chi Automata Translators for
                      {L}inear {T}emporal {L}ogic},
      address        = {Espoo, Finland},
      institution = {Helsinki University of Technology, Laboratory for
                      Theoretical Computer Science},
      number        = {A66},
      year        = {2000},
      url        = {http://citeseer.nj.nec.com/tauriainen00automated.html},
      type        = {Research Report},
      note        = {Reprint of Master's thesis}
    }

Although the intent is similar, there are some differences between the above published algorithm and this implementation. First labels are on transitions, and acceptance conditions are generated too. Second, the number of successors of a node is chosen in following a normal distribution with mean and variance . (This is less accurate, but faster than considering all possible n successors one by one.)

Note that while this constructs an automaton with random acceptance sets, this does not set the acceptance condition.

bool spot::scc_has_rejecting_cycle | ( | scc_info & | map,
|  | unsigned | scc
| ) |  |

`#include <spot/twaalgos/isweakscc.hh>`

Whether the SCC number scc in map has a rejecting cycle.

twa_statistics spot::stats_reachable | ( | const const_twa_ptr & | g | ) |

`#include <spot/twaalgos/stats.hh>`

Compute statistics for an automaton.

void spot::strip_acceptance_here | ( | twa_graph_ptr | a | ) |

`#include <spot/twaalgos/stripacc.hh>`

Remove all acceptance sets from a twa_graph.

This will also set the acceptance condition to true, and mark the automaton as weak. Doing so obviously makes all recognized infinite runs accepting.

twa_sub_statistics spot::sub_stats_reachable | ( | const const_twa_ptr & | g | ) |

`#include <spot/twaalgos/stats.hh>`

Compute sub statistics for an automaton.

twa_graph_ptr spot::tgba_powerset | ( | const const_twa_graph_ptr & | aut,
|  | power_map & | pm,
|  | bool | merge = `true`
| ) |  |

`#include <spot/twaalgos/powerset.hh>`

Build a deterministic automaton, ignoring acceptance conditions.

This create a deterministic automaton that recognizes the same language as aut would if its acceptance conditions were ignored. This is the classical powerset algorithm.

If pm is supplied it will be filled with the set of original states associated to each state of the deterministic automaton. The merge argument can be set to false to prevent merging of transitions.

twa_graph_ptr spot::tgba_powerset | ( | const const_twa_graph_ptr & | aut | ) |

`#include <spot/twaalgos/powerset.hh>`

Build a deterministic automaton, ignoring acceptance conditions.

This create a deterministic automaton that recognizes the same language as aut would if its acceptance conditions were ignored. This is the classical powerset algorithm.

If pm is supplied it will be filled with the set of original states associated to each state of the deterministic automaton. The merge argument can be set to false to prevent merging of transitions.

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.