stutter: complement non-det automata via determinization

Fixes #164.

* spot/twaalgos/stutter.hh, spot/twaalgos/stutter.cc: Implement
the determinization, while keeping it optional.
* NEWS: Mention the change.
* tests/core/ltl2dstar.test, tests/core/stutter-tgba.test: Add
test cases.
* tests/core/readsave.test: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2016-07-19 12:02:08 +02:00
parent 29a1e3a299
commit 5a2bc9f915
6 changed files with 65 additions and 26 deletions

View file

@ -29,6 +29,7 @@
#include <spot/twaalgos/isdet.hh>
#include <spot/twaalgos/complement.hh>
#include <spot/twaalgos/remfin.hh>
#include <spot/twaalgos/postproc.hh>
#include <spot/twa/twaproduct.hh>
#include <spot/twa/bddprint.hh>
#include <deque>
@ -606,7 +607,8 @@ namespace spot
}
trival
check_stutter_invariance(const twa_graph_ptr& aut, formula f)
check_stutter_invariance(const twa_graph_ptr& aut, formula f,
bool do_not_determinize)
{
trival is_stut = aut->prop_stutter_invariant();
if (is_stut.is_known())
@ -619,12 +621,18 @@ namespace spot
}
else
{
// If the automaton is deterministic, we
// know how to complement it.
aut->prop_deterministic(is_deterministic(aut));
if (!aut->prop_deterministic())
return trival::maybe();
neg = remove_fin(dtwa_complement(aut));
twa_graph_ptr tmp = aut;
if (!is_deterministic(aut))
{
if (do_not_determinize)
return trival::maybe();
spot::postprocessor p;
p.set_type(spot::postprocessor::Generic);
p.set_pref(spot::postprocessor::Deterministic);
p.set_level(spot::postprocessor::Low);
tmp = p.run(aut);
}
neg = dtwa_complement(tmp);
}
is_stut = is_stutter_invariant(make_twa_graph(aut, twa::prop_set::all()),

View file

@ -60,13 +60,17 @@ namespace spot
/// \brief Check whether \a aut is stutter-invariant
///
/// This procedure only works if \a aut is deterministic, or if the
/// equivalent formula \a f is given. The stutter-invariant property
/// of the automaton is updated and also returned.
/// This procedure requires the negation of \a aut to
/// be computed. This is easily done of \a aut is deterministic
/// or if a formula represented by \a aut is known. Otherwise
/// \a aut will be complemented by determinization, which can
/// be expansive. The determinization can be forbidden using
/// the \a do_not_determinize flag.
///
/// If no formula is given and the automaton is not deterministic,
/// If no complemented automaton could be constructed, the
/// the result will be returned as trival::maybe().
SPOT_API trival
check_stutter_invariance(const twa_graph_ptr& aut,
formula f = nullptr);
formula f = nullptr,
bool do_not_determinize = false);
}