autfilt: add a --track-formula option
Fixes #591. * spot/twaalgos/matchstates.cc, spot/twaalgos/matchstates.hh (match_states_decorate): New function. * bin/autfilt.cc: Add a --track-formula option. * tests/core/trackf.test: New file. * tests/Makefile.am: Test it. * NEWS: Mention it.
This commit is contained in:
parent
3d3e87948c
commit
c5d991e55c
6 changed files with 171 additions and 5 deletions
|
|
@ -22,6 +22,8 @@
|
|||
#include <spot/twaalgos/product.hh>
|
||||
#include <spot/twaalgos/ltl2tgba_fm.hh>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/tl/print.hh>
|
||||
#include <spot/tl/simplify.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -73,6 +75,8 @@ namespace spot
|
|||
for (unsigned i = 0; i < sz2; ++i)
|
||||
state_formulas.push_back(parse_formula((*state_names)[i]));
|
||||
|
||||
tl_simplifier tls(tl_simplifier_options(2));
|
||||
|
||||
std::vector<formula> res;
|
||||
res.reserve(sz1);
|
||||
|
||||
|
|
@ -82,8 +86,20 @@ namespace spot
|
|||
disjuncts.clear();
|
||||
for (unsigned j: v[i])
|
||||
disjuncts.push_back(state_formulas[j]);
|
||||
res.push_back(formula::Or(disjuncts));
|
||||
res.push_back(tls.simplify(formula::Or(disjuncts)));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
match_states_decorate(twa_graph_ptr& aut, formula f)
|
||||
{
|
||||
std::vector<formula> v = spot::match_states(aut, f);
|
||||
auto* n = new std::vector<std::string>;
|
||||
n->reserve(v.size());
|
||||
for (spot::formula f: v)
|
||||
n->push_back(str_psl(f));
|
||||
aut->set_named_prop("state-names", n);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,9 @@ namespace spot
|
|||
match_states(const const_twa_graph_ptr& aut1,
|
||||
const const_twa_graph_ptr& aut2);
|
||||
|
||||
/// \ingroup twa_algorithms \brief match the states of \a aut with
|
||||
/// formulas "reachable" from \a f.
|
||||
/// \ingroup twa_algorithms
|
||||
/// \brief match the states of \a aut with formulas "reachable" from
|
||||
/// \a f.
|
||||
///
|
||||
/// The returned vector V assigns each state `x` of \a aut to a
|
||||
/// formula `V[x]`.
|
||||
|
|
@ -55,4 +56,12 @@ namespace spot
|
|||
/// accept more than the words accepted from `a` in \a aut.
|
||||
SPOT_API std::vector<formula>
|
||||
match_states(const const_twa_graph_ptr& aut, formula f);
|
||||
|
||||
|
||||
/// \ingroup twa_algorithms
|
||||
///
|
||||
/// \brief label the state of \a aut with the result of
|
||||
/// `match_states(aut,f)`.
|
||||
SPOT_API void
|
||||
match_states_decorate(twa_graph_ptr& aut, formula f);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue