op_ex_verification.cpp

Go to the documentation of this file.
00001 /** @file op_ex_verification.cpp
00002 
00003     Tutorial, verification of properties of natural projections. 
00004 
00005     This tutorial explains the routines for verifying if the Lm-observer condition, output control consistency (OCC) 
00006     or local control consistency (LCC) are fulfilled for a given natural projection. The computations are carried out 
00007     with a given generator and a given high-level alphabet. 
00008 
00009     @ingroup Tutorials
00010 
00011     @include op_ex_verification.cpp
00012 */
00013 
00014 #include <stdio.h>
00015 #include <iostream>
00016 #include "libfaudes.h"
00017 #include "op_include.h"
00018 
00019 // make libFAUDES namespace available
00020 using namespace faudes;
00021 
00022 
00023 int main(int argc, char* argv[]) {
00024   //////////////////////////////////////////
00025   //Verification of the Lm-observer property
00026   //////////////////////////////////////////
00027   
00028   // construct original Generator from file
00029   System genOrig = Generator("data/ex_verification/ex_isnot_observer.gen");
00030   // construct abstraction alphabet from file
00031   EventSet highAlph = EventSet("data/ex_verification/ex_isnot_observer.alph", "Alphabet");
00032   // verify if the natural projection on highAlph is an Lm-observer and output the result. 
00033   // In this example, the Lm-observer property is violated.
00034   bool observer = IsObs(genOrig, highAlph);
00035   std::cout << "##################################\n";
00036   std::cout << "# Observer verification result: " << observer << std::endl;
00037   std::cout << "##################################\n";
00038 
00039 
00040   // read a new generator and a new high-level alphabet
00041   genOrig.Read("data/ex_verification/ex_is_observer.gen");
00042   highAlph.Read("data/ex_verification/ex_is_observer.alph", "Alphabet");
00043   // verify if the natural projection on the current highAlph is an Lm-observer and output the result. 
00044   // In this example, the Lm-observer property is fulfilled.
00045   observer = IsObs(genOrig, highAlph);
00046   std::cout << "##################################\n";
00047   std::cout << "Observer verification result: " << observer << std::endl;
00048   std::cout << "##################################\n";
00049   
00050   ///////////////////////////////////////////////////////////////
00051   //Verification of the output control consistency (OCC) property
00052   ///////////////////////////////////////////////////////////////
00053   
00054   //verify if the natural projection on highAlph fulfills OCC for the previously read generator and alphabet. 
00055   // In this example, OCC is violated.
00056   bool occ = IsOCC(genOrig, highAlph);
00057   std::cout << "###########################\n";
00058   std::cout << "OCC verification result: " << occ << std::endl;
00059   std::cout << "###########################\n";
00060 
00061   // read a new generator that fulfills OCC together with the previous highAlph
00062   genOrig.Read("data/ex_verification/ex_is_occ.gen");
00063   //Verification of the output control consistency (OCC) property. In this case, OCC is fulfilled.
00064   occ = IsOCC(genOrig, highAlph);
00065   std::cout << "###########################\n";
00066   std::cout << "OCC verification result: " << occ << std::endl;
00067   std::cout << "###########################\n";
00068   
00069   //////////////////////////////////////////////////////////////
00070   //Verification of the local control consistency (LCC) property
00071   //////////////////////////////////////////////////////////////
00072   
00073   //verify if the natural projection on highAlph fulfills LCC. In this case, LCC is fulfilled (OCC implies LCC).
00074   bool lcc = IsLCC(genOrig, highAlph);
00075   std::cout << "###########################\n";
00076   std::cout << "lcc verification result: " << lcc << std::endl;
00077   std::cout << "###########################\n";
00078   // read a new generator that does not fulfill LCC with highAlph.
00079   genOrig.Read("data/ex_verification/ex_is_observer.gen");
00080   //verify if the natural projection on highAlph fulfills LCC. In this case, LCC is violated.
00081   lcc = IsLCC(genOrig, highAlph);
00082   std::cout << "###########################\n";
00083   std::cout << "lcc verification result: " << lcc << std::endl;
00084   std::cout << "###########################\n";
00085   // read a new generator that fulfills LCC together with highAlph
00086   genOrig.Read("data/ex_verification/ex_is_lcc.gen");
00087   //Verification of the local control consistency (LCC) property. In this case, LCC is fulfilled.
00088   lcc = IsLCC(genOrig, highAlph);
00089   std::cout << "###########################\n";
00090   std::cout << "lcc verification result: " << lcc << std::endl;
00091   std::cout << "###########################\n";
00092 
00093   return 0;
00094 }

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen