Ease atomic proposition manipulation for twa.
* doc/org/tut22.org, src/ltlvisit/apcollect.cc, src/ltlvisit/apcollect.hh, src/parseaut/parseaut.yy, src/tests/ikwiad.cc, src/tests/tgbagraph.test, src/tests/twagraph.cc, src/twa/twa.cc, src/twa/twa.hh, src/twaalgos/ltl2tgba_fm.cc, src/twaalgos/randomgraph.cc, src/twaalgos/relabel.cc, src/twaalgos/stutter.cc, src/twaalgos/stutter.hh: here.
This commit is contained in:
parent
953181bbb7
commit
11b9ada2bb
14 changed files with 104 additions and 65 deletions
|
|
@ -139,11 +139,13 @@ namespace spot
|
|||
{
|
||||
public:
|
||||
|
||||
translate_dict(const bdd_dict_ptr& dict,
|
||||
translate_dict(twa_graph_ptr& a,
|
||||
const bdd_dict_ptr& dict,
|
||||
acc_cond& acc,
|
||||
ltl_simplifier* ls, bool exprop,
|
||||
bool single_acc, bool unambiguous)
|
||||
: dict(dict),
|
||||
: a_(a),
|
||||
dict(dict),
|
||||
ls(ls),
|
||||
a_set(bddtrue),
|
||||
var_set(bddtrue),
|
||||
|
|
@ -168,6 +170,7 @@ namespace spot
|
|||
j++->first.f->destroy();
|
||||
}
|
||||
|
||||
twa_graph_ptr& a_;
|
||||
bdd_dict_ptr dict;
|
||||
ltl_simplifier* ls;
|
||||
mark_tools mt;
|
||||
|
|
@ -418,6 +421,26 @@ namespace spot
|
|||
{
|
||||
bdd res = ls->as_bdd(f);
|
||||
var_set &= bdd_support(res);
|
||||
|
||||
bdd all = var_set;
|
||||
while (all != bddfalse)
|
||||
{
|
||||
bdd one = bdd_satone(all);
|
||||
all -= one;
|
||||
while (one != bddtrue)
|
||||
{
|
||||
int v = bdd_var(one);
|
||||
auto *f = var_to_formula(v);
|
||||
a_->register_ap(f);
|
||||
f->destroy();
|
||||
if (bdd_high(one) == bddfalse)
|
||||
one = bdd_low(one);
|
||||
else
|
||||
one = bdd_high(one);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -2301,7 +2324,8 @@ namespace spot
|
|||
twa_graph_ptr a = make_twa_graph(dict);
|
||||
auto namer = a->create_namer<const formula*>();
|
||||
|
||||
translate_dict d(dict, a->acc(), s, exprop, f->is_syntactic_persistence(),
|
||||
translate_dict d(a, dict, a->acc(), s, exprop,
|
||||
f->is_syntactic_persistence(),
|
||||
unambiguous);
|
||||
|
||||
// Compute the set of all promises that can possibly occur
|
||||
|
|
@ -2568,10 +2592,7 @@ namespace spot
|
|||
// Set the following to true to preserve state names.
|
||||
a->release_formula_namer(namer, false);
|
||||
|
||||
dict->register_propositions(fc.used_vars(), a);
|
||||
|
||||
auto& acc = a->acc();
|
||||
|
||||
unsigned ns = a->num_states();
|
||||
for (unsigned s = 0; s < ns; ++s)
|
||||
for (auto& t: a->out(s))
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ namespace spot
|
|||
|
||||
int pi = 0;
|
||||
for (auto i: *ap)
|
||||
props[pi++] = dict->register_proposition(i, res);
|
||||
props[pi++] = res->register_ap(i);
|
||||
|
||||
res->set_generalized_buchi(n_accs);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ namespace spot
|
|||
vars.reserve(relmap->size());
|
||||
for (auto& p: *relmap)
|
||||
{
|
||||
int oldv = d->register_proposition(p.first, aut);
|
||||
int newv = d->register_proposition(p.second, aut);
|
||||
int oldv = aut->register_ap(p.first);
|
||||
int newv = aut->register_ap(p.second);
|
||||
bdd_setpair(pairs, oldv, newv);
|
||||
vars.push_back(oldv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -281,34 +281,18 @@ namespace spot
|
|||
|
||||
// Queue of state to be processed.
|
||||
typedef std::deque<stutter_state> queue_t;
|
||||
|
||||
static bdd
|
||||
get_all_ap(const const_twa_graph_ptr& a)
|
||||
{
|
||||
bdd res = bddtrue;
|
||||
for (auto& i: a->edges())
|
||||
res &= bdd_support(i.cond);
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
twa_graph_ptr
|
||||
sl(const const_twa_graph_ptr& a, const ltl::formula* f)
|
||||
sl(const twa_graph_ptr& a)
|
||||
{
|
||||
bdd aps = f
|
||||
? atomic_prop_collect_as_bdd(f, a)
|
||||
: get_all_ap(a);
|
||||
return sl(a, aps);
|
||||
return sl(a, a->ap_var());
|
||||
}
|
||||
|
||||
twa_graph_ptr
|
||||
sl2(const const_twa_graph_ptr& a, const ltl::formula* f)
|
||||
sl2(const twa_graph_ptr& a)
|
||||
{
|
||||
bdd aps = f
|
||||
? atomic_prop_collect_as_bdd(f, a)
|
||||
: get_all_ap(a);
|
||||
return sl2(a, aps);
|
||||
return sl2(a, a->ap_var());
|
||||
}
|
||||
|
||||
twa_graph_ptr
|
||||
|
|
@ -379,7 +363,7 @@ namespace spot
|
|||
sl2(twa_graph_ptr&& a, bdd atomic_propositions)
|
||||
{
|
||||
if (atomic_propositions == bddfalse)
|
||||
atomic_propositions = get_all_ap(a);
|
||||
atomic_propositions = a->ap_var();
|
||||
unsigned num_states = a->num_states();
|
||||
unsigned num_edges = a->num_edges();
|
||||
std::vector<bdd> selfloops(num_states, bddfalse);
|
||||
|
|
@ -666,7 +650,7 @@ namespace spot
|
|||
}
|
||||
|
||||
is_stut = is_stutter_invariant(make_twa_graph(aut, twa::prop_set::all()),
|
||||
std::move(neg), get_all_ap(aut));
|
||||
std::move(neg), aut->ap_var());
|
||||
aut->prop_stutter_invariant(is_stut);
|
||||
aut->prop_stutter_sensitive(!is_stut);
|
||||
return is_stut;
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@
|
|||
namespace spot
|
||||
{
|
||||
SPOT_API twa_graph_ptr
|
||||
sl(const const_twa_graph_ptr&, const ltl::formula* = nullptr);
|
||||
sl(const twa_graph_ptr&);
|
||||
|
||||
SPOT_API twa_graph_ptr
|
||||
sl(const const_twa_graph_ptr&, bdd);
|
||||
|
||||
SPOT_API twa_graph_ptr
|
||||
sl2(const const_twa_graph_ptr&, const ltl::formula* = nullptr);
|
||||
sl2(const twa_graph_ptr&);
|
||||
|
||||
SPOT_API twa_graph_ptr
|
||||
sl2(const const_twa_graph_ptr&, bdd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue