tgbaproduct.hh 4.04 KB
Newer Older
1
2
// Copyright (C) 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
3
4
5
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//
// 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 2 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 Spot; see the file COPYING.  If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.

24
25
#ifndef SPOT_TGBA_TGBAPRODUCT_HH
# define SPOT_TGBA_TGBAPRODUCT_HH
26
27
28
29
30
31

#include "tgba.hh"

namespace spot
{

32
  /// \brief A state for spot::tgba_product.
33
  /// \ingroup tgba_on_the_fly_algorithms
34
35
36
  ///
  /// This state is in fact a pair of state: the state from the left
  /// automaton and that of the right.
37
  class state_product : public state
38
39
40
41
42
  {
  public:
    /// \brief Constructor
    /// \param left The state from the left automaton.
    /// \param right The state from the right automaton.
43
    /// These states are acquired by spot::state_product, and will
44
    /// be destroyed on destruction.
45
    state_product(state* left, state* right)
46
      :	left_(left),
47
48
49
	right_(right)
    {
    }
50

51
    /// Copy constructor
52
    state_product(const state_product& o);
53

54
    virtual ~state_product();
55

56
    state*
57
58
59
60
61
    left() const
    {
      return left_;
    }

62
    state*
63
64
65
66
67
68
    right() const
    {
      return right_;
    }

    virtual int compare(const state* other) const;
69
    virtual size_t hash() const;
70
    virtual state_product* clone() const;
71
72

  private:
73
74
    state* left_;		///< State from the left automaton.
    state* right_;		///< State from the right automaton.
75
76
77
78
  };


  /// \brief A lazy product.  (States are computed on the fly.)
79
  class tgba_product: public tgba
80
81
82
83
84
  {
  public:
    /// \brief Constructor.
    /// \param left The left automata in the product.
    /// \param right The right automata in the product.
85
    /// Do not be fooled by these arguments: a product is commutative.
86
    tgba_product(const tgba* left, const tgba* right);
87

88
    virtual ~tgba_product();
89

90
91
    virtual state* get_init_state() const;

92
    virtual tgba_succ_iterator*
93
94
95
    succ_iter(const state* local_state,
	      const state* global_state = 0,
	      const tgba* global_automaton = 0) const;
96

97
    virtual bdd_dict* get_dict() const;
98
99
100

    virtual std::string format_state(const state* state) const;

101
102
103
    virtual std::string
    transition_annotation(const tgba_succ_iterator* t) const;

104
105
    virtual state* project_state(const state* s, const tgba* t) const;

106
107
    virtual bdd all_acceptance_conditions() const;
    virtual bdd neg_acceptance_conditions() const;
108

109
110
111
112
  protected:
    virtual bdd compute_support_conditions(const state* state) const;
    virtual bdd compute_support_variables(const state* state) const;

113
  protected:
114
    bdd_dict* dict_;
115
116
    const tgba* left_;
    const tgba* right_;
117
    bool left_kripke_;
118
119
    bdd left_acc_complement_;
    bdd right_acc_complement_;
120
121
    bdd all_acceptance_conditions_;
    bdd neg_acceptance_conditions_;
122
    bddPair* right_common_acc_;
123
  private:
124
125
    // Disallow copy.
    tgba_product(const tgba_product&);
126
    tgba_product& operator=(const tgba_product&);
127
128
  };

129
130
131
132
133
134
135
  /// \brief A lazy product with different initial states.
  class tgba_product_init: public tgba_product
  {
  public:
    tgba_product_init(const tgba* left, const tgba* right,
		      const state* left_init, const state* right_init);
    virtual state* get_init_state() const;
136
  protected:
137
138
139
140
    const state* left_init_;
    const state* right_init_;
  };

141
142
}

143
#endif // SPOT_TGBA_TGBAPRODUCT_HH