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
|
|
@ -23,6 +23,7 @@
|
|||
#include "ltlast/constant.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
#include "tgbaexplicit.hh"
|
||||
#include "tgba/formula2bdd.hh"
|
||||
#include <cassert>
|
||||
|
||||
namespace spot
|
||||
|
|
@ -171,22 +172,23 @@ namespace spot
|
|||
}
|
||||
|
||||
bdd
|
||||
tgba_explicit::get_condition(ltl::formula* f)
|
||||
tgba_explicit::get_condition(const ltl::formula* f)
|
||||
{
|
||||
assert(dynamic_cast<ltl::atomic_prop*>(f));
|
||||
assert(dynamic_cast<const ltl::atomic_prop*>(f));
|
||||
int v = dict_->register_proposition(f, this);
|
||||
ltl::destroy(f);
|
||||
return bdd_ithvar(v);
|
||||
}
|
||||
|
||||
void
|
||||
tgba_explicit::add_condition(transition* t, ltl::formula* f)
|
||||
tgba_explicit::add_condition(transition* t, const ltl::formula* f)
|
||||
{
|
||||
t->condition &= get_condition(f);
|
||||
t->condition &= formula_to_bdd(f, dict_, this);
|
||||
ltl::destroy(f);
|
||||
}
|
||||
|
||||
void
|
||||
tgba_explicit::add_neg_condition(transition* t, ltl::formula* f)
|
||||
tgba_explicit::add_neg_condition(transition* t, const ltl::formula* f)
|
||||
{
|
||||
t->condition -= get_condition(f);
|
||||
}
|
||||
|
|
@ -199,7 +201,7 @@ namespace spot
|
|||
}
|
||||
|
||||
void
|
||||
tgba_explicit::declare_accepting_condition(ltl::formula* f)
|
||||
tgba_explicit::declare_accepting_condition(const ltl::formula* f)
|
||||
{
|
||||
int v = dict_->register_accepting_variable(f, this);
|
||||
ltl::destroy(f);
|
||||
|
|
@ -234,15 +236,15 @@ namespace spot
|
|||
}
|
||||
|
||||
bool
|
||||
tgba_explicit::has_accepting_condition(ltl::formula* f) const
|
||||
tgba_explicit::has_accepting_condition(const ltl::formula* f) const
|
||||
{
|
||||
return dict_->is_registered_accepting_variable(f, this);
|
||||
}
|
||||
|
||||
bdd
|
||||
tgba_explicit::get_accepting_condition(ltl::formula* f)
|
||||
tgba_explicit::get_accepting_condition(const ltl::formula* f)
|
||||
{
|
||||
ltl::constant* c = dynamic_cast<ltl::constant*>(f);
|
||||
const ltl::constant* c = dynamic_cast<const ltl::constant*>(f);
|
||||
if (c)
|
||||
{
|
||||
switch (c->val())
|
||||
|
|
@ -267,7 +269,7 @@ namespace spot
|
|||
}
|
||||
|
||||
void
|
||||
tgba_explicit::add_accepting_condition(transition* t, ltl::formula* f)
|
||||
tgba_explicit::add_accepting_condition(transition* t, const ltl::formula* f)
|
||||
{
|
||||
bdd c = get_accepting_condition(f);
|
||||
t->accepting_conditions |= c;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue