implement is_liveness() and is_liveness_automaton()

* spot/twaalgos/strength.cc, spot/twaalgos/strength.hh,
spot/tl/hierarchy.cc, spot/tl/hierarchy.hh: Here.
* bin/ltlfilt.cc (--liveness): New filter.
* NEWS: Mention those.
* tests/core/ltlfilt.test, tests/python/ltlsimple.py: Add test cases.
This commit is contained in:
Alexandre Duret-Lutz 2018-10-15 21:35:09 +02:00
parent d2316b1428
commit d94efe9fe1
8 changed files with 63 additions and 11 deletions

View file

@ -22,6 +22,9 @@
#include <spot/misc/hash.hh>
#include <spot/twaalgos/isweakscc.hh>
#include <spot/twaalgos/mask.hh>
#include <spot/twaalgos/minimize.hh>
#include <spot/twaalgos/isdet.hh>
#include <spot/twaalgos/sccfilter.hh>
using namespace std::string_literals;
@ -401,4 +404,13 @@ namespace spot
std::string num = std::to_string(scc_num);
return decompose_scc(sm, (accepting ? ('a' + num) : num).c_str());
}
bool
is_liveness_automaton(const const_twa_graph_ptr& aut)
{
auto mon = minimize_monitor(scc_filter_states(aut));
return mon->num_states() == 1 && is_complete(mon);
}
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2013, 2014, 2015, 2016, 2017 Laboratoire
// Copyright (C) 2010, 2011, 2013, 2014, 2015, 2016, 2017, 2018 Laboratoire
// de Recherche et Développement de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
@ -104,7 +104,7 @@ namespace spot
/// SCCs).
///
/// A minimized WDBA (as returned by a successful run of
/// minimize_obligation()) represent safety property if it is a
/// minimize_obligation()) represents safety property if it is a
/// safety automaton.
///
/// \param aut the automaton to check
@ -115,6 +115,15 @@ namespace spot
is_safety_automaton(const const_twa_graph_ptr& aut,
scc_info* sm = nullptr);
/// \brief Whether the automaton represents a liveness property.
///
/// An automaton represents a liveness property if after forcing the
/// acceptance condition to true, the resulting automaton accepts
/// all words. In other words, there is no prefix that cannot be
/// extended into an accepting word.
SPOT_API bool
is_liveness_automaton(const const_twa_graph_ptr& aut);
/// \brief Check whether an automaton is weak or terminal.
///
/// This sets the "inherently weak", "weak", "very-weak" and