snf: Fix the handling of bounded repetition.

star_normal_form() used to be called under bounded
repetitions like [*0..4], but some of these rewritings
are only correct for [*0..].  For instance
     (a*|1)[*]      can be rewritten to    1[*]
but  (a*|1)[*0..1]  cannot be rewritten to 1[*0..1]
it would be correct to rewrite the latter as (a[+]|1)[*0..1],
canceling the empty word in a*.

Also (a*;b*)[*]     can be rewritten to    (a|b)[*]
but  (a*;b*)[*0..1]  cannot be rewritten to (a|b)[*0..1]
and it cannot either be rewritten to (a[+]|b[+])[*0..1].

This patch introduces a new function to implement
rewritings under bounded repetition.

* src/ltlvisit/snf.hh, src/ltlvisit/snf.cc (star_normal_form_unbounded):
New function.
* src/ltlvisit/simplify.cc: Use it.
* src/ltltest/reduccmp.test: Add tests.
* doc/tl/tl.tex: Document the rewritings implemented.
This commit is contained in:
Alexandre Duret-Lutz 2014-05-15 20:06:43 +02:00
parent 53de8fc3a4
commit 05ed3def00
5 changed files with 112 additions and 21 deletions

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE).
// Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -52,6 +52,10 @@ namespace spot
/// \param cache an optional cache
SPOT_API const formula*
star_normal_form(const formula* sere, snf_cache* cache = 0);
/// A variant of star_normal_form() for r[*0..j] where j < ω.
SPOT_API const formula*
star_normal_form_bounded(const formula* sere, snf_cache* cache = 0);
}
}