Awali
Another Weighted Automata library
eps_removal.hh
Go to the documentation of this file.
1 // This file is part of Awali.
2 // Copyright 2016-2022 Sylvain Lombardy, Victor Marsault, Jacques Sakarovitch
3 //
4 // Awali is a free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 /*****************************************************************************
18  See template-docfile.hh for documentation and how characters are preprocessed
19 ******************************************************************************/
20 
21 #ifndef AWALI_COMMON_DOCSTRING_EPSREMOVAL_HH
22 #define AWALI_COMMON_DOCSTRING_EPSREMOVAL_HH
23 
25 
26 namespace awali { namespace docstring {
27 
28 static entry_t eps_removal = {
29 /* Name: */ "eps_removal",
30 /* Description: */ "Specification and description of the 'epsilon-removal' algorithm",
31 /* Title: */ " Specification and description of the epsilon-removal algorithm",
32 /* Content: */
33 R"---doxytoken---(
34 ### Specification:
35 
36 Write `<aut> = (I, E, T)` where `I` is the vector of initial states
37 (of initial values for weighted automata), `T` the vector of final states
38 (of final values for weighted automata), and `E` the transition matrix.
39 Let `E = F + G` where `F` is 'proper', that is, its entries do not contain
40 the empty word with non zero coefficient, whereas the entries of `G` are,
41 when non zero, the empty word with a non zero coefficient. The behaviour
42 of `<aut>` is:
43 
44  I.E^*.T = I.(F+G)^*.T = I.(G^*.F)^*.G^*.T = I.G^*.(F.G^*)^*.T
45 
46 By definition,
47 
48  proper( (I,E,T), backward) = ( I, (G^*.F), (G^*.T) ) and
49 
50  proper( (I,E,T), forward) = ( (I.G^*), (F.G^*), T ) .
51 
52 
53 ### Algorithm:
54 
55 Proper computes both `G^*.F` and `G^*.T` with a method which is similar
56 to the state elimination method. All states are visited, one after the other.
57 
58 At state `s`, every epsilon-transition incoming to `s` is removed, giving birth
59 to one new transition for every transition outgoing from `s`. The case of an
60 epsilon-transition which is a loop on `s` with weight `k` is special.
61 If `k` is starrable, the weight of every transition outgoing from `s` is
62 multiplied by `k^*`. If `k` is not starrable, then `<aut>` is not valid and
63 the algorithm fails and stops. Hence the algorithm is also the test for the
64 'validity' of `<aut>` (see 'is-valid' function).
65 
66 After all epsilon-transition incoming to `s` are removed, if no other incoming
67 transitions are left, state `s` is also removed.
68 
69 Of course, being final is treated as an outgoing transition, and being initial
70 as an incoming transition.
71 
72 More details can be found in: S. Lombardy, J. Sakarovitch: The validity of
73 weighted automata, *Int. J. of Algebra and Computation* (2013) 863--913.
74 )---doxytoken---"
75 };
76 
77 }} //End of namespaces awali::docstring and awali
78 
79 
80 #endif
81 
static entry_t eps_removal
Definition: eps_removal.hh:28
Definition: entry.hh:24
Main namespace of Awali.
Definition: ato.hh:22