bin: add --check=unambiguous

* src/bin/common_aoutput.cc: Add --check=unambiguous.
* src/twa/twa.hh: New unambiguous property.
* src/twaalgos/hoa.cc: Print it.
* src/twaalgos/ltl2tgba_fm.cc: Set it.
* src/twaalgos/isunamb.cc, src/twaalgos/isunamb.hh
(check_unambiguous): New function.
* src/tests/unambig.test: More tests.
This commit is contained in:
Alexandre Duret-Lutz 2015-05-10 17:39:26 +02:00
parent 98de84f3de
commit 487a86d06a
7 changed files with 47 additions and 7 deletions

View file

@ -296,7 +296,6 @@ namespace spot
os << aut->acc().get_acceptance();
os << nl;
os << "properties:";
// Make sure the property line is not too large,
// otherwise our test cases do not fit in 80 columns...
unsigned prop_len = 60;
@ -327,6 +326,8 @@ namespace spot
prop(" complete");
if (md.is_deterministic)
prop(" deterministic");
if (aut->is_unambiguous())
prop(" unambiguous");
assert(!(aut->is_stutter_invariant() && aut->is_stutter_sensitive()));
if (aut->is_stutter_invariant())
prop(" stutter-invariant");

View file

@ -28,7 +28,7 @@ namespace spot
{
bool is_unambiguous(const const_twa_graph_ptr& aut)
{
if (aut->is_deterministic())
if (aut->is_deterministic() || aut->is_unambiguous())
return true;
auto clean_a = scc_filter_states(aut);
auto prod = product(clean_a, clean_a);
@ -37,4 +37,10 @@ namespace spot
tgba_statistics sp = stats_reachable(clean_p);
return sa.states == sp.states && sa.transitions == sp.transitions;
}
bool check_unambiguous(const twa_graph_ptr& aut)
{
aut->prop_unambiguous(is_unambiguous(aut));
return aut->is_unambiguous();
}
}

View file

@ -25,7 +25,7 @@ namespace spot
{
class tgba;
/// \addtogroup tgba_misc
/// \addtogroup twa_misc
/// @{
/// \brief Whether the automaton \a aut is unambiguous.
@ -40,5 +40,8 @@ namespace spot
SPOT_API bool
is_unambiguous(const const_twa_graph_ptr& aut);
/// Like is_unambiguous(), but also sets the property in the twa.
SPOT_API bool
check_unambiguous(const twa_graph_ptr& aut);
/// @}
}

View file

@ -2555,6 +2555,9 @@ namespace spot
a->prop_inherently_weak(f->is_syntactic_persistence());
a->prop_stutter_invariant(f->is_syntactic_stutter_invariant());
// Currently the unambiguous option work only with LTL.
a->prop_unambiguous(f->is_ltl_formula() && unambiguous);
if (!simplifier)
// This should not be deleted before we have registered all propositions.
delete s;