ltlsynt: make sure the previous Xor optimization actually works

* spot/tl/simplify.hh, spot/tl/simplify.cc,
spot/twaalgos/translate.cc: Update the tl_simplification
options after all preferences have been given.
* bin/ltlsynt.cc: Display the size of the translation output.
* tests/core/ltlsynt.test: Add test case.
This commit is contained in:
Alexandre Duret-Lutz 2020-05-16 19:22:28 +02:00
parent 6bfa9793d6
commit 66aa6d0883
5 changed files with 48 additions and 6 deletions

View file

@ -4100,6 +4100,12 @@ namespace spot
return simplify_recursively(f, cache_);
}
tl_simplifier_options&
tl_simplifier::options()
{
return cache_->options;
}
formula
tl_simplifier::negative_normal_form(formula f, bool negated)
{

View file

@ -112,6 +112,14 @@ namespace spot
/// constructor).
formula simplify(formula f);
#ifndef SWIG
/// The simplifier options.
///
/// Those should can still be changed before the first formula is
/// simplified.
tl_simplifier_options& options();
#endif
/// Build the negative normal form of formula \a f.
/// All negations of the formula are pushed in front of the
/// atomic propositions. Operators <=>, =>, xor are all removed

View file

@ -106,10 +106,6 @@ namespace spot
throw std::runtime_error
("tls-impl should take a value between 0 and 3");
}
if (comp_susp_ > 0 || (ltl_split_ && type_ == Generic))
options.favor_event_univ = true;
if (type_ == Generic && ltl_split_ && (pref_ & Deterministic))
options.keep_top_xor = true;
simpl_owned_ = simpl_ = new tl_simplifier(options, dict);
}
@ -419,6 +415,18 @@ namespace spot
twa_graph_ptr translator::run(formula* f)
{
if (simpl_owned_)
{
// Modify the options according to set_pref() and set_type().
// We do it for all translation, but really only the first one
// matters.
auto& opt = simpl_owned_->options();
if (comp_susp_ > 0 || (ltl_split_ && type_ == Generic))
opt.favor_event_univ = true;
if (type_ == Generic && ltl_split_ && (pref_ & Deterministic))
opt.keep_top_xor = true;
}
// Do we want to relabel Boolean subformulas?
// If we have a huge formula such as
// (a1 & a2 & ... & an) U (b1 | b2 | ... | bm)