Get rid of bunop::Equal and bunop::Goto.

* src/ltlast/bunop.hh, src/ltlast/bunop.cc, src/ltlvisit/randomltl.cc,
src/ltlvisit/simplify.cc, src/ltlvisit/tostring.cc,
src/tgbaalgos/ltl2tgba_fm.cc: Remove all traces of these two
operators since they are not handled like sugar.
* doc/tl/tl.tex: Adjust documentation to reflect the fact that these
two operators are sugar.
This commit is contained in:
Alexandre Duret-Lutz 2012-04-15 00:13:42 +02:00
parent 210723e30c
commit abaf102746
7 changed files with 38 additions and 272 deletions

View file

@ -57,13 +57,6 @@ namespace spot
if (min_ == 0)
is.accepting_eword = true;
break;
case Equal:
case Goto:
is.finite = false;
is.accepting_eword = (min_ == 0);
// Equal and Goto can only apply to Boolean formulae.
assert(child->is_boolean());
break;
}
}
@ -140,12 +133,8 @@ namespace spot
{
switch (op_)
{
case Equal:
return "Equal";
case Star:
return "Star";
case Goto:
return "Goto";
}
// Unreachable code.
assert(0);
@ -157,9 +146,6 @@ namespace spot
{
std::ostringstream out;
unsigned default_min = 0;
unsigned default_max = unbounded;
switch (op_)
{
case Star:
@ -171,39 +157,14 @@ namespace spot
}
out << "[*";
break;
case Equal:
out << "[=";
break;
case Goto:
out << "[->";
default_min = 1;
default_max = 1;
break;
}
// Beware that the default parameters of the Goto operator are
// not the same as Star or Equal:
//
// [->] = [->1..1]
// [->..] = [->1..unbounded]
// [*] = [*0..unbounded]
// [*..] = [*0..unbounded]
// [=] = [=0..unbounded]
// [=..] = [=0..unbounded]
//
// Strictly speaking [=] is not specified by PSL, and anyway we
// automatically rewrite Exp[=0..unbounded] as
// Exp[*0..unbounded], so we should never have to print [=]
// here.
//
// Also
// [*..] = [*0..unbounded]
if (min_ != default_min || max_ != default_max)
if (min_ != 0 || max_ != unbounded)
{
// Always print the min_, even when it is equal to
// default_min, this way we avoid ambiguities (like
// when reading [*..3] near [*->..2])
// when reading a[*..3];b[->..2] which actually
// means a[*0..3];b[->1..2].
out << min_;
if (min_ != max_)
{
@ -227,81 +188,6 @@ namespace spot
switch (op)
{
case Equal:
{
// - Exp[=0..] = [*]
if (min == 0 && max == unbounded)
{
op = Star;
child->destroy();
child = constant::true_instance();
break;
}
// - 0[=0..max] = [*]
// - 0[=min..max] = 0 if min > 0
if (child == constant::false_instance())
{
if (min == 0)
{
max = unbounded;
op = Star;
child = constant::true_instance();
break;
}
else
return child;
}
// - 1[=0] = [*0]
// - 1[=min..max] = 1[*min..max]
if (child == constant::true_instance())
{
if (max == 0)
return constant::empty_word_instance();
else
{
op = Star;
break;
}
}
// - Exp[=0] = (!Exp)[*]
if (max == 0)
return bunop::instance(bunop::Star,
unop::instance(unop::Not, child));
break;
}
case Goto:
{
// - 0[->min..max] = 0 if min>0
// - 0[->0..max] = [*0]
if (child == constant::false_instance())
{
if (min == 0)
return constant::empty_word_instance();
else
return child;
}
// - 1[->0] = [*0]
// - 1[->min..max] = 1[*min..max]
if (child == constant::true_instance())
{
if (max == 0)
return constant::empty_word_instance();
else
{
op = Star;
break;
}
}
// - Exp[->0] = [*0]
if (max == 0)
{
child->destroy();
return constant::empty_word_instance();
}
break;
}
case Star:
{
// - [*0][*min..max] = [*0]

View file

@ -37,7 +37,7 @@ namespace spot
class bunop : public ref_formula
{
public:
enum type { Star, Equal, Goto };
enum type { Star };
static const unsigned unbounded = -1U;
@ -51,17 +51,6 @@ namespace spot
/// - [*0][*min..max] = [*0]
/// - Exp[*0] = [*0]
/// - Exp[*i..j][*k..l] = Exp[*ik..jl] if i*(k+1)<=jk+1.
/// - 0[=0..max] = 1[*]
/// - 0[=min..max] = 0 if min > 0
/// - 1[=0] = [*0]
/// - 1[=min..max] = 1[*min..max]
/// - Exp[=0..] = [*]
/// - Exp[=0] = (!Exp)[*]
/// - 0[->0..max] = [*0]
/// - 0[->min..max] = 0 if min>0
/// - 1[->0] = [*0]
/// - 1[->min..max] = 1[*min..max]
/// - Exp[->0] = [*0]
///
/// These rewriting rules imply that it is not possible to build
/// an LTL formula object that is SYNTACTICALLY equal to one of