MaMONAta is a library that provides an adapter for Mata and MONA implementations of automata. It allows users to easily convert between different automata implementations and transparently compare the performance of the two tools.
- Mata version used: 1.25.0
- MONA version used: 1.4-18
- Parsing of automata in
.mataand.monaformats. - All possible conversions between Mata and MONA automata.
- Transparent performance comparison between Mata and MONA implementations.
Timerclass for measuring the execution time of functions.MtRobddclass implementing Multi-terminal Reduced Ordered Binary Decision Diagrams (MtROBDDs).- DOT visualization of Mata, MONA, and MtROBDD structures.
| Operation | Mata | MONA |
|---|---|---|
| trim | ✓ | |
| remove_epsilon | ✓ | |
| revert | ✓ | |
| minimize_brzozowski | ✓ | |
| minimize_hopcroft | ✓ | |
| minimize | ✓ | |
| reduce_simulation | ✓ | |
| reduce_residual | ✓ | |
| concatenate | ✓ | |
| union_nondet | ✓ | |
| union_det_complete | ✓ | ✓ |
| determinize | ✓ | ✓ |
| intersection | ✓ | ✓ |
| complement_classical | ✓ | |
| complement_brzozowski | ✓ | |
| complement | ✓ |
All these operations are timed in default. The timing can be disabled by setting the TIMING_ENABLED option in CMakeLists.txt to OFF.
To obtain the timing results, use the get(operation_name) method of the Timer class.
The library provides a singleton Timer class that can be used to measure the execution time of various operations.
The timing results can be obtained using the get(operation_name) method of the Timer class.
All standard automata operations are timed by default. To start a custom timing use start(custom_name) and to stop it use stop(custom_name).
The MtRobdd class implements a Shared Multi-terminal Reduced Ordered Binary Decision Diagrams (MtROBDDs).
There is one MtROBDD instance per automaton that represents the transition function of the automaton.
Below you can see an example of Mata automaton in the DOT format, mona automaton in the DOT format, and its corresponding shared MtROBDD representation.
In order to support nonbinary alphabets in MONA, MaMONAta encodes each symbol using multiple binary variables. It uses
!!WARNING!!: When performing operations that combine multiple automata (e.g., union, intersection, concatenation), the user is responsible for ensuring that the alphabet encodings are consistent across all automata involved in the operation.
MaMONAta allows MONA to represent nondeterministic automata by introducing additional variables to encode nondeterministic choices. These variables are put at the end of the variable ordering. The determinization of the automaton is then performed by projecting out these nondeterministic choice variables. The placement of these variables at the end of the variable ordering makes the projection more efficient than if they were put at the beginning, which would lead to more difficult determinization of the shared MtROBDD representation.
!!WARNING!!: When performing any MONA operation on the automaton, the user is responsible for ensuring that there are no nondeterministic choice variables present in the automaton. The existence of such variables would lead to incorrect results. For example, two sequences, containing one alphabet variable and one nondeterministic variable (00 and 01), and differ only in the value of the nondeterministic choice variables, would be considered two different symbol encodings during operations like union or intersection, which is not the intended behavior.
MONA always works with complete transition functions. If the automaton is converted from Mata and has an incomplete transition function, MaMONAta adds a sink state to the automaton to make the transition function complete.
MONA relies on reduced BDDs to represent the transition function of the automaton. If the provided BDD is not reduced, the behavior of MONA is undefined.
!!WARNING!!: When manually building a .mona file, the user is responsible for ensuring that the BDD is reduced.
The following is a .mona file representing an automaton from above:
MONA DFA
number of variables: 2
variables: A0 A1
orders: 0 0
states: 8
initial: 0
bdd nodes: 19
final: -1 -1 -1 -1 -1 1 1 -1
behaviour: 0 5 8 13 16 18 2 2
bdd:
0 4 1
1 3 2
-1 7 0
-1 2 0
-1 1 0
0 6 2
1 2 7
-1 3 0
0 11 9
1 10 2
-1 5 0
1 2 12
-1 4 0
0 14 2
1 15 2
-1 6 0
0 17 2
1 2 10
0 17 9
end
MONA DFAis a mandatory header indicating that the file represents a deterministic finite automaton.number of variablesspecifies the number of binary variables used to encode the alphabet.variableslists the names of the variables used in the BDD representation. MaMONAta uses the prefixAfor alphabet variables andNfor nondeterministic choice variables.ordersindicates the order of each variable in the BDD.statesindicates the total number of states in the automaton.initialspecifies the initial state of the automaton.bdd nodesindicates the number of nodes in the BDD representation.finalis a list indicating the acceptance status of each state. A value of1indicates an accepting state, while-1indicates a non-accepting state.0is not used in Mata and is reserved for special use with WS1S in MONA.behaviourlists the BDD node indices corresponding to the beginning of the transition function for each state.bddsection contains the BDD nodes, each represented by three values: variable index, low child index, and high child index. A negative variable index indicates a terminal node, with the name/value of the target state being stored in the low child index. The high child index is unused for terminal nodes and is set to0.
Download the repositories by running the script extern/download.sh.
Build the project using make release or make debug for a debug build.
In CMakeLists.txt, you can choose whether to time the operations by setting the TIMING_ENABLED option to ON or OFF.
include/mata-bridge/- header files for the MaMONAta adapter.include/mona-bridge/- header files for the MONA adapter.include/mtrobdd.hh- header file for the MtROBDD implementation.include/timer.hh- header file with the Timer class.src/mtrobdd.cc- implementation of the MtROBDD.src/mata-bridge/- Mata adapter code.src/mona-bridge/- MONA adapter code.extern/download.sh- script to download the required external libraries.extern/mata/- Mata library.extern/MONA/- MONA library.


