pev_verify.h
Go to the documentation of this file.
1 #ifndef FAUDES_PEV_VERIFY_PRIORITY_H
2 #define FAUDES_PEV_VERIFY_PRIORITY_H
3 
4 
5 #include "corefaudes.h"
6 
7 namespace faudes {
8 
9 class CompVerify{
10 public:
11  CompVerify(void){}
12  CompVerify(Generator& goi);
14  CompVerify(GeneratorVector& gvoi, const EventSet& pevs);
15  virtual ~CompVerify(void);
16 
17  // counter example owns state attribute of the set of state indices matching the corresponding automata
18  class StateRef : public AttributeVoid{
19  FAUDES_TYPE_DECLARATION(Void,StateRef,AttribiteVoid)
20  public:
21  StateRef(void) : AttributeVoid() {}
22  virtual ~StateRef(void) {}
23 
24  // find state idx set begin via candidate
25  Idx FindState(Candidate* cand){return mref.find(cand)->second;}
26  void InsertStateRef(Candidate* cand,Idx state) {mref.insert({cand,state});}
27  void DeleteStateRef(Candidate* cand){mref.erase(mref.find(cand));}
28  void ClearStateRef(){mref.clear();}
29  std::map<Candidate*, Idx>::iterator StateRefBegin(){return mref.begin();}
30  std::map<Candidate*, Idx>::iterator StateRefEnd(){return mref.end();}
31  protected:
32  /*!
33  * \brief mref
34  * This map links a candidate to a state index.
35  * Generally, we do not really know to which candidate automaton (i.e. raw, hidden, merged, etc)
36  * does the state index refer. However, as each step of the ce refinement do have a certain map
37  * from which type of candiate automaton to which, thus it shall not cause ambiguity.
38  * For Example, after each refinement iteration, state indices are referred to raw automata,
39  * which are further extracted to result (e.g. merged) automaton of the successive iteration
40  */
41  std::map<Candidate*,Idx> mref;
42  };
43 
45 
46  // convenient func for last state of a ce
47  static StateSet::Iterator LastState (CounterExample& ce);
49  virtual void VerifyAll(Generator& trace);
50  virtual bool IsNonconflicting();
51  bool IsPreemptive(){return mIsPreemptive;}
52 
53  /*!
54  * Generate trace to bad states, i.e. some root in a blocking scc.
55  *
56  * @param rGen
57  * the blocking automaton
58  */
59  virtual void GenerateTrace(const Generator& rGen);
60 
61  /*!
62  * Generate the shortest path between given start and end state
63  * in a given automaton
64  *
65  * @param rGen
66  * the given automaton
67  * @param rRes
68  * the shortest path
69  * @param begin
70  * index of begin state
71  * @param end
72  * index of end state
73  * @return
74  * true if there exists a path between begin and end state
75  */
76  virtual bool ShortestPath(const Generator& rGen, Generator& rRes, Idx begin, Idx end);
77 
78 
79 
80  /*! counter example re-generation algorithm */
81 
82  /*!
83  * Clear all state attributes of a counter example. Intended for initialization
84  * @param rCE
85  * counter example
86  */
87  virtual void ClearAttribute (CounterExample& rCE);
88 
89  /*!
90  * Extract state attributes from composed automaton to its original automata
91  * @param cand
92  * the composed camp, i.e. with mMap
93  * @param rCE
94  * the counter example
95  * @exception
96  * 599: candidate not composed
97  */
98  virtual void ExtractParallel (Candidate* cand,CounterExample& rCE);
99 
100  /*!
101  * Expand counter example from state merging abstraction
102  *
103  * @param synchCands
104  * candidates (i.e. generators with their silentevs)
105  * @param cand
106  * the candidate which is abstracted
107  * @param rCE
108  * counter example, which is abstract at begin and shall be
109  * expanded to concrete finally w.r.t. cand
110  * @param isPreemptive
111  * flag, true when consider event preemption
112  * @exception
113  * 500: concrete bad state can not be reached
114  * (this is theoretically impossible. Will only occur
115  * in case of implementation bugs)
116  */
117  virtual void StateMergingExpansion (
118  SynchCandidates* synchCands,
119  Candidate* cand,
120  CounterExample& rCE
121  );
122 
123 
124  /*!
125  * wrapper for counter example generation
126  */
127  virtual void CounterExampleRefinement();
128 
129 protected:
130  Generator mGenFinal; //result of final abstraction
131  CounterExample mCounterExp; // resulting trace if conflicting
132  std::stack<SynchCandidates*> mAllCandidates;
134  bool mIsPreemptive = 0;
135 };
136 
137 
138 
139 
140 } // namespace
141 
142 #endif // VERIFY_PRIORITY_H
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
Definition: cfl_types.h:872
std::map< Candidate *, Idx > mref
mref This map links a candidate to a state index. Generally, we do not really know to which candidate...
Definition: pev_verify.h:41
void DeleteStateRef(Candidate *cand)
Definition: pev_verify.h:27
Idx FindState(Candidate *cand)
Definition: pev_verify.h:25
std::map< Candidate *, Idx >::iterator StateRefBegin()
Definition: pev_verify.h:29
std::map< Candidate *, Idx >::iterator StateRefEnd()
Definition: pev_verify.h:30
void InsertStateRef(Candidate *cand, Idx state)
Definition: pev_verify.h:26
virtual bool IsNonconflicting()
Definition: pev_verify.cpp:231
static StateSet::Iterator LastState(CounterExample &ce)
Definition: pev_verify.cpp:517
TaGenerator< AttributeVoid, StateRef, AttributeVoid, AttributeVoid > CounterExample
Definition: pev_verify.h:44
std::stack< SynchCandidates * > mAllCandidates
Definition: pev_verify.h:132
virtual ~CompVerify(void)
Definition: pev_verify.cpp:71
Generator mGenFinal
Definition: pev_verify.h:130
virtual void CounterExampleRefinement()
Definition: pev_verify.cpp:772
EventSet AllPevs()
Definition: pev_verify.h:48
CounterExample mCounterExp
Definition: pev_verify.h:131
virtual void ExtractParallel(Candidate *cand, CounterExample &rCE)
Definition: pev_verify.cpp:532
virtual void StateMergingExpansion(SynchCandidates *synchCands, Candidate *cand, CounterExample &rCE)
Definition: pev_verify.cpp:544
virtual void ClearAttribute(CounterExample &rCE)
Definition: pev_verify.cpp:525
virtual bool ShortestPath(const Generator &rGen, Generator &rRes, Idx begin, Idx end)
Definition: pev_verify.cpp:467
virtual void GenerateTrace(const Generator &rGen)
Definition: pev_verify.cpp:422
virtual void VerifyAll(Generator &trace)
Definition: pev_verify.cpp:186
uint32_t Idx

libFAUDES 2.33b --- 2025.05.07 --- c++ api documentaion by doxygen