diff --git a/ChangeLog b/ChangeLog index 08b14841d..11782ed4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-04-29 Alexandre Duret-Lutz + + * src/ltlvisit/reduce.cc (reduce): Repeat the reduction as + long as the formula changes, it makes more sense when + combining algorithm. E.g. basic reductions can help language + containment and vice-versa. + 2007-04-20 Alexandre Duret-Lutz * src/tgbatest/spotlbtt.test: Disable formula rewriting during diff --git a/src/ltlvisit/reduce.cc b/src/ltlvisit/reduce.cc index 000827742..abb439c75 100644 --- a/src/ltlvisit/reduce.cc +++ b/src/ltlvisit/reduce.cc @@ -1,6 +1,6 @@ -// Copyright (C) 2004, 2006 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre -// et Marie Curie. +// Copyright (C) 2004, 2006, 2007 Laboratoire d'Informatique de Paris 6 +// (LIP6), département Systèmes Répartis Coopératifs (SRC), +// Université Pierre et Marie Curie. // // This file is part of Spot, a model checking library. // @@ -296,54 +296,61 @@ namespace spot { formula* f1; formula* f2; + formula* prev = 0; - f1 = unabbreviate_logic(f); - f2 = simplify_f_g(f1); - destroy(f1); - f1 = negative_normal_form(f2); - destroy(f2); - f2 = f1; + int n = 0; - if (opt & Reduce_Basics) + while (f != prev) { - f1 = basic_reduce(f2); - destroy(f2); - f2 = f1; - } - - if (opt & (Reduce_Syntactic_Implications - | Reduce_Eventuality_And_Universality)) - { - reduce_visitor v(opt); - f2->accept(v); - f1 = v.result(); + ++n; + assert(n < 100); + if (prev) + { + destroy(prev); + prev = const_cast(f); + } + else + { + prev = clone(f); + } + f1 = unabbreviate_logic(f); + f2 = simplify_f_g(f1); + destroy(f1); + f1 = negative_normal_form(f2); destroy(f2); f2 = f1; - // Run basic_reduce again. - // - // Consider `FG b & g' were g is an eventual formula rewritten - // as `g = FG c' Then basic_reduce with rewrite it - // as FG(b & c). if (opt & Reduce_Basics) { f1 = basic_reduce(f2); destroy(f2); f2 = f1; } + + if (opt & (Reduce_Syntactic_Implications + | Reduce_Eventuality_And_Universality)) + { + reduce_visitor v(opt); + f2->accept(v); + f1 = v.result(); + destroy(f2); + f2 = f1; + } + + + if (opt & (Reduce_Containment_Checks + | Reduce_Containment_Checks_Stronger)) + { + formula* f1 = + reduce_tau03(f2, + opt & Reduce_Containment_Checks_Stronger); + destroy(f2); + f2 = f1; + } + f = f2; } - - - if (opt & (Reduce_Containment_Checks - | Reduce_Containment_Checks_Stronger)) - { - formula* f1 = reduce_tau03(f2, - opt & Reduce_Containment_Checks_Stronger); - destroy(f2); - f2 = f1; - } - - return f2; + destroy(prev); + return const_cast(f); } } }