translate: add support for -x exprop

This helped confirming a behavior observed in #298.

* spot/twaalgos/translate.cc, spot/twaalgos/translate.hh: Add support
for -x exprop.
* bin/spot-x.cc, NEWS: Document it.
* tests/core/ltl2tgba2.test: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2020-12-14 15:53:19 +01:00
parent 71f1928052
commit 142460628c
5 changed files with 44 additions and 5 deletions

18
NEWS
View file

@ -135,11 +135,21 @@ New in spot 2.9.5.dev (not yet released)
automaton, but we should not waste too much space and time trying
that.
spot::translator additionally honor the following new variable:
spot::translator additionally honor the following new variables:
tls-max-states Maximum number of states of automata involved in
automata-based implication checks for formula
simplifications. Defaults to 64.
tls-max-states Maximum number of states of automata involved in
automata-based implication checks for formula
simplifications. Defaults to 64.
exprop When set, this causes the core LTL translation to
explicitly iterate over all possible valuations of
atomic propositions when considering the successors
of a BDD-encoded state, instead of discovering
possible successors by rewriting the BDD as a sum of
product. This is enabled by default for --high,
and disabled by default otherwise. When unambiguous
automata are required, this option forced and
cannot be disabled. (This feature is not new, but
was not tunable before.)
- tgba_powerset() now takes an extra optional argument to specify a
list of accepting sinks states if some are known. Doing so can

View file

@ -58,6 +58,12 @@ default) to disable.") },
the transitions that enter accepting SCCs, and not only on the transitions \
inside accepting SCCs. This option defaults to 0, and is only used when \
comp-susp=1.") },
{ DOC("exprop", "When set, this causes the core LTL translation to \
explicitly iterate over all possible valuations of atomic propositions when \
considering the successors of a BDD-encoded state, instead of discovering \
possible successors by rewriting the BDD as a sum of product. This is enabled \
by default for --high, and disabled by default otherwise. When unambiguous \
automata are required, this option forced and cannot be disabled.") },
{ DOC("skel-simul", "Default to 1. Set to 0 to disable simulation \
on the skeleton automaton during compositional suspension. Only used when \
comp-susp=1.") },

View file

@ -39,6 +39,7 @@ namespace spot
relabel_bool_ = 4;
tls_impl_ = -1;
ltl_split_ = true;
exprop_ = -1;
opt_ = opt;
if (!opt)
@ -62,6 +63,7 @@ namespace spot
ltl_split_ = opt->get("ltl-split", 1);
int tls_max_states = opt->get("tls-max-states", 64);
tls_max_states_ = std::max(0, tls_max_states);
exprop_ = opt->get("exprop", -1);
}
void translator::build_simplifier(const bdd_dict_ptr& dict)
@ -396,7 +398,9 @@ namespace spot
}
}
}
bool exprop = unambiguous || level_ == postprocessor::High;
bool exprop = unambiguous
|| (level_ == postprocessor::High && exprop_ != 0)
|| exprop_ > 0;
aut = ltl_to_tgba_fm(r, simpl_->get_dict(), exprop,
true, false, false, nullptr, nullptr,
unambiguous);

View file

@ -155,6 +155,7 @@ namespace spot
bool gf_guarantee_set_ = false;
bool ltl_split_;
unsigned tls_max_states_ = 0;
int exprop_;
const option_map* opt_;
};
/// @}

View file

@ -485,3 +485,21 @@ f='(!(G({(a)} |=> {(b)[*12]})))'
test 14,1 = `ltl2tgba -B --stats=%s,%d "$f"`
f='(!(G({(a)} |=> {(b)[*13]})))'
test 15,0 = `ltl2tgba -B --stats=%s,%d "$f"`
# Related to Issue #298. The difference between the translation of
# this formula with --med and --high is just a different ordering of
# the states caused by the use of exprop.
opts="-x scc-filter=0,tls-impl=0,gf-guarantee=0,wdba-minimize=0"
f='G(p0 -> F(p1 & !p2 & X(!p2 U p3)))'
ltl2tgba $opts --med "$f" >med.hoa
ltl2tgba $opts,exprop=0 "$f" > high.hoa
diff med.hoa high.hoa
ltl2tgba $opts "$f" > high.hoa
test $(wc -l < med.hoa) = $(wc -l < high.hoa)
cmp med.hoa high.hoa && exit 1
autfilt --stats=%F:%s,%e med.hoa high.hoa >out
cat >exp <<EOF
med.hoa:4,14
high.hoa:4,14
EOF
diff exp out