spot  2.16
translate.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/twaalgos/postproc.hh>
22 #include <spot/tl/simplify.hh>
23 
24 namespace spot
25 {
26  struct mtdswa;
27  typedef std::shared_ptr<mtdswa> mtdswa_ptr;
28 
66  class SPOT_API translator: protected postprocessor
67  {
68  public:
70  translator(tl_simplifier* simpl, const option_map* opt = nullptr)
71  : postprocessor(opt), simpl_(simpl), simpl_owned_(nullptr)
72  {
73  SPOT_ASSERT(simpl);
74  setup_opt(opt);
75  }
76 
78  translator(const bdd_dict_ptr& dict, const option_map* opt = nullptr)
79  : postprocessor(opt)
80  {
81  setup_opt(opt);
82  build_simplifier(dict);
83  }
84 
86  translator(const option_map* opt = nullptr)
87  : postprocessor(opt)
88  {
89  setup_opt(opt);
90  build_simplifier(make_bdd_dict());
91  }
92 
93  ~translator()
94  {
95  // simpl_owned_ is 0 if simpl_ was supplied to the constructor.
96  delete simpl_owned_;
97  }
98 
101 
103  void
105  {
106  this->postprocessor::set_type(type);
107  }
108 
111 
113  void
115  {
116  this->postprocessor::set_pref(pref);
117  }
118 
121 
123  void
125  {
126  level_ = level;
127  if (simpl_owned_)
128  {
129  auto d = simpl_owned_->get_dict();
130  delete simpl_owned_;
131  build_simplifier(d);
132  }
133  if (!gf_guarantee_set_)
134  gf_guarantee_ = level != Low;
135  }
136 
141 
147 
149  void clear_caches();
150 
151  protected:
153  void setup_opt(const option_map* opt);
155  void build_simplifier(const bdd_dict_ptr& dict);
163  twa_graph_ptr translate_via_fm(formula f, bool unambiguous);
165  static void add_leading_x(twa_graph_ptr& aut, unsigned n);
166 
167  private:
168  tl_simplifier* simpl_;
169  tl_simplifier* simpl_owned_;
170  int comp_susp_;
171  int early_susp_;
172  int skel_wdba_;
173  int skel_simul_;
174  int relabel_bool_;
175  int relabel_overlap_;
176  int tls_impl_;
177  int new_oblig_ = -1;
178  bool gf_guarantee_ = true;
179  bool gf_guarantee_set_ = false;
180  bool ltl_split_;
181  int branchpost_ = -1;
182  unsigned tls_max_states_ = 64;
183  unsigned tls_max_ops_ = 16;
184  int exprop_;
185  const option_map* opt_;
186  };
187 
188 }
Main class for temporal logic formula.
Definition: formula.hh:847
Manage a map of options.
Definition: optionmap.hh:34
Wrap TGBA/BA/Monitor post-processing algorithms in an easy interface.
Definition: postproc.hh:66
int output_pref
Output preferences bitmask.
Definition: postproc.hh:157
void set_pref(output_pref pref)
Select the desired characteristics of the output automaton.
Definition: postproc.hh:207
optimization_level
Optimization level selection.
Definition: postproc.hh:213
output_type
Output type selection.
Definition: postproc.hh:75
void set_type(output_type type)
Select the desired output type.
Definition: postproc.hh:140
Rewrite or simplify f in various ways.
Definition: simplify.hh:145
Translate an LTL formula into an optimized twa_graph.
Definition: translate.hh:67
twa_graph_ptr run_q(formula f)
Run translation on a quantified formula.
void setup_opt(const option_map *opt)
Initialize options from an option_map.
translator(const option_map *opt=nullptr)
Construct a translator with optional options.
Definition: translate.hh:86
twa_graph_ptr run_aux(formula f)
Run translation on a formula.
twa_graph_ptr run(formula f)
Convert f into an automaton.
void set_type(output_type type)
Select the desired output type.
Definition: translate.hh:104
void clear_caches()
Clear the LTL simplification caches.
twa_graph_ptr translate_via_fm(formula f, bool unambiguous)
Translate a formula via ltl_to_tgba_fm and branching post.
void set_pref(output_pref pref)
Select the desired output characteristics.
Definition: translate.hh:114
translator(tl_simplifier *simpl, const option_map *opt=nullptr)
Construct a translator with a given simplifier.
Definition: translate.hh:70
void set_level(optimization_level level)
Set the optimization level.
Definition: translate.hh:124
static void add_leading_x(twa_graph_ptr &aut, unsigned n)
Prepend n leading X states before the initial state.
translator(const bdd_dict_ptr &dict, const option_map *opt=nullptr)
Construct a translator with a given BDD dictionary.
Definition: translate.hh:78
void build_simplifier(const bdd_dict_ptr &dict)
Build the LTL simplifier with the given dict.
twa_graph_ptr finish_obligation_mtdswa(formula f, mtdswa_ptr mtdwa)
Finalize the result of obligation_to_mtdswa().
twa_graph_ptr run(formula *f)
Convert f into an automaton, and update f.
std::shared_ptr< mtdswa > mtdswa_ptr
Shared pointer to an mtdswa.
Definition: mtdswa.hh:164
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
std::shared_ptr< twa_graph > twa_graph_ptr
Shared pointer to a mutable twa_graph.
Definition: fwd.hh:44
Definition: automata.hh:26

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.1