Rewrite "(Xc) M b" as "b & X(b U c)", plus three similar rules.

* src/ltlvisit/simplify.hh (ltl_simplifier_options): New option
reduce_size_stricly.
* src/ltlvisit/simplify.cc (simplify_visitor): Implement these
rules.
* src/ltltest/reduc.cc: Check with reduce_size_strictly unset or
set, but only use the latter result to check sizes.
* src/ltltest/reduccmp.test: Test them.
* doc/tl/tl.tex: Document them.
This commit is contained in:
Alexandre Duret-Lutz 2012-02-13 17:58:57 +01:00
parent c9b34d684a
commit bb56c26d1c
5 changed files with 122 additions and 48 deletions

View file

@ -1747,6 +1747,24 @@ namespace spot
}
}
}
// If b is Boolean:
// (Xc) U b = b | X(b M c)
// (Xc) W b = b | X(b R c)
if (!opt_.reduce_size_strictly
&& fu1 && fu1->op() == unop::X && b->is_boolean())
{
formula* c = fu1->child()->clone();;
fu1->destroy();
formula* x =
unop::instance(unop::X,
binop::instance(op == binop::U
? binop::M
: binop::R,
b->clone(), c));
result_ =
recurse_destroy(multop::instance(multop::Or, b, x));
return;
}
}
else if (op == binop::M || op == binop::R)
{
@ -1791,6 +1809,25 @@ namespace spot
}
}
}
// If b is Boolean:
// (Xc) R b = b & X(b W c)
// (Xc) M b = b & X(b U c)
if (!opt_.reduce_size_strictly
&& fu1 && fu1->op() == unop::X && b->is_boolean())
{
formula* c = fu1->child()->clone();;
fu1->destroy();
formula* x =
unop::instance(unop::X,
binop::instance(op == binop::M
? binop::U
: binop::W,
b->clone(), c));
result_ =
recurse_destroy(multop::instance(multop::And, b, x));
return;
}
}
}
case binop::Xor:

View file

@ -1,5 +1,5 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// Copyright (C) 2011, 2012 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -37,15 +37,15 @@ namespace spot
bool event_univ = true,
bool containment_checks = false,
bool containment_checks_stronger = false,
bool nenoform_stop_on_boolean = false)
bool nenoform_stop_on_boolean = false,
bool reduce_size_strictly = false)
: reduce_basics(basics),
synt_impl(synt_impl),
event_univ(event_univ),
containment_checks(containment_checks),
containment_checks_stronger(containment_checks_stronger),
// If true, Boolean subformulae will not be put into
// negative normal form.
nenoform_stop_on_boolean(nenoform_stop_on_boolean)
nenoform_stop_on_boolean(nenoform_stop_on_boolean),
reduce_size_strictly(reduce_size_strictly)
{
}
@ -57,6 +57,10 @@ namespace spot
// If true, Boolean subformulae will not be put into
// negative normal form.
bool nenoform_stop_on_boolean;
// If true, some rules that produce slightly larger formulae
// will be disabled. Those larger formulae are normally easier
// to translate, so we recommend to set this to false.
bool reduce_size_strictly;
};
// fwd declaration to hide technical details.