Module: Conversion of Finite Automata: (conversions)¶
Conversions between objects.
Deterministic and non-deterministic automata manipulation, conversion and evaluation. .. Authors: Rogério Reis & Nelma Moreira .. This is part of FAdo project https://fado.dcc.fc.up.pt.
Classes¶
GFA¶
- class GFA[source]¶
Class for Generalized Finite Automata: NFA with a unique initial state and transitions are labeled with RegExp.

- addTransition(sti1, sym, sti2)[source]¶
- Adds a new transition from
sti1tosti2consuming symbolsym. Label of the transition function is a RegExp.
- Adds a new transition from
- completeDelta()[source]¶
Adds empty set transitions between the automatons final and initial states in order to make it complete. It’s only meant to be used in the final stage of SEA…
- deleteStates(del_states)[source]¶
To be implemented below
- Parameters
del_states (list) – states to be deleted
- eliminateState(st)[source]¶
Deletes a state and updates the automaton
- Parameters
st (int) – the state to be deleted
- evalNumberOfStateCycles()[source]¶
Evaluates the number of cycles each state participates
- Returns
state->list of cycle lengths
- Return type
- normalize()[source]¶
Create a single initial and final state with Epsilon transitions.
Attention
works in place
- reorder(dictio)[source]¶
Reorder states indexes according to given dictionary.
- Parameters
dictio (dict) – order
Note
dictionary does not have to be complete
:members:
Functions¶
FA2GFA¶
FAallRegExps¶
cutPoints¶
FA2regexpSE¶
FA2regexpSE_nn¶
SP2regexp¶
- SP2regexp(aut)[source]¶
Checks if FA is SP (Serial-PArallel), and if so returns the regular expression whose language is recognised by the FA
- Parameters
aut (OFA) – the automaton
- Returns
equivalent regular expression
- Return type
- Raises
NotSP – if the automaton is not Serial-Parallel
See also
Moreira & Reis, Fundamenta Informatica, Series-Parallel automata and short regular expressions, n.91 3-4, pag 611-629. https://www.dcc.fc.up.pt/~nam/publica/spa07.pdf
Note
Automata must be Serial-Parallel
FAeliminateSingles¶
FA2regexpCG¶
FA2regexpCG_nn¶
- FA2regexpCG_nn(aut: FAdo.fa.OFA)[source]¶
Regular expression from state elimination whose language is recognised by the FA. Uses a heuristic to choose the order of elimination. The FA is not normalized before the state elimination.
- Parameters
aut (OFA) – the automaton
- Returns
the equivalent regular expression
- Return type
FA2regexpSEO¶
FA2regexpDynamicCycleHeuristic¶
- FA2regexpDynamicCycleHeuristic(aut)[source]¶
State elimination Heuristic based on the number of cycles that passes through each state. Here those numbers are evaluated dynamically after each elimination step
- Parameters
aut (OFA) – the automaton
- Returns
an equivalent regular expression
- Return type
See also
Nelma Moreira, Davide Nabais, and Rogério Reis. State elimination ordering strategies: Some experimental results. Proc. of 11th Workshop on Descriptional Complexity of Formal Systems (DCFS10), pages 169-180.2010. DOI: 10.4204/EPTCS.31.16
FA2regexpStaticCycleHeuristic¶
- FA2regexpStaticCycleHeuristic(aut)[source]¶
State elimination Heuristic based on the number of cycles that passes through each state. Here those numbers are evaluated statically in the beginning of the process
- Parameters
aut (OFA) – the automaton
- Returns
a equivalent regular expression
- Return type
See also
Nelma Moreira, Davide Nabais, and Rogério Reis. State elimination ordering strategies: Some experimental results. Proc. of 11th Workshop on Descriptional Complexity of Formal Systems (DCFS10), pages 169-180.2010. DOI: 10.4204/EPTCS.31.16
DFA2regexpDijkstra¶
- DFA2regexpDijkstra(aut) FAdo.reex.RegExp[source]¶
Returns a regexp for the current DFA considering the recursive method. Very inefficent.
- Parameters
aut (DFA) – the automaton
- Returns
a regexp equivalent to the current DFA
- Return type