formula: replace nth() by operator[]()
* src/ltlast/formula.hh (formula::nth): Replace by ... (formula::operator[]): ... this. * src/ltlvisit/mark.cc, src/ltlvisit/mutation.cc, src/ltlvisit/print.cc, src/ltlvisit/relabel.cc, src/ltlvisit/remove_x.cc, src/ltlvisit/simpfg.cc, src/ltlvisit/simplify.cc, src/ltlvisit/snf.cc, src/ltlvisit/unabbrev.cc, src/twa/formula2bdd.cc, src/twaalgos/compsusp.cc, src/twaalgos/ltl2taa.cc, src/twaalgos/ltl2tgba_fm.cc, wrap/python/spot_impl.i: Adjust.
This commit is contained in:
parent
533268000d
commit
2369389850
15 changed files with 373 additions and 373 deletions
|
|
@ -1076,12 +1076,12 @@ namespace spot
|
|||
{
|
||||
return ptr_->end();
|
||||
}
|
||||
#endif
|
||||
|
||||
formula nth(unsigned i) const
|
||||
formula operator[](unsigned i) const
|
||||
{
|
||||
return formula(ptr_->nth(i)->clone());
|
||||
}
|
||||
#endif
|
||||
|
||||
static formula ff()
|
||||
{
|
||||
|
|
@ -1206,7 +1206,7 @@ namespace spot
|
|||
case op::Closure:
|
||||
case op::NegClosure:
|
||||
case op::NegClosureMarked:
|
||||
return unop(o, trans(nth(0)));
|
||||
return unop(o, trans((*this)[0]));
|
||||
case op::Xor:
|
||||
case op::Implies:
|
||||
case op::Equiv:
|
||||
|
|
@ -1218,8 +1218,8 @@ namespace spot
|
|||
case op::EConcatMarked:
|
||||
case op::UConcat:
|
||||
{
|
||||
formula tmp = trans(nth(0));
|
||||
return binop(o, tmp, trans(nth(1)));
|
||||
formula tmp = trans((*this)[0]);
|
||||
return binop(o, tmp, trans((*this)[1]));
|
||||
}
|
||||
case op::Or:
|
||||
case op::OrRat:
|
||||
|
|
@ -1237,7 +1237,7 @@ namespace spot
|
|||
}
|
||||
case op::Star:
|
||||
case op::FStar:
|
||||
return bunop(o, trans(nth(0)), min(), max());
|
||||
return bunop(o, trans((*this)[0]), min(), max());
|
||||
}
|
||||
SPOT_UNREACHABLE();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,10 +63,10 @@ namespace spot
|
|||
res = f;
|
||||
break;
|
||||
case op::NegClosure:
|
||||
res = ltl::formula::NegClosureMarked(f.nth(0));
|
||||
res = ltl::formula::NegClosureMarked(f[0]);
|
||||
break;
|
||||
case op::EConcat:
|
||||
res = ltl::formula::EConcatMarked(f.nth(0), f.nth(1));
|
||||
res = ltl::formula::EConcatMarked(f[0], f[1]);
|
||||
break;
|
||||
case op::Or:
|
||||
case op::And:
|
||||
|
|
@ -138,7 +138,7 @@ namespace spot
|
|||
{
|
||||
if (c.is(op::EConcatMarked))
|
||||
{
|
||||
empairs.emplace(c.nth(0), c.nth(1));
|
||||
empairs.emplace(c[0], c[1]);
|
||||
v.push_back(c.map(recurse));
|
||||
}
|
||||
else if (c.is(op::EConcat))
|
||||
|
|
@ -147,7 +147,7 @@ namespace spot
|
|||
}
|
||||
else if (c.is(op::NegClosureMarked))
|
||||
{
|
||||
nmset.insert(c.nth(0));
|
||||
nmset.insert(c[0]);
|
||||
v.push_back(c.map(recurse));
|
||||
}
|
||||
else if (c.is(op::NegClosure))
|
||||
|
|
@ -162,13 +162,13 @@ namespace spot
|
|||
// Keep only the non-marked EConcat for which we
|
||||
// have not seen a similar EConcatMarked.
|
||||
for (auto e: elist)
|
||||
if (empairs.find(std::make_pair(e.nth(0), e.nth(1)))
|
||||
if (empairs.find(std::make_pair(e[0], e[1]))
|
||||
== empairs.end())
|
||||
v.push_back(e);
|
||||
// Keep only the non-marked NegClosure for which we
|
||||
// have not seen a similar NegClosureMarked.
|
||||
for (auto n: nlist)
|
||||
if (nmset.find(n.nth(0)) == nmset.end())
|
||||
if (nmset.find(n[0]) == nmset.end())
|
||||
v.push_back(n);
|
||||
res = ltl::formula::And(v);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace spot
|
|||
case op::G:
|
||||
if ((opts_ & Mut_Remove_Ops)
|
||||
&& mutation_counter_-- == 0)
|
||||
return f.nth(0);
|
||||
return f[0];
|
||||
// fall through
|
||||
case op::Closure:
|
||||
case op::NegClosure:
|
||||
|
|
@ -118,7 +118,7 @@ namespace spot
|
|||
{
|
||||
vec v1;
|
||||
vec v2;
|
||||
v1.push_back(f.nth(0));
|
||||
v1.push_back(f[0]);
|
||||
bool reverse = false;
|
||||
int i = 1;
|
||||
while (i < mos)
|
||||
|
|
@ -130,10 +130,10 @@ namespace spot
|
|||
reverse = true;
|
||||
break;
|
||||
}
|
||||
v1.push_back(f.nth(i++));
|
||||
v1.push_back(f[i++]);
|
||||
}
|
||||
for (; i < mos; ++i)
|
||||
v2.push_back(f.nth(i));
|
||||
v2.push_back(f[i]);
|
||||
formula first = AndNLM_(v1);
|
||||
formula second = AndNLM_(v2);
|
||||
formula ost = formula::one_star();
|
||||
|
|
@ -164,8 +164,8 @@ namespace spot
|
|||
case op::EConcatMarked:
|
||||
case op::UConcat:
|
||||
{
|
||||
formula first = f.nth(0);
|
||||
formula second = f.nth(1);
|
||||
formula first = f[0];
|
||||
formula second = f[1];
|
||||
op o = f.kind();
|
||||
bool left_is_sere = o == op::EConcat
|
||||
|| o == op::EConcatMarked
|
||||
|
|
@ -242,7 +242,7 @@ namespace spot
|
|||
case op::Star:
|
||||
case op::FStar:
|
||||
{
|
||||
formula c = f.nth(0);
|
||||
formula c = f[0];
|
||||
op o = f.kind();
|
||||
if (opts_ & Mut_Remove_Ops && mutation_counter_-- == 0)
|
||||
return c;
|
||||
|
|
|
|||
|
|
@ -348,10 +348,10 @@ namespace spot
|
|||
match_goto(formula mo, unsigned i)
|
||||
{
|
||||
assert(i + 1 < mo.size());
|
||||
formula b = strip_star_not(mo.nth(i));
|
||||
formula b = strip_star_not(mo[i]);
|
||||
if (b == nullptr || !b.is_boolean())
|
||||
return nullptr;
|
||||
if (mo.nth(i + 1) == b)
|
||||
if (mo[i + 1] == b)
|
||||
return b;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -482,7 +482,7 @@ namespace spot
|
|||
break;
|
||||
case op::Not:
|
||||
{
|
||||
formula c = f.nth(0);
|
||||
formula c = f[0];
|
||||
if (c.is(op::AP))
|
||||
{
|
||||
// If we negate a single letter in UTF-8, use a
|
||||
|
|
@ -514,15 +514,15 @@ namespace spot
|
|||
}
|
||||
case op::X:
|
||||
emit(KX);
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
break;
|
||||
case op::F:
|
||||
emit(KF);
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
break;
|
||||
case op::G:
|
||||
emit(KG);
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
break;
|
||||
case op::NegClosure:
|
||||
case op::NegClosureMarked:
|
||||
|
|
@ -534,45 +534,45 @@ namespace spot
|
|||
os_ << '{';
|
||||
in_ratexp_ = true;
|
||||
top_level_ = true;
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
os_ << '}';
|
||||
in_ratexp_ = false;
|
||||
top_level_ = false;
|
||||
break;
|
||||
case op::Xor:
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
emit(KXor);
|
||||
visit(f.nth(1));
|
||||
visit(f[1]);
|
||||
break;
|
||||
case op::Implies:
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
emit(KImplies);
|
||||
visit(f.nth(1));
|
||||
visit(f[1]);
|
||||
break;
|
||||
case op::Equiv:
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
emit(KEquiv);
|
||||
visit(f.nth(1));
|
||||
visit(f[1]);
|
||||
break;
|
||||
case op::U:
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
emit(KU);
|
||||
visit(f.nth(1));
|
||||
visit(f[1]);
|
||||
break;
|
||||
case op::R:
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
emit(KR);
|
||||
visit(f.nth(1));
|
||||
visit(f[1]);
|
||||
break;
|
||||
case op::W:
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
emit(KW);
|
||||
visit(f.nth(1));
|
||||
visit(f[1]);
|
||||
break;
|
||||
case op::M:
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
emit(KM);
|
||||
visit(f.nth(1));
|
||||
visit(f[1]);
|
||||
break;
|
||||
case op::EConcat:
|
||||
case op::EConcatMarked:
|
||||
|
|
@ -581,11 +581,11 @@ namespace spot
|
|||
in_ratexp_ = true;
|
||||
openp();
|
||||
top_level_ = true;
|
||||
formula left = f.nth(0);
|
||||
formula right = f.nth(1);
|
||||
formula left = f[0];
|
||||
formula right = f[1];
|
||||
unsigned last = left.size() - 1;
|
||||
bool onelast = false;
|
||||
if (left.is(op::Concat) && left.nth(last).is(op::True))
|
||||
if (left.is(op::Concat) && left[last].is_true())
|
||||
{
|
||||
visit(left.all_but(last));
|
||||
onelast = true;
|
||||
|
|
@ -609,7 +609,7 @@ namespace spot
|
|||
}
|
||||
else if (o == op::EConcat)
|
||||
{
|
||||
if (f.nth(1).is(op::True))
|
||||
if (f[1].is(op::True))
|
||||
{
|
||||
os_ << '!';
|
||||
// No recursion on right.
|
||||
|
|
@ -633,7 +633,7 @@ namespace spot
|
|||
case op::AndNLM:
|
||||
case op::Fusion:
|
||||
{
|
||||
visit(f.nth(0));
|
||||
visit(f[0]);
|
||||
keyword k = KFalse; // Initialize to something to please GCC.
|
||||
switch (o)
|
||||
{
|
||||
|
|
@ -664,7 +664,7 @@ namespace spot
|
|||
for (unsigned n = 1; n < max; ++n)
|
||||
{
|
||||
emit(k);
|
||||
visit(f.nth(n));
|
||||
visit(f[n]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -686,7 +686,7 @@ namespace spot
|
|||
|
||||
// Wait... maybe we are looking at (!b)[*];b;(!b)[*]
|
||||
// in which case it's b[=1].
|
||||
if (i + 2 < max && f.nth(i) == f.nth(i + 2))
|
||||
if (i + 2 < max && f[i] == f[i + 2])
|
||||
{
|
||||
emit(KEqualBunop);
|
||||
os_ << '1';
|
||||
|
|
@ -702,12 +702,12 @@ namespace spot
|
|||
continue;
|
||||
}
|
||||
// Try to match ((!b)[*];b)[*i..j];(!b)[*]
|
||||
formula fi = f.nth(i);
|
||||
formula fi = f[i];
|
||||
if (fi.is(op::Star))
|
||||
{
|
||||
if (formula b2 = strip_star_not(f.nth(i + 1)))
|
||||
if (formula b2 = strip_star_not(f[i + 1]))
|
||||
{
|
||||
formula fic = fi.nth(0);
|
||||
formula fic = fi[0];
|
||||
if (fic.is(op::Concat))
|
||||
if (formula b1 = match_goto(fic, 0))
|
||||
if (b1 == b2)
|
||||
|
|
@ -730,14 +730,14 @@ namespace spot
|
|||
}
|
||||
}
|
||||
}
|
||||
visit(f.nth(i));
|
||||
visit(f[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case op::Star:
|
||||
case op::FStar:
|
||||
{
|
||||
formula c = f.nth(0);
|
||||
formula c = f[0];
|
||||
enum { Star, FStar, Goto } sugar = Star;
|
||||
unsigned default_min = 0;
|
||||
unsigned default_max = formula::unbounded();
|
||||
|
|
|
|||
|
|
@ -280,24 +280,24 @@ namespace spot
|
|||
visit(b);
|
||||
}
|
||||
for (; i < sz; ++i)
|
||||
visit(f.nth(i));
|
||||
visit(f[i]);
|
||||
if (sz > 1 && f.is_boolean())
|
||||
{
|
||||
// For Boolean nodes, connect all children in a
|
||||
// loop. This way the node can only be a cut-point
|
||||
// if it separates all children from the reset of
|
||||
// the graph (not only one).
|
||||
formula pred = f.nth(0);
|
||||
formula pred = f[0];
|
||||
for (i = 1; i < sz; ++i)
|
||||
{
|
||||
formula next = f.nth(i);
|
||||
formula next = f[i];
|
||||
// Note that we only add an edge in one
|
||||
// direction, because we are building a cycle
|
||||
// between all children anyway.
|
||||
g[pred].push_back(next);
|
||||
pred = next;
|
||||
}
|
||||
g[pred].push_back(f.nth(0));
|
||||
g[pred].push_back(f[0]);
|
||||
}
|
||||
s.pop();
|
||||
}
|
||||
|
|
@ -446,7 +446,7 @@ namespace spot
|
|||
res.reserve(sz);
|
||||
}
|
||||
for (; i < sz; ++i)
|
||||
res.push_back(visit(f.nth(i)));
|
||||
res.push_back(visit(f[i]));
|
||||
return formula::multop(f.kind(), res);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace spot
|
|||
if (!f.is(op::X))
|
||||
return f.map(rec);
|
||||
|
||||
formula c = rec(f.nth(0));
|
||||
formula c = rec(f[0]);
|
||||
|
||||
std::vector<formula> vo;
|
||||
for (auto i: aps)
|
||||
|
|
|
|||
|
|
@ -29,17 +29,17 @@ namespace spot
|
|||
formula simplify_f_g(formula p)
|
||||
{
|
||||
// 1 U p = Fp
|
||||
if (p.is(op::U) && p.nth(0).is_true())
|
||||
return formula::F(p.nth(1));
|
||||
if (p.is(op::U) && p[0].is_true())
|
||||
return formula::F(p[1]);
|
||||
// 0 R p = Gp
|
||||
if (p.is(op::R) && p.nth(0).is_false())
|
||||
return formula::G(p.nth(1));
|
||||
if (p.is(op::R) && p[0].is_false())
|
||||
return formula::G(p[1]);
|
||||
// p W 0 = Gp
|
||||
if (p.is(op::W) && p.nth(1).is_false())
|
||||
return formula::G(p.nth(0));
|
||||
if (p.is(op::W) && p[1].is_false())
|
||||
return formula::G(p[0]);
|
||||
// p M 1 = Fp
|
||||
if (p.is(op::M) && p.nth(1).is_true())
|
||||
return formula::F(p.nth(0));
|
||||
if (p.is(op::M) && p[1].is_true())
|
||||
return formula::F(p[0]);
|
||||
return p.map(simplify_f_g);
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -56,9 +56,9 @@ namespace spot
|
|||
break;
|
||||
case op::Star:
|
||||
if (!bounded)
|
||||
out = visit(f.nth(0)); // Strip the star.
|
||||
out = visit(f[0]); // Strip the star.
|
||||
else
|
||||
out = formula::Star(visit(f.nth(0)),
|
||||
out = formula::Star(visit(f[0]),
|
||||
std::max(unsigned(f.min()), 1U), f.max());
|
||||
break;
|
||||
case op::Concat:
|
||||
|
|
@ -91,7 +91,7 @@ namespace spot
|
|||
std::vector<formula> v;
|
||||
v.reserve(s);
|
||||
for (unsigned pos = 0; pos < s; ++pos)
|
||||
v.emplace_back(visit(f.nth(pos)));
|
||||
v.emplace_back(visit(f[pos]));
|
||||
out = formula::OrRat(v);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace spot
|
|||
// F f = true U f
|
||||
if (!re_f_)
|
||||
break;
|
||||
out = formula::U(formula::tt(), out.nth(0));
|
||||
out = formula::U(formula::tt(), out[0]);
|
||||
break;
|
||||
case op::G:
|
||||
// G f = false R f
|
||||
|
|
@ -130,16 +130,16 @@ namespace spot
|
|||
break;
|
||||
if (!re_r_)
|
||||
{
|
||||
out = formula::R(formula::ff(), out.nth(0));
|
||||
out = formula::R(formula::ff(), out[0]);
|
||||
break;
|
||||
}
|
||||
if (!re_w_)
|
||||
{
|
||||
out = formula::W(out.nth(0), formula::ff());
|
||||
out = formula::W(out[0], formula::ff());
|
||||
break;
|
||||
}
|
||||
{
|
||||
auto nc = formula::Not(out.nth(0));
|
||||
auto nc = formula::Not(out[0]);
|
||||
if (!re_f_)
|
||||
{
|
||||
out = formula::Not(formula::F(nc));
|
||||
|
|
@ -154,8 +154,8 @@ namespace spot
|
|||
if (!re_xor_)
|
||||
break;
|
||||
{
|
||||
auto f1 = out.nth(0);
|
||||
auto f2 = out.nth(1);
|
||||
auto f1 = out[0];
|
||||
auto f2 = out[1];
|
||||
if (!re_e_)
|
||||
{
|
||||
out = formula::Not(formula::Equiv(f1, f2));
|
||||
|
|
@ -172,15 +172,15 @@ namespace spot
|
|||
// f1 => f2 == !f1 | f2
|
||||
if (!re_i_)
|
||||
break;
|
||||
out = formula::Or({formula::Not(out.nth(0)), out.nth(1)});
|
||||
out = formula::Or({formula::Not(out[0]), out[1]});
|
||||
break;
|
||||
case op::Equiv:
|
||||
// f1 <=> f2 == (f1 & f2) | (!f1 & !f2)
|
||||
if (!re_e_)
|
||||
break;
|
||||
{
|
||||
auto f1 = out.nth(0);
|
||||
auto f2 = out.nth(1);
|
||||
auto f1 = out[0];
|
||||
auto f2 = out[1];
|
||||
auto nf1 = formula::Not(f1);
|
||||
auto nf2 = formula::Not(f2);
|
||||
auto term1 = formula::And({f1, f2});
|
||||
|
|
@ -196,8 +196,8 @@ namespace spot
|
|||
if (!re_r_)
|
||||
break;
|
||||
{
|
||||
auto f1 = out.nth(0);
|
||||
auto f2 = out.nth(1);
|
||||
auto f1 = out[0];
|
||||
auto f2 = out[1];
|
||||
auto f12 = formula::And({f1, f2});
|
||||
if (!re_w_)
|
||||
{
|
||||
|
|
@ -218,8 +218,8 @@ namespace spot
|
|||
if (!re_w_)
|
||||
break;
|
||||
{
|
||||
auto f1 = out.nth(0);
|
||||
auto f2 = out.nth(1);
|
||||
auto f1 = out[0];
|
||||
auto f2 = out[1];
|
||||
if (!re_r_)
|
||||
{
|
||||
out = formula::R(f2, formula::Or({f2, f1}));
|
||||
|
|
@ -236,8 +236,8 @@ namespace spot
|
|||
if (!re_m_)
|
||||
break;
|
||||
{
|
||||
auto f2 = out.nth(1);
|
||||
out = formula::U(f2, formula::And({f2, out.nth(0)}));
|
||||
auto f2 = out[1];
|
||||
out = formula::U(f2, formula::And({f2, out[0]}));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,13 +101,13 @@ namespace spot
|
|||
case op::AP:
|
||||
return bdd_ithvar(d->register_proposition(f, owner));
|
||||
case op::Not:
|
||||
return bdd_not(recurse(f.nth(0)));
|
||||
return bdd_not(recurse(f[0]));
|
||||
case op::Xor:
|
||||
return bdd_apply(recurse(f.nth(0)), recurse(f.nth(1)), bddop_xor);
|
||||
return bdd_apply(recurse(f[0]), recurse(f[1]), bddop_xor);
|
||||
case op::Implies:
|
||||
return bdd_apply(recurse(f.nth(0)), recurse(f.nth(1)), bddop_imp);
|
||||
return bdd_apply(recurse(f[0]), recurse(f[1]), bddop_imp);
|
||||
case op::Equiv:
|
||||
return bdd_apply(recurse(f.nth(0)), recurse(f.nth(1)), bddop_biimp);
|
||||
return bdd_apply(recurse(f[0]), recurse(f[1]), bddop_biimp);
|
||||
case op::And:
|
||||
case op::Or:
|
||||
{
|
||||
|
|
@ -120,7 +120,7 @@ namespace spot
|
|||
}
|
||||
unsigned s = f.size();
|
||||
for (unsigned n = 0; n < s; ++n)
|
||||
res = bdd_apply(res, recurse(f.nth(n)), op);
|
||||
res = bdd_apply(res, recurse(f[n]), op);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace spot
|
|||
unsigned mos = f.size();
|
||||
for (unsigned i = 0; i < mos; ++i)
|
||||
{
|
||||
ltl::formula c = f.nth(i);
|
||||
ltl::formula c = f[i];
|
||||
if (c.is_boolean())
|
||||
res.push_back(c);
|
||||
else if (oblig_ && c.is_syntactic_obligation())
|
||||
|
|
@ -91,7 +91,7 @@ namespace spot
|
|||
{
|
||||
// res || susp -> (res && G![susp]) || G[susp])
|
||||
auto r = ltl::formula::multop(op, res);
|
||||
auto gn = ltl::formula::G(ltl::formula::Not(g.nth(0)));
|
||||
auto gn = ltl::formula::G(ltl::formula::Not(g[0]));
|
||||
return ltl::formula::Or({ltl::formula::And({r, gn}), g});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace spot
|
|||
}
|
||||
case op::X:
|
||||
{
|
||||
ltl2taa_visitor v = recurse(f.nth(0));
|
||||
ltl2taa_visitor v = recurse(f[0]);
|
||||
std::vector<formula> dst;
|
||||
std::vector<formula> a;
|
||||
if (v.succ_.empty()) // Handle X(0)
|
||||
|
|
@ -104,7 +104,7 @@ namespace spot
|
|||
case op::Not:
|
||||
{
|
||||
negated_ = true;
|
||||
ltl2taa_visitor v = recurse(f.nth(0));
|
||||
ltl2taa_visitor v = recurse(f[0]);
|
||||
// Done in recurse
|
||||
succ_ = v.succ_;
|
||||
return;
|
||||
|
|
@ -143,8 +143,8 @@ namespace spot
|
|||
void
|
||||
visit_binop(formula f)
|
||||
{
|
||||
ltl2taa_visitor v1 = recurse(f.nth(0));
|
||||
ltl2taa_visitor v2 = recurse(f.nth(1));
|
||||
ltl2taa_visitor v1 = recurse(f[0]);
|
||||
ltl2taa_visitor v2 = recurse(f[1]);
|
||||
|
||||
std::vector<succ_state>::iterator i1;
|
||||
std::vector<succ_state>::iterator i2;
|
||||
|
|
@ -159,7 +159,7 @@ namespace spot
|
|||
// fall thru
|
||||
case op::W:
|
||||
if (refined_)
|
||||
contained = lcc_->contained(f.nth(0), f.nth(1));
|
||||
contained = lcc_->contained(f[0], f[1]);
|
||||
for (i1 = v1.succ_.begin(); i1 != v1.succ_.end(); ++i1)
|
||||
{
|
||||
// Refined rule
|
||||
|
|
@ -169,11 +169,11 @@ namespace spot
|
|||
|
||||
i1->Q.push_back(init_); // Add the initial state
|
||||
if (strong)
|
||||
i1->acc.push_back(f.nth(1));
|
||||
i1->acc.push_back(f[1]);
|
||||
t = res_->create_transition(init_, i1->Q);
|
||||
res_->add_condition(t, i1->condition);
|
||||
if (strong)
|
||||
res_->add_acceptance_condition(t, f.nth(1));
|
||||
res_->add_acceptance_condition(t, f[1]);
|
||||
else
|
||||
for (unsigned i = 0; i < i1->acc.size(); ++i)
|
||||
res_->add_acceptance_condition(t, i1->acc[i]);
|
||||
|
|
@ -190,7 +190,7 @@ namespace spot
|
|||
strong = true;
|
||||
case op::R: // Weak Release
|
||||
if (refined_)
|
||||
contained = lcc_->contained(f.nth(0), f.nth(1));
|
||||
contained = lcc_->contained(f[0], f[1]);
|
||||
|
||||
for (i2 = v2.succ_.begin(); i2 != v2.succ_.end(); ++i2)
|
||||
{
|
||||
|
|
@ -222,8 +222,8 @@ namespace spot
|
|||
|
||||
if (strong)
|
||||
{
|
||||
i2->acc.push_back(f.nth(0));
|
||||
res_->add_acceptance_condition(t, f.nth(0));
|
||||
i2->acc.push_back(f[0]);
|
||||
res_->add_acceptance_condition(t, f[0]);
|
||||
}
|
||||
else if (refined_)
|
||||
for (unsigned i = 0; i < i2->acc.size(); ++i)
|
||||
|
|
@ -244,7 +244,7 @@ namespace spot
|
|||
std::vector<ltl2taa_visitor> vs;
|
||||
for (unsigned n = 0, s = f.size(); n < s; ++n)
|
||||
{
|
||||
vs.push_back(recurse(f.nth(n)));
|
||||
vs.push_back(recurse(f[n]));
|
||||
if (vs[n].succ_.empty()) // Handle 0
|
||||
ok = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,28 +69,28 @@ namespace spot
|
|||
unsigned s = f.size();
|
||||
for (unsigned n = 0; n < s; ++n)
|
||||
{
|
||||
formula sub = f.nth(n);
|
||||
formula sub = f[n];
|
||||
// Recurring is set if we are under "G(...)" or "0 R (...)"
|
||||
// or (...) W 0".
|
||||
if (recurring)
|
||||
rec.insert(sub);
|
||||
if (sub.is(op::G))
|
||||
{
|
||||
implied_subformulae(sub.nth(0), rec, true);
|
||||
implied_subformulae(sub[0], rec, true);
|
||||
}
|
||||
else if (sub.is(op::W))
|
||||
{
|
||||
// f W 0 = Gf
|
||||
if (sub.nth(1).is_false())
|
||||
implied_subformulae(sub.nth(0), rec, true);
|
||||
if (sub[1].is_false())
|
||||
implied_subformulae(sub[0], rec, true);
|
||||
}
|
||||
else
|
||||
while (sub.is(op::R, op::M))
|
||||
{
|
||||
// in 'f R g' and 'f M g' always evaluate 'g'.
|
||||
formula b = sub;
|
||||
sub = b.nth(1);
|
||||
if (b.nth(0).is_false())
|
||||
sub = b[1];
|
||||
if (b[0].is_false())
|
||||
{
|
||||
assert(b.is(op::R)); // because 0 M g = 0
|
||||
// 0 R f = Gf
|
||||
|
|
@ -305,12 +305,12 @@ namespace spot
|
|||
if (f.is(op::U))
|
||||
{
|
||||
// P(a U b) = P(b)
|
||||
f = f.nth(1);
|
||||
f = f[1];
|
||||
}
|
||||
else if (f.is(op::M))
|
||||
{
|
||||
// P(a M b) = P(a & b)
|
||||
formula g = formula::And({f.nth(0), f.nth(1)});
|
||||
formula g = formula::And({f[0], f[1]});
|
||||
int num = dict->register_acceptance_variable(g, this);
|
||||
a_set &= bdd_ithvar(num);
|
||||
|
||||
|
|
@ -322,7 +322,7 @@ namespace spot
|
|||
else if (f.is(op::F))
|
||||
{
|
||||
// P(F(a)) = P(a)
|
||||
f = f.nth(0);
|
||||
f = f[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -596,7 +596,7 @@ namespace spot
|
|||
{
|
||||
// Not can only appear in front of Boolean
|
||||
// expressions.
|
||||
formula g = f.nth(0);
|
||||
formula g = f[0];
|
||||
assert(g.is_boolean());
|
||||
return (!recurse(g)) & next_to_concat();
|
||||
}
|
||||
|
|
@ -619,7 +619,7 @@ namespace spot
|
|||
unsigned min2 = (min == 0) ? 0 : (min - 1);
|
||||
unsigned max2 =
|
||||
max == formula::unbounded() ? formula::unbounded() : (max - 1);
|
||||
f = formula::bunop(o, f.nth(0), min2, max2);
|
||||
f = formula::bunop(o, f[0], min2, max2);
|
||||
|
||||
// If we have something to append, we can actually append it
|
||||
// to f. This is correct even in the case of FStar, as f
|
||||
|
|
@ -629,13 +629,13 @@ namespace spot
|
|||
|
||||
if (o == op::Star)
|
||||
{
|
||||
if (!bo.nth(0).accepts_eword())
|
||||
if (!bo[0].accepts_eword())
|
||||
{
|
||||
// f*;g -> f;f*;g | g
|
||||
//
|
||||
// If f does not accept the empty word, we can easily
|
||||
// add "f*;g" as to_concat_ when translating f.
|
||||
bdd res = recurse(bo.nth(0), f);
|
||||
bdd res = recurse(bo[0], f);
|
||||
if (min == 0)
|
||||
res |= now_to_concat();
|
||||
return res;
|
||||
|
|
@ -651,7 +651,7 @@ namespace spot
|
|||
// 1. translate f,
|
||||
// 2. append f*;g to all destinations
|
||||
// 3. add |g
|
||||
bdd res = recurse(bo.nth(0));
|
||||
bdd res = recurse(bo[0]);
|
||||
// f*;g -> f;f*;g
|
||||
minato_isop isop(res);
|
||||
bdd cube;
|
||||
|
|
@ -682,7 +682,7 @@ namespace spot
|
|||
bdd tail_bdd;
|
||||
bool tail_computed = false;
|
||||
|
||||
minato_isop isop(recurse(bo.nth(0)));
|
||||
minato_isop isop(recurse(bo[0]));
|
||||
bdd cube;
|
||||
bdd res = bddfalse;
|
||||
if (min == 0)
|
||||
|
|
@ -779,7 +779,7 @@ namespace spot
|
|||
vec conj;
|
||||
for (unsigned m = 0; m < s; ++m)
|
||||
{
|
||||
formula g = f.nth(m);
|
||||
formula g = f[m];
|
||||
if (n != m)
|
||||
g = formula::Concat({g, star});
|
||||
conj.push_back(g);
|
||||
|
|
@ -815,17 +815,17 @@ namespace spot
|
|||
unsigned s = f.size();
|
||||
v.reserve(s);
|
||||
for (unsigned n = 1; n < s; ++n)
|
||||
v.push_back(f.nth(n));
|
||||
v.push_back(f[n]);
|
||||
if (to_concat_)
|
||||
v.push_back(to_concat_);
|
||||
return recurse(f.nth(0), formula::Concat(std::move(v)));
|
||||
return recurse(f[0], formula::Concat(std::move(v)));
|
||||
}
|
||||
case op::Fusion:
|
||||
{
|
||||
assert(f.size() >= 2);
|
||||
|
||||
// the head
|
||||
bdd res = recurse(f.nth(0));
|
||||
bdd res = recurse(f[0]);
|
||||
|
||||
// the tail
|
||||
formula tail = f.all_but(0);
|
||||
|
|
@ -1129,7 +1129,7 @@ namespace spot
|
|||
{
|
||||
// r(Fy) = r(y) + a(y)X(Fy) if not recurring
|
||||
// r(Fy) = r(y) + a(y) if recurring (see comment in G)
|
||||
formula child = node.nth(0);
|
||||
formula child = node[0];
|
||||
bdd y = recurse(child);
|
||||
bdd a = bdd_ithvar(dict_.register_a_variable(child));
|
||||
if (!recurring_)
|
||||
|
|
@ -1172,13 +1172,13 @@ namespace spot
|
|||
|
||||
// r(Gy) = r(y)X(Gy)
|
||||
int x = dict_.register_next_variable(node);
|
||||
bdd y = recurse(node.nth(0), /* recurring = */ true);
|
||||
bdd y = recurse(node[0], /* recurring = */ true);
|
||||
return y & bdd_ithvar(x);
|
||||
}
|
||||
case op::Not:
|
||||
{
|
||||
// r(!y) = !r(y)
|
||||
return bdd_not(recurse(node.nth(0)));
|
||||
return bdd_not(recurse(node[0]));
|
||||
}
|
||||
case op::X:
|
||||
{
|
||||
|
|
@ -1201,7 +1201,7 @@ namespace spot
|
|||
// effect is less clear. Benchmarks show that it
|
||||
// reduces the number of states and transitions, but it
|
||||
// increases the number of non-deterministic states...
|
||||
formula y = node.nth(0);
|
||||
formula y = node[0];
|
||||
bdd res;
|
||||
if (y.is(op::And))
|
||||
{
|
||||
|
|
@ -1226,7 +1226,7 @@ namespace spot
|
|||
case op::Closure:
|
||||
{
|
||||
// rat_seen_ = true;
|
||||
formula f = node.nth(0);
|
||||
formula f = node[0];
|
||||
auto p = dict_.transdfa.succ(f);
|
||||
bdd res = bddfalse;
|
||||
auto aut = std::get<0>(p);
|
||||
|
|
@ -1267,7 +1267,7 @@ namespace spot
|
|||
has_marked_ = true;
|
||||
}
|
||||
|
||||
formula f = node.nth(0);
|
||||
formula f = node[0];
|
||||
auto p = dict_.transdfa.succ(f);
|
||||
auto aut = std::get<0>(p);
|
||||
|
||||
|
|
@ -1316,15 +1316,15 @@ namespace spot
|
|||
SPOT_UNREACHABLE();
|
||||
case op::U:
|
||||
{
|
||||
bdd f1 = recurse(node.nth(0));
|
||||
bdd f2 = recurse(node.nth(1));
|
||||
bdd f1 = recurse(node[0]);
|
||||
bdd f2 = recurse(node[1]);
|
||||
// r(f1 U f2) = r(f2) + a(f2)r(f1)X(f1 U f2) if not recurring
|
||||
// r(f1 U f2) = r(f2) + a(f2)r(f1) if recurring
|
||||
f1 &= bdd_ithvar(dict_.register_a_variable(node.nth(1)));
|
||||
f1 &= bdd_ithvar(dict_.register_a_variable(node[1]));
|
||||
if (!recurring_)
|
||||
f1 &= bdd_ithvar(dict_.register_next_variable(node));
|
||||
if (dict_.unambiguous)
|
||||
f1 &= neg_of(node.nth(1));
|
||||
f1 &= neg_of(node[1]);
|
||||
return f2 | f1;
|
||||
}
|
||||
case op::W:
|
||||
|
|
@ -1333,36 +1333,36 @@ namespace spot
|
|||
// r(f1 W f2) = r(f2) + r(f1) if recurring
|
||||
//
|
||||
// also f1 W 0 = G(f1), so we can enable recurring on f1
|
||||
bdd f1 = recurse(node.nth(0), node.nth(1).is_false());
|
||||
bdd f2 = recurse(node.nth(1));
|
||||
bdd f1 = recurse(node[0], node[1].is_false());
|
||||
bdd f2 = recurse(node[1]);
|
||||
if (!recurring_)
|
||||
f1 &= bdd_ithvar(dict_.register_next_variable(node));
|
||||
if (dict_.unambiguous)
|
||||
f1 &= neg_of(node.nth(1));
|
||||
f1 &= neg_of(node[1]);
|
||||
return f2 | f1;
|
||||
}
|
||||
case op::R:
|
||||
{
|
||||
// r(f2) is in factor, so we can propagate the recurring_ flag.
|
||||
// if f1=false, we can also turn it on (0 R f = Gf).
|
||||
bdd res = recurse(node.nth(1),
|
||||
recurring_ || node.nth(0).is_false());
|
||||
bdd res = recurse(node[1],
|
||||
recurring_ || node[0].is_false());
|
||||
// r(f1 R f2) = r(f2)(r(f1) + X(f1 R f2)) if not recurring
|
||||
// r(f1 R f2) = r(f2) if recurring
|
||||
if (recurring_ && !dict_.unambiguous)
|
||||
return res;
|
||||
bdd f1 = recurse(node.nth(0));
|
||||
bdd f1 = recurse(node[0]);
|
||||
bdd f2 = bddtrue;
|
||||
if (!recurring_)
|
||||
f2 = bdd_ithvar(dict_.register_next_variable(node));
|
||||
if (dict_.unambiguous)
|
||||
f2 &= neg_of(node.nth(0));
|
||||
f2 &= neg_of(node[0]);
|
||||
return res & (f1 | f2);
|
||||
}
|
||||
case op::M:
|
||||
{
|
||||
bdd res = recurse(node.nth(1), recurring_);
|
||||
bdd f1 = recurse(node.nth(0));
|
||||
bdd res = recurse(node[1], recurring_);
|
||||
bdd f1 = recurse(node[0]);
|
||||
// r(f1 M f2) = r(f2)(r(f1) + a(f1&f2)X(f1 M f2)) if not recurring
|
||||
// r(f1 M f2) = r(f2)(r(f1) + a(f1&f2)) if recurring
|
||||
//
|
||||
|
|
@ -1383,7 +1383,7 @@ namespace spot
|
|||
if (!recurring_)
|
||||
a &= bdd_ithvar(dict_.register_next_variable(node));
|
||||
if (dict_.unambiguous)
|
||||
a &= neg_of(node.nth(0));
|
||||
a &= neg_of(node[0]);
|
||||
return res & (f1 | a);
|
||||
}
|
||||
case op::EConcatMarked:
|
||||
|
|
@ -1394,8 +1394,8 @@ namespace spot
|
|||
{
|
||||
// Recognize f2 on transitions going to destinations
|
||||
// that accept the empty word.
|
||||
bdd f2 = recurse(node.nth(1));
|
||||
bdd f1 = translate_ratexp(node.nth(0), dict_);
|
||||
bdd f2 = recurse(node[1]);
|
||||
bdd f1 = translate_ratexp(node[0], dict_);
|
||||
bdd res = bddfalse;
|
||||
|
||||
if (mark_all_)
|
||||
|
|
@ -1417,7 +1417,7 @@ namespace spot
|
|||
dict_.bdd_to_sere(bdd_exist(f1 & label,
|
||||
dict_.var_set));
|
||||
|
||||
formula dest2 = formula::binop(o, dest, node.nth(1));
|
||||
formula dest2 = formula::binop(o, dest, node[1]);
|
||||
bool unamb = dict_.unambiguous;
|
||||
if (!dest2.is(op::False))
|
||||
{
|
||||
|
|
@ -1426,13 +1426,13 @@ namespace spot
|
|||
// deterministic automaton at no additional
|
||||
// cost. You can test this on
|
||||
// G({{1;1}*}<>->a)
|
||||
if (node.nth(1).is_boolean())
|
||||
if (node[1].is_boolean())
|
||||
unamb = true;
|
||||
|
||||
bdd toadd = label &
|
||||
bdd_ithvar(dict_.register_next_variable(dest2));
|
||||
if (dest.accepts_eword() && unamb)
|
||||
toadd &= neg_of(node.nth(1));
|
||||
toadd &= neg_of(node[1]);
|
||||
res |= toadd;
|
||||
}
|
||||
if (dest.accepts_eword())
|
||||
|
|
@ -1462,7 +1462,7 @@ namespace spot
|
|||
}
|
||||
else
|
||||
{
|
||||
formula dest2 = formula::binop(o, dest, node.nth(1));
|
||||
formula dest2 = formula::binop(o, dest, node[1]);
|
||||
if (!dest2.is(op::False))
|
||||
res |= label &
|
||||
bdd_ithvar(dict_.register_next_variable(dest2));
|
||||
|
|
@ -1483,8 +1483,8 @@ namespace spot
|
|||
// interpretation of first() as a universal automaton,
|
||||
// and using implication to encode it) was explained
|
||||
// to me (adl) by Felix Klaedtke.
|
||||
bdd f2 = recurse(node.nth(1));
|
||||
bdd f1 = translate_ratexp(node.nth(0), dict_);
|
||||
bdd f2 = recurse(node[1]);
|
||||
bdd f1 = translate_ratexp(node[0], dict_);
|
||||
|
||||
if (exprop_)
|
||||
{
|
||||
|
|
@ -1500,7 +1500,7 @@ namespace spot
|
|||
formula dest =
|
||||
dict_.bdd_to_sere(bdd_exist(f1 & label, dict_.var_set));
|
||||
|
||||
formula dest2 = formula::binop(o, dest, node.nth(1));
|
||||
formula dest2 = formula::binop(o, dest, node[1]);
|
||||
|
||||
bdd udest =
|
||||
bdd_ithvar(dict_.register_next_variable(dest2));
|
||||
|
|
@ -1526,7 +1526,7 @@ namespace spot
|
|||
bdd label = bdd_exist(cube, dict_.next_set);
|
||||
bdd dest_bdd = bdd_existcomp(cube, dict_.next_set);
|
||||
formula dest = dict_.conj_bdd_to_sere(dest_bdd);
|
||||
formula dest2 = formula::binop(o, dest, node.nth(1));
|
||||
formula dest2 = formula::binop(o, dest, node[1]);
|
||||
|
||||
bdd udest =
|
||||
bdd_ithvar(dict_.register_next_variable(dest2));
|
||||
|
|
@ -1930,10 +1930,10 @@ namespace spot
|
|||
{
|
||||
if (f.is(op::F))
|
||||
all_promises &=
|
||||
bdd_ithvar(d.register_a_variable(f.nth(0)));
|
||||
bdd_ithvar(d.register_a_variable(f[0]));
|
||||
else if (f.is(op::U))
|
||||
all_promises &=
|
||||
bdd_ithvar(d.register_a_variable(f.nth(1)));
|
||||
bdd_ithvar(d.register_a_variable(f[1]));
|
||||
else if (f.is(op::M))
|
||||
all_promises &=
|
||||
bdd_ithvar(d.register_a_variable(f));
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ namespace std {
|
|||
int __cmp__(spot::ltl::formula b) { return self->id() - b.id(); }
|
||||
size_t __hash__() { return self->id(); }
|
||||
unsigned __len__() { return self->size(); }
|
||||
formula __getitem__(unsigned pos) { return self->nth(pos); }
|
||||
formula __getitem__(unsigned pos) { return (*self)[pos]; }
|
||||
|
||||
std::string __repr__() { return spot::ltl::str_psl(*self); }
|
||||
std::string _repr_latex_()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue