convert.hh 2.41 KB
Newer Older
1
// -*- coding: utf-8 -*-
2
// Copyright (C) 2015, 2016, 2020 Laboratoire de Recherche et Developpement de
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
// l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.


#pragma once

#include <bddx.h>
#include <unordered_map>
#include <spot/misc/common.hh>
#include <spot/twacube/cube.hh>
27 28
#include <spot/twacube/twacube.hh>
#include <spot/twa/twagraph.hh>
29 30 31 32 33 34 35

namespace spot
{
  /// \brief Transform one truth assignment represented as a BDD
  /// into a \a cube cube passed in parameter. The parameter
  /// \a binder map bdd indexes to cube indexes.
  SPOT_API spot::cube satone_to_cube(bdd one, cubeset& cubeset,
36
                                     std::unordered_map<int, int>& binder);
37 38 39 40

  /// \brief Transform a \a cube cube into bdd using the map
  /// that bind cube indexes to bdd indexes.
  SPOT_API bdd cube_to_bdd(spot::cube cube, const cubeset& cubeset,
41
                           std::unordered_map<int, int>& reverse_binder);
42

Etienne Renault's avatar
Etienne Renault committed
43 44
  /// \brief Extract the atomic propositions from the automaton. This method
  /// also fill the binder, i.e. the mapping between BDD indexes to cube indexes
45
  SPOT_API std::vector<std::string>*
Etienne Renault's avatar
Etienne Renault committed
46
  extract_aps(spot::const_twa_graph_ptr aut,
47
              std::unordered_map<int, int>& ap_binder);
48 49

  /// \brief Convert a twa into a twacube
Etienne Renault's avatar
Etienne Renault committed
50
  SPOT_API twacube_ptr
Etienne Renault's avatar
Etienne Renault committed
51
  twa_to_twacube(spot::const_twa_graph_ptr aut);
52

53 54 55
  /// \brief Convert a twacube into a twa.
  /// When \d is specified, the BDD_dict in parameter is used rather than
  /// creating a new one.
56
  SPOT_API spot::twa_graph_ptr
57 58
  twacube_to_twa(spot::twacube_ptr twacube,
                 spot::bdd_dict_ptr d = nullptr);
59 60 61 62

  /// \brief Check wether a twacube and a twa are equivalent
  SPOT_API bool are_equivalent(const spot::twacube_ptr twacube,
                               const spot::const_twa_graph_ptr twa);
63
}