syn_ctrlpfx.h
Go to the documentation of this file.
1 /** @file syn_ctrlpfx.h Controllability prefix */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5  Copyright (C) 2025 Thomas Moor
6  Exclusive copyright is granted to Klaus Schmidt
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
21 
22 
23 #ifndef FAUDES_SYN_CTRLPFX_H
24 #define FAUDES_SYN_CTRLPFX_H
25 
26 #include "corefaudes.h"
27 
28 namespace faudes {
29 
30 
31 /**
32  * Operator on state sets
33  *
34  * Light weight base class to be used in fixpoint iterations. See
35  * faudes::CtrlPfxOperator for an example of a derived class.
36  *
37  * @ingroup SynthesisPlugIn
38  */
40 
41 public:
42 
43  /** construct */
45 
46  /** disable copy construct */
48 
49  /** destruct */
51 
52  /**
53  * Domain
54  *
55  * Some operations need to take complements and thus refer to the full state set.
56  * The base class returns the empty set as a dummy. Reimplement this function
57  * if you need that extra functionality. See faudes::CtrlPfxOperator for a derived class.
58  *
59  * @return
60  * Full state set.
61  **/
62  virtual const StateSet& Domain(void) const;
63 
64  /**
65  * Evaluate opertor on arguments
66  *
67  * This is a wrapper for the protected method DoEvaluate. The latter
68  * should be re-implemented by derived classes to encode the actual operator.
69  *
70  * @param rArgs
71  * State-set valued arguments the operator performs on
72  * @param rRes
73  * Resulting state set
74  **/
75  void Evaluate(StateSetVector& rArgs, StateSet& rRes) const;
76 
77  /**
78  * Evaluate opertor on arguments
79  *
80  * This is a convenience wrapper for the protected method DoEvaluate for
81  * operator with orny one argument.
82  *
83  * @param rArg
84  * State-set valued argument
85  * @param rRes
86  * Resulting state set
87  **/
88  void Evaluate(StateSet& rArg, StateSet& rRes) const;
89 
90  /**
91  * Evaluate opertor on arguments
92  *
93  * This is a convenience wrapper for the protected method DoEvaluate for
94  * operators with no arguments.
95  *
96  * @param rRes
97  * Resulting state set
98  **/
99  void Evaluate(StateSet& rRes) const;
100 
101  /** signature, i.e., the number of arguments we expect */
102  StateSetVector::Position ArgCount(void) const;
103 
104  /** signature, i.e., argument names (cosmetic) */
105  const std::string& ArgName(StateSetVector::Position pos) const;
106 
107  /** argument stats (debugging/development) */
108  std::string ArgStatistics(const StateSetVector& rArgs) const;
109 
110  /** indent (cosmetic) */
111  virtual const std::string& Indent(void) const;
112 
113  /** indent (cosmetic) */
114  virtual void Indent(const std::string& indent) const;
115 
116  /** logging progress (cosmetic) */
117  static void LogMuNu(bool on);
118 
119 
120 protected:
121 
122  /** signature */
124 
125  /** support cosmetic siganture */
126  std::vector<std::string> mArgNames;
127 
128  /** support cosmetic */
129  std::string mIndent;
130 
131  /** support cosmetic */
132  static bool mLogMuNu;
133 
134 
135  /**
136  * Evaluate opertor on arguments (protected virtual)
137  *
138  * The arguments are given as a vector of state sets. For fixpoint iterations, the last
139  * entry in the vector becomes the iteration variable, while the remaining entries are constant
140  * parameters. Re-implement this function for the oparater you want to iterate on. See
141  * faudes::CtrlPfxOperator for a derived class.
142  *
143  * @param rAggs
144  * State-set valued arguments the operator performs on
145  * @param rRes
146  * Resulting state set
147  **/
148  virtual void DoEvaluate(StateSetVector& rArgs, StateSet& rRes) const =0;
149 
150 };
151 
152 /**
153  * Operator used for the computation of the controllability prefix.
154  *
155  * @ingroup SynthesisPlugIn
156  */
158 
159 public:
160 
161  /** construct */
162  CtrlPfxOperator(const vGenerator& rGenerator, const EventSet& rSigmaCtrl);
163 
164  /** destruct */
166 
167  /**
168  * Domain
169  *
170  * Report the universe of all states, as given by the generator on construction.
171  *
172  * @return
173  * Full state set.
174  **/
175  virtual const StateSet& Domain(void) const;
176 
177 protected:
178 
179  /**
180  * Evaluate opertor on arguments
181  *
182  * For the purpose of the controllability prefix, we evalate to
183  *
184  * eval([Y,X]) =
185  * (pre_exitential(X) union marked_states) intersected with pre_universal_ctrl(Y)
186  *
187  * Note: the order of the argument vector matters. The last entry is the iterate
188  * in the inner most iteration.
189  *
190  * @param rArgs
191  * Argument [Y,X] in that order
192  * @param rRes
193  * Resulting state set
194  **/
195  virtual void DoEvaluate(StateSetVector& rArgs, StateSet& rRes) const;
196 
197 
198  /** set up context references */
199  const vGenerator& rGen;
200 
201  /** set up conbtext references */
203 
204  /** set up context references */
206 
207  /** have a reverse transition relation*/
209 
210 };
211 
212 /**
213  * Mu-iterations on state sets.
214  *
215  * Given an opertor on state stes, this class facilitates nested
216  * fixpoint iterations as in the mu-calculus. In tis specific class,
217  * we implement the mu-iteration, i.e., we seek for the smallest fixpoint.
218  *
219  * The implementation is meant for a simple API, we do not care about
220  * performance at this stage.
221  *
222  * @ingroup SynthesisPlugIn
223  */
225 
226  public:
227 
228  /**
229  * Construct from operator
230  *
231  * The last entry of the operator argument becomes the variable we iterate in.
232  * The preceeding entries are interpreted ans constant paramters in our scope.
233  *
234  * @param rOp
235  * Operator to iterate
236  */
237  MuIteration(const StateSetOperator& rOp);
238 
239  /** detsruct */
240  ~MuIteration(void){};
241 
242  /**
243  * Domain
244  *
245  * Report the universe of all states, as given by the operator on construction.
246  *
247  * @return
248  * Full state set.
249  **/
250  virtual const StateSet& Domain(void) const;
251 
252  /** indent (cosmetic) */
254  virtual void Indent(const std::string& indent) const;
255 
256 protected:
257 
258  /**
259  * Implement the mu-iteration to find the smallest fixpoint.
260  *
261  * Given the parameter vector rArgs, we append one additional state set
262  * X for which we seek a fixpoint of Op(rArgs,X). Effectively we iterate
263  *
264  * X(0) = emptyset
265  * X(i+1) = X(i) union Op(rArgs,X(i))
266  *
267  * until the fixpoint is achieved.
268  *
269  * @param rArgs
270  * Arguments the operator performs on
271  * @param rRes
272  * Resulting state set
273  **/
274  virtual void DoEvaluate(StateSetVector& rArgs, StateSet& rRes) const;
275 
276  /** the base operator to iterate with */
278 };
279 
280 
281 /**
282  * Nu-iterations on state sets.
283  *
284  * Given an opertor on state stes, this class facilitates nested
285  * fixpoint iterations as in the mu-calculus. In tis specific class,
286  * we implement the nu-iteration, i.e., we seek for the greatest fixpoint.
287  *
288  * The implementation is meant for a simple API, we do not care about
289  * performance at this stage.
290  *
291  * @ingroup SynthesisPlugIn
292  */
294 
295  public:
296 
297  /**
298  * Construct from operator
299  *
300  * The last entry of the operator argument becomes the variable we iterate in.
301  * The preceeding entries are interpreted ans constant paramters in our scope.
302  *
303  * @param rOp
304  * Operator to iterate
305  */
306  NuIteration(const StateSetOperator& rOp);
307 
308  /** detsruct */
309  ~NuIteration(void){};
310 
311  /**
312  * Domain
313  *
314  * Report the universe of all states, as given by the operator on construction.
315  *
316  * @return
317  * Full state set.
318  **/
319  virtual const StateSet& Domain(void) const;
320 
321 
322  /** reimplemengt indent */
324  virtual void Indent(const std::string& indent) const;
325 
326 protected:
327 
328  /**
329  * Implement the nu-iteration to find the smallest fixpoint.
330  *
331  * Given the parameter vector rArgs, we append one additional state set
332  * X for which we seek a fixpoint of Op(rArgs,X). Effectively we iterate
333  *
334  * X(0) = Domain
335  * X(i+1) = X(i) intersected with Op(rArgs,X(i))
336  *
337  * until the fixpoint is achieved.
338  *
339  * @param rArgs
340  * Arguments the operator performs on
341  * @param rRes
342  * Resulting state set
343  **/
344  virtual void DoEvaluate(StateSetVector& rArgs, StateSet& rRes) const;
345 
346  /** the base operator to iterate on */
348 };
349 
350 
351 
352 
353 
354 
355 } // namespace faudes
356 
357 #endif
358 
359 
#define FAUDES_API
Definition: cfl_platform.h:80
const TransSet & rTransRel
Definition: syn_ctrlpfx.h:205
const vGenerator & rGen
Definition: syn_ctrlpfx.h:199
TransSetX2EvX1 mRevTransRel
Definition: syn_ctrlpfx.h:208
const StateSetOperator & mrOp
Definition: syn_ctrlpfx.h:277
const StateSetOperator & mrOp
Definition: syn_ctrlpfx.h:347
StateSetOperator(const StateSetOperator &)=delete
virtual void DoEvaluate(StateSetVector &rArgs, StateSet &rRes) const =0
virtual const std::string & Indent(void) const
std::vector< std::string > mArgNames
Definition: syn_ctrlpfx.h:126
StateSetVector::Position mArgCount
Definition: syn_ctrlpfx.h:123
std::vector< int >::size_type Position

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