spot  2.4.1
simplify.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2011-2017 Laboratoire de Recherche et Developpement
3 // 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  SPOT_FALLTHROUGH;
62  case 2:
63  synt_impl = true;
64  SPOT_FALLTHROUGH;
65  case 1:
66  reduce_basics = true;
67  event_univ = true;
68  SPOT_FALLTHROUGH;
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 
182  void clear_caches();
183 
185  bdd_dict_ptr get_dict() const;
186 
188  formula star_normal_form(formula f);
189 
195  formula boolean_to_isop(formula f);
196 
198  void print_stats(std::ostream& os) const;
199 
200  private:
201  tl_simplifier_cache* cache_;
202  // Copy disallowed.
203  tl_simplifier(const tl_simplifier&) = delete;
204  void operator=(const tl_simplifier&) = delete;
205  };
206 }
Definition: automata.hh:26
LTL/PSL formula interface.
Main class for temporal logic formula.
Definition: formula.hh:673
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 Thu Oct 5 2017 20:23:11 for spot by doxygen 1.8.13