monitor: fix -MD/-M difference in property output

Fixes #241.

* spot/twaalgos/postproc.cc: Use the deterministic monitor if it
has as many states as the non-deterministic one.
* spot/twaalgos/minimize.cc (minimize_monitor): Quickly check
for terminal automata.
* spot/twaalgos/stripacc.cc: Set the weak property.
* spot/twaalgos/stripacc.hh: Improve documentation.
* tests/core/monitor.test, tests/core/sbacc.test: Update.
* NEWS: Mention the issue.
This commit is contained in:
Alexandre Duret-Lutz 2017-03-03 18:23:57 +01:00
parent 3699e6cd0c
commit a66e7704d8
7 changed files with 37 additions and 8 deletions

View file

@ -490,6 +490,13 @@ namespace spot
res->prop_deterministic(true);
res->prop_weak(true);
res->prop_state_acc(true);
// Quickly check if this is a terminal automaton
for (auto& e: res->edges())
if (e.src == e.dst && e.cond == bddtrue)
{
res->prop_terminal(true);
break;
}
return res;
}

View file

@ -234,10 +234,11 @@ namespace spot
// For Small,High we return the smallest between the output of
// the simulation, and that of the deterministic minimization.
// Prefer the deterministic automaton in case of equality.
if (PREF_ == Small && level_ == High && simul_)
{
auto m = minimize_monitor(a);
if (m->num_states() < a->num_states())
if (m->num_states() <= a->num_states())
a = m;
}
a->remove_unused_ap();

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2014, 2015 Laboratoire de Recherche et
// Copyright (C) 2012, 2014, 2015, 2017 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -30,5 +30,6 @@ namespace spot
t.acc = 0U;
a->set_generalized_buchi(0);
a->release_named_properties();
a->prop_weak(true);
}
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et
// Copyright (C) 2012-2014, 2017 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -26,7 +26,9 @@ namespace spot
/// \ingroup twa_misc
/// \brief Remove all acceptance sets from a twa_graph.
///
/// This is equivalent to marking all states/transitions as accepting.
/// This will also set the acceptance condition to true, and mark
/// the automaton as weak. Doing so obviously makes all recognized
/// infinite runs accepting.
SPOT_API void
strip_acceptance_here(twa_graph_ptr a);
}