spot  2.4.2
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 
69  template<class I>
70  SPOT_API
71  unsigned states_and(const twa_graph_ptr& aut, I begin, I end)
72  {
73  if (begin == end)
74  throw std::runtime_error
75  ("state_and() expects an non-empty list of states");
76  outedge_combiner combiner(aut);
77  bdd combination = bddtrue;
78  while (begin != end)
79  combination &= combiner(*begin++);
80  unsigned new_s = aut->new_state();
81  combiner.new_dests(new_s, combination);
82  return new_s;
83  }
84 
85  template<class T>
86  SPOT_API
87  unsigned states_and(const twa_graph_ptr& aut,
88  const std::initializer_list<T>& il)
89  {
90  return states_and(aut, il.begin(), il.end());
91  }
93 
102  SPOT_API
103  twa_graph_ptr remove_alternation(const const_twa_graph_ptr& aut,
104  bool named_states = false);
105 }
Definition: automata.hh:26
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 Sat Nov 25 2017 02:13:16 for spot by doxygen 1.8.13