Speedup mark_concat_ops() and simplify_mark() with a cache.

* src/ltlvisit/mark.hh, src/ltlvisit/mark.cc (mark_concat_ops,
simplify_mark): Rewrite these two functions as methods of
(mark_tools): this new class.
* src/ltlast/binop.cc, src/ltlast/unop.cc: Adjust computation
of not_marked to ignore marked operators that are not at
the top-level.  I.e., something like X(!{a}) is not marked.
* src/tgbaalgos/ltl2tgba_fm.cc (translate_dict::mt): New
instance of mark_tools.
(formula_canonizer::translate) Adjust calls to
mark_concat_ops() and simplify_mark().
This commit is contained in:
Alexandre Duret-Lutz 2011-11-13 19:44:40 +01:00
parent f68f639e68
commit 0f11e5fe0e
5 changed files with 116 additions and 77 deletions

View file

@ -106,9 +106,8 @@ namespace spot
is.accepting_eword = false;
break;
case EConcatMarked:
is.not_marked = false;
// fall through
case EConcat:
is.not_marked = (op != EConcatMarked);
is.ltl_formula = false;
is.boolean = false;
is.eltl_formula = false;
@ -130,11 +129,11 @@ namespace spot
is.syntactic_obligation = second->is_syntactic_guarantee();
is.syntactic_recurrence = second->is_syntactic_guarantee();
}
assert(first->is_sere_formula());
assert(second->is_psl_formula());
break;
case UConcat:
is.not_marked = true;
is.ltl_formula = false;
is.boolean = false;
is.eltl_formula = false;
@ -156,11 +155,11 @@ namespace spot
is.syntactic_obligation = second->is_syntactic_safety();
is.syntactic_persistence = second->is_syntactic_safety();
}
assert(first->is_sere_formula());
assert(second->is_psl_formula());
break;
case U:
is.not_marked = true;
// f U g is universal if g is eventual, or if f == 1.
is.eventual = second->is_eventual();
is.eventual |= (first == constant::true_instance());
@ -181,6 +180,7 @@ namespace spot
// is.syntactic_persistence = Persistence U Persistance
break;
case W:
is.not_marked = true;
// f W g is universal if f and g are, or if g == 0.
is.universal |= (second == constant::false_instance());
is.boolean = false;
@ -200,6 +200,7 @@ namespace spot
break;
case R:
is.not_marked = true;
// g R f is universal if f is universal, or if g == 0.
is.universal = second->is_universal();
is.universal |= (first == constant::false_instance());
@ -220,6 +221,7 @@ namespace spot
break;
case M:
is.not_marked = true;
// g M f is eventual if both g and f are eventual, or if f == 1.
is.eventual |= (second == constant::true_instance());
is.boolean = false;

View file

@ -39,6 +39,7 @@ namespace spot
switch (op)
{
case Not:
is.not_marked = true;
is.eventual = child->is_universal();
is.universal = child->is_eventual();
is.in_nenoform = (child->kind() == AtomicProp);
@ -53,6 +54,7 @@ namespace spot
is.accepting_eword = false;
break;
case X:
is.not_marked = true;
is.boolean = false;
is.X_free = false;
is.eltl_formula = false;
@ -65,6 +67,7 @@ namespace spot
is.accepting_eword = false;
break;
case F:
is.not_marked = true;
is.boolean = false;
is.eltl_formula = false;
is.sere_formula = false;
@ -79,6 +82,7 @@ namespace spot
is.accepting_eword = false;
break;
case G:
is.not_marked = true;
is.boolean = false;
is.eltl_formula = false;
is.sere_formula = false;
@ -93,6 +97,7 @@ namespace spot
is.accepting_eword = false;
break;
case Finish:
is.not_marked = true;
is.boolean = false;
is.ltl_formula = false;
is.psl_formula = false;
@ -120,6 +125,7 @@ namespace spot
is.accepting_eword = false;
break;
case Closure:
is.not_marked = true;
is.boolean = false;
is.ltl_formula = false;
is.eltl_formula = false;