autfilt: add a --simplify-exclusive-ap option

* src/bin/autfilt.cc: Add option.
* src/ltlvisit/exclusive.cc, src/ltlvisit/exclusive.hh: implement it.
* src/tgbatest/exclusive.test: Test it.
* src/misc/minato.cc, src/misc/minato.hh: Add an interface to
simplify a Boolean function with don't care.
This commit is contained in:
Alexandre Duret-Lutz 2015-03-30 11:37:32 +02:00
parent 25de479e12
commit 75328f1a21
6 changed files with 115 additions and 18 deletions

View file

@ -24,6 +24,7 @@
#include "ltlast/constant.hh"
#include "tgbaalgos/mask.hh"
#include "misc/casts.hh"
#include "misc/minato.hh"
#include "apcollect.hh"
namespace spot
@ -160,7 +161,8 @@ namespace spot
return ltl::multop::instance(ltl::multop::And, f->clone(), c);
}
tgba_digraph_ptr exclusive_ap::constrain(const_tgba_digraph_ptr aut) const
tgba_digraph_ptr exclusive_ap::constrain(const_tgba_digraph_ptr aut,
bool simplify_guards) const
{
// Compute the support of the automaton.
bdd support = bddtrue;
@ -196,11 +198,29 @@ namespace spot
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;
});
if (simplify_guards)
{
transform_accessible(aut, res, [&](unsigned, bdd& cond,
acc_cond::mark_t&, unsigned)
{
minato_isop isop(cond & restrict,
cond | !restrict,
true);
bdd res = bddfalse;
bdd cube = bddfalse;
while ((cube = isop.next()) != bddfalse)
res |= cube;
cond = res;
});
}
else
{
transform_accessible(aut, res, [&](unsigned, bdd& cond,
acc_cond::mark_t&, unsigned)
{
cond &= restrict;
});
}
return res;
}
}

View file

@ -42,6 +42,7 @@ namespace spot
}
const ltl::formula* constrain(const ltl::formula* f) const;
tgba_digraph_ptr constrain(const_tgba_digraph_ptr aut) const;
tgba_digraph_ptr constrain(const_tgba_digraph_ptr aut,
bool simplify_guards = false) const;
};
}