op_ex_verification.cpp
Go to the documentation of this file.
1 /** @file op_ex_verification.cpp
2 
3  Tutorial, verification of properties of natural projections.
4 
5  This tutorial explains the routines for verifying if the Lm-observer condition, output control consistency (OCC)
6  or local control consistency (LCC) are fulfilled for a given natural projection. The computations are carried out
7  with a given generator and a given high-level alphabet.
8 
9  @ingroup Tutorials
10 
11  @include op_ex_verification.cpp
12 */
13 
14 #include <stdio.h>
15 #include <iostream>
16 #include "libfaudes.h"
17 #include "op_include.h"
18 
19 // make libFAUDES namespace available
20 using namespace faudes;
21 
22 
23 int main(int argc, char* argv[]) {
24  //////////////////////////////////////////
25  //Verification of the Lm-observer property
26  //////////////////////////////////////////
27 
28  // construct original Generator from file
29  System genOrig = Generator("data/ex_verification/ex_isnot_observer.gen");
30  // construct abstraction alphabet from file
31  EventSet highAlph = EventSet("data/ex_verification/ex_isnot_observer.alph", "Alphabet");
32  // verify if the natural projection on highAlph is an Lm-observer and output the result.
33  // In this example, the Lm-observer property is violated.
34  bool observer = IsObs(genOrig, highAlph);
35  std::cout << "##################################\n";
36  std::cout << "# Observer verification result: " << observer << std::endl;
37  std::cout << "##################################\n";
38 
39 
40  // read a new generator and a new high-level alphabet
41  genOrig.Read("data/ex_verification/ex_is_observer.gen");
42  highAlph.Read("data/ex_verification/ex_is_observer.alph", "Alphabet");
43  // verify if the natural projection on the current highAlph is an Lm-observer and output the result.
44  // In this example, the Lm-observer property is fulfilled.
45  observer = IsObs(genOrig, highAlph);
46  std::cout << "##################################\n";
47  std::cout << "Observer verification result: " << observer << std::endl;
48  std::cout << "##################################\n";
49 
50  ///////////////////////////////////////////////////////////////
51  //Verification of the output control consistency (OCC) property
52  ///////////////////////////////////////////////////////////////
53 
54  //verify if the natural projection on highAlph fulfills OCC for the previously read generator and alphabet.
55  // In this example, OCC is violated.
56  bool occ = IsOCC(genOrig, highAlph);
57  std::cout << "###########################\n";
58  std::cout << "OCC verification result: " << occ << std::endl;
59  std::cout << "###########################\n";
60 
61  // read a new generator that fulfills OCC together with the previous highAlph
62  genOrig.Read("data/ex_verification/ex_is_occ.gen");
63  //Verification of the output control consistency (OCC) property. In this case, OCC is fulfilled.
64  occ = IsOCC(genOrig, highAlph);
65  std::cout << "###########################\n";
66  std::cout << "OCC verification result: " << occ << std::endl;
67  std::cout << "###########################\n";
68 
69  //////////////////////////////////////////////////////////////
70  //Verification of the local control consistency (LCC) property
71  //////////////////////////////////////////////////////////////
72 
73  //verify if the natural projection on highAlph fulfills LCC. In this case, LCC is fulfilled (OCC implies LCC).
74  bool lcc = IsLCC(genOrig, highAlph);
75  std::cout << "###########################\n";
76  std::cout << "lcc verification result: " << lcc << std::endl;
77  std::cout << "###########################\n";
78  // read a new generator that does not fulfill LCC with highAlph.
79  genOrig.Read("data/ex_verification/ex_is_observer.gen");
80  //verify if the natural projection on highAlph fulfills LCC. In this case, LCC is violated.
81  lcc = IsLCC(genOrig, highAlph);
82  std::cout << "###########################\n";
83  std::cout << "lcc verification result: " << lcc << std::endl;
84  std::cout << "###########################\n";
85  // read a new generator that fulfills LCC together with highAlph
86  genOrig.Read("data/ex_verification/ex_is_lcc.gen");
87  //Verification of the local control consistency (LCC) property. In this case, LCC is fulfilled.
88  lcc = IsLCC(genOrig, highAlph);
89  std::cout << "###########################\n";
90  std::cout << "lcc verification result: " << lcc << std::endl;
91  std::cout << "###########################\n";
92 
93  return 0;
94 }
Set of indices with symbolic names.
Definition: cfl_nameset.h:69
Generator with controllability attributes.
void Read(const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
Read configuration data from file with label specified.
Definition: cfl_types.cpp:261
NameSet EventSet
Convenience typedef for plain event sets.
Definition: cfl_nameset.h:531
vGenerator Generator
Plain generator, api typedef for generator with no attributes.
bool IsOCC(const System &rLowGen, const EventSet &rHighAlph)
Verification of output control consistency (OCC).
bool IsLCC(const System &rLowGen, const EventSet &rHighAlph)
Verification of local control consistency (LCC).
bool IsObs(const Generator &rLowGen, const EventSet &rHighAlph)
Verification of the natural observer property.
Includes all libFAUDES headers, incl plugings
libFAUDES resides within the namespace faudes.
int main(int argc, char *argv[])
Includes all observer plugin headers.

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen