Combine Boolean formulae in Fusion arguments.
* src/ltlast/multop.cc (multop::instance): Implement
the rewriting. "a🅱️c[*]:d:e" becomes "{{a&&b}&c[*]}:{d&&e}".
* src/ltlast/multop.hh: Document it.
* src/ltltest/equals.test, src/ltltest/kind.test: Add test cases.
This commit is contained in:
parent
a2da5184b5
commit
2669df1c96
4 changed files with 46 additions and 4 deletions
|
|
@ -271,6 +271,41 @@ namespace spot
|
|||
abs = constant::false_instance();
|
||||
abs2 = constant::empty_word_instance();
|
||||
weak_abs = 0;
|
||||
|
||||
// Make a first pass to gather Boolean formulae.
|
||||
// - Fusion(Exps1...,BoolExp1...BoolExpN,Exps2,Exps3...) =
|
||||
// Fusion(Exps1...,AndNLM(And(BoolExp1...BoolExpN),Exps2),Exps3...)
|
||||
{
|
||||
vec* b = 0;
|
||||
vec::iterator i = v->begin();
|
||||
while (i != v->end())
|
||||
{
|
||||
if ((*i)->is_boolean())
|
||||
{
|
||||
if (!b)
|
||||
b = new vec;
|
||||
b->push_back(*i);
|
||||
i = v->erase(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
// We have found a non-Boolean Exp. "AndNLM" it
|
||||
// with all the previous Boolean formulae.
|
||||
*i = instance(AndNLM, instance(And, b), *i);
|
||||
b = 0;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
if (b)
|
||||
{
|
||||
// Group all trailing Boolean formulae.
|
||||
v->push_back(instance(And, b));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ namespace spot
|
|||
/// - Fusion(Exps1...,0,Exps2...) = 0
|
||||
/// - Fusion(Exps1...,[*0],Exps2...) = 0
|
||||
/// - Fusion(Exp) = Exp
|
||||
/// - Fusion(Exps1...,BoolExp1...BoolExpN,Exps2,Exps3...) =
|
||||
/// Fusion(Exps1...,AndNLM(And(BoolExp1...BoolExpN),Exps2),Exps3...)
|
||||
static formula* instance(type op, vec* v);
|
||||
|
||||
virtual void accept(visitor& v);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue