Simplify fUf, fRf, fWf, and fRF as f.

* src/ltlast/binop.cc (binop::instance): Simplify fUf, fRf, fWf,
and fRF.
* src/ltlast/binop.hh: Document it.
* src/ltltest/equals.test: Add new tests for 'Exp U Exp'
and 'Exp R Exp', and all missing tests for W and M.
This commit is contained in:
Alexandre Duret-Lutz 2010-10-25 17:46:26 +02:00
parent 5bb171c8f6
commit 1671aa5da1
3 changed files with 27 additions and 4 deletions

View file

@ -225,9 +225,11 @@ namespace spot
// - (Exp U 1) = 1
// - (Exp U 0) = 0
// - (0 U Exp) = Exp
// - (Exp U Exp) = Exp
if (second == constant::true_instance()
|| second == constant::false_instance()
|| first == constant::false_instance())
|| first == constant::false_instance()
|| first == second)
{
first->destroy();
return second;
@ -237,8 +239,10 @@ namespace spot
// - (Exp W 1) = 1
// - (0 W Exp) = Exp
// - (1 W Exp) = 1
// - (Exp W Exp) = Exp
if (second == constant::true_instance()
|| first == constant::false_instance())
|| first == constant::false_instance()
|| first == second)
{
first->destroy();
return second;
@ -253,9 +257,11 @@ namespace spot
// - (Exp R 1) = 1
// - (Exp R 0) = 0
// - (1 R Exp) = Exp
// - (Exp R Exp) = Exp
if (second == constant::true_instance()
|| second == constant::false_instance()
|| first == constant::true_instance())
|| first == constant::true_instance()
|| first == second)
{
first->destroy();
return second;
@ -265,8 +271,10 @@ namespace spot
// - (Exp M 0) = 0
// - (1 M Exp) = Exp
// - (0 M Exp) = 0
// - (Exp M Exp) = Exp
if (second == constant::false_instance()
|| first == constant::true_instance())
|| first == constant::true_instance()
|| first == second)
{
first->destroy();
return second;

View file

@ -83,15 +83,19 @@ namespace spot
/// - (Exp U 1) = 1
/// - (Exp U 0) = 0
/// - (0 U Exp) = Exp
/// - (Exp U Exp) = Exp
/// - (Exp W 1) = 1
/// - (0 W Exp) = Exp
/// - (1 W Exp) = 1
/// - (Exp W Exp) = Exp
/// - (Exp R 1) = 1
/// - (Exp R 0) = 0
/// - (1 R Exp) = Exp
/// - (Exp R Exp) = Exp
/// - (Exp M 0) = 0
/// - (1 M Exp) = Exp
/// - (0 M Exp) = 0
/// - (Exp M Exp) = Exp
static formula* instance(type op, formula* first, formula* second);
virtual void accept(visitor& v);