contain.hh 2.68 KB
Newer Older
1
// -*- coding: utf-8 -*-
2
// Copyright (C) 2011, 2012, 2013, 2014 Laboratoire de Recherche et
3
// Developpement de l'Epita (LRDE).
4
// Copyright (C) 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
5
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
6
7
8
9
10
11
// et Marie Curie.
//
// 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
12
// the Free Software Foundation; either version 3 of the License, or
13
14
15
16
17
18
19
20
// (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
21
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
23
24
25
26
27
28

#ifndef SPOT_LTLVISIT_CONTAIN_HH
# define SPOT_LTLVISIT_CONTAIN_HH

#include "ltlast/formula.hh"
#include "tgbaalgos/ltl2tgba_fm.hh"
#include "misc/hash.hh"
29
#include <map>
30
31
32
33
34

namespace spot
{
  namespace ltl
  {
35
36
    /// Check containment between LTL formulae.
    class SPOT_API language_containment_checker
37
38
39
40
    {
      struct record_
      {
	const tgba* translation;
41
	typedef std::map<const record_*, bool> incomp_map;
42
43
	incomp_map incompatible;
      };
44
45
      typedef std::unordered_map<const formula*,
				 record_, formula_ptr_hash> trans_map;
46
47
    public:
      /// This class uses spot::ltl_to_tgba_fm to translate LTL
48
      /// formulae.  See that function for the meaning of these options.
49
50
51
52
53
54
55
      language_containment_checker(bdd_dict* dict, bool exprop,
				   bool symb_merge,
				   bool branching_postponement,
				   bool fair_loop_approx);

      ~language_containment_checker();

56
57
58
      /// Clear the cache.
      void clear();

59
60
      /// Check whether L(l) is a subset of L(g).
      bool contained(const formula* l, const formula* g);
61
62
63
64
      /// Check whether L(!l) is a subset of L(g).
      bool neg_contained(const formula* l, const formula* g);
      /// Check whether L(l) is a subset of L(!g).
      bool contained_neg(const formula* l, const formula* g);
65
66
67
68
69

      /// Check whether L(l) = L(g).
      bool equal(const formula* l, const formula* g);

    protected:
70
71
72
      bool incompatible_(record_* l, record_* g);

      record_* register_formula_(const formula* f);
73
74
75
76
77
78
79
80
81
82
83
84
85
86

      /* Translation options */
      bdd_dict* dict_;
      bool exprop_;
      bool symb_merge_;
      bool branching_postponement_;
      bool fair_loop_approx_;
      /* Translation Maps */
      trans_map translated_;
    };
  }
}

#endif // SPOT_LTLVISIT_CONTAIN_HH