autfilt: add a --exclusive-ap option
* src/ltlvisit/exclusive.cc, src/ltlvisit/exclusive.hh: Implement constrain() for automata. * src/bin/autfilt.cc: Add --exclusive-ap option. * src/tgba/bdddict.cc, src/tgba/bdddict.hh: Add a has_registered_proposition() method. * src/tgbatest/exclusive.test: New file. * src/tgbatest/Makefile.am: Add it.
This commit is contained in:
parent
544c533ed3
commit
fb7b7a944a
7 changed files with 216 additions and 8 deletions
|
|
@ -22,6 +22,7 @@
|
|||
#include "ltlast/multop.hh"
|
||||
#include "ltlast/unop.hh"
|
||||
#include "ltlast/constant.hh"
|
||||
#include "tgbaalgos/mask.hh"
|
||||
#include "misc/casts.hh"
|
||||
#include "apcollect.hh"
|
||||
|
||||
|
|
@ -158,4 +159,48 @@ namespace spot
|
|||
ltl::multop::instance(ltl::multop::And, v));
|
||||
return ltl::multop::instance(ltl::multop::And, f->clone(), c);
|
||||
}
|
||||
|
||||
tgba_digraph_ptr exclusive_ap::constrain(const_tgba_digraph_ptr aut) const
|
||||
{
|
||||
// Compute the support of the automaton.
|
||||
bdd support = bddtrue;
|
||||
{
|
||||
std::set<int> bdd_seen;
|
||||
for (auto& t: aut->transitions())
|
||||
if (bdd_seen.insert(t.cond.id()).second)
|
||||
support &= bdd_support(t.cond);
|
||||
}
|
||||
|
||||
bdd restrict = bddtrue;
|
||||
auto d = aut->get_dict();
|
||||
|
||||
std::vector<bdd> group;
|
||||
for (auto& g: groups)
|
||||
{
|
||||
group.clear();
|
||||
|
||||
for (auto ap: g)
|
||||
{
|
||||
int v = d->has_registered_proposition(ap, aut);
|
||||
if (v >= 0)
|
||||
group.push_back(bdd_nithvar(v));
|
||||
}
|
||||
|
||||
unsigned s = group.size();
|
||||
for (unsigned j = 0; j < s; ++j)
|
||||
for (unsigned k = j + 1; k < s; ++k)
|
||||
restrict &= group[j] | group[k];
|
||||
}
|
||||
|
||||
tgba_digraph_ptr res = make_tgba_digraph(aut->get_dict());
|
||||
res->copy_ap_of(aut);
|
||||
res->prop_copy(aut, { true, true, true, true });
|
||||
res->copy_acceptance_of(aut);
|
||||
transform_accessible(aut, res, [&](unsigned, bdd& cond,
|
||||
acc_cond::mark_t&, unsigned)
|
||||
{
|
||||
cond &= restrict;
|
||||
});
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <vector>
|
||||
#include "ltlast/atomic_prop.hh"
|
||||
#include "ltlast/formula.hh"
|
||||
#include "tgba/tgbagraph.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -41,5 +42,6 @@ namespace spot
|
|||
}
|
||||
|
||||
const ltl::formula* constrain(const ltl::formula* f) const;
|
||||
tgba_digraph_ptr constrain(const_tgba_digraph_ptr aut) const;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue