omg_buechifnct.h
Go to the documentation of this file.
1 /** @file omg_buechifnct.h
2 
3 Operations on omega languages accepted by Buechi automata
4 
5 */
6 
7 /* FAU Discrete Event Systems Library (libfaudes)
8 
9  Copyright (C) 2010, 2025 Thomas Moor
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 2.1 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
24 
25 
26 #ifndef FAUDES_OMG_BUECHIFNCT_H
27 #define FAUDES_OMG_BUECHIFNCT_H
28 
29 #include "corefaudes.h"
30 
31 namespace faudes {
32 
33 
34 /**
35  * Trim generator w.r.t Buechi acceptance
36  *
37  * This function removes states such that the generator becomes
38  * omega trim while not affecting the induced omega language.
39  *
40  * The implementation first makes the generator accessible
41  * and then iteratively removes state that either
42  * never reach a marked state or that are guaranteed to eventually
43  * reach a terminal state. There might be a more efficient
44  * approach.
45  *
46  * @param rGen
47  * Automaton to trim
48  *
49  * @return
50  * True if resulting generator contains at least one initial state and at least one marked state.
51  *
52  * @ingroup OmgPlugin
53  */
54 extern FAUDES_API bool BuechiTrim(vGenerator& rGen);
55 
56 
57 /**
58  * Trim generator w.r.t Buechi acceptance
59  *
60  * This is a API wrapper for BuechiTrim(vGenerator&).
61  *
62  * @param rGen
63  * Automaton to trim (const ref)
64  * @param rRes
65  * Resulting automaton
66  * @return
67  * True if resulting generator contains at least one initial state and at least one marked state.
68  *
69  * @ingroup OmgPlugin
70  */
71 extern FAUDES_API bool BuechiTrim(const vGenerator& rGen, vGenerator& rRes);
72 
73 /**
74  * Check if generator is omega-trim.
75  *
76  * Returns true if all states are accessible, coacessible, and
77  * have a successor state.
78  *
79  * @return
80  * True if generator is omega-trim
81  */
82 extern FAUDES_API bool IsBuechiTrim(const vGenerator& rGen);
83 
84 
85 /**
86  * Product composition for Buechi automata
87  *
88  * Referring to the Buechi acceptance condition, the resulting genarator
89  * accepts all those inifinite words that are accepted by both, G1 and G2.
90  * This implementation extends the usual product state space by a flag to indentify
91  * executions with alternating marking.
92  *
93  * @param rGen1
94  * First generator
95  * @param rGen2
96  * Second generator
97  * @param rResGen
98  * Reference to resulting product composition generator
99  *
100  *
101  * @ingroup OmgPlugin
102  *
103  */
104 extern FAUDES_API void BuechiProduct(const Generator& rGen1, const Generator& rGen2, Generator& rResGen);
105 
106 
107 /**
108  * Product composition for Buechi automata
109  *
110  * See also BuechiProduct(const Generator&, const Generator&, Generator&).
111  * This version tries to be transparent on event attributes: if
112  * argument attributes match and if the result can take the respective
113  * attributes, then they are copied; it is considered an error if
114  * argument attributes do not match.
115  *
116  * @param rGen1
117  * First generator
118  * @param rGen2
119  * Second generator
120  * @param rResGen
121  * Reference to resulting product composition generator
122  *
123  * @ingroup OmgPlugin
124  */
125 extern FAUDES_API void aBuechiProduct(const Generator& rGen1, const Generator& rGen2, Generator& rResGen);
126 
127 
128 /**
129  * Parallel composition with relaxed acceptance condition.
130  *
131  * This version of the parallel composition relaxes the synchronisation of the acceptance
132  * condition (marking). It requires that the omega extension of the generated language
133  * has infinitely many prefixes that comply to the marked languages of G1 and G2, referring
134  * to the projection on the respective alphabet.
135  * It does however not require the synchronous acceptance.
136  *
137  * @param rGen1
138  * First generator
139  * @param rGen2
140  * Second generator
141  * @param rResGen
142  * Reference to resulting parallel composition generator
143  *
144  *
145  * @ingroup OmgPlugin
146  *
147  */
148 extern FAUDES_API void BuechiParallel(const Generator& rGen1, const Generator& rGen2, Generator& rResGen);
149 
150 
151 /**
152  * Parallel composition with relaxed acceptance condition.
153  *
154  * See also BuechiParallel(const Generator&, const Generator&, Generator&).
155  * This version tries to be transparent on event attributes: if
156  * argument attributes match and if the result can take the respective
157  * attributes, then they are copied; it is considered an error if
158  * argument attributes do not match.
159  *
160  * @param rGen1
161  * First generator
162  * @param rGen2
163  * Second generator
164  * @param rResGen
165  * Reference to resulting composition generator
166  *
167  * @ingroup OmgPlugin
168  */
169 extern FAUDES_API void aBuechiParallel(const Generator& rGen1, const Generator& rGen2, Generator& rResGen);
170 
171 
172 /**
173  * Topological closure.
174  *
175  * This function computes the topological closure the omega language
176  * Bm accepted by the Buechi automaton rGen.
177  *
178  * Method:
179  * First, BuechiTrim is called to erase all states of rGen that do not
180  * contribute to Bm. Then, all remaining states are marked.
181  *
182  * No restrictions on parameter.
183  *
184  *
185  * @param rGen
186  * Generator that realizes Bm to which omega closure is applied
187  *
188  * <h4>Example:</h4>
189  * <table>
190  * <tr> <td> Generator G </td> <td> BuechiClosure(G) </td> </tr>
191  * <tr>
192  * <td> @image html tmp_omg_bclosure_g.png </td>
193  * <td> @image html tmp_omg_bclosure_gRes.png </td>
194  * </tr>
195  * </table>
196  *
197  * @ingroup OmgPlugin
198  */
199 extern FAUDES_API void BuechiClosure(Generator& rGen);
200 
201 
202 /**
203  * Test for topologically closed omega language.
204  *
205  * This function tests whether the omega language Bm(G) realized by the specified
206  * Buechi automata is topologically closed.
207  *
208  * Method:
209  * First, compute the Buechi-trim state set and restrict the discussion to that set.
210  * Then, omega-closedness is equivalent to the non-existence on a non-trivial SCC
211  * with no marked states.
212  *
213  * @param rGen
214  * Generator that realizes Bm to which omega closure is applied
215  * @return
216  * True <> Bm(G) is omega closed
217  *
218  * @ingroup OmgPlugin
219  */
220 extern FAUDES_API bool IsBuechiClosed(const Generator& rGen);
221 
222 /**
223  * Test for relative marking, omega langauges.
224  *
225  * Tests whether the omega language Bm(GCand)
226  * is relatively marked w.r.t.
227  * the omega language Bm(GPlant). The formal definition of this property
228  * requires
229  *
230  * closure(Bm(GCand)) ^ Bm(GPlant) <= Bm(GCand).
231  *
232  * The implementation first performs the product composition
233  * of the two generators with product state space QPlant x QCand and
234  * generated language L(GPlant x GCand) = L(Plant) ^ L(Cand). It then investigates
235  * all SCCs that do not
236  * contain a state that corresponds to GCand-marking. If and only if
237  * none of the considered SCCs has a GPlant marking, the function
238  * returns true.
239  *
240  * The arguments GCand and GPlant are required to be deterministic and omega trim.
241  *
242  * @param rGenPlant
243  * Generator GPlant
244  * @param rGenCand
245  * Generator GCand
246  *
247  * @exception Exception
248  * - alphabets of generators don't match (id 100)
249  * - arguments are not omega-trim (id 201, only if FAUDES_CHECKED is set)
250  * - arguments are non-deterministic (id 202, only if FAUDES_CHECKED is set)
251  *
252  *
253  * @return
254  * true / false
255  *
256  * @ingroup SynthesisPlugIn
257  */
258 extern FAUDES_API bool IsBuechiRelativelyMarked(const Generator& rGenPlant, const Generator& rGenCand);
259 
260 /**
261  * Test for relative closedness, omega languages.
262  *
263  * Tests whether the omega language Bm(GCand)
264  * is relatively closed w.r.t.
265  * the omega language Bm(GPlant). The formal definition of this property
266  * requires
267  *
268  * closure(Bm(GCand)) ^ Bm(GPlant) = Bm(GCand).
269  *
270  *
271  * The implementation first performs the product composition
272  * of the two generators with product state space QPlant x QCand and
273  * generated language L(GPlant x GCand) = L(GPlant) ^ L(GCand). It uses the composition
274  * to test the follwing three conditions:
275  * - L(GCand) subseteq L(GPlant);
276  * - no SCC of GPlant x GCand without GCand-marking contains a state with GPlant-marking; and
277  * - no SCC of GPlant x GCand without GPlant-marking contains a state with GCand-marking.
278  * If and only if all three tests are passed, the function
279  * returns true.
280  *
281  * The arguments GCand and GPlant are required to be deterministic and omega trim.
282  *
283  * @param rGenPlant
284  * Generator GPlant
285  * @param rGenCand
286  * Generator GCand
287  *
288  *
289  * @exception Exception
290  * - alphabets of generators don't match (id 100)
291  * - arguments are not omega trim (id 201, only if FAUDES_CHECKED is set)
292  * - arguments are non-deterministic (id 202, only if FAUDES_CHECKED is set)
293  *
294  *
295  * @return
296  * true / false
297  *
298  * @ingroup SynthesisPlugIn
299  */
300 extern FAUDES_API bool IsBuechiRelativelyClosed(const Generator& rGenPlant, const Generator& rGenCand);
301 
302 /**
303  * Test for relative closedness, omega languages.
304  *
305  * This variant does not perform consitency tests on the parameters. Neither
306  * does it handle the special cases on empty arguments.
307  * See also IsBuechiRelativelyClosed(const Generator&, const Generator& )
308  *
309  * @param rGenPlant
310  * Generator GPlant
311  * @param rGenCand
312  * Generator GCand
313  *
314  */
315 extern FAUDES_API bool IsBuechiRelativelyClosedUnchecked(const Generator& rGenPlant, const Generator& rGenCand);
316 
317 
318 } // namespace faudes
319 
320 #endif
321 
#define FAUDES_API
Definition: cfl_platform.h:80
vGenerator Generator
void aBuechiProduct(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
void BuechiProduct(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
void BuechiParallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
void aBuechiParallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
bool BuechiTrim(vGenerator &rGen)
void BuechiClosure(Generator &rGen)
bool IsBuechiClosed(const Generator &rGen)
bool IsBuechiRelativelyClosed(const Generator &rGenPlant, const Generator &rGenCand)
bool IsBuechiRelativelyMarked(const Generator &rGenPlant, const Generator &rGenCand)
bool IsBuechiTrim(const vGenerator &rGen)
bool IsBuechiRelativelyClosedUnchecked(const Generator &rGenPlant, const Generator &rGenCand)

libFAUDES 2.33h --- 2025.06.18 --- c++ api documentaion by doxygen