spot  2.3.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
alternation.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2016 Laboratoire de Recherche et Développement de
3 // 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/twa/twagraph.hh>
23 #include <utility>
24 
25 namespace spot
26 {
45  class SPOT_API outedge_combiner
46  {
47  private:
48  const twa_graph_ptr& aut_;
49  std::map<unsigned, int> state_to_var;
50  std::map<int, unsigned> var_to_state;
51  bdd vars_;
52  public:
53  outedge_combiner(const twa_graph_ptr& aut);
55  bdd operator()(unsigned st);
56  void new_dests(unsigned st, bdd out) const;
57  };
58 
68  template<class I>
69  SPOT_API
70  unsigned states_and(const twa_graph_ptr& aut, I begin, I end)
71  {
72  if (begin == end)
73  throw std::runtime_error
74  ("state_and() expects an non-empty list of states");
75  outedge_combiner combiner(aut);
76  bdd combination = bddtrue;
77  while (begin != end)
78  combination &= combiner(*begin++);
79  unsigned new_s = aut->new_state();
80  combiner.new_dests(new_s, combination);
81  return new_s;
82  }
83 
84  template<class T>
85  SPOT_API
86  unsigned states_and(const twa_graph_ptr& aut,
87  const std::initializer_list<T>& il)
88  {
89  return states_and(aut, il.begin(), il.end());
90  }
92 
100  SPOT_API
101  twa_graph_ptr remove_alternation(const const_twa_graph_ptr& aut,
102  bool named_states = false);
103 }
Definition: graph.hh:33
Helper class combine outgoing edges in alternating automata.
Definition: alternation.hh:45

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Tue Apr 11 2017 13:40:03 for spot by doxygen 1.8.8