Mungojerrie  1.1
Mungojerrie
Parity.hh
Go to the documentation of this file.
1 #ifndef PARITY_HH_
2 #define PARITY_HH_
3 
46 #include "Verbosity.hh"
47 #include "LTS.hh"
48 
49 using Priority = short int;
50 
55  friend class Parity;
56  friend std::ostream & operator<<(std::ostream & os, ParityTransition const & p);
57 public:
58  ParityTransition() {}
59  ParityTransition(State d, BDD l, Priority p) :
60  BaseTransition(d,l), priority(p) {}
61  ParityTransition(State d, BDD l) : ParityTransition(d,l,0) {}
65  bool operator==(ParityTransition const & right) const;
69  bool operator<(ParityTransition const & right) const;
70  /* @brief Returns the priority of a transition. */
71  Priority getPriority(void) const { return priority; }
72 private:
73  Priority priority;
74 };
75 
77 std::ostream & operator<<(std::ostream & os, ParityTransition const & p);
78 
85 class Parity: public LTS<ParityTransition> {
86 public:
87 
88  struct DotAttributes {
89  std::map<State, std::string> nodeShapes;
90  std::map<State, std::string> nodeColors;
91  std::map<State, std::string> nodeLabels;
92  std::map<std::pair<State, State>, std::string> edgeColors;
93  };
95  Parity(Cudd mgr);
97  Parity(Cudd mgr, std::string const & filename,
98  Verbosity::Level verbosity = Verbosity::Silent, bool noMdp = false);
100  Parity(Cudd mgr, std::istream & is,
101  Verbosity::Level verbosity = Verbosity::Silent, bool noMdp = false);
103  void addTransition(State source, State destination,
104  BDD label, Priority priority);
106  void printDot(std::string graphname = std::string("parity"),
107  std::string filename = std::string("-"),
108  bool showtrees = false) const;
110  void printDot(std::string graphname,
111  DotAttributes const & attributes,
112  std::string filename = std::string("-"),
113  bool showtrees = false) const;
115  void printHOA(std::string const & name = std::string("parity"),
116  std::string filename = std::string("-")) const;
118  std::vector<State> getStates(void) const;
124  Priority getPriority(State source, BDD label,
125  State destination, bool silent = false) const;
127  Priority getMaxPriority(void) const;
129  Priority getMinPriority(void) const;
131  std::vector<EdgeSet> edgePartition(void) const;
133  std::map<State,unsigned> classifyStates(void) const;
135  Parity determinize(void) const;
138  unsigned CartonMaceiras(void);
143  unsigned minimumIndex(void);
145  Parity toLDPW(bool epsilonJumps = false) const;
147  void directSimulationRelation(std::set<StatePair> & simul) const;
149  void directSimulationMinimization(void);
151  void stateMinimization(void);
153  void trim(void);
155  void makeComplete(void);
157  void safetyLiveness(Parity & safety, Parity & liveness) const;
159  bool isTriviallyEmpty(void) const;
163  bool isTerminal(bool ignoreTransient = true) const;
166  StateSet getTrapStates(void) const;
168  void unite(Parity const & second);
170  Parity complement(void) const;
173  void solveOneStreettPairGame(StateSet const & spoilerStates,
174  StateSet & dwinning,
175  StateMap & dstrategy,
176  StateMap & sstrategy) const;
178  bool leadSimulates(void) const;
180  bool fairSimulates(Parity const & other) const;
182  bool directSimulates(Parity const & other) const;
183 private:
185  Parity(LTS const & lts);
186  Priority CartonMaceirasRecur(StateSet const & Q, EdgeSet forbiddenEdges);
187  bool zeroToTwo(unsigned maxpriority);
188  bool directCompareStates(State p, State q,
189  std::set<StatePair> const & simul) const;
190  void addTrap(unsigned priority);
191  void makeSafety(bool wascomplete);
192  Parity buildEnvironment(void) const;
193  void makeLiveness(void);
194  TransitionMap inverseTransitions(void) const;
195  Parity buildLeadSimulationGame(StateSet & spoilerStates,
196  DotAttributes & attributes) const;
197  Parity buildFairSimulationGame(Parity const & other,
198  StateSet & spoilerStates,
199  DotAttributes & attributes) const;
200  Parity buildDirectSimulationGame(Parity const & other,
201  StateSet & spoilerStates,
202  DotAttributes & attributes) const;
203  class Determ;
204  friend class Determ;
205  class Simul;
206  friend class Simul;
207  class OSPGame;
208  friend class OSPGame;
209 };
210 
212 std::ostream & operator<<(std::ostream & os, Parity const & p);
213 
214 #endif
Parity::complement
Parity complement(void) const
Return complement of automaton.
Definition: Parity.cc:1819
Parity::getPriority
Priority getPriority(State source, BDD label, State destination, bool silent=false) const
Gets the priority of a transition.
Definition: Parity.cc:126
Parity::classifyStates
std::map< State, unsigned > classifyStates(void) const
Classify states according to the priorities of their transitions.
Definition: Parity.cc:1331
ParityTransition::operator<<
friend std::ostream & operator<<(std::ostream &os, ParityTransition const &p)
Overloads stream insertion operator.
Parity::edgePartition
std::vector< EdgeSet > edgePartition(void) const
Returns the partition of the edges according to their priorities.
Definition: Parity.cc:179
Parity::getStates
std::vector< State > getStates(void) const
Returns the state set.
Definition: Parity.cc:121
Parity::printHOA
void printHOA(std::string const &name=std::string("parity"), std::string filename=std::string("-")) const
Writes automaton in HOA format.
Definition: Parity.cc:316
Parity::Determ
Helper class to perform DPW determinization.
Definition: Parity.cc:388
Parity::toLDPW
Parity toLDPW(bool epsilonJumps=false) const
Converts DPW to LDPW with priorities 0 and 1.
Definition: Parity.cc:786
Parity::Simul
Helper class for simulation equivalence computation.
Definition: Parity.cc:878
Parity::safetyLiveness
void safetyLiveness(Parity &safety, Parity &liveness) const
Decomposes automaton into safety and liveness components.
Definition: Parity.cc:1614
Parity::Parity
Parity(Cudd mgr)
Constructor.
Definition: Parity.cc:54
Parity::getMaxPriority
Priority getMaxPriority(void) const
Gets maximum priority of automaton.
Definition: Parity.cc:149
operator<<
std::ostream & operator<<(std::ostream &os, ParityTransition const &p)
Overloads stream insertion operator.
Parity::solveOneStreettPairGame
void solveOneStreettPairGame(StateSet const &spoilerStates, StateSet &dwinning, StateMap &dstrategy, StateMap &sstrategy) const
Solve one-Streett-pair game.
Definition: Parity.cc:2045
Parity::CartonMaceiras
unsigned CartonMaceiras(void)
Reduces index of acceptance condition.
Definition: Parity.cc:749
Parity::determinize
Parity determinize(void) const
Returns determinized automaton.
Definition: Parity.cc:520
Parity::printDot
void printDot(std::string graphname=std::string("parity"), std::string filename=std::string("-"), bool showtrees=false) const
Converts automaton to dot format.
Parity::getTrapStates
StateSet getTrapStates(void) const
Returns set of trap states.
Definition: Parity.cc:1692
Parity::fairSimulates
bool fairSimulates(Parity const &other) const
Checks whether automaton fair-simulates other.
Definition: Parity.cc:2411
Parity::makeComplete
void makeComplete(void)
Adds rejecting trap if necessary to make automaton complete.
Definition: Parity.cc:1472
Parity::stateMinimization
void stateMinimization(void)
Minimizes deterministic automaton based on state equivalence.
Definition: Parity.cc:1386
Parity::isTerminal
bool isTerminal(bool ignoreTransient=true) const
Checks whether the automaton is terminal.
Definition: Parity.cc:1652
Parity::OSPGame
Helper class to solve 3-priority parity games.
Definition: Parity.cc:1841
Parity::unite
void unite(Parity const &second)
Takes the nondeterministic union with another automaton.
Definition: Parity.cc:1764
ParityTransition::operator<
bool operator<(ParityTransition const &right) const
Comparison function used to store transitions in ordered containers.
Definition: Parity.cc:90
Parity::directSimulationMinimization
void directSimulationMinimization(void)
Minimizes automaton based on direct simulation.
Definition: Parity.cc:1132
Verbosity.hh
Verbosity-related definitions.
LTS
Class of labeled transition systems.
Definition: LTS.hh:84
Parity::directSimulates
bool directSimulates(Parity const &other) const
Checks whether automaton direct-simulates other.
Definition: Parity.cc:2578
ParityTransition
Class of parity-annotated transitions.
Definition: Parity.hh:54
BaseTransition
Base class for the labeled edges of the transition graph.
Definition: LTS.hh:53
Parity::isTriviallyEmpty
bool isTriviallyEmpty(void) const
Checks whether the automaton is trivially empty.
Definition: Parity.cc:1637
ParityTransition::operator==
bool operator==(ParityTransition const &right) const
Checks whether two transitions have the same endpoints, label, and priority.
Definition: Parity.cc:83
Parity::trim
void trim(void)
Trims automaton of states on no accepting path.
Definition: Parity.cc:1430
Parity::addTransition
void addTransition(State source, State destination, BDD label, Priority priority)
Adds a transition to a state of the automaton.
Definition: Parity.cc:108
Parity::leadSimulates
bool leadSimulates(void) const
Checks whether automaton lead-simulates itself.
Definition: Parity.cc:2258
Parity::getMinPriority
Priority getMinPriority(void) const
Gets minimum priority of automaton.
Definition: Parity.cc:163
LTS.hh
Labeled transition systems (base class for automata classes).
Parity::DotAttributes
Definition: Parity.hh:88
Parity::minimumIndex
unsigned minimumIndex(void)
Reduces index of acceptance condition.
Definition: Parity.cc:759
Parity
Class of parity automata.
Definition: Parity.hh:85
second
State second
Model state.
Definition: Gym.hh:56
Parity::directSimulationRelation
void directSimulationRelation(std::set< StatePair > &simul) const
Computes direct simulation relation.
Definition: Parity.cc:1079