spot  2.11.6
taproduct.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2011, 2012, 2013, 2014, 2016 Laboratoire de Recherche
3 // et Développement de l'Epita (LRDE).
4 //
5 // This file is part of Spot, a model checking library.
6 //
7 // Spot is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // Spot is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20 #pragma once
21 
22 #include <spot/ta/ta.hh>
23 #include <spot/kripke/kripke.hh>
24 
25 namespace spot
26 {
27 
33  class SPOT_API state_ta_product : public state
34  {
35  public:
39  state_ta_product(const state* ta_state, const state* kripke_state) :
40  ta_state_(ta_state), kripke_state_(kripke_state)
41  {
42  }
43 
44  state_ta_product(const state_ta_product& o) = delete;
45 
46  virtual
48 
49  const state*
50  get_ta_state() const
51  {
52  return ta_state_;
53  }
54 
55  const state*
56  get_kripke_state() const
57  {
58  return kripke_state_;
59  }
60 
61  virtual int
62  compare(const state* other) const override;
63  virtual size_t
64  hash() const override;
65  virtual state_ta_product*
66  clone() const override;
67 
68  private:
69  const state* ta_state_;
70  const state* kripke_state_;
71  };
72 
75  {
76  public:
77  ta_succ_iterator_product(const state_ta_product* s, const ta* t,
78  const kripke* k);
79 
80  virtual
82 
83  // iteration
84  virtual bool first() override;
85  virtual bool next() override;
86  virtual bool done() const override;
87 
88  // inspection
89  virtual state_ta_product* dst() const override;
90  virtual bdd cond() const override;
91  virtual acc_cond::mark_t acc() const override;
92 
95 
96  protected:
98  void step_();
100  bool next_non_stuttering_();
101 
103  void
105 
107 
108  protected:
109  const state_ta_product* source_;
110  const ta* ta_;
111  const kripke* kripke_;
112  ta_succ_iterator* ta_succ_it_;
113  twa_succ_iterator* kripke_succ_it_;
114  const state_ta_product* current_state_;
115  bdd current_condition_;
116  acc_cond::mark_t current_acceptance_conditions_;
117  bool is_stuttering_transition_;
118  bdd kripke_source_condition;
119  const state* kripke_current_dest_state;
120 
121  };
122 
126  class SPOT_API ta_product final: public ta
127  {
128  public:
132  ta_product(const const_ta_ptr& testing_automaton,
133  const const_kripke_ptr& kripke_structure);
134 
135  virtual
136  ~ta_product();
137 
138  virtual ta::const_states_set_t
139  get_initial_states_set() const override;
140 
141  virtual ta_succ_iterator_product*
142  succ_iter(const spot::state* s) const override;
143 
144  virtual ta_succ_iterator_product*
145  succ_iter(const spot::state* s, bdd changeset) const override;
146 
147  bdd_dict_ptr
148  get_dict() const;
149 
150  virtual std::string
151  format_state(const spot::state* s) const override;
152 
153  virtual bool
154  is_accepting_state(const spot::state* s) const override;
155 
156  virtual bool
157  is_livelock_accepting_state(const spot::state* s) const override;
158 
159  virtual bool
160  is_initial_state(const spot::state* s) const override;
161 
164  bool
166 
167  virtual bdd
168  get_state_condition(const spot::state* s) const override;
169 
170  virtual void
171  free_state(const spot::state* s) const override;
172 
173  const const_ta_ptr&
174  get_ta() const
175  {
176  return ta_;
177  }
178 
179  const const_kripke_ptr&
180  get_kripke() const
181  {
182  return kripke_;
183  }
184 
185  private:
186  bdd_dict_ptr dict_;
187  const_ta_ptr ta_;
188  const_kripke_ptr kripke_;
189 
190  // Disallow copy.
191  ta_product(const ta_product&) = delete;
192  ta_product& operator=(const ta_product&) = delete;
193  };
194 
195 
196  typedef std::shared_ptr<ta_product> ta_product_ptr;
197  typedef std::shared_ptr<const ta_product> const_ta_product_ptr;
198  inline ta_product_ptr product(const const_ta_ptr& testing_automaton,
199  const const_kripke_ptr& kripke_structure)
200  {
201  return std::make_shared<ta_product>(testing_automaton, kripke_structure);
202  }
203 
206  {
207  public:
209  const ta* t, const kripke* k,
210  bdd changeset);
211 
214  };
215 }
Interface for a Kripke structure.
Definition: kripke.hh:178
A state for spot::ta_product.
Definition: taproduct.hh:34
virtual int compare(const state *other) const override
Compares two states (that come from the same automaton).
state_ta_product(const state *ta_state, const state *kripke_state)
Constructor.
Definition: taproduct.hh:39
virtual size_t hash() const override
Hash a state.
virtual state_ta_product * clone() const override
Duplicate a state.
Abstract class for states.
Definition: twa.hh:51
A lazy product between a Testing automaton and a Kripke structure. (States are computed on the fly....
Definition: taproduct.hh:127
virtual bool is_livelock_accepting_state(const spot::state *s) const override
Return true if s is a livelock-accepting state , otherwise false.
virtual ta_succ_iterator_product * succ_iter(const spot::state *s) const override
Get an iterator over the successors of state.
virtual bdd get_state_condition(const spot::state *s) const override
Return a BDD condition that represents the valuation of atomic propositions in the state s.
virtual bool is_initial_state(const spot::state *s) const override
Return true if s is an initial state, otherwise false.
ta_product(const const_ta_ptr &testing_automaton, const const_kripke_ptr &kripke_structure)
Constructor.
virtual std::string format_state(const spot::state *s) const override
Format the state as a string for printing.
virtual ta::const_states_set_t get_initial_states_set() const override
Get the initial states set of the automaton.
virtual bool is_accepting_state(const spot::state *s) const override
Return true if s is a Buchi-accepting state, otherwise false.
bool is_hole_state_in_ta_component(const spot::state *s) const
Return true if the state s has no succeseurs in the TA automaton (the TA component of the product aut...
virtual void free_state(const spot::state *s) const override
Release a state s.
virtual ta_succ_iterator_product * succ_iter(const spot::state *s, bdd changeset) const override
Get an iterator over the successors of state filtred by the changeset on transitions.
void next_kripke_dest()
Move to the next successor in the Kripke structure.
Iterate over the successors of a product computed on the fly.
Definition: taproduct.hh:75
virtual bool first() override
Position the iterator on the first successor (if any).
virtual state_ta_product * dst() const override
Get the destination state of the current edge.
virtual bool done() const override
Check whether the iteration is finished.
bool is_stuttering_transition() const
Return true if the changeset of the current transition is empty.
virtual bool next() override
Jump to the next successor (if any).
virtual bdd cond() const override
Get the condition on the edge leading to this successor.
void next_kripke_dest()
Move to the next successor in the kripke structure.
virtual acc_cond::mark_t acc() const override
Get the acceptance mark of the edge leading to this successor.
Iterate over the successors of a state.
Definition: ta.hh:198
A Testing Automaton.
Definition: ta.hh:76
Iterate over the successors of a state.
Definition: twa.hh:398
Definition: automata.hh:27
An acceptance mark.
Definition: acc.hh:85

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.1