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) is relatively marked w.r.t. the
226  * omega language Bm(GPlant). The formal definition of this property requires
227  *
228  * closure(Bm(GCand)) ^ Bm(GPlant) <= Bm(GCand).
229  *
230  * The implementation first performs the product composition of the two generators
231  * with product state space QPlant x QCand and generated language L(GPlant x GCand)
232  * = L(Plant) ^ L(Cand). It test whether
233  * - when muting the GCand-marking, there must be no SCC with GPlant-marking
234  *
235  * The arguments GCand and GPlant are required to be deterministic and omega trim.
236  *
237  * @param rGenPlant
238  * Generator GPlant
239  * @param rGenCand
240  * Generator GCand
241  *
242  * @exception Exception
243  * - alphabets of generators don't match (id 100)
244  * - arguments are not omega-trim (id 201, only if FAUDES_CHECKED is set)
245  * - arguments are non-deterministic (id 202, only if FAUDES_CHECKED is set)
246  *
247  *
248  * @return
249  * true / false
250  *
251  * @ingroup OmgPlugIn
252  */
253 extern FAUDES_API bool IsBuechiRelativelyMarked(const Generator& rGenPlant, const Generator& rGenCand);
254 
255 /**
256  * Test for relative closedness, omega languages.
257  *
258  * Tests whether the omega language Bm(GCand) is relatively closed w.r.t.
259  * the omega language Bm(GPlant). The formal definition of this property
260  * requires
261  *
262  * closure(Bm(GCand)) ^ Bm(GPlant) = Bm(GCand).
263  *
264  *
265  * The implementation first performs the product composition of the two generators with
266  * product state space QPlant x QCand and generated language L(GPlant x GCand) = L(GPlant) ^ L(GCand).
267  * It uses the composition to test the follwing three conditions:
268  * - L(GCand) subseteq L(GPlant);
269  * - when muting the GCand-marking, there must be no SCC with GPlant-marking
270  * - when muting the GPlant-marking, there must be no SCC with GCand-marking
271  * If and only if all three tests are passed, the function
272  * returns true.
273  *
274  * The arguments GCand and GPlant are required to be deterministic and omega trim.
275  *
276  * @param rGenPlant
277  * Generator GPlant
278  * @param rGenCand
279  * Generator GCand
280  *
281  *
282  * @exception Exception
283  * - alphabets of generators don't match (id 100)
284  * - arguments are not omega trim (id 201, only if FAUDES_CHECKED is set)
285  * - arguments are non-deterministic (id 202, only if FAUDES_CHECKED is set)
286  *
287  *
288  * @return
289  * true / false
290  *
291  * @ingroup OmgPlugIn
292  */
293 extern FAUDES_API bool IsBuechiRelativelyClosed(const Generator& rGenPlant, const Generator& rGenCand);
294 
295 /**
296  * Test for relative closedness, omega languages.
297  *
298  * This variant does not perform consitency tests on the parameters. Neither
299  * does it handle the special cases on empty arguments.
300  * See also IsBuechiRelativelyClosed(const Generator&, const Generator& )
301  *
302  * @param rGenPlant
303  * Generator GPlant
304  * @param rGenCand
305  * Generator GCand
306  *
307  */
308 extern FAUDES_API bool IsBuechiRelativelyClosedUnchecked(const Generator& rGenPlant, const Generator& rGenCand);
309 
310 /**
311  * Test for languege inclusion, omega languages.
312  *
313  * Tests whether the omega language Bm(Gen1) is included in Bm(Gen2).
314  *
315  * The implementation first performs the product composition of the two generators with
316  * product state space QPlant x QCand and generated language L(GPlant x GCand) = L(GPlant) ^ L(GCand).
317  * It uses the composition to test the follwing conditions:
318  * - L(Gen1) subseteq L(Gen2);
319  * - when muting the Gen2-marking, there must be no SCC with Gen1-marking
320  * If and only if both tests are passed, the function returns true.
321  *
322  * Note. Relevant Background is given in ""Complementing Deterministic Biichi Automata in Polynomial Time",
323  * by R.P. KURSHAN, 1986. The setting in the reference is quire different, but at the end our implementation
324  * should match.
325  *
326  *
327  * The arguments Gen1 and Gen2 are required to be deterministic and omega trim.
328  *
329  * @param rGen1
330  * Generator Gen1
331  * @param rGen2
332  * Generator Gen2
333  *
334  * @exception Exception
335  * - alphabets of generators don't match (id 100)
336  * - arguments are not omega trim (id 201, only if FAUDES_CHECKED is set)
337  * - arguments are non-deterministic (id 202, only if FAUDES_CHECKED is set)
338  *
339  * @return
340  * true / false
341  *
342  * @ingroup OmgPlugIn
343  */
344 extern FAUDES_API bool BuechiLanguageInclusion(const Generator& rGen1, const Generator& rGen2);
345 
346 
347 /**
348  * Test for languege equality, omega languages.
349  *
350  * Tests whether the omega language Bm(Gen1) equalsBm(Gen2).
351  *
352  * The implementation first performs the product composition of the two generators with
353  * product state space QPlant x QCand and generated language L(GPlant x GCand) = L(GPlant) ^ L(GCand).
354  * It uses the composition to test the follwing conditions:
355  * - L(Gen1) = L(Gen2);
356  * - when muting the Gen2-marking, there must be no SCC with Gen1-marking
357  * - when muting the Gen1-marking, there must be no SCC with Gen2-marking
358  * If and only if all tests are passed, the function returns true.
359  *
360  * The arguments Gen1 and Gen2 are required to be deterministic and omega trim.
361  *
362  * @param rGen1
363  * Generator Gen1
364  * @param rGen2
365  * Generator Gen2
366  *
367  * @exception Exception
368  * - alphabets of generators don't match (id 100)
369  * - arguments are not omega trim (id 201, only if FAUDES_CHECKED is set)
370  * - arguments are non-deterministic (id 202, only if FAUDES_CHECKED is set)
371  *
372  * @return
373  * true / false
374  *
375  * @ingroup OmgPlugIn
376  */
377 extern FAUDES_API bool BuechiLanguageEquality(const Generator& rGen1, const Generator& rGen2);
378 
379 
380 } // namespace faudes
381 
382 #endif
383 
#define FAUDES_API
Definition: cfl_platform.h:85
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 BuechiLanguageInclusion(const Generator &rGen1, const Generator &rGen2)
bool BuechiLanguageEquality(const Generator &rGen1, const Generator &rGen2)
bool IsBuechiTrim(const vGenerator &rGen)
bool IsBuechiRelativelyClosed(const Generator &rGenPlant, const Generator &rGenCand)
bool IsBuechiRelativelyMarked(const Generator &rGenPlant, const Generator &rGenCand)
bool IsBuechiRelativelyClosedUnchecked(const Generator &rGenPlant, const Generator &rGenCand)

libFAUDES 2.33l --- 2025.09.16 --- c++ api documentaion by doxygen