twa: add prop_set::improve_det
Algorithms that remove transitions can turn a non-deterministic automaton into a deterministic one, so we need to be able to specify that determinism can be improved (as opposed to preserved). * spot/twa/twa.hh (twa::prop_set::improve_det): New attribute. (twa::prop_keep, twa::prop_copy): Honor it. * spot/tl/exclusive.cc, spot/twaalgos/alternation.cc, spot/twaalgos/complete.cc, spot/twaalgos/degen.cc, spot/twaalgos/determinize.cc, spot/twaalgos/mask.cc, spot/twaalgos/minimize.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: Adjust calls to prop_keep() and prop_copy().
This commit is contained in:
parent
ada8185361
commit
684c9c47c4
17 changed files with 62 additions and 35 deletions
|
|
@ -1404,11 +1404,17 @@ namespace spot
|
|||
///
|
||||
/// This can be used for instance as:
|
||||
/// \code
|
||||
/// aut->prop_copy(other_aut, {true, false, false, true});
|
||||
/// aut->prop_copy(other_aut, {true, false, false, false, true});
|
||||
/// \endcode
|
||||
/// This would copy the "state-based acceptance" and
|
||||
/// "stutter invariant" properties from \c other_aut to \c code.
|
||||
///
|
||||
/// There are two flags for the determinism. If \code
|
||||
/// deterministic is set, the deterministic, semi-deterministic,
|
||||
/// and unambiguous properties are copied as-is. If deterministic
|
||||
/// is unset but improve_det is set, then those properties are
|
||||
/// only copied if they are positive.
|
||||
///
|
||||
/// The reason there is no default value for these flags is that
|
||||
/// whenever we add a new property that do not fall into any of
|
||||
/// these groups, we will be forced to review all algorithm to
|
||||
|
|
@ -1420,7 +1426,8 @@ namespace spot
|
|||
{
|
||||
bool state_based; ///< preserve state-based acceptnace
|
||||
bool inherently_weak; ///< preserve inherently weak, weak, & terminal
|
||||
bool deterministic; ///< preserve deterministic and unambiguous
|
||||
bool deterministic; ///< preserve deterministic, semi-det, unambiguous
|
||||
bool improve_det; ///< improves deterministic, semi-det, unambiguous
|
||||
bool stutter_inv; ///< preserve stutter invariance
|
||||
|
||||
/// \brief An all-true \c prop_set
|
||||
|
|
@ -1432,7 +1439,7 @@ namespace spot
|
|||
/// properties currently implemented, use an explicit
|
||||
///
|
||||
/// \code
|
||||
/// {true, true, true, true}
|
||||
/// {true, true, true, true, true}
|
||||
/// \endcode
|
||||
///
|
||||
/// instead of calling \c all(). This way, the day a new
|
||||
|
|
@ -1440,7 +1447,7 @@ namespace spot
|
|||
/// algorithm X, in case that new property is not preserved.
|
||||
static prop_set all()
|
||||
{
|
||||
return { true, true, true, true };
|
||||
return { true, true, true, true, true };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1471,6 +1478,20 @@ namespace spot
|
|||
prop_semi_deterministic(other->prop_semi_deterministic());
|
||||
prop_unambiguous(other->prop_unambiguous());
|
||||
}
|
||||
else if (p.improve_det)
|
||||
{
|
||||
if (other->prop_deterministic().is_true())
|
||||
{
|
||||
prop_deterministic(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (other->prop_semi_deterministic().is_true())
|
||||
prop_semi_deterministic(true);
|
||||
if (other->prop_unambiguous().is_true())
|
||||
prop_unambiguous(true);
|
||||
}
|
||||
}
|
||||
if (p.stutter_inv)
|
||||
prop_stutter_invariant(other->prop_stutter_invariant());
|
||||
}
|
||||
|
|
@ -1493,9 +1514,12 @@ namespace spot
|
|||
}
|
||||
if (!p.deterministic)
|
||||
{
|
||||
prop_deterministic(trival::maybe());
|
||||
prop_semi_deterministic(trival::maybe());
|
||||
prop_unambiguous(trival::maybe());
|
||||
if (!(p.improve_det && prop_deterministic().is_true()))
|
||||
prop_deterministic(trival::maybe());
|
||||
if (!(p.improve_det && prop_semi_deterministic().is_true()))
|
||||
prop_semi_deterministic(trival::maybe());
|
||||
if (!(p.improve_det && prop_unambiguous().is_true()))
|
||||
prop_unambiguous(trival::maybe());
|
||||
}
|
||||
if (!p.stutter_inv)
|
||||
prop_stutter_invariant(trival::maybe());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue