Translate Boolean formulae as BDD using the ltl_simplifier cache.

* src/ltlvisit/simplify.hh, src/ltlvisit/simplify.cc
(ltl_simplifier::ltl_simplifier, ltl_simplifier::get_dict): Make
it possible to supply and retrieve the dictionary used.
(ltl_simplifier::as_bdd): New function, exported from the cache.
* src/tgbaalgos/ltl2tgba_fm.cc (translate_dict): Store the
ltl_simplifier object.
(translate_dict::boolean_to_bdd): Call ltl_simplifier::as_bdd.
(translate_ratexp): New wrapper around the ratexp_trad_visitor,
calling boolean_to_bdd whenever possible.
(ratexp_trad_visitor): Do not deal with negated formulae, there
are necessarily Boolean and handled by translate_ratexp().
(ltl_visitor): Adjust to call translate_ratexp.
(ltl_to_tgba_fm): Adjust passing of the ltl_simplifier to the
translate_dict, and make sure everybody is using the same
dictionary.
* src/tgbatest/ltl2tgba.cc: Pass the dictionary to the
ltl_simplifier.
This commit is contained in:
Alexandre Duret-Lutz 2011-10-30 18:59:17 +01:00
parent 369ad87e50
commit 07e40e706a
4 changed files with 149 additions and 77 deletions

View file

@ -23,6 +23,7 @@
#include "ltlast/formula.hh"
#include "bdd.h"
#include "tgba/bdddict.hh"
namespace spot
{
@ -66,8 +67,8 @@ namespace spot
class ltl_simplifier
{
public:
ltl_simplifier();
ltl_simplifier(ltl_simplifier_options& opt);
ltl_simplifier(bdd_dict* dict = 0);
ltl_simplifier(ltl_simplifier_options& opt, bdd_dict* dict = 0);
~ltl_simplifier();
/// Simplify the formula \a f (using options supplied to the
@ -118,11 +119,20 @@ namespace spot
/// two products, and two emptiness checks.
bool are_equivalent(const formula* f, const formula* g);
/// \brief Convert a Boolean formula as a BDD.
///
/// If you plan to use this method, be sure to pass a bdd_dict
/// to the constructor.
bdd as_bdd(const formula* f);
/// Return the bdd_dict used.
bdd_dict* get_dict() const;
private:
ltl_simplifier_cache* cache_;
// Copy disallowed.
ltl_simplifier(const ltl_simplifier&);
bool owndict;
};
}