Reimplement basic_reduce()'s rules in ltl_simplifier.

So far I have only checked these rewritings with reduccmp.test.
There are probably a few kinks to iron out.

* src/ltlvisit/simplify.cc: Reimplement most of the basic
rewriting rules, leaving some FIXME comments for dubious ones.
* src/ltlast/multop.cc, src/ltlast/multop.hh: Ignore NULL
pointers in the vector.
* src/ltlvisit/reduce.cc (reduce): Do not call basic_reduce().
* src/ltltest/reduccmp.test: Adjust tests.
This commit is contained in:
Alexandre Duret-Lutz 2011-08-22 19:34:09 +02:00
parent e3e0f913b6
commit ca2fe4f3f8
5 changed files with 1020 additions and 45 deletions

View file

@ -163,7 +163,7 @@ namespace spot
// We match equivalent formulae modulo "ACI rules"
// (i.e. associativity, commutativity and idempotence of the
// operator). For instance If `+' designate the OR operator and
// operator). For instance if `+' designates the OR operator and
// `0' is false (the neutral element for `+') , then `f+f+0' is
// equivalent to `f'.
formula*
@ -178,6 +178,16 @@ namespace spot
vec::iterator i = v->begin();
while (i != v->end())
{
// Some simplification routines erase terms using null
// pointers that we must ignore.
if ((*i) == 0)
{
// FIXME: We should replace the pointer by the
// first non-null value at the end of the array
// instead of calling erase.
i = v->erase(i);
continue;
}
if ((*i)->kind() == MultOp)
{
multop* p = static_cast<multop*>(*i);
@ -187,6 +197,7 @@ namespace spot
for (unsigned n = 0; n < ps; ++n)
inlined.push_back(p->nth(n)->clone());
(*i)->destroy();
// FIXME: Do not use erase. See previous FIXME.
i = v->erase(i);
continue;
}