Explicit automata can now have arbitrary logic formula on their
arcs. ltl2tgba_fm benefits from this and join multiple arcs with the same destination and acceptance conditions. * src/tgba/formula2bdd.cc, src/tgba/formula2bdd.hh: New files. * src/tgba/Makefile.am (tgba_HEADERS, libtgba_la_SOURCES): Add them. * src/tgba/bddprint.cc, src/tgba/bddprint.hh (bdd_pring_formula, bdd_format_formula): New functions. * src/tgba/tgbaexplicit.hh (tgba_explicit::get_condition, tgba_explicit::add_condition, tgba_explicit::add_neg_condition, tgba_explicit::declare_accepting_condition, tgba_explicit::has_accepting_condition, tgba_explicit::get_accepting_condition, tgba_explicit::add_accepting_condition): Take a const formula*. * src/tgba/tgbaexplicit.cc (tgba_explicit::add_condition): Rewrite using formula_to_bdd. * src/tgbaalgos/dotty.cc (dotty_bfs::process_link): Use bdd_print_formula to display conditions. * src/tgbaalgos/save.cc (save_bfs::process_state): Likewise. * src/tgbaalgos/ltl2tgba_fm.cc (translate_dict::bdd_to_formula): New function. (translate_dict::conj_bdd_to_atomic_props): Remove. (ltl_to_tgba_fm): Factor successors on accepting conditions and destinations, not conditions. Use bdd_to_formula to translate the conditions. * src/tgbaparse/tgbaparse.yy: Expect conditions as a formula in a string, call the LTL parser for this. * src/tgbaparse/tgbascan.ll: Process " and \ escapes in strings. * src/tgbatest/emptchke.test, src/tgbatest/explicit.test, src/tgbatest/explpro2.test, src/tgbatest/explpro3.test, src/tgbatest/explprod.test, src/tgbatest/mixprod.test, src/tgbatest/readsave.test, src/tgbatest/tgbaread.test, src/tgbatest/tripprod.test: Adjust to new syntax for explicit automata.
This commit is contained in:
parent
3126e49b28
commit
20289e4e7f
22 changed files with 465 additions and 116 deletions
|
|
@ -60,8 +60,8 @@ namespace spot
|
|||
process_link(int in, int out, const tgba_succ_iterator* si)
|
||||
{
|
||||
os_ << " " << in << " -> " << out << " [label=\"";
|
||||
bdd_print_set(os_, automata_->get_dict(),
|
||||
si->current_condition()) << "\\n";
|
||||
bdd_print_formula(os_, automata_->get_dict(),
|
||||
si->current_condition()) << "\\n";
|
||||
bdd_print_set(os_, automata_->get_dict(),
|
||||
si->current_accepting_conditions()) << "\"]" << std::endl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ namespace spot
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(bdd_low(b) == bddfalse);
|
||||
b = high;
|
||||
}
|
||||
assert(b != bddfalse);
|
||||
|
|
@ -216,30 +217,21 @@ namespace spot
|
|||
return ltl::multop::instance(ltl::multop::And, v);
|
||||
}
|
||||
|
||||
void
|
||||
conj_bdd_to_atomic_props(tgba_explicit* a, bdd b,
|
||||
tgba_explicit::transition* t)
|
||||
const formula*
|
||||
bdd_to_formula(bdd f)
|
||||
{
|
||||
assert(b != bddfalse);
|
||||
while (b != bddtrue)
|
||||
{
|
||||
int var = bdd_var(b);
|
||||
ltl::formula* ap = var_to_formula(var);
|
||||
bdd high = bdd_high(b);
|
||||
if (high == bddfalse)
|
||||
{
|
||||
a->add_neg_condition(t, ap);
|
||||
b = bdd_low(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
a->add_condition(t, ap);
|
||||
b = high;
|
||||
}
|
||||
assert(b != bddfalse);
|
||||
}
|
||||
}
|
||||
if (f == bddfalse)
|
||||
return ltl::constant::false_instance();
|
||||
|
||||
multop::vec* v = new multop::vec;
|
||||
|
||||
minato_isop isop(f);
|
||||
bdd cube;
|
||||
while ((cube = isop.next()) != bddfalse)
|
||||
v->push_back(conj_bdd_to_formula(cube));
|
||||
|
||||
return multop::instance(multop::Or, v);
|
||||
}
|
||||
|
||||
void
|
||||
conj_bdd_to_acc(tgba_explicit* a, bdd b, tgba_explicit::transition* t)
|
||||
|
|
@ -462,7 +454,7 @@ namespace spot
|
|||
|
||||
std::string now = to_string(f);
|
||||
|
||||
minato_isop isop(res);
|
||||
minato_isop isop(res, d.next_set & d.a_set);
|
||||
bdd cube;
|
||||
while ((cube = isop.next()) != bddfalse)
|
||||
{
|
||||
|
|
@ -473,7 +465,8 @@ namespace spot
|
|||
|
||||
tgba_explicit::transition* t = a->create_transition(now, next);
|
||||
|
||||
d.conj_bdd_to_atomic_props(a, bdd_existcomp(cube, d.var_set), t);
|
||||
a->add_condition(t,
|
||||
d.bdd_to_formula(bdd_existcomp(cube, d.var_set)));
|
||||
d.conj_bdd_to_acc(a, bdd_existcomp(cube, d.a_set), t);
|
||||
|
||||
if (formulae_seen.find(dest) == formulae_seen.end())
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ namespace spot
|
|||
{
|
||||
state* dest = si->current_state();
|
||||
os_ << "\"" << cur << "\", \""
|
||||
<< automata_->format_state(dest) << "\", ";
|
||||
bdd_print_sat(os_, d, si->current_condition()) << ",";
|
||||
<< automata_->format_state(dest) << "\", \"";
|
||||
bdd_print_formula(os_, d, si->current_condition()) << "\",";
|
||||
bdd_print_acc(os_, d, si->current_accepting_conditions());
|
||||
os_ << ";" << std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue