Twacube must share the order of atomic propositions

* spot/ltsmin/ltsmin.cc, spot/ltsmin/ltsmin.hh,
tests/ltsmin/modelcheck.cc: here.
This commit is contained in:
Etienne Renault 2016-09-28 16:31:01 +02:00
parent a1787dd1ce
commit 50d888adf8
3 changed files with 24 additions and 22 deletions

View file

@ -45,6 +45,9 @@
#include <spot/mc/ec.hh> #include <spot/mc/ec.hh>
#include <bricks/brick-hashset.h> #include <bricks/brick-hashset.h>
#include <bricks/brick-hash.h> #include <bricks/brick-hash.h>
#include <spot/twaalgos/dot.hh>
#include <spot/twa/twaproduct.hh>
#include <spot/twaalgos/emptiness.hh>
using namespace std::string_literals; using namespace std::string_literals;
@ -1706,13 +1709,13 @@ namespace spot
relop oper; relop oper;
// Now, left and (possibly) right are should refer atomic // Now, left and (possibly) right may refer atomic
// propositions or specific state inside of a process. // propositions or specific state inside of a process.
// First check if it is a known atomic proposition // First check if it is a known atomic proposition
it = std::find(k_aps.begin(), k_aps.end(), left); it = std::find(k_aps.begin(), k_aps.end(), left);
if (it != k_aps.end()) if (it != k_aps.end())
{ {
// The aps is directly an AP of the system, we will just // The ap is directly an AP of the system, we will just
// have to detect if the variable is 0 or not. // have to detect if the variable is 0 or not.
lval = std::distance(k_aps.begin(), it); lval = std::distance(k_aps.begin(), it);
} }
@ -1939,7 +1942,7 @@ namespace spot
} }
ltsmin_kripkecube_ptr ltsmin_kripkecube_ptr
ltsmin_model::kripkecube(const atomic_prop_set* to_observe, ltsmin_model::kripkecube(std::vector<std::string> to_observe,
const formula dead, int compress) const const formula dead, int compress) const
{ {
// Register the "dead" proposition. There are three cases to // Register the "dead" proposition. There are three cases to
@ -1958,26 +1961,19 @@ namespace spot
else if (dead != spot::formula::tt()) else if (dead != spot::formula::tt())
dead_ap = dead.ap_name(); dead_ap = dead.ap_name();
// Build the set of observed propositons, i.e. those in the // Is dead proposition is already in to_observe?
// formula
std::vector<std::string> observed;
bool add_dead = true; bool add_dead = true;
for (auto it: *to_observe) for (auto it: to_observe)
{ if (it.compare(dead_ap))
observed.push_back(it.ap_name()); add_dead = false;
// Dead proposition is already in observed prop
if (it.ap_name().compare(dead_ap))
add_dead = false;
}
if (dead_ap.compare("") != 0 && add_dead) if (dead_ap.compare("") != 0 && add_dead)
observed.push_back(dead_ap); to_observe.push_back(dead_ap);
// Finally build the system. // Finally build the system.
return std::make_shared<spot::kripkecube<spot::cspins_state, return std::make_shared<spot::kripkecube<spot::cspins_state,
spot::cspins_iterator>> spot::cspins_iterator>>
(iface, compress, observed, selfloopize, dead_ap); (iface, compress, to_observe, selfloopize, dead_ap);
} }
kripke_ptr kripke_ptr
@ -2016,6 +2012,12 @@ namespace spot
ltsmin_model::modelcheck(ltsmin_kripkecube_ptr sys, ltsmin_model::modelcheck(ltsmin_kripkecube_ptr sys,
spot::twacube_ptr twa, bool compute_ctrx) spot::twacube_ptr twa, bool compute_ctrx)
{ {
// Must ensure that the two automata are working on the same
// set of atomic propositions.
assert(sys->get_ap().size() == twa->get_ap().size());
for (unsigned int i = 0; i < sys->get_ap().size(); ++i)
assert(sys->get_ap()[i].compare(twa->get_ap()[i]) == 0);
ec_renault13lpar<cspins_state, cspins_iterator, ec_renault13lpar<cspins_state, cspins_iterator,
cspins_state_hash, cspins_state_equal> ec(*sys, twa); cspins_state_hash, cspins_state_equal> ec(*sys, twa);
bool has_ctrx = ec.run(); bool has_ctrx = ec.run();

View file

@ -83,10 +83,9 @@ namespace spot
// \brief The same as above but returns a kripkecube, i.e. a kripke // \brief The same as above but returns a kripkecube, i.e. a kripke
// that can be use in parallel. Moreover, it support more ellaborated // that can be use in parallel. Moreover, it support more ellaborated
// atomic propositions such as "P.a == P.c" // atomic propositions such as "P.a == P.c"
ltsmin_kripkecube_ptr ltsmin_kripkecube_ptr kripkecube(std::vector<std::string> to_observe,
kripkecube(const atomic_prop_set* to_observe, formula dead = formula::tt(),
formula dead = formula::tt(), int compress = 0) const;
int compress = 0) const;
/// \brief Check for the emptiness between a system and a twa. /// \brief Check for the emptiness between a system and a twa.
/// Return a pair containing a boolean indicating wether a counterexample /// Return a pair containing a boolean indicating wether a counterexample

View file

@ -29,6 +29,7 @@
#include <spot/twaalgos/translate.hh> #include <spot/twaalgos/translate.hh>
#include <spot/twaalgos/emptiness.hh> #include <spot/twaalgos/emptiness.hh>
#include <spot/twaalgos/postproc.hh> #include <spot/twaalgos/postproc.hh>
#include <spot/twaalgos/are_isomorphic.hh>
#include <spot/twa/twaproduct.hh> #include <spot/twa/twaproduct.hh>
#include <spot/misc/timer.hh> #include <spot/misc/timer.hh>
#include <spot/misc/memusage.hh> #include <spot/misc/memusage.hh>
@ -408,8 +409,8 @@ static int checked_main()
spot::ltsmin_kripkecube_ptr modelcube = nullptr; spot::ltsmin_kripkecube_ptr modelcube = nullptr;
try try
{ {
modelcube = spot::ltsmin_model::load(mc_options.model) modelcube = spot::ltsmin_model::load(mc_options.model)
.kripkecube(&ap, deadf, mc_options.compress); .kripkecube(propcube->get_ap(), deadf, mc_options.compress);
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {