spot  2.0.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
simplify.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2011, 2012, 2013, 2014, 2015 Laboratoire de Recherche
3 // et Developpement de 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/tl/formula.hh>
23 #include <bddx.h>
24 #include <spot/twa/bdddict.hh>
25 #include <iosfwd>
26 
27 namespace spot
28 {
30  {
31  public:
32  tl_simplifier_options(bool basics = true,
33  bool synt_impl = true,
34  bool event_univ = true,
35  bool containment_checks = false,
36  bool containment_checks_stronger = false,
37  bool nenoform_stop_on_boolean = false,
38  bool reduce_size_strictly = false,
39  bool boolean_to_isop = false,
40  bool favor_event_univ = false)
41  : reduce_basics(basics),
42  synt_impl(synt_impl),
43  event_univ(event_univ),
44  containment_checks(containment_checks),
45  containment_checks_stronger(containment_checks_stronger),
46  nenoform_stop_on_boolean(nenoform_stop_on_boolean),
47  reduce_size_strictly(reduce_size_strictly),
48  boolean_to_isop(boolean_to_isop),
49  favor_event_univ(favor_event_univ)
50  {
51  }
52 
53  tl_simplifier_options(int level) :
54  tl_simplifier_options(false, false, false)
55  {
56  switch (level)
57  {
58  case 3:
59  containment_checks = true;
60  containment_checks_stronger = true;
61  // fall through
62  case 2:
63  synt_impl = true;
64  // fall through
65  case 1:
66  reduce_basics = true;
67  event_univ = true;
68  // fall through
69  default:
70  break;
71  }
72  }
73 
74  bool reduce_basics;
75  bool synt_impl;
76  bool event_univ;
77  bool containment_checks;
78  bool containment_checks_stronger;
79  // If true, Boolean subformulae will not be put into
80  // negative normal form.
81  bool nenoform_stop_on_boolean;
82  // If true, some rules that produce slightly larger formulae
83  // will be disabled. Those larger formulae are normally easier
84  // to translate, so we recommend to set this to false.
85  bool reduce_size_strictly;
86  // If true, Boolean subformulae will be rewritten in ISOP form.
87  bool boolean_to_isop;
88  // Try to isolate subformulae that are eventual and universal.
89  bool favor_event_univ;
90  };
91 
92  // fwd declaration to hide technical details.
93  class tl_simplifier_cache;
94 
97  class SPOT_API tl_simplifier
98  {
99  public:
100  tl_simplifier(const bdd_dict_ptr& dict = make_bdd_dict());
102  bdd_dict_ptr dict = make_bdd_dict());
103  ~tl_simplifier();
104 
107  formula simplify(formula f);
108 
117  formula
118  negative_normal_form(formula f, bool negated = false);
119 
125 
138  bool syntactic_implication(formula f, formula g);
145  bool syntactic_implication_neg(formula f, formula g,
146  bool right);
147 
152  bool are_equivalent(formula f, formula g);
153 
154 
160  bool implication(formula f, formula g);
161 
166  bdd as_bdd(formula f);
167 
177  void clear_as_bdd_cache();
178 
180  bdd_dict_ptr get_dict() const;
181 
183  formula star_normal_form(formula f);
184 
190  formula boolean_to_isop(formula f);
191 
193  void print_stats(std::ostream& os) const;
194 
195  private:
196  tl_simplifier_cache* cache_;
197  // Copy disallowed.
198  tl_simplifier(const tl_simplifier&) = delete;
199  void operator=(const tl_simplifier&) = delete;
200  };
201 }
Definition: graph.hh:32
LTL/PSL formula interface.
Main class for temporal logic formula.
Definition: formula.hh:650
Definition: simplify.hh:29
Rewrite or simplify f in various ways.
Definition: simplify.hh:97
formula negative_normal_form(formula f, bool negated=false)
Build the negative normal form of f.

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Mon Jul 11 2016 09:54:34 for spot by doxygen 1.8.8