twa: add support for prop_complete()
* spot/twa/twa.hh: Add support. Make two constructors for prop_set in order to diagnose constructions with 5 arguments. * spot/parseaut/parseaut.yy: Adjust diagnostics for complete and deterministic. * spot/tl/exclusive.cc, spot/twa/twagraph.cc, spot/twaalgos/alternation.cc, spot/twaalgos/complete.cc, spot/twaalgos/complete.hh, spot/twaalgos/degen.cc, spot/twaalgos/determinize.cc, spot/twaalgos/hoa.cc, spot/twaalgos/isdet.cc, spot/twaalgos/mask.cc, spot/twaalgos/minimize.cc, spot/twaalgos/product.cc, spot/twaalgos/remfin.cc, spot/twaalgos/remprop.cc, spot/twaalgos/sbacc.cc, spot/twaalgos/sccfilter.cc, spot/twaalgos/simulation.cc, spot/twaalgos/strength.cc, spot/twaalgos/stutter.cc, spot/twaalgos/totgba.cc, tests/core/parseaut.test, tests/python/product.ipynb: Adjust. * NEWS, doc/org/concepts.org, doc/org/hoa.org, doc/org/tut21.org: Document it.
This commit is contained in:
parent
90a8a912e0
commit
0de5f50da9
28 changed files with 296 additions and 106 deletions
|
|
@ -1,9 +1,9 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2009, 2011, 2013, 2014, 2015, 2016 Laboratoire de
|
||||
// Recherche et Développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de
|
||||
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
// Université Pierre et Marie Curie.
|
||||
// Copyright (C) 2009, 2011, 2013-2017 Laboratoire de Recherche et
|
||||
// Développement de l'Epita (LRDE).
|
||||
// Copyright (C) 2003-2005 Laboratoire d'Informatique de Paris 6
|
||||
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
|
||||
// Pierre et Marie Curie.
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
|
|
@ -992,6 +992,7 @@ namespace spot
|
|||
trival::repr_t stutter_invariant:2; // Stutter invariant language.
|
||||
trival::repr_t very_weak:2; // very-weak, or 1-weak
|
||||
trival::repr_t semi_deterministic:2; // semi-deterministic automaton.
|
||||
trival::repr_t complete:2; // Complete automaton.
|
||||
};
|
||||
union
|
||||
{
|
||||
|
|
@ -1267,6 +1268,29 @@ namespace spot
|
|||
}
|
||||
|
||||
|
||||
/// \brief Whether the automaton is complete..
|
||||
///
|
||||
/// An automaton is complete if for each state the union of the
|
||||
/// labels of its outgoing transitions is always true.
|
||||
///
|
||||
/// Note that this method may return trival::maybe() when it is
|
||||
/// unknown whether the automaton is complete or not. If you
|
||||
/// need a true/false answer, prefer the is_complete() function.
|
||||
///
|
||||
/// \see prop_complete()
|
||||
/// \see is_complete()
|
||||
trival prop_complete() const
|
||||
{
|
||||
return is.complete;
|
||||
}
|
||||
|
||||
/// \brief Set the complete property.
|
||||
///
|
||||
/// \see is_complete()
|
||||
void prop_complete(trival val)
|
||||
{
|
||||
is.complete = val.val();
|
||||
}
|
||||
|
||||
/// \brief Whether the automaton is deterministic.
|
||||
///
|
||||
|
|
@ -1404,7 +1428,7 @@ namespace spot
|
|||
///
|
||||
/// This can be used for instance as:
|
||||
/// \code
|
||||
/// aut->prop_copy(other_aut, {true, false, false, false, true});
|
||||
/// aut->prop_copy(other_aut, {true, false, false, false, false, true});
|
||||
/// \endcode
|
||||
/// This would copy the "state-based acceptance" and
|
||||
/// "stutter invariant" properties from \c other_aut to \c code.
|
||||
|
|
@ -1428,8 +1452,52 @@ namespace spot
|
|||
bool inherently_weak; ///< preserve inherently weak, weak, & terminal
|
||||
bool deterministic; ///< preserve deterministic, semi-det, unambiguous
|
||||
bool improve_det; ///< improves deterministic, semi-det, unambiguous
|
||||
bool complete; ///< preserves completeness
|
||||
bool stutter_inv; ///< preserve stutter invariance
|
||||
|
||||
prop_set()
|
||||
: state_based(false),
|
||||
inherently_weak(false),
|
||||
deterministic(false),
|
||||
improve_det(false),
|
||||
complete(false),
|
||||
stutter_inv(false)
|
||||
{
|
||||
}
|
||||
|
||||
prop_set(bool state_based,
|
||||
bool inherently_weak,
|
||||
bool deterministic,
|
||||
bool improve_det,
|
||||
bool complete,
|
||||
bool stutter_inv)
|
||||
: state_based(state_based),
|
||||
inherently_weak(inherently_weak),
|
||||
deterministic(deterministic),
|
||||
improve_det(improve_det),
|
||||
complete(complete),
|
||||
stutter_inv(stutter_inv)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef SWIG
|
||||
// The "complete" argument was added in Spot 2.4
|
||||
SPOT_DEPRECATED("prop_set() now takes 6 arguments")
|
||||
prop_set(bool state_based,
|
||||
bool inherently_weak,
|
||||
bool deterministic,
|
||||
bool improve_det,
|
||||
bool stutter_inv)
|
||||
: state_based(state_based),
|
||||
inherently_weak(inherently_weak),
|
||||
deterministic(deterministic),
|
||||
improve_det(improve_det),
|
||||
complete(false),
|
||||
stutter_inv(stutter_inv)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/// \brief An all-true \c prop_set
|
||||
///
|
||||
/// Use that only in algorithms that copy an automaton without
|
||||
|
|
@ -1439,7 +1507,7 @@ namespace spot
|
|||
/// properties currently implemented, use an explicit
|
||||
///
|
||||
/// \code
|
||||
/// {true, true, true, true, true}
|
||||
/// {true, true, true, true, true, true}
|
||||
/// \endcode
|
||||
///
|
||||
/// instead of calling \c all(). This way, the day a new
|
||||
|
|
@ -1447,7 +1515,7 @@ namespace spot
|
|||
/// algorithm X, in case that new property is not preserved.
|
||||
static prop_set all()
|
||||
{
|
||||
return { true, true, true, true, true };
|
||||
return { true, true, true, true, true, true };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1492,6 +1560,8 @@ namespace spot
|
|||
prop_unambiguous(true);
|
||||
}
|
||||
}
|
||||
if (p.complete)
|
||||
prop_complete(other->prop_complete());
|
||||
if (p.stutter_inv)
|
||||
prop_stutter_invariant(other->prop_stutter_invariant());
|
||||
}
|
||||
|
|
@ -1521,6 +1591,8 @@ namespace spot
|
|||
if (!(p.improve_det && prop_unambiguous().is_true()))
|
||||
prop_unambiguous(trival::maybe());
|
||||
}
|
||||
if (!p.complete)
|
||||
prop_complete(trival::maybe());
|
||||
if (!p.stutter_inv)
|
||||
prop_stutter_invariant(trival::maybe());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,6 +233,14 @@ namespace spot
|
|||
v = current++;
|
||||
if (current == todo.size())
|
||||
return; // No unreachable state.
|
||||
|
||||
// Removing some non-deterministic dead state could make the
|
||||
// automaton deterministic.
|
||||
if (prop_deterministic().is_false())
|
||||
prop_deterministic(trival::maybe());
|
||||
if (prop_complete().is_false())
|
||||
prop_complete(trival::maybe());
|
||||
|
||||
defrag_states(std::move(todo), current);
|
||||
}
|
||||
|
||||
|
|
@ -393,6 +401,14 @@ namespace spot
|
|||
useful[s] = -1U;
|
||||
if (current == num_states)
|
||||
return; // No useless state.
|
||||
|
||||
// Removing some non-deterministic dead state could make the
|
||||
// automaton deterministic. Likewise for non-complete.
|
||||
if (prop_deterministic().is_false())
|
||||
prop_deterministic(trival::maybe());
|
||||
if (prop_complete().is_false())
|
||||
prop_complete(trival::maybe());
|
||||
|
||||
defrag_states(std::move(useful), current);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue