ltl2tgba_fm: fix translation of !{f} as done last year for {f}

* src/tgbaalgos/ltl2tgba_fm.cc: Fix.
* src/tgbatest/randpsl.test: Rewrite using ltlcross and add a testcase.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2014-08-21 17:36:34 +02:00
parent d3ddd724c9
commit 408dc878e5
3 changed files with 35 additions and 42 deletions

3
NEWS
View file

@ -31,6 +31,9 @@ New in spot 1.2.4a (not yet released)
not use this operator as some LTL patterns are automatically not use this operator as some LTL patterns are automatically
reduced to it). reduced to it).
- Fix simplification of bounded repetition in SERE formulas. - Fix simplification of bounded repetition in SERE formulas.
- Fix incorrect translation of PSL formulas of the form !{f} where
f is unsatisifable. A similar bug was fixed for {f} in Spot
1.1.4, but for some reason it was not fixed for !{f}.
- Fix parsing of neverclaims produced by Modella. - Fix parsing of neverclaims produced by Modella.
- Fix a memory leak in the little-used conversion from - Fix a memory leak in the little-used conversion from
transition-based alternating automata to tgba. transition-based alternating automata to tgba.

View file

@ -1438,48 +1438,51 @@ namespace spot
case unop::NegClosure: case unop::NegClosure:
rat_seen_ = true; rat_seen_ = true;
{ {
const formula* c = node->child();
if (mark_all_) if (mark_all_)
{ {
op = unop::NegClosureMarked; op = unop::NegClosureMarked;
has_marked_ = true; has_marked_ = true;
} }
bdd f1 = translate_ratexp(c, dict_);
// trace_ltl_bdd(dict_, f1); const formula* f = node->child();
tgba_succ_iterator* i = dict_.transdfa.succ(f);
res_ = bddtrue;
bdd var_set = bdd_existcomp(bdd_support(f1), dict_.var_set); if (!i)
bdd all_props = bdd_existcomp(f1, dict_.var_set); break;
res_ = !all_props & res_ = bddfalse;
// stick X(1) to preserve determinism. bdd missing = bddtrue;
bdd_ithvar(dict_.register_next_variable for (i->first(); !i->done(); i->next())
(constant::true_instance()));
while (all_props != bddfalse)
{ {
bdd label = bdd_satoneset(all_props, var_set, bddtrue); bdd label = i->current_condition();
all_props -= label; state* s = i->current_state();
const formula* dest = dict_.transdfa.get_label(f, s);
s->destroy();
const formula* dest = missing -= label;
dict_.bdd_to_sere(bdd_exist(f1 & label, dict_.var_set));
// !{ Exp } is false if Exp accepts the empty word.
if (dest->accepts_eword()) if (dest->accepts_eword())
{ {
dest->destroy(); dest->destroy();
continue;
} }
else
const formula* dest2 = unop::instance(op, dest); {
const formula* dest2 = unop::instance(op, dest);
if (dest2 == constant::false_instance()) if (dest2 == constant::false_instance())
continue; continue;
int x = dict_.register_next_variable(dest2);
int x = dict_.register_next_variable(dest2); dest2->destroy();
dest2->destroy(); res_ |= label & bdd_ithvar(x);
res_ |= label & bdd_ithvar(x); }
} }
delete i;
res_ |= missing &
// stick X(1) to preserve determinism.
bdd_ithvar(dict_.register_next_variable
(constant::true_instance()));
//trace_ltl_bdd(dict_, res_);
} }
break; break;

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2011, 2012 Laboratoire de Recherche et Développement # Copyright (C) 2011, 2012, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE). # de l'Epita (LRDE).
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
@ -22,23 +22,10 @@
set -e set -e
check_psl()
{
# Do not use "run", this is too slow.
# Make cross products with FM
../ltl2tgba -f -R3 -b "$1" > out.tgba
../ltl2tgba -f -R3 -Pout.tgba -E "!($1)"
# Also try with -x turned on.
../ltl2tgba -f -x -R3 -b "$1" > out.tgba
../ltl2tgba -f -x -R3 -Pout.tgba -E "!($1)"
}
# Generate 50 random unique PSL formula that do not simplify to LTL # Generate 50 random unique PSL formula that do not simplify to LTL
# formulae, and that have a size of at lease 12. # formulae, and that have a size of at lease 12.
../../bin/randltl -n -1 --tree-size 30 --seed 0 --psl a b c | ../../bin/randltl -n -1 --tree-size 30 --seed 0 --psl a b c |
../../bin/ltlfilt -r --size-min 12 --unique | ../../bin/ltlfilt -r --size-min 12 --unique |
../../bin/ltlfilt -v --ltl | head -n 50 | ../../bin/ltlfilt -v --ltl | head -n 50 |
while read formula; do ../../bin/ltlcross '../ltl2tgba -R3 -t %f >%T' '../ltl2tgba -x -R3 -t %f >%T' \
check_psl "$formula" -F - -f '{{(p1)}[*]:{(p3) && {{!(p1)} xor {!(p3)}}}}'
done