Commit 9460e076 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

FM: Translate X(a&b) as if it were X(a)&X(b).

This helps reducing (p&XF!p)|(!p&XFp)|X(Fp&F!p) to (p&XF!p)|(!p&XFp).

* src/tgbaalgos/ltl2tgba_fm.cc: Adjust rewriting rules of X.
* src/tgbatest/ltl2tgba.test: Add a test case.
parent d7ff0665
......@@ -1307,8 +1307,52 @@ namespace spot
case unop::X:
{
// r(Xy) = Next[y]
int x = dict_.register_next_variable(node->child());
res_ = bdd_ithvar(x);
// r(X(a&b&c)) = Next[a]&Next[b]&Next[c]
// r(X(a|b|c)) = Next[a]|Next[b]|Next[c]
//
// The special case for And is to that
// (p&XF!p)|(!p&XFp)|X(Fp&F!p) (1)
// get translated as
// (p&XF!p)|(!p&XFp)|XFp&XF!p (2)
// and then automatically reduced to
// (p&XF!p)|(!p&XFp)
//
// Formula (2) appears as an example of Boolean
// simplification in Wring, but our LTL rewriting
// rules tend to rewrite it as (1).
//
// The special case for Or follows naturally, but it's
// effect is less clear. Benchmarks show that it
// reduces the number of states and transitions, but it
// increases the number of non-deterministic states...
const formula* y = node->child();
if (const multop* m = is_And(y))
{
res_ = bddtrue;
unsigned s = m->size();
for (unsigned n = 0; n < s; ++n)
{
int x = dict_.register_next_variable(m->nth(n));
res_ &= bdd_ithvar(x);
}
}
#if 0
else if (const multop* m = is_Or(y))
{
res_ = bddfalse;
unsigned s = m->size();
for (unsigned n = 0; n < s; ++n)
{
int x = dict_.register_next_variable(m->nth(n));
res_ |= bdd_ithvar(x);
}
}
#endif
else
{
int x = dict_.register_next_variable(y);
res_ = bdd_ithvar(x);
}
break;
}
case unop::Closure:
......
......@@ -201,3 +201,8 @@ run 0 ../ltl2tgba -XN -kt out.never > count.never
run 0 ../ltl2tgba -R1q -R1t -DS -b 'FGa|FGb' > out.spot
run 0 ../ltl2tgba -X -kt out.spot > count.spot
cmp count.never count.spot
# The following automaton should have only 4 states.
run 0 ../ltl2tgba -R3 -ks -f '(p&XF!p)|(!p&XFp)|X(Fp&F!p)' >stdout
grep 'transitions: 7$' stdout
grep 'states: 4$' stdout
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment