Commit 21402560 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

Simplify F(a)|F(b) as F(a|b). Add similar rule for G(a)&G(b).

* src/ltlvisit/basicreduce.cc (basic_reduce_visitor): Replace
the FG(a)|FG(b) == FG(a|b) rule by the above more generic one.
Add the dual rule for G(a)&G(b), as we had none (this one won't
improve anything in the translation, but it is more symmetric
this way).  Also simplify some pointer checks.
parent 34af3287
2010-03-05 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Simplify F(a)|F(b) as F(a|b). Add similar rule for G(a)&G(b).
* src/ltlvisit/basicreduce.cc (basic_reduce_visitor): Replace
the FG(a)|FG(b) == FG(a|b) rule by the above more generic one.
Add the dual rule for G(a)&G(b), as we had none (this one won't
improve anything in the translation, but it is more symmetric
this way). Also simplify some pointer checks.
2010-03-05 Alexandre Duret-Lutz <adl@lrde.epita.fr> 2010-03-05 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Better selection of the acceptance of the initial state in SBA. Better selection of the acceptance of the initial state in SBA.
......
// Copyright (C) 2008, 2009 Laboratoire de Recherche et Développement // Copyright (C) 2008, 2009, 2010 Laboratoire de Recherche et
// de l'Epita (LRDE). // Dveloppement de l'Epita (LRDE).
// Copyright (C) 2004, 2007 Laboratoire d'Informatique de // Copyright (C) 2004, 2007 Laboratoire d'Informatique de
// Paris 6 (LIP6), dpartement Systmes Rpartis Coopratifs (SRC), // Paris 6 (LIP6), dpartement Systmes Rpartis Coopratifs (SRC),
// Universit Pierre et Marie Curie. // Universit Pierre et Marie Curie.
...@@ -305,7 +305,9 @@ namespace spot ...@@ -305,7 +305,9 @@ namespace spot
multop::vec* tmpU = new multop::vec; multop::vec* tmpU = new multop::vec;
multop::vec* tmpR = new multop::vec; multop::vec* tmpR = new multop::vec;
multop::vec* tmpFG = new multop::vec; multop::vec* tmpFG = new multop::vec;
multop::vec* tmpF = new multop::vec;
multop::vec* tmpGF = new multop::vec; multop::vec* tmpGF = new multop::vec;
multop::vec* tmpG = new multop::vec;
multop::vec* tmpOther = new multop::vec; multop::vec* tmpOther = new multop::vec;
...@@ -326,7 +328,7 @@ namespace spot ...@@ -326,7 +328,7 @@ namespace spot
binop* bo = dynamic_cast<binop*>(*i); binop* bo = dynamic_cast<binop*>(*i);
if (uo) if (uo)
{ {
if (uo && uo->op() == unop::X) if (uo->op() == unop::X)
{ {
// Xa & Xb = X(a & b) // Xa & Xb = X(a & b)
tmpX->push_back(uo->child()->clone()); tmpX->push_back(uo->child()->clone());
...@@ -337,6 +339,11 @@ namespace spot ...@@ -337,6 +339,11 @@ namespace spot
unop* uo2 = dynamic_cast<unop*>(uo->child()); unop* uo2 = dynamic_cast<unop*>(uo->child());
tmpFG->push_back(uo2->child()->clone()); tmpFG->push_back(uo2->child()->clone());
} }
else if (uo->op() == unop::G)
{
// G(a) | G(b) = G(a | b)
tmpG->push_back(uo->child()->clone());
}
else else
{ {
tmpOther->push_back((*i)->clone()); tmpOther->push_back((*i)->clone());
...@@ -416,10 +423,6 @@ namespace spot ...@@ -416,10 +423,6 @@ namespace spot
} }
(*i)->destroy(); (*i)->destroy();
} }
delete tmpGF;
tmpGF = 0;
break; break;
case multop::Or: case multop::Or:
...@@ -432,7 +435,7 @@ namespace spot ...@@ -432,7 +435,7 @@ namespace spot
binop* bo = dynamic_cast<binop*>(*i); binop* bo = dynamic_cast<binop*>(*i);
if (uo) if (uo)
{ {
if (uo && uo->op() == unop::X) if (uo->op() == unop::X)
{ {
// Xa | Xb = X(a | b) // Xa | Xb = X(a | b)
tmpX->push_back(uo->child()->clone()); tmpX->push_back(uo->child()->clone());
...@@ -443,10 +446,10 @@ namespace spot ...@@ -443,10 +446,10 @@ namespace spot
unop* uo2 = dynamic_cast<unop*>(uo->child()); unop* uo2 = dynamic_cast<unop*>(uo->child());
tmpGF->push_back(uo2->child()->clone()); tmpGF->push_back(uo2->child()->clone());
} }
else if (is_FG(*i)) else if (uo->op() == unop::F)
{ {
// FG(a) | FG(b) = F(Ga | Gb) // F(a) | F(b) = F(a | b)
tmpFG->push_back(uo->child()->clone()); tmpF->push_back(uo->child()->clone());
} }
else else
{ {
...@@ -540,19 +543,32 @@ namespace spot ...@@ -540,19 +543,32 @@ namespace spot
else else
delete tmpX; delete tmpX;
if (!tmpF->empty())
tmpOther->push_back(unop::instance(unop::F,
multop::instance(mo->op(),
tmpF)));
else
delete tmpF;
if (!tmpG->empty())
tmpOther->push_back(unop::instance(unop::G,
multop::instance(mo->op(),
tmpG)));
else
delete tmpG;
if (tmpU && !tmpU->empty()) if (!tmpU->empty())
tmpOther->push_back(multop::instance(mo->op(), tmpU)); tmpOther->push_back(multop::instance(mo->op(), tmpU));
else else
delete tmpU; delete tmpU;
if (tmpR && !tmpR->empty()) if (!tmpR->empty())
tmpOther->push_back(multop::instance(mo->op(), tmpR)); tmpOther->push_back(multop::instance(mo->op(), tmpR));
else else
delete tmpR; delete tmpR;
if (tmpGF && !tmpGF->empty()) if (!tmpGF->empty())
{ {
formula* ftmp formula* ftmp
= unop::instance(unop::G, = unop::instance(unop::G,
...@@ -565,7 +581,7 @@ namespace spot ...@@ -565,7 +581,7 @@ namespace spot
delete tmpGF; delete tmpGF;
if (tmpFG && !tmpFG->empty()) if (!tmpFG->empty())
{ {
formula* ftmp = 0; formula* ftmp = 0;
if (mo->op() == multop::And) if (mo->op() == multop::And)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment