formula: rename the constants for consistency

False/True are problematic in Python, and I don't like that the
enum is op::False but the constructor formula::ff().  So let's
just use ff and tt everywhere, and also eword instead of EmptyWord.

* src/ltlast/formula.hh (False, True, EmptyWord, AP, is_false, is_true):
Rename to...
(ff, tt, eword, ap, is_ff, is_tt): ... these.
* iface/ltsmin/ltsmin.cc, src/ltlast/formula.cc,
src/ltlvisit/apcollect.cc, src/ltlvisit/dot.cc, src/ltlvisit/mark.cc,
src/ltlvisit/mutation.cc, src/ltlvisit/print.cc,
src/ltlvisit/relabel.cc, src/ltlvisit/simpfg.cc,
src/ltlvisit/simplify.cc, src/ltlvisit/snf.cc, src/ltlvisit/unabbrev.cc,
src/twa/acc.cc, src/twa/acc.hh, src/twa/formula2bdd.cc,
src/twaalgos/gtec/gtec.cc, src/twaalgos/hoa.cc, src/twaalgos/ltl2taa.cc,
src/twaalgos/ltl2tgba_fm.cc, src/twaalgos/neverclaim.cc,
src/twaalgos/product.cc, src/twaalgos/remfin.cc, src/twaalgos/safety.cc,
src/tests/parseerr.test, src/tests/utf8.test, wrap/python/spot.py:
Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2015-09-27 22:47:17 +02:00
parent fad05632a2
commit 8b4ec5ded0
27 changed files with 211 additions and 211 deletions

View file

