print_hoa: output all registered APs
Also introduce twa::unregister_ap() and twa_graph::remove_unused_ap() so that the methods where this behavior is expected can be fixed. And fix ltsmin::kripke() which did not register APs. Part of #170. * spot/twaalgos/hoa.cc: Use apvars() to print all registerd APs. Throw an exception when printing automata using unregistered APs. * spot/ltsmin/ltsmin.cc: Call register_ap(). * spot/twa/twa.cc, spot/twa/twa.hh, spot/twa/twagraph.cc, spot/twa/twagraph.hh (twa::unregister_ap, twa_graph::remove_unused_ap): New methods. * spot/tl/exclusive.cc, spot/twaalgos/postproc.cc, spot/twaalgos/remprop.cc, spot/twaalgos/relabel.cc: Use them. * tests/core/maskacc.test, tests/core/maskkeep.test, tests/core/strength.test: Adjust expected results. * NEWS: Mention those changes.
This commit is contained in:
parent
9afa98a1dd
commit
1c2c914d7e
14 changed files with 124 additions and 49 deletions
|
|
@ -67,7 +67,7 @@ namespace spot
|
|||
check_det_and_comp(aut);
|
||||
use_implicit_labels = implicit && is_deterministic && is_complete;
|
||||
use_state_labels &= state_labels;
|
||||
number_all_ap();
|
||||
number_all_ap(aut);
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
|
|
@ -164,12 +164,22 @@ namespace spot
|
|||
assert(state_acc || aut->prop_state_acc() != true);
|
||||
}
|
||||
|
||||
void number_all_ap()
|
||||
void number_all_ap(const const_twa_graph_ptr& aut)
|
||||
{
|
||||
// Make sure that the automaton uses only atomic propositions
|
||||
// that have been registered via twa::register_ap() or some
|
||||
// variant. If that is not the case, it is a bug that should
|
||||
// be fixed in the function creating the automaton. Since
|
||||
// that function could be written by the user, throw an
|
||||
// exception rather than using an assert().
|
||||
bdd all = bddtrue;
|
||||
for (auto& i: sup)
|
||||
all &= bdd_support(i.first);
|
||||
all_ap = all;
|
||||
all_ap = aut->ap_vars();
|
||||
if (bdd_exist(all, all_ap) != bddtrue)
|
||||
throw std::runtime_error("print_hoa(): automaton uses "
|
||||
"unregistered atomic propositions");
|
||||
all = all_ap;
|
||||
|
||||
while (all != bddtrue)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@ namespace spot
|
|||
if (m->num_states() < a->num_states())
|
||||
a = m;
|
||||
}
|
||||
a->remove_unused_ap();
|
||||
if (COMP_)
|
||||
a = complete(a);
|
||||
return a;
|
||||
|
|
@ -478,6 +479,8 @@ namespace spot
|
|||
|
||||
sim = dba ? dba : sim;
|
||||
|
||||
sim->remove_unused_ap();
|
||||
|
||||
if (COMP_)
|
||||
sim = complete(sim);
|
||||
if (SBACC_)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2015 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
// Copyright (C) 2015, 2016 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
|
|
@ -38,6 +38,6 @@ namespace spot
|
|||
for (auto& t: aut->edges())
|
||||
t.cond = bdd_replace(t.cond, pairs);
|
||||
for (auto v: vars)
|
||||
d->unregister_variable(v, aut);
|
||||
aut->unregister_ap(v);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2015 Laboratoire de Recherche et Développement de
|
||||
// Copyright (C) 2015, 2016 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -139,7 +139,7 @@ namespace spot
|
|||
if (v >= 0)
|
||||
{
|
||||
exist &= bdd_ithvar(v);
|
||||
d->unregister_variable(v, res);
|
||||
res->unregister_ap(v);
|
||||
}
|
||||
}
|
||||
for (auto ap: props_pos)
|
||||
|
|
@ -148,7 +148,7 @@ namespace spot
|
|||
if (v >= 0)
|
||||
{
|
||||
restrict &= bdd_ithvar(v);
|
||||
d->unregister_variable(v, res);
|
||||
res->unregister_ap(v);
|
||||
}
|
||||
}
|
||||
for (auto ap: props_neg)
|
||||
|
|
@ -157,7 +157,7 @@ namespace spot
|
|||
if (v >= 0)
|
||||
{
|
||||
restrict &= bdd_nithvar(v);
|
||||
d->unregister_variable(v, res);
|
||||
res->unregister_ap(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue