tgbaproduct.hh 4.29 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

#include "tgba.hh"
28
#include "misc/fixpool.hh"
29
30
31
32

namespace spot
{

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

52
    virtual void destroy() const;
53

54
    state*
55
56
57
58
59
    left() const
    {
      return left_;
    }

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

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

  private:
71
72
    state* left_;		///< State from the left automaton.
    state* right_;		///< State from the right automaton.
73
74
75
76
77
    mutable unsigned count_;
    fixed_size_pool* pool_;

    virtual ~state_product();
    state_product(const state_product& o); // No implementation.
78
79
80
81
  };


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

91
    virtual ~tgba_product();
92

93
94
    virtual state* get_init_state() const;

95
    virtual tgba_succ_iterator*
96
97
98
    succ_iter(const state* local_state,
	      const state* global_state = 0,
	      const tgba* global_automaton = 0) const;
99

100
    virtual bdd_dict* get_dict() const;
101
102
103

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

104
105
106
    virtual std::string
    transition_annotation(const tgba_succ_iterator* t) const;

107
108
    virtual state* project_state(const state* s, const tgba* t) const;

109
110
    virtual bdd all_acceptance_conditions() const;
    virtual bdd neg_acceptance_conditions() const;
111

112
113
114
115
  protected:
    virtual bdd compute_support_conditions(const state* state) const;
    virtual bdd compute_support_variables(const state* state) const;

116
  protected:
117
    bdd_dict* dict_;
118
119
    const tgba* left_;
    const tgba* right_;
120
    bool left_kripke_;
121
122
    bdd left_acc_complement_;
    bdd right_acc_complement_;
123
124
    bdd all_acceptance_conditions_;
    bdd neg_acceptance_conditions_;
125
    bddPair* right_common_acc_;
126
127
    fixed_size_pool pool_;

128
  private:
129
130
    // Disallow copy.
    tgba_product(const tgba_product&);
131
    tgba_product& operator=(const tgba_product&);
132
133
  };

134
135
136
137
138
139
140
  /// \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;
141
  protected:
142
143
144
145
    const state* left_init_;
    const state* right_init_;
  };

146
147
}

148
#endif // SPOT_TGBA_TGBAPRODUCT_HH