spot 2.16
Loading...
Searching...
No Matches
simplify.hh
1// -*- coding: utf-8 -*-
2// Copyright (C) by the Spot authors, see the AUTHORS file for details.
3//
4// This file is part of Spot, a model checking library.
5//
6// Spot is free software; you can redistribute it and/or modify it
7// under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 3 of the License, or
9// (at your option) any later version.
10//
11// Spot is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14// License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19#pragma once
20
21#include <spot/tl/formula.hh>
22#include <bddx.h>
23#include <spot/twa/bdddict.hh>
24#include <iosfwd>
25
26namespace spot
27{
28 // forward declaration
29 class option_map;
30
33 class SPOT_API tl_simplifier_options
34 {
35 public:
37 tl_simplifier_options(bool basics = true,
38 bool synt_impl = true,
39 bool event_univ = true,
40 bool containment_checks = false,
41 bool containment_checks_stronger = false,
42 bool nenoform_stop_on_boolean = false,
43 bool reduce_size_strictly = false,
44 bool boolean_to_isop = false,
45 bool favor_event_univ = false,
46 bool keep_top_xor = false,
47 bool unit_prop = false)
48 : reduce_basics(basics),
49 synt_impl(synt_impl),
50 event_univ(event_univ),
51 containment_checks(containment_checks),
52 containment_checks_stronger(containment_checks_stronger),
53 nenoform_stop_on_boolean(nenoform_stop_on_boolean),
54 reduce_size_strictly(reduce_size_strictly),
55 boolean_to_isop(boolean_to_isop),
56 favor_event_univ(favor_event_univ),
57 keep_top_xor(keep_top_xor),
58 unit_prop(unit_prop)
59 {
60 }
61
67 tl_simplifier_options(false, false, false)
68 {
69 switch (level)
70 {
71 case 3:
72 containment_checks = true;
73 containment_checks_stronger = true;
74 SPOT_FALLTHROUGH;
75 case 2:
76 synt_impl = true;
77 SPOT_FALLTHROUGH;
78 case 1:
79 reduce_basics = true;
80 event_univ = true;
81 SPOT_FALLTHROUGH;
82 default:
83 break;
84 }
85 }
86
88 bool synt_impl;
113 unsigned containment_max_states = 0;
116 unsigned containment_max_ops = 16;
117
119 bool is_enabled() const
120 {
121 return reduce_basics || synt_impl || event_univ
122 || containment_checks || containment_checks_stronger
123 || nenoform_stop_on_boolean || reduce_size_strictly
124 || boolean_to_isop || favor_event_univ || keep_top_xor
125 || unit_prop;
126 }
127
130 void save_to_option_map(option_map& om, const char* prefix) const;
131
136 bool load_from_option_map(const option_map& om, const char* prefix);
137 };
138
139 // fwd declaration to hide technical details.
140 class tl_simplifier_cache;
141
144 class SPOT_API tl_simplifier
145 {
146 public:
151 bdd_dict_ptr dict = make_bdd_dict());
153
157
158#ifndef SWIG
164#endif
165
174 formula
175 negative_normal_form(formula f, bool negated = false);
176
190 bool right);
191
197
198
205
211
222
227
230
233
240
242 void print_stats(std::ostream& os) const;
243
244 private:
245 tl_simplifier_cache* cache_;
246 // Copy disallowed.
247 tl_simplifier(const tl_simplifier&) = delete;
248 void operator=(const tl_simplifier&) = delete;
249 };
250
251
259}
Main class for temporal logic formula.
Definition formula.hh:847
Manage a map of options.
Definition optionmap.hh:34
Options controlling which simplification passes the tl_simplifier applies.
Definition simplify.hh:34
void save_to_option_map(option_map &om, const char *prefix) const
bool containment_checks
Enable language containment checks.
Definition simplify.hh:90
bool containment_checks_stronger
Definition simplify.hh:91
bool reduce_size_strictly
Definition simplify.hh:98
bool favor_event_univ
Try to isolate subformulae that are eventual and universal.
Definition simplify.hh:102
tl_simplifier_options(int level)
Construct from a simplification level (0–3).
Definition simplify.hh:66
bool unit_prop
Definition simplify.hh:110
tl_simplifier_options(bool basics=true, bool synt_impl=true, bool event_univ=true, bool containment_checks=false, bool containment_checks_stronger=false, bool nenoform_stop_on_boolean=false, bool reduce_size_strictly=false, bool boolean_to_isop=false, bool favor_event_univ=false, bool keep_top_xor=false, bool unit_prop=false)
Construct with individual option flags.
Definition simplify.hh:37
bool keep_top_xor
Definition simplify.hh:106
bool boolean_to_isop
If true, Boolean subformulae will be rewritten in ISOP form.
Definition simplify.hh:100
bool is_enabled() const
Return true if any simplification option is enabled.
Definition simplify.hh:119
bool synt_impl
Enable syntactic implication simplifications.
Definition simplify.hh:88
bool load_from_option_map(const option_map &om, const char *prefix)
bool nenoform_stop_on_boolean
Definition simplify.hh:94
bool event_univ
Enable eventuality/universality reductions.
Definition simplify.hh:89
bool reduce_basics
Enable basic rewriting rules.
Definition simplify.hh:87
Rewrite or simplify f in various ways.
Definition simplify.hh:145
tl_simplifier(const tl_simplifier_options &opt, bdd_dict_ptr dict=make_bdd_dict())
Construct with given options and BDD dictionary.
bool implication(formula f, formula g)
Check whether f implies g.
formula simplify(formula f)
formula boolean_to_isop(formula f)
Rewrite a Boolean formula f into as an irredundant sum of product.
bdd_dict_ptr get_dict() const
Return the bdd_dict used.
bool syntactic_implication(formula f, formula g)
Syntactic implication.
tl_simplifier_options & options()
bool are_equivalent(formula f, formula g)
check whether two formulas are equivalent.
void clear_caches()
Clear all caches.
tl_simplifier(const bdd_dict_ptr &dict=make_bdd_dict())
Construct with default options and given BDD dictionary.
void print_stats(std::ostream &os) const
Dump statistics about the caches.
formula star_normal_form(formula f)
Cached version of spot::star_normal_form().
bdd as_bdd(formula f)
Convert a Boolean formula as a BDD.
bool syntactic_implication_neg(formula f, formula g, bool right)
Syntactic implication with one negated argument.
formula negative_normal_form(formula f, bool negated=false)
void clear_as_bdd_cache()
Clear the as_bdd() cache.
LTL/PSL formula interface.
bdd_dict_ptr make_bdd_dict()
Create a new, empty bdd_dict wrapped in a shared pointer.
Definition bdddict.hh:308
std::shared_ptr< bdd_dict > bdd_dict_ptr
Shared pointer to a bdd_dict.
Definition bdddict.hh:304
Definition automata.hh:26
formula normalize_quantifiers(formula)
Remove unnecessary quantified variables.

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.8