@ -133,7 +133,7 @@ namespace spot
{
{
auto acc = ecs_->aut->acc();
if (acc.get_acceptance().is_false())
if (acc.get_acceptance().is_ff())
return nullptr;
if (acc.uses_fin_acceptance())
throw std::runtime_error
@ -395,7 +395,7 @@ namespace spot
{
{
auto acc = ecs_->aut->acc();
if (acc.get_acceptance().is_false())
if (acc.get_acceptance().is_ff())
return nullptr;
if (acc.uses_fin_acceptance())
throw std::runtime_error

View file

@ -299,7 +299,7 @@ namespace spot
acc_cond::acc_code acc_c = aut->acc().get_acceptance();
if (aut->acc().is_generalized_buchi())
{
if (aut->acc().is_true())
if (aut->acc().is_tt())
os << "acc-name: all";
else if (aut->acc().is_buchi())
os << "acc-name: Buchi";
@ -309,7 +309,7 @@ namespace spot
}
else if (aut->acc().is_generalized_co_buchi())
{
if (aut->acc().is_false())
if (aut->acc().is_ff())
os << "acc-name: none";
else if (aut->acc().is_co_buchi())
os << "acc-name: co-Buchi";

View file

@ -60,9 +60,9 @@ namespace spot
init_ = f;
switch (f.kind())
{
case op::False:
case op::ff:
return;
case op::True:
case op::tt:
{
std::vector<formula> empty;
res_->create_transition(init_, empty);
@ -70,9 +70,9 @@ namespace spot
succ_.push_back(ss);
return;
}
case op::EmptyWord:
case op::eword:
SPOT_UNIMPLEMENTED();
case op::AP:
case op::ap:
{
if (negated_)
f = formula::Not(f);

View file

@ -81,7 +81,7 @@ namespace spot
else if (sub.is(op::W))
{
// f W 0 = Gf
if (sub[1].is_false())
if (sub[1].is_ff())
implied_subformulae(sub[0], rec, true);
}
else
@ -90,7 +90,7 @@ namespace spot
// in 'f R g' and 'f M g' always evaluate 'g'.
formula b = sub;
sub = b[1];
if (b[0].is_false())
if (b[0].is_ff())
{
assert(b.is(op::R)); // because 0 M g = 0
// 0 R f = Gf
@ -539,7 +539,7 @@ namespace spot
bdd now_to_concat()
{
if (to_concat_ && !to_concat_.is(op::EmptyWord))
if (to_concat_ && !to_concat_.is(op::eword))
return recurse(to_concat_);
return bddfalse;
}
@ -557,14 +557,14 @@ 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);
if (dest.is(op::EmptyWord))
if (dest.is(op::eword))
{
out |= label & next_to_concat();
}
else
{
formula dest2 = formula::Concat({dest, to_concat_});
if (!dest2.is(op::False))
if (!dest2.is_ff())
out |=
label & bdd_ithvar(dict_.register_next_variable(dest2));
}
@ -576,13 +576,13 @@ namespace spot
{
switch (op o = f.kind())
{
case op::False:
case op::ff:
return bddfalse;
case op::True:
case op::tt:
return next_to_concat();
case op::EmptyWord:
case op::eword:
return now_to_concat();
case op::AP:
case op::ap:
return (bdd_ithvar(dict_.register_proposition(f))
& next_to_concat());
case op::F:
@ -661,7 +661,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);
if (dest.is(op::EmptyWord))
if (dest.is(op::eword))
{
res |= label &
bdd_ithvar(dict_.register_next_variable(f));
@ -669,7 +669,7 @@ namespace spot
else
{
formula dest2 = formula::Concat({dest, f});
if (!dest2.is(op::False))
if (!dest2.is_ff())
res |= label & bdd_ithvar
(dict_.register_next_variable(dest2));
}
@ -711,10 +711,10 @@ namespace spot
// If the destination is not 0 or [*0], it means it
// can have successors. Fusion the tail.
if (!dest.is(op::False, op::EmptyWord))
if (!dest.is(op::ff, op::eword))
{
formula dest2 = formula::Fusion({dest, f});
if (!dest2.is(op::False))
if (!dest2.is_ff())
res |= label &
bdd_ithvar(dict_.register_next_variable(dest2));
}
@ -858,12 +858,12 @@ namespace spot
// If the destination is not 0 or [*0], it means it
// can have successors. Fusion the tail and append
// anything to concatenate.
if (!dest.is(op::False, op::EmptyWord))
if (!dest.is(op::ff, op::eword))
{
formula dest2 = formula::Fusion({dest, tail});
if (to_concat_)
dest2 = formula::Concat({dest2, to_concat_});
if (!dest2.is(op::False))
if (!dest2.is_ff())
res |= label
& bdd_ithvar(dict_.register_next_variable(dest2));
}
@ -1117,13 +1117,13 @@ namespace spot
{
switch (op o = node.kind())
{
case op::False:
case op::ff:
return bddfalse;
case op::True:
case op::tt:
return bddtrue;
case op::EmptyWord:
case op::eword:
SPOT_UNIMPLEMENTED();
case op::AP:
case op::ap:
return bdd_ithvar(dict_.register_proposition(node));
case op::F:
{
@ -1248,7 +1248,7 @@ namespace spot
else
{
formula dest2 = formula::unop(o, dest);
if (dest2.is_false())
if (dest2.is_ff())
continue;
res |=
label & bdd_ithvar(dict_.register_next_variable(dest2));
@ -1290,7 +1290,7 @@ namespace spot
if (!dest.accepts_eword())
{
formula dest2 = formula::unop(o, dest);
if (dest2.is_false())
if (dest2.is_ff())
continue;
res |= label
& bdd_ithvar(dict_.register_next_variable(dest2));
@ -1333,7 +1333,7 @@ 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[0], node[1].is_false());
bdd f1 = recurse(node[0], node[1].is_ff());
bdd f2 = recurse(node[1]);
if (!recurring_)
f1 &= bdd_ithvar(dict_.register_next_variable(node));
@ -1346,7 +1346,7 @@ namespace spot
// 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[1],
recurring_ || node[0].is_false());
recurring_ || node[0].is_ff());
// 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)
@ -1419,7 +1419,7 @@ namespace spot
formula dest2 = formula::binop(o, dest, node[1]);
bool unamb = dict_.unambiguous;
if (!dest2.is(op::False))
if (!dest2.is_ff())
{
// If the rhs is Boolean, the
// unambiguous code will produce a more
@ -1456,14 +1456,14 @@ namespace spot
bdd dest_bdd = bdd_existcomp(cube, dict_.next_set);
formula dest = dict_.conj_bdd_to_sere(dest_bdd);
if (dest.is(op::EmptyWord))
if (dest.is(op::eword))
{
res |= label & f2;
}
else
{
formula dest2 = formula::binop(o, dest, node[1]);
if (!dest2.is(op::False))
if (!dest2.is_ff())
res |= label &
bdd_ithvar(dict_.register_next_variable(dest2));
if (dest.accepts_eword())
@ -2080,7 +2080,7 @@ namespace spot
{
dest = simplifier->simplify(dest);
// Ignore the arc if the destination reduces to false.
if (dest.is_false())
if (dest.is_ff())
continue;
}
@ -2131,11 +2131,11 @@ namespace spot
// f ----> 1
//
// because there is no point in looping on f if we can go to 1.
if (dests.front().dest.is_true())
if (dests.front().dest.is_tt())
{
dest_map::iterator i = dests.begin();
bdd c = bddfalse;
while (i != dests.end() && i->dest.is_true())
while (i != dests.end() && i->dest.is_tt())
c |= i++->cond;
for (; i != dests.end(); ++i)
i->cond -= c;
@ -2158,7 +2158,7 @@ namespace spot
// When translating LTL for an event-based logic
// with unobservable events, the 1 state should
// accept all events, even unobservable events.
if (unobs && t.dest.is_true() && now.is_true())
if (unobs && t.dest.is_tt() && now.is_tt())
t.cond = all_events;
// Will this be a new state?

View file

@ -205,7 +205,7 @@ namespace spot
print_never_claim(std::ostream& os, const const_twa_ptr& g,
const char* options)
{
if (!(g->acc().is_buchi() || g->acc().is_true()))
if (!(g->acc().is_buchi() || g->acc().is_tt()))
throw std::runtime_error
("Never claim output only supports Büchi acceptance");
never_claim_output d(os, options);

View file

@ -81,7 +81,7 @@ namespace spot
};
res->set_init_state(new_state(left_state, right_state));
if (right_acc.is_false())
if (right_acc.is_ff())
// Do not bother doing any work if the resulting acceptance is
// false.
return res;

View file

@ -311,7 +311,7 @@ namespace spot
auto code = aut->get_acceptance();
if (code.is_true())
if (code.is_tt())
return nullptr;
acc_cond::mark_t inf_pairs = 0U;
@ -586,7 +586,7 @@ namespace spot
auto c = acc.inf(m);
for (unsigned i = 0; i < sz; ++i)
{
if (!code[i].is_true())
if (!code[i].is_tt())
continue;
add[i] = m;
code[i].append_and(c);

View file

@ -65,7 +65,7 @@ namespace spot
bool is_safety_mwdba(const const_twa_graph_ptr& aut)
{
if (!(aut->acc().is_buchi() || aut->acc().is_true()))
if (!(aut->acc().is_buchi() || aut->acc().is_tt()))
throw std::runtime_error
("is_safety_mwdba() should be called on a Buchi automaton");