sanity: Replace tabulars by spaces in *.cc *.hh *.hxx
* bin/autfilt.cc, bin/common_aoutput.cc, bin/common_aoutput.hh, bin/common_finput.cc, bin/common_finput.hh, bin/common_hoaread.cc, bin/common_output.cc, bin/common_output.hh, bin/common_post.cc, bin/common_post.hh, bin/common_r.hh, bin/common_range.cc, bin/common_range.hh, bin/common_setup.cc, bin/common_trans.cc, bin/common_trans.hh, bin/dstar2tgba.cc, bin/genltl.cc, bin/ltl2tgba.cc, bin/ltl2tgta.cc, bin/ltlcross.cc, bin/ltldo.cc, bin/ltlfilt.cc, bin/ltlgrind.cc, bin/randaut.cc, bin/randltl.cc, bin/spot-x.cc, spot/graph/graph.hh, spot/graph/ngraph.hh, spot/kripke/kripkegraph.hh, spot/ltsmin/ltsmin.cc, spot/ltsmin/ltsmin.hh, spot/misc/bareword.cc, spot/misc/bitvect.cc, spot/misc/bitvect.hh, spot/misc/common.hh, spot/misc/escape.cc, spot/misc/fixpool.hh, spot/misc/formater.cc, spot/misc/hash.hh, spot/misc/intvcmp2.cc, spot/misc/intvcmp2.hh, spot/misc/intvcomp.cc, spot/misc/intvcomp.hh, spot/misc/location.hh, spot/misc/minato.cc, spot/misc/minato.hh, spot/misc/mspool.hh, spot/misc/optionmap.cc, spot/misc/optionmap.hh, spot/misc/random.cc, spot/misc/random.hh, spot/misc/satsolver.cc, spot/misc/satsolver.hh, spot/misc/timer.cc, spot/misc/timer.hh, spot/misc/tmpfile.cc, spot/misc/trival.hh, spot/parseaut/fmterror.cc, spot/parseaut/parsedecl.hh, spot/parseaut/public.hh, spot/parsetl/fmterror.cc, spot/parsetl/parsedecl.hh, spot/priv/accmap.hh, spot/priv/bddalloc.cc, spot/priv/freelist.cc, spot/priv/trim.cc, spot/priv/weight.cc, spot/priv/weight.hh, spot/ta/taexplicit.cc, spot/ta/taexplicit.hh, spot/ta/taproduct.cc, spot/ta/taproduct.hh, spot/ta/tgtaexplicit.cc, spot/ta/tgtaexplicit.hh, spot/ta/tgtaproduct.cc, spot/ta/tgtaproduct.hh, spot/taalgos/dot.cc, spot/taalgos/dot.hh, spot/taalgos/emptinessta.cc, spot/taalgos/emptinessta.hh, spot/taalgos/minimize.cc, spot/taalgos/tgba2ta.cc, spot/taalgos/tgba2ta.hh, spot/tl/apcollect.cc, spot/tl/contain.cc, spot/tl/contain.hh, spot/tl/dot.cc, spot/tl/exclusive.cc, spot/tl/exclusive.hh, spot/tl/formula.cc, spot/tl/formula.hh, spot/tl/length.cc, spot/tl/mark.cc, spot/tl/mutation.cc, spot/tl/mutation.hh, spot/tl/parse.hh, spot/tl/print.cc, spot/tl/print.hh, spot/tl/randomltl.cc, spot/tl/randomltl.hh, spot/tl/relabel.cc, spot/tl/relabel.hh, spot/tl/remove_x.cc, spot/tl/simplify.cc, spot/tl/simplify.hh, spot/tl/snf.cc, spot/tl/snf.hh, spot/tl/unabbrev.cc, spot/tl/unabbrev.hh, spot/twa/acc.cc, spot/twa/acc.hh, spot/twa/bdddict.cc, spot/twa/bdddict.hh, spot/twa/bddprint.cc, spot/twa/formula2bdd.cc, spot/twa/formula2bdd.hh, spot/twa/taatgba.cc, spot/twa/taatgba.hh, spot/twa/twa.cc, spot/twa/twa.hh, spot/twa/twagraph.cc, spot/twa/twagraph.hh, spot/twa/twaproduct.cc, spot/twa/twaproduct.hh, spot/twaalgos/are_isomorphic.cc, spot/twaalgos/are_isomorphic.hh, spot/twaalgos/bfssteps.cc, spot/twaalgos/bfssteps.hh, spot/twaalgos/cleanacc.cc, spot/twaalgos/complete.cc, spot/twaalgos/compsusp.cc, spot/twaalgos/compsusp.hh, spot/twaalgos/copy.cc, spot/twaalgos/cycles.cc, spot/twaalgos/cycles.hh, spot/twaalgos/degen.cc, spot/twaalgos/degen.hh, spot/twaalgos/determinize.cc, spot/twaalgos/determinize.hh, spot/twaalgos/dot.cc, spot/twaalgos/dot.hh, spot/twaalgos/dtbasat.cc, spot/twaalgos/dtbasat.hh, spot/twaalgos/dtwasat.cc, spot/twaalgos/dtwasat.hh, spot/twaalgos/emptiness.cc, spot/twaalgos/emptiness.hh, spot/twaalgos/emptiness_stats.hh, spot/twaalgos/gtec/ce.cc, spot/twaalgos/gtec/ce.hh, spot/twaalgos/gtec/gtec.cc, spot/twaalgos/gtec/gtec.hh, spot/twaalgos/gtec/sccstack.cc, spot/twaalgos/gtec/status.cc, spot/twaalgos/gv04.cc, spot/twaalgos/hoa.cc, spot/twaalgos/hoa.hh, spot/twaalgos/isdet.cc, spot/twaalgos/isunamb.cc, spot/twaalgos/isweakscc.cc, spot/twaalgos/lbtt.cc, spot/twaalgos/lbtt.hh, spot/twaalgos/ltl2taa.cc, spot/twaalgos/ltl2taa.hh, spot/twaalgos/ltl2tgba_fm.cc, spot/twaalgos/ltl2tgba_fm.hh, spot/twaalgos/magic.cc, spot/twaalgos/magic.hh, spot/twaalgos/mask.cc, spot/twaalgos/mask.hh, spot/twaalgos/minimize.cc, spot/twaalgos/minimize.hh, spot/twaalgos/ndfs_result.hxx, spot/twaalgos/neverclaim.cc, spot/twaalgos/neverclaim.hh, spot/twaalgos/postproc.cc, spot/twaalgos/postproc.hh, spot/twaalgos/powerset.cc, spot/twaalgos/powerset.hh, spot/twaalgos/product.cc, spot/twaalgos/product.hh, spot/twaalgos/projrun.cc, spot/twaalgos/projrun.hh, spot/twaalgos/randomgraph.cc, spot/twaalgos/randomgraph.hh, spot/twaalgos/randomize.cc, spot/twaalgos/randomize.hh, spot/twaalgos/reachiter.cc, spot/twaalgos/reachiter.hh, spot/twaalgos/relabel.cc, spot/twaalgos/relabel.hh, spot/twaalgos/remfin.cc, spot/twaalgos/remprop.cc, spot/twaalgos/sbacc.cc, spot/twaalgos/sccfilter.cc, spot/twaalgos/sccfilter.hh, spot/twaalgos/sccinfo.cc, spot/twaalgos/sccinfo.hh, spot/twaalgos/se05.cc, spot/twaalgos/se05.hh, spot/twaalgos/sepsets.cc, spot/twaalgos/simulation.cc, spot/twaalgos/simulation.hh, spot/twaalgos/stats.cc, spot/twaalgos/stats.hh, spot/twaalgos/strength.cc, spot/twaalgos/strength.hh, spot/twaalgos/stripacc.cc, spot/twaalgos/stutter.cc, spot/twaalgos/stutter.hh, spot/twaalgos/tau03.cc, spot/twaalgos/tau03opt.cc, spot/twaalgos/tau03opt.hh, spot/twaalgos/totgba.cc, spot/twaalgos/translate.cc, spot/twaalgos/word.cc, tests/core/acc.cc, tests/core/bitvect.cc, tests/core/checkpsl.cc, tests/core/checkta.cc, tests/core/consterm.cc, tests/core/emptchk.cc, tests/core/equalsf.cc, tests/core/graph.cc, tests/core/ikwiad.cc, tests/core/intvcmp2.cc, tests/core/intvcomp.cc, tests/core/kind.cc, tests/core/kripkecat.cc, tests/core/ltlrel.cc, tests/core/ngraph.cc, tests/core/randtgba.cc, tests/core/readltl.cc, tests/core/reduc.cc, tests/core/safra.cc, tests/core/syntimpl.cc, tests/ltsmin/modelcheck.cc: Replace tabulars by 8 spaces. * tests/sanity/style.test: Add checks for no tabulars in *.cc *.hh *.hxx
This commit is contained in:
parent
1eee12b8b4
commit
f7e7b4f14e
239 changed files with 25359 additions and 25355 deletions
|
|
@ -35,109 +35,109 @@ namespace spot
|
|||
void
|
||||
parse_opts(const char* options)
|
||||
{
|
||||
const char* orig = options;
|
||||
while (char c = *options++)
|
||||
switch (c)
|
||||
{
|
||||
case '.':
|
||||
{
|
||||
// Copy the value in a string, so future calls to
|
||||
// parse_opts do not fail if the environment has
|
||||
// changed. (This matters particularly in an ipython
|
||||
// notebook, where it is tempting to redefine
|
||||
// SPOT_DOTDEFAULT.)
|
||||
static std::string def = []()
|
||||
{
|
||||
auto s = getenv("SPOT_DOTDEFAULT");
|
||||
return s ? s : "";
|
||||
}();
|
||||
// Prevent infinite recursions...
|
||||
if (orig == def.c_str())
|
||||
throw std::runtime_error
|
||||
(std::string("SPOT_DOTDEFAULT should not contain '.'"));
|
||||
if (!def.empty())
|
||||
parse_opts(def.c_str());
|
||||
break;
|
||||
}
|
||||
case 'A':
|
||||
opt_hide_sets_ = true;
|
||||
break;
|
||||
case 'c':
|
||||
opt_circles_ = true;
|
||||
break;
|
||||
case 'C':
|
||||
if (*options != '(')
|
||||
throw std::runtime_error
|
||||
("invalid node color specification for print_dot()");
|
||||
{
|
||||
auto* end = strchr(++options, ')');
|
||||
if (!end)
|
||||
throw std::runtime_error
|
||||
("invalid node color specification for print_dot()");
|
||||
opt_node_color_ = std::string(options, end - options);
|
||||
options = end + 1;
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
opt_horizontal_ = true;
|
||||
break;
|
||||
case 'f':
|
||||
if (*options != '(')
|
||||
throw std::runtime_error
|
||||
(std::string("invalid font specification for dotty()"));
|
||||
{
|
||||
auto* end = strchr(++options, ')');
|
||||
if (!end)
|
||||
throw std::runtime_error
|
||||
(std::string("invalid font specification for dotty()"));
|
||||
opt_font_ = std::string(options, end - options);
|
||||
options = end + 1;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
opt_horizontal_ = false;
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'B':
|
||||
case 'e':
|
||||
case 'n':
|
||||
case 'N':
|
||||
case 'o':
|
||||
case 'r':
|
||||
case 'R':
|
||||
case 's':
|
||||
case 't':
|
||||
case '+':
|
||||
case '<':
|
||||
case '#':
|
||||
// All these options are implemented by dotty() on TGBA,
|
||||
// but are not implemented here. We simply ignore them,
|
||||
// because raising an exception if they are in
|
||||
// SPOT_DEFAULT would be annoying.
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error
|
||||
(std::string("unknown option for dotty(): ") + c);
|
||||
}
|
||||
const char* orig = options;
|
||||
while (char c = *options++)
|
||||
switch (c)
|
||||
{
|
||||
case '.':
|
||||
{
|
||||
// Copy the value in a string, so future calls to
|
||||
// parse_opts do not fail if the environment has
|
||||
// changed. (This matters particularly in an ipython
|
||||
// notebook, where it is tempting to redefine
|
||||
// SPOT_DOTDEFAULT.)
|
||||
static std::string def = []()
|
||||
{
|
||||
auto s = getenv("SPOT_DOTDEFAULT");
|
||||
return s ? s : "";
|
||||
}();
|
||||
// Prevent infinite recursions...
|
||||
if (orig == def.c_str())
|
||||
throw std::runtime_error
|
||||
(std::string("SPOT_DOTDEFAULT should not contain '.'"));
|
||||
if (!def.empty())
|
||||
parse_opts(def.c_str());
|
||||
break;
|
||||
}
|
||||
case 'A':
|
||||
opt_hide_sets_ = true;
|
||||
break;
|
||||
case 'c':
|
||||
opt_circles_ = true;
|
||||
break;
|
||||
case 'C':
|
||||
if (*options != '(')
|
||||
throw std::runtime_error
|
||||
("invalid node color specification for print_dot()");
|
||||
{
|
||||
auto* end = strchr(++options, ')');
|
||||
if (!end)
|
||||
throw std::runtime_error
|
||||
("invalid node color specification for print_dot()");
|
||||
opt_node_color_ = std::string(options, end - options);
|
||||
options = end + 1;
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
opt_horizontal_ = true;
|
||||
break;
|
||||
case 'f':
|
||||
if (*options != '(')
|
||||
throw std::runtime_error
|
||||
(std::string("invalid font specification for dotty()"));
|
||||
{
|
||||
auto* end = strchr(++options, ')');
|
||||
if (!end)
|
||||
throw std::runtime_error
|
||||
(std::string("invalid font specification for dotty()"));
|
||||
opt_font_ = std::string(options, end - options);
|
||||
options = end + 1;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
opt_horizontal_ = false;
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'B':
|
||||
case 'e':
|
||||
case 'n':
|
||||
case 'N':
|
||||
case 'o':
|
||||
case 'r':
|
||||
case 'R':
|
||||
case 's':
|
||||
case 't':
|
||||
case '+':
|
||||
case '<':
|
||||
case '#':
|
||||
// All these options are implemented by dotty() on TGBA,
|
||||
// but are not implemented here. We simply ignore them,
|
||||
// because raising an exception if they are in
|
||||
// SPOT_DEFAULT would be annoying.
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error
|
||||
(std::string("unknown option for dotty(): ") + c);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
dotty_bfs(std::ostream& os, const const_ta_ptr& a,
|
||||
const char* opt) :
|
||||
const char* opt) :
|
||||
ta_reachable_iterator_breadth_first(a), os_(os)
|
||||
{
|
||||
parse_opts(opt ? opt : ".");
|
||||
parse_opts(opt ? opt : ".");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -145,56 +145,56 @@ namespace spot
|
|||
{
|
||||
os_ << "digraph G {\n";
|
||||
|
||||
if (opt_horizontal_)
|
||||
os_ << " rankdir=LR\n";
|
||||
if (opt_circles_)
|
||||
os_ << " node [shape=\"circle\"]\n";
|
||||
if (!opt_node_color_.empty())
|
||||
os_ << " node [style=\"filled\", fillcolor=\""
|
||||
<< opt_node_color_ << "\"]\n";
|
||||
if (!opt_font_.empty())
|
||||
os_ << " fontname=\"" << opt_font_
|
||||
<< "\"\n node [fontname=\"" << opt_font_
|
||||
<< "\"]\n edge [fontname=\"" << opt_font_
|
||||
<< "\"]\n";
|
||||
if (opt_horizontal_)
|
||||
os_ << " rankdir=LR\n";
|
||||
if (opt_circles_)
|
||||
os_ << " node [shape=\"circle\"]\n";
|
||||
if (!opt_node_color_.empty())
|
||||
os_ << " node [style=\"filled\", fillcolor=\""
|
||||
<< opt_node_color_ << "\"]\n";
|
||||
if (!opt_font_.empty())
|
||||
os_ << " fontname=\"" << opt_font_
|
||||
<< "\"\n node [fontname=\"" << opt_font_
|
||||
<< "\"]\n edge [fontname=\"" << opt_font_
|
||||
<< "\"]\n";
|
||||
|
||||
// Always copy the environment variable into a static string,
|
||||
// so that we (1) look it up once, but (2) won't crash if the
|
||||
// environment is changed.
|
||||
static std::string extra = []()
|
||||
{
|
||||
auto s = getenv("SPOT_DOTEXTRA");
|
||||
return s ? s : "";
|
||||
}();
|
||||
// Any extra text passed in the SPOT_DOTEXTRA environment
|
||||
// variable should be output at the end of the "header", so
|
||||
// that our setup can be overridden.
|
||||
if (!extra.empty())
|
||||
os_ << " " << extra << '\n';
|
||||
// Always copy the environment variable into a static string,
|
||||
// so that we (1) look it up once, but (2) won't crash if the
|
||||
// environment is changed.
|
||||
static std::string extra = []()
|
||||
{
|
||||
auto s = getenv("SPOT_DOTEXTRA");
|
||||
return s ? s : "";
|
||||
}();
|
||||
// Any extra text passed in the SPOT_DOTEXTRA environment
|
||||
// variable should be output at the end of the "header", so
|
||||
// that our setup can be overridden.
|
||||
if (!extra.empty())
|
||||
os_ << " " << extra << '\n';
|
||||
|
||||
artificial_initial_state_ = t_automata_->get_artificial_initial_state();
|
||||
|
||||
ta::const_states_set_t init_states_set;
|
||||
|
||||
if (artificial_initial_state_)
|
||||
{
|
||||
init_states_set.insert(artificial_initial_state_);
|
||||
os_ << " 0 [label=\"\", style=invis, height=0]\n 0 -> 1\n";
|
||||
}
|
||||
{
|
||||
init_states_set.insert(artificial_initial_state_);
|
||||
os_ << " 0 [label=\"\", style=invis, height=0]\n 0 -> 1\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
int n = 0;
|
||||
init_states_set = t_automata_->get_initial_states_set();
|
||||
for (auto s: init_states_set)
|
||||
{
|
||||
bdd init_condition = t_automata_->get_state_condition(s);
|
||||
std::string label = bdd_format_formula(t_automata_->get_dict(),
|
||||
init_condition);
|
||||
++n;
|
||||
os_ << " " << -n << " [label=\"\", style=invis, height=0]\n "
|
||||
<< -n << " -> " << n << " [label=\"" << label << "\"]\n";
|
||||
}
|
||||
}
|
||||
{
|
||||
int n = 0;
|
||||
init_states_set = t_automata_->get_initial_states_set();
|
||||
for (auto s: init_states_set)
|
||||
{
|
||||
bdd init_condition = t_automata_->get_state_condition(s);
|
||||
std::string label = bdd_format_formula(t_automata_->get_dict(),
|
||||
init_condition);
|
||||
++n;
|
||||
os_ << " " << -n << " [label=\"\", style=invis, height=0]\n "
|
||||
<< -n << " -> " << n << " [label=\"" << label << "\"]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -209,41 +209,41 @@ namespace spot
|
|||
|
||||
std::string style;
|
||||
if (t_automata_->is_accepting_state(s))
|
||||
style = ",peripheries=2";
|
||||
style = ",peripheries=2";
|
||||
|
||||
if (t_automata_->is_livelock_accepting_state(s))
|
||||
style += ",shape=box";
|
||||
if (t_automata_->is_livelock_accepting_state(s))
|
||||
style += ",shape=box";
|
||||
|
||||
os_ << " " << n << " [label=";
|
||||
if (s == artificial_initial_state_)
|
||||
os_ << "init";
|
||||
else
|
||||
os_ << quote_unless_bare_word(t_automata_->format_state(s));
|
||||
os_ << style << "]\n";
|
||||
os_ << " " << n << " [label=";
|
||||
if (s == artificial_initial_state_)
|
||||
os_ << "init";
|
||||
else
|
||||
os_ << quote_unless_bare_word(t_automata_->format_state(s));
|
||||
os_ << style << "]\n";
|
||||
}
|
||||
|
||||
void
|
||||
process_link(int in, int out, const ta_succ_iterator* si)
|
||||
{
|
||||
bdd_dict_ptr d = t_automata_->get_dict();
|
||||
std::string label =
|
||||
((in == 1 && artificial_initial_state_)
|
||||
? bdd_format_formula(d, si->cond())
|
||||
: bdd_format_accset(d, si->cond()));
|
||||
bdd_dict_ptr d = t_automata_->get_dict();
|
||||
std::string label =
|
||||
((in == 1 && artificial_initial_state_)
|
||||
? bdd_format_formula(d, si->cond())
|
||||
: bdd_format_accset(d, si->cond()));
|
||||
|
||||
if (label.empty())
|
||||
label = "{}";
|
||||
if (label.empty())
|
||||
label = "{}";
|
||||
|
||||
if (!opt_hide_sets_)
|
||||
{
|
||||
label += "\n";
|
||||
label += t_automata_->acc().
|
||||
format(si->acc());
|
||||
}
|
||||
if (!opt_hide_sets_)
|
||||
{
|
||||
label += "\n";
|
||||
label += t_automata_->acc().
|
||||
format(si->acc());
|
||||
}
|
||||
|
||||
os_ << " " << in << " -> " << out << " [label=\"";
|
||||
escape_str(os_, label);
|
||||
os_ << "\"]\n";
|
||||
escape_str(os_, label);
|
||||
os_ << "\"]\n";
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ namespace spot
|
|||
{
|
||||
SPOT_API std::ostream&
|
||||
print_dot(std::ostream& os, const const_ta_ptr& a,
|
||||
const char* opt = nullptr);
|
||||
const char* opt = nullptr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,10 +102,10 @@ namespace spot
|
|||
(ta_init_it_->dst()), kripke_init_state->clone());
|
||||
|
||||
if (!h.emplace(init, num + 1).second)
|
||||
{
|
||||
init->destroy();
|
||||
continue;
|
||||
}
|
||||
{
|
||||
init->destroy();
|
||||
continue;
|
||||
}
|
||||
|
||||
scc.push(++num);
|
||||
arc.push(0U);
|
||||
|
|
@ -146,7 +146,7 @@ namespace spot
|
|||
}
|
||||
|
||||
// fill rem with any component removed,
|
||||
auto i = h.find(curr);
|
||||
auto i = h.find(curr);
|
||||
assert(i != h.end());
|
||||
|
||||
scc.rem().push_front(curr);
|
||||
|
|
@ -168,7 +168,7 @@ namespace spot
|
|||
{
|
||||
// removing states
|
||||
for (auto j: scc.rem())
|
||||
h[j] = -1;
|
||||
h[j] = -1;
|
||||
dec_depth(scc.rem().size());
|
||||
scc.pop();
|
||||
assert(!arc.empty());
|
||||
|
|
@ -209,7 +209,7 @@ namespace spot
|
|||
// We do not need SUCC from now on.
|
||||
|
||||
// Are we going to a new state?
|
||||
auto p = h.emplace(dest, num + 1);
|
||||
auto p = h.emplace(dest, num + 1);
|
||||
if (p.second)
|
||||
{
|
||||
// Number it, stack it, and register its successors
|
||||
|
|
@ -277,23 +277,23 @@ namespace spot
|
|||
|
||||
scc.rem().splice(scc.rem().end(), rem);
|
||||
bool is_accepting_sscc = scc.top().is_accepting
|
||||
|| a_->acc().accepting(scc.top().condition);
|
||||
|| a_->acc().accepting(scc.top().condition);
|
||||
|
||||
if (is_accepting_sscc)
|
||||
{
|
||||
trace
|
||||
<< "PASS 1: SUCCESS: a_->is_livelock_accepting_state(curr): "
|
||||
<< a_->is_livelock_accepting_state(curr) << '\n';
|
||||
<< "PASS 1: SUCCESS: a_->is_livelock_accepting_state(curr): "
|
||||
<< a_->is_livelock_accepting_state(curr) << '\n';
|
||||
trace
|
||||
<< "PASS 1: scc.top().condition : "
|
||||
<< scc.top().condition << '\n';
|
||||
<< scc.top().condition << '\n';
|
||||
trace
|
||||
<< "PASS 1: a_->acc().all_sets() : "
|
||||
<< (a_->acc().all_sets()) << '\n';
|
||||
<< (a_->acc().all_sets()) << '\n';
|
||||
trace
|
||||
<< ("PASS 1 CYCLE and accepting? ")
|
||||
<< a_->acc().accepting(scc.top().condition)
|
||||
<< std::endl;
|
||||
<< ("PASS 1 CYCLE and accepting? ")
|
||||
<< a_->acc().accepting(scc.top().condition)
|
||||
<< std::endl;
|
||||
clear(h, todo, ta_init_it_);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -315,19 +315,19 @@ namespace spot
|
|||
h_livelock_root = h[livelock_roots.top()];
|
||||
|
||||
if (heuristic_livelock_detection(dest, h, h_livelock_root,
|
||||
liveset_curr))
|
||||
liveset_curr))
|
||||
{
|
||||
clear(h, todo, ta_init_it_);
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const state* succ: liveset_dest)
|
||||
if (heuristic_livelock_detection(succ, h, h_livelock_root,
|
||||
liveset_curr))
|
||||
{
|
||||
clear(h, todo, ta_init_it_);
|
||||
return true;
|
||||
}
|
||||
if (heuristic_livelock_detection(succ, h, h_livelock_root,
|
||||
liveset_curr))
|
||||
{
|
||||
clear(h, todo, ta_init_it_);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -403,11 +403,11 @@ namespace spot
|
|||
auto init = ta_init_it_.front();
|
||||
ta_init_it_.pop();
|
||||
|
||||
if (!h.emplace(init, num + 1).second)
|
||||
{
|
||||
init->destroy();
|
||||
continue;
|
||||
}
|
||||
if (!h.emplace(init, num + 1).second)
|
||||
{
|
||||
init->destroy();
|
||||
continue;
|
||||
}
|
||||
|
||||
sscc.push(num);
|
||||
sscc.top().is_accepting = t->is_livelock_accepting_state(init);
|
||||
|
|
@ -435,7 +435,7 @@ namespace spot
|
|||
trace << "PASS 2 : backtrack\n";
|
||||
|
||||
// fill rem with any component removed,
|
||||
auto i = h.find(curr);
|
||||
auto i = h.find(curr);
|
||||
assert(i != h.end());
|
||||
|
||||
sscc.rem().push_front(curr);
|
||||
|
|
@ -449,7 +449,7 @@ namespace spot
|
|||
{
|
||||
// removing states
|
||||
for (auto j: sscc.rem())
|
||||
h[j] = -1;
|
||||
h[j] = -1;
|
||||
dec_depth(sscc.rem().size());
|
||||
sscc.pop();
|
||||
}
|
||||
|
|
@ -498,10 +498,10 @@ namespace spot
|
|||
inc_depth();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
dest->destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
dest->destroy();
|
||||
}
|
||||
|
||||
// If we have reached a dead component, ignore it.
|
||||
if (i->second == -1)
|
||||
|
|
@ -509,12 +509,12 @@ namespace spot
|
|||
|
||||
//self loop state
|
||||
if (!curr->compare(i->first))
|
||||
if (t->is_livelock_accepting_state(curr))
|
||||
{
|
||||
clear(h, todo, ta_init_it_);
|
||||
trace << "PASS 2: SUCCESS\n";
|
||||
return true;
|
||||
}
|
||||
if (t->is_livelock_accepting_state(curr))
|
||||
{
|
||||
clear(h, todo, ta_init_it_);
|
||||
trace << "PASS 2: SUCCESS\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
// Now this is the most interesting case. We have reached a
|
||||
// state S1 which is already part of a non-dead SSCC. Any such
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace spot
|
|||
namespace
|
||||
{
|
||||
typedef std::pair<const spot::state*,
|
||||
ta_succ_iterator_product*> pair_state_iter;
|
||||
ta_succ_iterator_product*> pair_state_iter;
|
||||
}
|
||||
|
||||
/// \addtogroup ta_emptiness_check Emptiness-checks
|
||||
|
|
@ -111,7 +111,7 @@ namespace spot
|
|||
/// this heuristic is described in the paper cited above
|
||||
bool
|
||||
check(bool disable_second_pass = false,
|
||||
bool disable_heuristic_for_livelock_detection = false);
|
||||
bool disable_heuristic_for_livelock_detection = false);
|
||||
|
||||
/// \brief Check whether the product automaton contains
|
||||
/// a livelock-accepting run
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ namespace spot
|
|||
{
|
||||
static std::ostream&
|
||||
dump_hash_set(const hash_set* hs,
|
||||
const const_ta_ptr& aut,
|
||||
std::ostream& out)
|
||||
const const_ta_ptr& aut,
|
||||
std::ostream& out)
|
||||
{
|
||||
out << '{';
|
||||
const char* sep = "";
|
||||
|
|
@ -73,7 +73,7 @@ namespace spot
|
|||
// automaton
|
||||
static void
|
||||
build_result(const const_ta_ptr& a, std::list<hash_set*>& sets,
|
||||
twa_graph_ptr result_tgba, const ta_explicit_ptr& result)
|
||||
twa_graph_ptr result_tgba, const ta_explicit_ptr& result)
|
||||
{
|
||||
// For each set, create a state in the tgbaulting automaton.
|
||||
// For a state s, state_num[s] is the number of the state in the minimal
|
||||
|
|
@ -82,103 +82,103 @@ namespace spot
|
|||
std::list<hash_set*>::iterator sit;
|
||||
unsigned num = 0;
|
||||
for (sit = sets.begin(); sit != sets.end(); ++sit)
|
||||
{
|
||||
hash_set::iterator hit;
|
||||
hash_set* h = *sit;
|
||||
for (hit = h->begin(); hit != h->end(); ++hit)
|
||||
state_num[*hit] = num;
|
||||
result_tgba->new_state();
|
||||
++num;
|
||||
}
|
||||
{
|
||||
hash_set::iterator hit;
|
||||
hash_set* h = *sit;
|
||||
for (hit = h->begin(); hit != h->end(); ++hit)
|
||||
state_num[*hit] = num;
|
||||
result_tgba->new_state();
|
||||
++num;
|
||||
}
|
||||
|
||||
// For each transition in the initial automaton, add the corresponding
|
||||
// transition in ta.
|
||||
|
||||
for (sit = sets.begin(); sit != sets.end(); ++sit)
|
||||
{
|
||||
hash_set::iterator hit;
|
||||
hash_set* h = *sit;
|
||||
hit = h->begin();
|
||||
const state* src = *hit;
|
||||
unsigned src_num = state_num[src];
|
||||
{
|
||||
hash_set::iterator hit;
|
||||
hash_set* h = *sit;
|
||||
hit = h->begin();
|
||||
const state* src = *hit;
|
||||
unsigned src_num = state_num[src];
|
||||
|
||||
bdd tgba_condition = bddtrue;
|
||||
bool is_initial_state = a->is_initial_state(src);
|
||||
if (!a->get_artificial_initial_state() && is_initial_state)
|
||||
tgba_condition = a->get_state_condition(src);
|
||||
bool is_accepting_state = a->is_accepting_state(src);
|
||||
bool is_livelock_accepting_state =
|
||||
a->is_livelock_accepting_state(src);
|
||||
bdd tgba_condition = bddtrue;
|
||||
bool is_initial_state = a->is_initial_state(src);
|
||||
if (!a->get_artificial_initial_state() && is_initial_state)
|
||||
tgba_condition = a->get_state_condition(src);
|
||||
bool is_accepting_state = a->is_accepting_state(src);
|
||||
bool is_livelock_accepting_state =
|
||||
a->is_livelock_accepting_state(src);
|
||||
|
||||
state_ta_explicit* new_src =
|
||||
new state_ta_explicit(result_tgba->state_from_number(src_num),
|
||||
tgba_condition, is_initial_state,
|
||||
is_accepting_state,
|
||||
is_livelock_accepting_state);
|
||||
state_ta_explicit* new_src =
|
||||
new state_ta_explicit(result_tgba->state_from_number(src_num),
|
||||
tgba_condition, is_initial_state,
|
||||
is_accepting_state,
|
||||
is_livelock_accepting_state);
|
||||
|
||||
state_ta_explicit* ta_src = result->add_state(new_src);
|
||||
state_ta_explicit* ta_src = result->add_state(new_src);
|
||||
|
||||
if (ta_src != new_src)
|
||||
{
|
||||
delete new_src;
|
||||
}
|
||||
else if (a->get_artificial_initial_state())
|
||||
{
|
||||
if (a->get_artificial_initial_state() == src)
|
||||
result->set_artificial_initial_state(new_src);
|
||||
}
|
||||
else if (is_initial_state)
|
||||
{
|
||||
result->add_to_initial_states_set(new_src);
|
||||
}
|
||||
if (ta_src != new_src)
|
||||
{
|
||||
delete new_src;
|
||||
}
|
||||
else if (a->get_artificial_initial_state())
|
||||
{
|
||||
if (a->get_artificial_initial_state() == src)
|
||||
result->set_artificial_initial_state(new_src);
|
||||
}
|
||||
else if (is_initial_state)
|
||||
{
|
||||
result->add_to_initial_states_set(new_src);
|
||||
}
|
||||
|
||||
ta_succ_iterator* succit = a->succ_iter(src);
|
||||
ta_succ_iterator* succit = a->succ_iter(src);
|
||||
|
||||
for (succit->first(); !succit->done(); succit->next())
|
||||
{
|
||||
const state* dst = succit->dst();
|
||||
hash_map::const_iterator i = state_num.find(dst);
|
||||
for (succit->first(); !succit->done(); succit->next())
|
||||
{
|
||||
const state* dst = succit->dst();
|
||||
hash_map::const_iterator i = state_num.find(dst);
|
||||
|
||||
if (i == state_num.end()) // Ignore useless destinations.
|
||||
continue;
|
||||
if (i == state_num.end()) // Ignore useless destinations.
|
||||
continue;
|
||||
|
||||
bdd tgba_condition = bddtrue;
|
||||
is_initial_state = a->is_initial_state(dst);
|
||||
if (!a->get_artificial_initial_state() && is_initial_state)
|
||||
tgba_condition = a->get_state_condition(dst);
|
||||
bool is_accepting_state = a->is_accepting_state(dst);
|
||||
bool is_livelock_accepting_state =
|
||||
a->is_livelock_accepting_state(dst);
|
||||
bdd tgba_condition = bddtrue;
|
||||
is_initial_state = a->is_initial_state(dst);
|
||||
if (!a->get_artificial_initial_state() && is_initial_state)
|
||||
tgba_condition = a->get_state_condition(dst);
|
||||
bool is_accepting_state = a->is_accepting_state(dst);
|
||||
bool is_livelock_accepting_state =
|
||||
a->is_livelock_accepting_state(dst);
|
||||
|
||||
state_ta_explicit* new_dst =
|
||||
new state_ta_explicit
|
||||
(result_tgba->state_from_number(i->second),
|
||||
tgba_condition, is_initial_state,
|
||||
is_accepting_state,
|
||||
is_livelock_accepting_state);
|
||||
state_ta_explicit* new_dst =
|
||||
new state_ta_explicit
|
||||
(result_tgba->state_from_number(i->second),
|
||||
tgba_condition, is_initial_state,
|
||||
is_accepting_state,
|
||||
is_livelock_accepting_state);
|
||||
|
||||
state_ta_explicit* ta_dst = result->add_state(new_dst);
|
||||
state_ta_explicit* ta_dst = result->add_state(new_dst);
|
||||
|
||||
if (ta_dst != new_dst)
|
||||
{
|
||||
delete new_dst;
|
||||
}
|
||||
else if (a->get_artificial_initial_state())
|
||||
{
|
||||
if (a->get_artificial_initial_state() == dst)
|
||||
result->set_artificial_initial_state(new_dst);
|
||||
}
|
||||
if (ta_dst != new_dst)
|
||||
{
|
||||
delete new_dst;
|
||||
}
|
||||
else if (a->get_artificial_initial_state())
|
||||
{
|
||||
if (a->get_artificial_initial_state() == dst)
|
||||
result->set_artificial_initial_state(new_dst);
|
||||
}
|
||||
|
||||
else if (is_initial_state)
|
||||
result->add_to_initial_states_set(new_dst);
|
||||
else if (is_initial_state)
|
||||
result->add_to_initial_states_set(new_dst);
|
||||
|
||||
result->create_transition
|
||||
(ta_src, succit->cond(),
|
||||
succit->acc(),
|
||||
ta_dst);
|
||||
}
|
||||
delete succit;
|
||||
}
|
||||
result->create_transition
|
||||
(ta_src, succit->cond(),
|
||||
succit->acc(),
|
||||
ta_dst);
|
||||
}
|
||||
delete succit;
|
||||
}
|
||||
}
|
||||
|
||||
static partition_t
|
||||
|
|
@ -187,22 +187,22 @@ namespace spot
|
|||
unsigned num_sets = ta_->acc().num_sets();
|
||||
std::map<acc_cond::mark_t, bdd> m2b;
|
||||
int acc_vars = ta_->get_dict()->register_anonymous_variables(num_sets,
|
||||
&m2b);
|
||||
&m2b);
|
||||
auto mark_to_bdd = [&](acc_cond::mark_t m) -> bdd
|
||||
{
|
||||
auto i = m2b.find(m);
|
||||
if (i != m2b.end())
|
||||
return i->second;
|
||||
{
|
||||
auto i = m2b.find(m);
|
||||
if (i != m2b.end())
|
||||
return i->second;
|
||||
|
||||
bdd res = bddtrue;
|
||||
for (unsigned n = 0; n < num_sets; ++n)
|
||||
if (m.has(n))
|
||||
res &= bdd_ithvar(acc_vars + n);
|
||||
else
|
||||
res &= bdd_nithvar(acc_vars + n);
|
||||
m2b.emplace_hint(i, m, res);
|
||||
return res;
|
||||
};
|
||||
bdd res = bddtrue;
|
||||
for (unsigned n = 0; n < num_sets; ++n)
|
||||
if (m.has(n))
|
||||
res &= bdd_ithvar(acc_vars + n);
|
||||
else
|
||||
res &= bdd_nithvar(acc_vars + n);
|
||||
m2b.emplace_hint(i, m, res);
|
||||
return res;
|
||||
};
|
||||
|
||||
partition_t cur_run;
|
||||
partition_t next_run;
|
||||
|
|
@ -231,22 +231,22 @@ namespace spot
|
|||
auto artificial_initial_state = ta_->get_artificial_initial_state();
|
||||
|
||||
for (it = states_set.begin(); it != states_set.end(); ++it)
|
||||
{
|
||||
const state* s = *it;
|
||||
if (s == artificial_initial_state)
|
||||
I->insert(s);
|
||||
else if (!artificial_initial_state && ta_->is_initial_state(s))
|
||||
I->insert(s);
|
||||
else if (ta_->is_livelock_accepting_state(s)
|
||||
&& ta_->is_accepting_state(s))
|
||||
G_F->insert(s);
|
||||
else if (ta_->is_accepting_state(s))
|
||||
F->insert(s);
|
||||
else if (ta_->is_livelock_accepting_state(s))
|
||||
G->insert(s);
|
||||
else
|
||||
S->insert(s);
|
||||
}
|
||||
{
|
||||
const state* s = *it;
|
||||
if (s == artificial_initial_state)
|
||||
I->insert(s);
|
||||
else if (!artificial_initial_state && ta_->is_initial_state(s))
|
||||
I->insert(s);
|
||||
else if (ta_->is_livelock_accepting_state(s)
|
||||
&& ta_->is_accepting_state(s))
|
||||
G_F->insert(s);
|
||||
else if (ta_->is_accepting_state(s))
|
||||
F->insert(s);
|
||||
else if (ta_->is_livelock_accepting_state(s))
|
||||
G->insert(s);
|
||||
else
|
||||
S->insert(s);
|
||||
}
|
||||
|
||||
hash_map state_set_map;
|
||||
|
||||
|
|
@ -255,103 +255,103 @@ namespace spot
|
|||
// Use bdd variables to number sets. set_num is the first variable
|
||||
// available.
|
||||
unsigned set_num =
|
||||
ta_->get_dict()->register_anonymous_variables(size, &m2b);
|
||||
ta_->get_dict()->register_anonymous_variables(size, &m2b);
|
||||
|
||||
std::set<int> free_var;
|
||||
for (unsigned i = set_num; i < set_num + size; ++i)
|
||||
free_var.insert(i);
|
||||
free_var.insert(i);
|
||||
std::map<int, int> used_var;
|
||||
|
||||
for (hash_set::const_iterator i = I->begin(); i != I->end(); ++i)
|
||||
{
|
||||
hash_set* cI = new hash_set;
|
||||
cI->insert(*i);
|
||||
done.push_back(cI);
|
||||
{
|
||||
hash_set* cI = new hash_set;
|
||||
cI->insert(*i);
|
||||
done.push_back(cI);
|
||||
|
||||
used_var[set_num] = 1;
|
||||
free_var.erase(set_num);
|
||||
state_set_map[*i] = set_num;
|
||||
++set_num;
|
||||
used_var[set_num] = 1;
|
||||
free_var.erase(set_num);
|
||||
state_set_map[*i] = set_num;
|
||||
++set_num;
|
||||
|
||||
}
|
||||
}
|
||||
delete I;
|
||||
|
||||
if (!G->empty())
|
||||
{
|
||||
unsigned s = G->size();
|
||||
unsigned num = set_num;
|
||||
++set_num;
|
||||
used_var[num] = s;
|
||||
free_var.erase(num);
|
||||
if (s > 1)
|
||||
cur_run.push_back(G);
|
||||
else
|
||||
done.push_back(G);
|
||||
for (hash_set::const_iterator i = G->begin(); i != G->end(); ++i)
|
||||
state_set_map[*i] = num;
|
||||
{
|
||||
unsigned s = G->size();
|
||||
unsigned num = set_num;
|
||||
++set_num;
|
||||
used_var[num] = s;
|
||||
free_var.erase(num);
|
||||
if (s > 1)
|
||||
cur_run.push_back(G);
|
||||
else
|
||||
done.push_back(G);
|
||||
for (hash_set::const_iterator i = G->begin(); i != G->end(); ++i)
|
||||
state_set_map[*i] = num;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete G;
|
||||
}
|
||||
{
|
||||
delete G;
|
||||
}
|
||||
|
||||
if (!F->empty())
|
||||
{
|
||||
unsigned s = F->size();
|
||||
unsigned num = set_num;
|
||||
++set_num;
|
||||
used_var[num] = s;
|
||||
free_var.erase(num);
|
||||
if (s > 1)
|
||||
cur_run.push_back(F);
|
||||
else
|
||||
done.push_back(F);
|
||||
for (hash_set::const_iterator i = F->begin(); i != F->end(); ++i)
|
||||
state_set_map[*i] = num;
|
||||
}
|
||||
{
|
||||
unsigned s = F->size();
|
||||
unsigned num = set_num;
|
||||
++set_num;
|
||||
used_var[num] = s;
|
||||
free_var.erase(num);
|
||||
if (s > 1)
|
||||
cur_run.push_back(F);
|
||||
else
|
||||
done.push_back(F);
|
||||
for (hash_set::const_iterator i = F->begin(); i != F->end(); ++i)
|
||||
state_set_map[*i] = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete F;
|
||||
}
|
||||
{
|
||||
delete F;
|
||||
}
|
||||
|
||||
if (!G_F->empty())
|
||||
{
|
||||
unsigned s = G_F->size();
|
||||
unsigned num = set_num;
|
||||
++set_num;
|
||||
used_var[num] = s;
|
||||
free_var.erase(num);
|
||||
if (s > 1)
|
||||
cur_run.push_back(G_F);
|
||||
else
|
||||
done.push_back(G_F);
|
||||
for (hash_set::const_iterator i = G_F->begin(); i != G_F->end(); ++i)
|
||||
state_set_map[*i] = num;
|
||||
}
|
||||
{
|
||||
unsigned s = G_F->size();
|
||||
unsigned num = set_num;
|
||||
++set_num;
|
||||
used_var[num] = s;
|
||||
free_var.erase(num);
|
||||
if (s > 1)
|
||||
cur_run.push_back(G_F);
|
||||
else
|
||||
done.push_back(G_F);
|
||||
for (hash_set::const_iterator i = G_F->begin(); i != G_F->end(); ++i)
|
||||
state_set_map[*i] = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete G_F;
|
||||
}
|
||||
{
|
||||
delete G_F;
|
||||
}
|
||||
|
||||
if (!S->empty())
|
||||
{
|
||||
unsigned s = S->size();
|
||||
unsigned num = set_num;
|
||||
++set_num;
|
||||
used_var[num] = s;
|
||||
free_var.erase(num);
|
||||
if (s > 1)
|
||||
cur_run.push_back(S);
|
||||
else
|
||||
done.push_back(S);
|
||||
for (hash_set::const_iterator i = S->begin(); i != S->end(); ++i)
|
||||
state_set_map[*i] = num;
|
||||
}
|
||||
{
|
||||
unsigned s = S->size();
|
||||
unsigned num = set_num;
|
||||
++set_num;
|
||||
used_var[num] = s;
|
||||
free_var.erase(num);
|
||||
if (s > 1)
|
||||
cur_run.push_back(S);
|
||||
else
|
||||
done.push_back(S);
|
||||
for (hash_set::const_iterator i = S->begin(); i != S->end(); ++i)
|
||||
state_set_map[*i] = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete S;
|
||||
}
|
||||
{
|
||||
delete S;
|
||||
}
|
||||
|
||||
|
||||
// A bdd_states_map is a list of formulae (in a BDD form)
|
||||
|
|
@ -366,132 +366,132 @@ namespace spot
|
|||
bdd bdd_false_acceptance_condition = bdd_ithvar(num);
|
||||
|
||||
while (did_split)
|
||||
{
|
||||
did_split = false;
|
||||
while (!cur_run.empty())
|
||||
{
|
||||
// Get a set to process.
|
||||
hash_set* cur = cur_run.front();
|
||||
cur_run.pop_front();
|
||||
{
|
||||
did_split = false;
|
||||
while (!cur_run.empty())
|
||||
{
|
||||
// Get a set to process.
|
||||
hash_set* cur = cur_run.front();
|
||||
cur_run.pop_front();
|
||||
|
||||
trace
|
||||
<< "processing " << format_hash_set(cur, ta_) << std::endl;
|
||||
trace
|
||||
<< "processing " << format_hash_set(cur, ta_) << std::endl;
|
||||
|
||||
hash_set::iterator hi;
|
||||
bdd_states_map bdd_map;
|
||||
for (hi = cur->begin(); hi != cur->end(); ++hi)
|
||||
{
|
||||
const state* src = *hi;
|
||||
bdd f = bddfalse;
|
||||
ta_succ_iterator* si = ta_->succ_iter(src);
|
||||
trace << "+src: " << src << std::endl;
|
||||
for (si->first(); !si->done(); si->next())
|
||||
{
|
||||
const state* dst = si->dst();
|
||||
hash_map::const_iterator i = state_set_map.find(dst);
|
||||
hash_set::iterator hi;
|
||||
bdd_states_map bdd_map;
|
||||
for (hi = cur->begin(); hi != cur->end(); ++hi)
|
||||
{
|
||||
const state* src = *hi;
|
||||
bdd f = bddfalse;
|
||||
ta_succ_iterator* si = ta_->succ_iter(src);
|
||||
trace << "+src: " << src << std::endl;
|
||||
for (si->first(); !si->done(); si->next())
|
||||
{
|
||||
const state* dst = si->dst();
|
||||
hash_map::const_iterator i = state_set_map.find(dst);
|
||||
|
||||
assert(i != state_set_map.end());
|
||||
auto curacc =
|
||||
mark_to_bdd(si->acc());
|
||||
f |= (bdd_ithvar(i->second)
|
||||
& si->cond() & curacc);
|
||||
trace
|
||||
<< "+f: " << bdd_format_accset(ta_->get_dict(), f)
|
||||
<< "\n -bdd_ithvar(i->second): "
|
||||
<< bdd_format_accset(ta_->get_dict(),
|
||||
bdd_ithvar(i->second))
|
||||
<< "\n -si->cond(): "
|
||||
<< bdd_format_accset(ta_->get_dict(),
|
||||
si->cond())
|
||||
<< "\n -current_acceptance_conditions: "
|
||||
<< si->acc()
|
||||
<< std::endl;
|
||||
}
|
||||
delete si;
|
||||
assert(i != state_set_map.end());
|
||||
auto curacc =
|
||||
mark_to_bdd(si->acc());
|
||||
f |= (bdd_ithvar(i->second)
|
||||
& si->cond() & curacc);
|
||||
trace
|
||||
<< "+f: " << bdd_format_accset(ta_->get_dict(), f)
|
||||
<< "\n -bdd_ithvar(i->second): "
|
||||
<< bdd_format_accset(ta_->get_dict(),
|
||||
bdd_ithvar(i->second))
|
||||
<< "\n -si->cond(): "
|
||||
<< bdd_format_accset(ta_->get_dict(),
|
||||
si->cond())
|
||||
<< "\n -current_acceptance_conditions: "
|
||||
<< si->acc()
|
||||
<< std::endl;
|
||||
}
|
||||
delete si;
|
||||
|
||||
// Have we already seen this formula ?
|
||||
bdd_states_map::iterator bsi = bdd_map.find(f);
|
||||
if (bsi == bdd_map.end())
|
||||
{
|
||||
// No, create a new set.
|
||||
hash_set* new_set = new hash_set;
|
||||
new_set->insert(src);
|
||||
bdd_map[f] = new_set;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Yes, add the current state to the set.
|
||||
bsi->second->insert(src);
|
||||
}
|
||||
}
|
||||
// Have we already seen this formula ?
|
||||
bdd_states_map::iterator bsi = bdd_map.find(f);
|
||||
if (bsi == bdd_map.end())
|
||||
{
|
||||
// No, create a new set.
|
||||
hash_set* new_set = new hash_set;
|
||||
new_set->insert(src);
|
||||
bdd_map[f] = new_set;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Yes, add the current state to the set.
|
||||
bsi->second->insert(src);
|
||||
}
|
||||
}
|
||||
|
||||
bdd_states_map::iterator bsi = bdd_map.begin();
|
||||
if (bdd_map.size() == 1)
|
||||
{
|
||||
// The set was not split.
|
||||
trace
|
||||
<< "set " << format_hash_set(bsi->second, ta_)
|
||||
<< " was not split" << std::endl;
|
||||
next_run.push_back(bsi->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
did_split = true;
|
||||
for (; bsi != bdd_map.end(); ++bsi)
|
||||
{
|
||||
hash_set* set = bsi->second;
|
||||
// Free the number associated to these states.
|
||||
unsigned num = state_set_map[*set->begin()];
|
||||
assert(used_var.find(num) != used_var.end());
|
||||
unsigned left = (used_var[num] -= set->size());
|
||||
// Make sure LEFT does not become negative
|
||||
// (hence bigger than SIZE when read as unsigned)
|
||||
assert(left < size);
|
||||
if (left == 0)
|
||||
{
|
||||
used_var.erase(num);
|
||||
free_var.insert(num);
|
||||
}
|
||||
// Pick a free number
|
||||
assert(!free_var.empty());
|
||||
num = *free_var.begin();
|
||||
free_var.erase(free_var.begin());
|
||||
used_var[num] = set->size();
|
||||
for (hash_set::iterator hit = set->begin();
|
||||
hit != set->end(); ++hit)
|
||||
state_set_map[*hit] = num;
|
||||
// Trivial sets can't be splitted any further.
|
||||
if (set->size() == 1)
|
||||
{
|
||||
trace
|
||||
<< "set " << format_hash_set(set, ta_)
|
||||
<< " is minimal" << std::endl;
|
||||
done.push_back(set);
|
||||
}
|
||||
else
|
||||
{
|
||||
trace
|
||||
<< "set " << format_hash_set(set, ta_)
|
||||
<< " should be processed further" << std::endl;
|
||||
next_run.push_back(set);
|
||||
}
|
||||
}
|
||||
}
|
||||
delete cur;
|
||||
}
|
||||
if (did_split)
|
||||
trace
|
||||
<< "splitting did occur during this pass." << std::endl;
|
||||
bdd_states_map::iterator bsi = bdd_map.begin();
|
||||
if (bdd_map.size() == 1)
|
||||
{
|
||||
// The set was not split.
|
||||
trace
|
||||
<< "set " << format_hash_set(bsi->second, ta_)
|
||||
<< " was not split" << std::endl;
|
||||
next_run.push_back(bsi->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
did_split = true;
|
||||
for (; bsi != bdd_map.end(); ++bsi)
|
||||
{
|
||||
hash_set* set = bsi->second;
|
||||
// Free the number associated to these states.
|
||||
unsigned num = state_set_map[*set->begin()];
|
||||
assert(used_var.find(num) != used_var.end());
|
||||
unsigned left = (used_var[num] -= set->size());
|
||||
// Make sure LEFT does not become negative
|
||||
// (hence bigger than SIZE when read as unsigned)
|
||||
assert(left < size);
|
||||
if (left == 0)
|
||||
{
|
||||
used_var.erase(num);
|
||||
free_var.insert(num);
|
||||
}
|
||||
// Pick a free number
|
||||
assert(!free_var.empty());
|
||||
num = *free_var.begin();
|
||||
free_var.erase(free_var.begin());
|
||||
used_var[num] = set->size();
|
||||
for (hash_set::iterator hit = set->begin();
|
||||
hit != set->end(); ++hit)
|
||||
state_set_map[*hit] = num;
|
||||
// Trivial sets can't be splitted any further.
|
||||
if (set->size() == 1)
|
||||
{
|
||||
trace
|
||||
<< "set " << format_hash_set(set, ta_)
|
||||
<< " is minimal" << std::endl;
|
||||
done.push_back(set);
|
||||
}
|
||||
else
|
||||
{
|
||||
trace
|
||||
<< "set " << format_hash_set(set, ta_)
|
||||
<< " should be processed further" << std::endl;
|
||||
next_run.push_back(set);
|
||||
}
|
||||
}
|
||||
}
|
||||
delete cur;
|
||||
}
|
||||
if (did_split)
|
||||
trace
|
||||
<< "splitting did occur during this pass." << std::endl;
|
||||
|
||||
std::swap(cur_run, next_run);
|
||||
}
|
||||
std::swap(cur_run, next_run);
|
||||
}
|
||||
|
||||
done.splice(done.end(), cur_run);
|
||||
|
||||
#ifdef TRACE
|
||||
trace << "Final partition: ";
|
||||
for (partition_t::const_iterator i = done.begin(); i != done.end(); ++i)
|
||||
trace << format_hash_set(*i, ta_) << ' ';
|
||||
trace << format_hash_set(*i, ta_) << ' ';
|
||||
trace << std::endl;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -51,17 +51,17 @@ namespace spot
|
|||
{
|
||||
|
||||
if (artificial_livelock_acc_state)
|
||||
{
|
||||
auto artificial_livelock_acc_state_added =
|
||||
{
|
||||
auto artificial_livelock_acc_state_added =
|
||||
testing_automata->add_state(artificial_livelock_acc_state);
|
||||
|
||||
// unique artificial_livelock_acc_state
|
||||
assert(artificial_livelock_acc_state_added
|
||||
== artificial_livelock_acc_state);
|
||||
(void)artificial_livelock_acc_state_added;
|
||||
artificial_livelock_acc_state->set_livelock_accepting_state(true);
|
||||
artificial_livelock_acc_state->free_transitions();
|
||||
}
|
||||
// unique artificial_livelock_acc_state
|
||||
assert(artificial_livelock_acc_state_added
|
||||
== artificial_livelock_acc_state);
|
||||
(void)artificial_livelock_acc_state_added;
|
||||
artificial_livelock_acc_state->set_livelock_accepting_state(true);
|
||||
artificial_livelock_acc_state->free_transitions();
|
||||
}
|
||||
|
||||
ta::states_set_t states_set = testing_automata->get_states_set();
|
||||
ta::states_set_t::iterator it;
|
||||
|
|
@ -70,86 +70,86 @@ namespace spot
|
|||
new state_ta_explicit::transitions;
|
||||
|
||||
for (it = states_set.begin(); it != states_set.end(); ++it)
|
||||
{
|
||||
auto source = const_cast<state_ta_explicit*>
|
||||
(static_cast<const state_ta_explicit*>(*it));
|
||||
{
|
||||
auto source = const_cast<state_ta_explicit*>
|
||||
(static_cast<const state_ta_explicit*>(*it));
|
||||
|
||||
transitions_to_livelock_states->clear();
|
||||
transitions_to_livelock_states->clear();
|
||||
|
||||
state_ta_explicit::transitions* trans = source->get_transitions();
|
||||
state_ta_explicit::transitions::iterator it_trans;
|
||||
state_ta_explicit::transitions* trans = source->get_transitions();
|
||||
state_ta_explicit::transitions::iterator it_trans;
|
||||
|
||||
if (trans)
|
||||
for (it_trans = trans->begin(); it_trans != trans->end();)
|
||||
{
|
||||
auto dest = const_cast<state_ta_explicit*>((*it_trans)->dest);
|
||||
if (trans)
|
||||
for (it_trans = trans->begin(); it_trans != trans->end();)
|
||||
{
|
||||
auto dest = const_cast<state_ta_explicit*>((*it_trans)->dest);
|
||||
|
||||
state_ta_explicit::transitions* dest_trans =
|
||||
dest->get_transitions();
|
||||
bool dest_trans_empty = !dest_trans || dest_trans->empty();
|
||||
state_ta_explicit::transitions* dest_trans =
|
||||
dest->get_transitions();
|
||||
bool dest_trans_empty = !dest_trans || dest_trans->empty();
|
||||
|
||||
//select transitions where a destination is a livelock state
|
||||
// which isn't a Buchi accepting state and has successors
|
||||
if (dest->is_livelock_accepting_state()
|
||||
&& (!dest->is_accepting_state()) && (!dest_trans_empty))
|
||||
transitions_to_livelock_states->push_front(*it_trans);
|
||||
//select transitions where a destination is a livelock state
|
||||
// which isn't a Buchi accepting state and has successors
|
||||
if (dest->is_livelock_accepting_state()
|
||||
&& (!dest->is_accepting_state()) && (!dest_trans_empty))
|
||||
transitions_to_livelock_states->push_front(*it_trans);
|
||||
|
||||
// optimization to have, after minimization, an unique
|
||||
// livelock state which has no successors
|
||||
if (dest->is_livelock_accepting_state() && (dest_trans_empty))
|
||||
dest->set_accepting_state(false);
|
||||
// optimization to have, after minimization, an unique
|
||||
// livelock state which has no successors
|
||||
if (dest->is_livelock_accepting_state() && (dest_trans_empty))
|
||||
dest->set_accepting_state(false);
|
||||
|
||||
++it_trans;
|
||||
}
|
||||
++it_trans;
|
||||
}
|
||||
|
||||
if (transitions_to_livelock_states)
|
||||
{
|
||||
state_ta_explicit::transitions::iterator it_trans;
|
||||
if (transitions_to_livelock_states)
|
||||
{
|
||||
state_ta_explicit::transitions::iterator it_trans;
|
||||
|
||||
for (it_trans = transitions_to_livelock_states->begin();
|
||||
it_trans != transitions_to_livelock_states->end();
|
||||
++it_trans)
|
||||
{
|
||||
if (artificial_livelock_acc_state)
|
||||
{
|
||||
testing_automata->create_transition
|
||||
(source,
|
||||
(*it_trans)->condition,
|
||||
(*it_trans)->acceptance_conditions,
|
||||
artificial_livelock_acc_state, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
testing_automata->create_transition
|
||||
(source,
|
||||
(*it_trans)->condition,
|
||||
(*it_trans)->acceptance_conditions,
|
||||
((*it_trans)->dest)->stuttering_reachable_livelock,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (it_trans = transitions_to_livelock_states->begin();
|
||||
it_trans != transitions_to_livelock_states->end();
|
||||
++it_trans)
|
||||
{
|
||||
if (artificial_livelock_acc_state)
|
||||
{
|
||||
testing_automata->create_transition
|
||||
(source,
|
||||
(*it_trans)->condition,
|
||||
(*it_trans)->acceptance_conditions,
|
||||
artificial_livelock_acc_state, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
testing_automata->create_transition
|
||||
(source,
|
||||
(*it_trans)->condition,
|
||||
(*it_trans)->acceptance_conditions,
|
||||
((*it_trans)->dest)->stuttering_reachable_livelock,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete transitions_to_livelock_states;
|
||||
|
||||
for (it = states_set.begin(); it != states_set.end(); ++it)
|
||||
{
|
||||
state_ta_explicit* state = static_cast<state_ta_explicit*> (*it);
|
||||
state_ta_explicit::transitions* state_trans =
|
||||
{
|
||||
state_ta_explicit* state = static_cast<state_ta_explicit*> (*it);
|
||||
state_ta_explicit::transitions* state_trans =
|
||||
(state)->get_transitions();
|
||||
bool state_trans_empty = !state_trans || state_trans->empty();
|
||||
bool state_trans_empty = !state_trans || state_trans->empty();
|
||||
|
||||
if (state->is_livelock_accepting_state()
|
||||
&& (!state->is_accepting_state()) && (!state_trans_empty))
|
||||
state->set_livelock_accepting_state(false);
|
||||
}
|
||||
if (state->is_livelock_accepting_state()
|
||||
&& (!state->is_accepting_state()) && (!state_trans_empty))
|
||||
state->set_livelock_accepting_state(false);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
compute_livelock_acceptance_states(const ta_explicit_ptr& testing_aut,
|
||||
bool single_pass_emptiness_check,
|
||||
state_ta_explicit*
|
||||
artificial_livelock_acc_state)
|
||||
bool single_pass_emptiness_check,
|
||||
state_ta_explicit*
|
||||
artificial_livelock_acc_state)
|
||||
{
|
||||
// We use five main data in this algorithm:
|
||||
// * sscc: a stack of strongly stuttering-connected components (SSCC)
|
||||
|
|
@ -177,234 +177,234 @@ namespace spot
|
|||
std::stack<const state*> init_set;
|
||||
|
||||
for (auto s: testing_aut->get_initial_states_set())
|
||||
init_set.push(s);
|
||||
init_set.push(s);
|
||||
|
||||
while (!init_set.empty())
|
||||
{
|
||||
// Setup depth-first search from initial states.
|
||||
{
|
||||
// Setup depth-first search from initial states.
|
||||
|
||||
{
|
||||
auto init = down_cast<const state_ta_explicit*> (init_set.top());
|
||||
init_set.pop();
|
||||
{
|
||||
auto init = down_cast<const state_ta_explicit*> (init_set.top());
|
||||
init_set.pop();
|
||||
|
||||
if (!h.emplace(init, num + 1).second)
|
||||
{
|
||||
init->destroy();
|
||||
continue;
|
||||
}
|
||||
if (!h.emplace(init, num + 1).second)
|
||||
{
|
||||
init->destroy();
|
||||
continue;
|
||||
}
|
||||
|
||||
sscc.push(++num);
|
||||
arc.push(0U);
|
||||
sscc.top().is_accepting
|
||||
sscc.push(++num);
|
||||
arc.push(0U);
|
||||
sscc.top().is_accepting
|
||||
= testing_aut->is_accepting_state(init);
|
||||
twa_succ_iterator* iter = testing_aut->succ_iter(init);
|
||||
iter->first();
|
||||
todo.emplace(init, iter);
|
||||
}
|
||||
twa_succ_iterator* iter = testing_aut->succ_iter(init);
|
||||
iter->first();
|
||||
todo.emplace(init, iter);
|
||||
}
|
||||
|
||||
while (!todo.empty())
|
||||
{
|
||||
auto curr = todo.top().first;
|
||||
while (!todo.empty())
|
||||
{
|
||||
auto curr = todo.top().first;
|
||||
|
||||
auto i = h.find(curr);
|
||||
// If we have reached a dead component, ignore it.
|
||||
if (i != h.end() && i->second == -1)
|
||||
{
|
||||
todo.pop();
|
||||
continue;
|
||||
}
|
||||
auto i = h.find(curr);
|
||||
// If we have reached a dead component, ignore it.
|
||||
if (i != h.end() && i->second == -1)
|
||||
{
|
||||
todo.pop();
|
||||
continue;
|
||||
}
|
||||
|
||||
// We are looking at the next successor in SUCC.
|
||||
twa_succ_iterator* succ = todo.top().second;
|
||||
// We are looking at the next successor in SUCC.
|
||||
twa_succ_iterator* succ = todo.top().second;
|
||||
|
||||
// If there is no more successor, backtrack.
|
||||
if (succ->done())
|
||||
{
|
||||
// We have explored all successors of state CURR.
|
||||
// If there is no more successor, backtrack.
|
||||
if (succ->done())
|
||||
{
|
||||
// We have explored all successors of state CURR.
|
||||
|
||||
// Backtrack TODO.
|
||||
todo.pop();
|
||||
// Backtrack TODO.
|
||||
todo.pop();
|
||||
|
||||
// fill rem with any component removed,
|
||||
assert(i != h.end());
|
||||
sscc.rem().push_front(curr);
|
||||
// fill rem with any component removed,
|
||||
assert(i != h.end());
|
||||
sscc.rem().push_front(curr);
|
||||
|
||||
// When backtracking the root of an SSCC, we must also
|
||||
// remove that SSCC from the ROOT stacks. We must
|
||||
// discard from H all reachable states from this SSCC.
|
||||
assert(!sscc.empty());
|
||||
if (sscc.top().index == i->second)
|
||||
{
|
||||
// removing states
|
||||
bool is_livelock_accepting_sscc = (sscc.rem().size() > 1)
|
||||
&& ((sscc.top().is_accepting) ||
|
||||
(testing_aut->acc().
|
||||
accepting(sscc.top().condition)));
|
||||
trace << "*** sscc.size() = ***" << sscc.size() << '\n';
|
||||
for (auto j: sscc.rem())
|
||||
{
|
||||
h[j] = -1;
|
||||
// When backtracking the root of an SSCC, we must also
|
||||
// remove that SSCC from the ROOT stacks. We must
|
||||
// discard from H all reachable states from this SSCC.
|
||||
assert(!sscc.empty());
|
||||
if (sscc.top().index == i->second)
|
||||
{
|
||||
// removing states
|
||||
bool is_livelock_accepting_sscc = (sscc.rem().size() > 1)
|
||||
&& ((sscc.top().is_accepting) ||
|
||||
(testing_aut->acc().
|
||||
accepting(sscc.top().condition)));
|
||||
trace << "*** sscc.size() = ***" << sscc.size() << '\n';
|
||||
for (auto j: sscc.rem())
|
||||
{
|
||||
h[j] = -1;
|
||||
|
||||
if (is_livelock_accepting_sscc)
|
||||
{
|
||||
// if it is an accepting sscc add the state to
|
||||
// G (=the livelock-accepting states set)
|
||||
trace << "*** sscc.size() > 1: states: ***"
|
||||
<< testing_aut->format_state(j)
|
||||
<< '\n';
|
||||
auto livelock_accepting_state =
|
||||
const_cast<state_ta_explicit*>
|
||||
(down_cast<const state_ta_explicit*>(j));
|
||||
if (is_livelock_accepting_sscc)
|
||||
{
|
||||
// if it is an accepting sscc add the state to
|
||||
// G (=the livelock-accepting states set)
|
||||
trace << "*** sscc.size() > 1: states: ***"
|
||||
<< testing_aut->format_state(j)
|
||||
<< '\n';
|
||||
auto livelock_accepting_state =
|
||||
const_cast<state_ta_explicit*>
|
||||
(down_cast<const state_ta_explicit*>(j));
|
||||
|
||||
livelock_accepting_state->
|
||||
set_livelock_accepting_state(true);
|
||||
livelock_accepting_state->
|
||||
set_livelock_accepting_state(true);
|
||||
|
||||
if (single_pass_emptiness_check)
|
||||
{
|
||||
livelock_accepting_state
|
||||
->set_accepting_state(true);
|
||||
livelock_accepting_state
|
||||
->stuttering_reachable_livelock
|
||||
= livelock_accepting_state;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (single_pass_emptiness_check)
|
||||
{
|
||||
livelock_accepting_state
|
||||
->set_accepting_state(true);
|
||||
livelock_accepting_state
|
||||
->stuttering_reachable_livelock
|
||||
= livelock_accepting_state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert(!arc.empty());
|
||||
sscc.pop();
|
||||
arc.pop();
|
||||
}
|
||||
assert(!arc.empty());
|
||||
sscc.pop();
|
||||
arc.pop();
|
||||
}
|
||||
|
||||
// automata reduction
|
||||
testing_aut->delete_stuttering_and_hole_successors(curr);
|
||||
// automata reduction
|
||||
testing_aut->delete_stuttering_and_hole_successors(curr);
|
||||
|
||||
delete succ;
|
||||
// Do not delete CURR: it is a key in H.
|
||||
continue;
|
||||
}
|
||||
delete succ;
|
||||
// Do not delete CURR: it is a key in H.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Fetch the values destination state we are interested in...
|
||||
auto dest = succ->dst();
|
||||
// Fetch the values destination state we are interested in...
|
||||
auto dest = succ->dst();
|
||||
|
||||
auto acc_cond = succ->acc();
|
||||
// ... and point the iterator to the next successor, for
|
||||
// the next iteration.
|
||||
succ->next();
|
||||
// We do not need SUCC from now on.
|
||||
auto acc_cond = succ->acc();
|
||||
// ... and point the iterator to the next successor, for
|
||||
// the next iteration.
|
||||
succ->next();
|
||||
// We do not need SUCC from now on.
|
||||
|
||||
// Are we going to a new state through a stuttering transition?
|
||||
bool is_stuttering_transition =
|
||||
testing_aut->get_state_condition(curr)
|
||||
== testing_aut->get_state_condition(dest);
|
||||
auto id = h.find(dest);
|
||||
// Are we going to a new state through a stuttering transition?
|
||||
bool is_stuttering_transition =
|
||||
testing_aut->get_state_condition(curr)
|
||||
== testing_aut->get_state_condition(dest);
|
||||
auto id = h.find(dest);
|
||||
|
||||
// Is this a new state?
|
||||
if (id == h.end())
|
||||
{
|
||||
if (!is_stuttering_transition)
|
||||
{
|
||||
init_set.push(dest);
|
||||
dest->destroy();
|
||||
continue;
|
||||
}
|
||||
// Is this a new state?
|
||||
if (id == h.end())
|
||||
{
|
||||
if (!is_stuttering_transition)
|
||||
{
|
||||
init_set.push(dest);
|
||||
dest->destroy();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Number it, stack it, and register its successors
|
||||
// for later processing.
|
||||
h[dest] = ++num;
|
||||
sscc.push(num);
|
||||
arc.push(acc_cond);
|
||||
sscc.top().is_accepting =
|
||||
testing_aut->is_accepting_state(dest);
|
||||
// Number it, stack it, and register its successors
|
||||
// for later processing.
|
||||
h[dest] = ++num;
|
||||
sscc.push(num);
|
||||
arc.push(acc_cond);
|
||||
sscc.top().is_accepting =
|
||||
testing_aut->is_accepting_state(dest);
|
||||
|
||||
twa_succ_iterator* iter = testing_aut->succ_iter(dest);
|
||||
iter->first();
|
||||
todo.emplace(dest, iter);
|
||||
continue;
|
||||
}
|
||||
dest->destroy();
|
||||
twa_succ_iterator* iter = testing_aut->succ_iter(dest);
|
||||
iter->first();
|
||||
todo.emplace(dest, iter);
|
||||
continue;
|
||||
}
|
||||
dest->destroy();
|
||||
|
||||
// If we have reached a dead component, ignore it.
|
||||
if (id->second == -1)
|
||||
continue;
|
||||
// If we have reached a dead component, ignore it.
|
||||
if (id->second == -1)
|
||||
continue;
|
||||
|
||||
trace << "***compute_livelock_acceptance_states: CYCLE***\n";
|
||||
trace << "***compute_livelock_acceptance_states: CYCLE***\n";
|
||||
|
||||
if (!curr->compare(id->first))
|
||||
{
|
||||
auto self_loop_state = const_cast<state_ta_explicit*>
|
||||
(down_cast<const state_ta_explicit*>(curr));
|
||||
assert(self_loop_state);
|
||||
if (!curr->compare(id->first))
|
||||
{
|
||||
auto self_loop_state = const_cast<state_ta_explicit*>
|
||||
(down_cast<const state_ta_explicit*>(curr));
|
||||
assert(self_loop_state);
|
||||
|
||||
if (testing_aut->is_accepting_state(self_loop_state)
|
||||
|| (testing_aut->acc().accepting(acc_cond)))
|
||||
{
|
||||
self_loop_state->set_livelock_accepting_state(true);
|
||||
if (single_pass_emptiness_check)
|
||||
{
|
||||
self_loop_state->set_accepting_state(true);
|
||||
self_loop_state->stuttering_reachable_livelock
|
||||
= self_loop_state;
|
||||
}
|
||||
}
|
||||
if (testing_aut->is_accepting_state(self_loop_state)
|
||||
|| (testing_aut->acc().accepting(acc_cond)))
|
||||
{
|
||||
self_loop_state->set_livelock_accepting_state(true);
|
||||
if (single_pass_emptiness_check)
|
||||
{
|
||||
self_loop_state->set_accepting_state(true);
|
||||
self_loop_state->stuttering_reachable_livelock
|
||||
= self_loop_state;
|
||||
}
|
||||
}
|
||||
|
||||
trace
|
||||
<< "***compute_livelock_acceptance_states: CYCLE: "
|
||||
<< "self_loop_state***\n";
|
||||
}
|
||||
trace
|
||||
<< "***compute_livelock_acceptance_states: CYCLE: "
|
||||
<< "self_loop_state***\n";
|
||||
}
|
||||
|
||||
// Now this is the most interesting case. We have reached a
|
||||
// state S1 which is already part of a non-dead SSCC. Any such
|
||||
// non-dead SSCC has necessarily been crossed by our path to
|
||||
// this state: there is a state S2 in our path which belongs
|
||||
// to this SSCC too. We are going to merge all states between
|
||||
// this S1 and S2 into this SSCC.
|
||||
//
|
||||
// This merge is easy to do because the order of the SSCC in
|
||||
// ROOT is ascending: we just have to merge all SSCCs from the
|
||||
// top of ROOT that have an index greater to the one of
|
||||
// the SSCC of S2 (called the "threshold").
|
||||
int threshold = id->second;
|
||||
std::list<const state*> rem;
|
||||
bool acc = false;
|
||||
// Now this is the most interesting case. We have reached a
|
||||
// state S1 which is already part of a non-dead SSCC. Any such
|
||||
// non-dead SSCC has necessarily been crossed by our path to
|
||||
// this state: there is a state S2 in our path which belongs
|
||||
// to this SSCC too. We are going to merge all states between
|
||||
// this S1 and S2 into this SSCC.
|
||||
//
|
||||
// This merge is easy to do because the order of the SSCC in
|
||||
// ROOT is ascending: we just have to merge all SSCCs from the
|
||||
// top of ROOT that have an index greater to the one of
|
||||
// the SSCC of S2 (called the "threshold").
|
||||
int threshold = id->second;
|
||||
std::list<const state*> rem;
|
||||
bool acc = false;
|
||||
|
||||
while (threshold < sscc.top().index)
|
||||
{
|
||||
assert(!sscc.empty());
|
||||
assert(!arc.empty());
|
||||
acc |= sscc.top().is_accepting;
|
||||
acc_cond |= sscc.top().condition;
|
||||
acc_cond |= arc.top();
|
||||
rem.splice(rem.end(), sscc.rem());
|
||||
sscc.pop();
|
||||
arc.pop();
|
||||
}
|
||||
while (threshold < sscc.top().index)
|
||||
{
|
||||
assert(!sscc.empty());
|
||||
assert(!arc.empty());
|
||||
acc |= sscc.top().is_accepting;
|
||||
acc_cond |= sscc.top().condition;
|
||||
acc_cond |= arc.top();
|
||||
rem.splice(rem.end(), sscc.rem());
|
||||
sscc.pop();
|
||||
arc.pop();
|
||||
}
|
||||
|
||||
// Note that we do not always have
|
||||
// threshold == sscc.top().index
|
||||
// after this loop, the SSCC whose index is threshold might have
|
||||
// been merged with a lower SSCC.
|
||||
// Note that we do not always have
|
||||
// threshold == sscc.top().index
|
||||
// after this loop, the SSCC whose index is threshold might have
|
||||
// been merged with a lower SSCC.
|
||||
|
||||
// Accumulate all acceptance conditions into the merged SSCC.
|
||||
sscc.top().is_accepting |= acc;
|
||||
sscc.top().condition |= acc_cond;
|
||||
// Accumulate all acceptance conditions into the merged SSCC.
|
||||
sscc.top().is_accepting |= acc;
|
||||
sscc.top().condition |= acc_cond;
|
||||
|
||||
sscc.rem().splice(sscc.rem().end(), rem);
|
||||
sscc.rem().splice(sscc.rem().end(), rem);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (artificial_livelock_acc_state || single_pass_emptiness_check)
|
||||
transform_to_single_pass_automaton(testing_aut,
|
||||
artificial_livelock_acc_state);
|
||||
transform_to_single_pass_automaton(testing_aut,
|
||||
artificial_livelock_acc_state);
|
||||
}
|
||||
|
||||
ta_explicit_ptr
|
||||
build_ta(const ta_explicit_ptr& ta, bdd atomic_propositions_set_,
|
||||
bool degeneralized,
|
||||
bool single_pass_emptiness_check,
|
||||
bool artificial_livelock_state_mode,
|
||||
bool no_livelock)
|
||||
bool degeneralized,
|
||||
bool single_pass_emptiness_check,
|
||||
bool artificial_livelock_state_mode,
|
||||
bool no_livelock)
|
||||
{
|
||||
|
||||
std::stack<state_ta_explicit*> todo;
|
||||
|
|
@ -414,140 +414,140 @@ namespace spot
|
|||
auto tgba_init_state = tgba_->get_init_state();
|
||||
|
||||
bdd tgba_condition = [&]()
|
||||
{
|
||||
bdd cond = bddfalse;
|
||||
for (auto i: tgba_->succ(tgba_init_state))
|
||||
cond |= i->cond();
|
||||
return cond;
|
||||
}();
|
||||
{
|
||||
bdd cond = bddfalse;
|
||||
for (auto i: tgba_->succ(tgba_init_state))
|
||||
cond |= i->cond();
|
||||
return cond;
|
||||
}();
|
||||
|
||||
bool is_acc = false;
|
||||
if (degeneralized)
|
||||
{
|
||||
twa_succ_iterator* it = tgba_->succ_iter(tgba_init_state);
|
||||
it->first();
|
||||
if (!it->done())
|
||||
is_acc = it->acc() != 0U;
|
||||
delete it;
|
||||
}
|
||||
{
|
||||
twa_succ_iterator* it = tgba_->succ_iter(tgba_init_state);
|
||||
it->first();
|
||||
if (!it->done())
|
||||
is_acc = it->acc() != 0U;
|
||||
delete it;
|
||||
}
|
||||
|
||||
bdd satone_tgba_condition;
|
||||
while ((satone_tgba_condition = bdd_satoneset(tgba_condition,
|
||||
atomic_propositions_set_,
|
||||
bddtrue)) != bddfalse)
|
||||
{
|
||||
tgba_condition -= satone_tgba_condition;
|
||||
state_ta_explicit* init_state = new
|
||||
state_ta_explicit(tgba_init_state->clone(),
|
||||
satone_tgba_condition, true, is_acc);
|
||||
state_ta_explicit* s = ta->add_state(init_state);
|
||||
assert(s == init_state);
|
||||
ta->add_to_initial_states_set(s);
|
||||
atomic_propositions_set_,
|
||||
bddtrue)) != bddfalse)
|
||||
{
|
||||
tgba_condition -= satone_tgba_condition;
|
||||
state_ta_explicit* init_state = new
|
||||
state_ta_explicit(tgba_init_state->clone(),
|
||||
satone_tgba_condition, true, is_acc);
|
||||
state_ta_explicit* s = ta->add_state(init_state);
|
||||
assert(s == init_state);
|
||||
ta->add_to_initial_states_set(s);
|
||||
|
||||
todo.push(init_state);
|
||||
}
|
||||
todo.push(init_state);
|
||||
}
|
||||
tgba_init_state->destroy();
|
||||
|
||||
while (!todo.empty())
|
||||
{
|
||||
state_ta_explicit* source = todo.top();
|
||||
todo.pop();
|
||||
{
|
||||
state_ta_explicit* source = todo.top();
|
||||
todo.pop();
|
||||
|
||||
twa_succ_iterator* twa_succ_it =
|
||||
tgba_->succ_iter(source->get_tgba_state());
|
||||
for (twa_succ_it->first(); !twa_succ_it->done();
|
||||
twa_succ_it->next())
|
||||
{
|
||||
const state* tgba_state = twa_succ_it->dst();
|
||||
bdd tgba_condition = twa_succ_it->cond();
|
||||
acc_cond::mark_t tgba_acceptance_conditions =
|
||||
twa_succ_iterator* twa_succ_it =
|
||||
tgba_->succ_iter(source->get_tgba_state());
|
||||
for (twa_succ_it->first(); !twa_succ_it->done();
|
||||
twa_succ_it->next())
|
||||
{
|
||||
const state* tgba_state = twa_succ_it->dst();
|
||||
bdd tgba_condition = twa_succ_it->cond();
|
||||
acc_cond::mark_t tgba_acceptance_conditions =
|
||||
twa_succ_it->acc();
|
||||
bdd satone_tgba_condition;
|
||||
while ((satone_tgba_condition =
|
||||
bdd_satoneset(tgba_condition,
|
||||
atomic_propositions_set_, bddtrue))
|
||||
!= bddfalse)
|
||||
{
|
||||
tgba_condition -= satone_tgba_condition;
|
||||
bdd satone_tgba_condition;
|
||||
while ((satone_tgba_condition =
|
||||
bdd_satoneset(tgba_condition,
|
||||
atomic_propositions_set_, bddtrue))
|
||||
!= bddfalse)
|
||||
{
|
||||
tgba_condition -= satone_tgba_condition;
|
||||
|
||||
bdd all_props = bddtrue;
|
||||
bdd dest_condition;
|
||||
bdd all_props = bddtrue;
|
||||
bdd dest_condition;
|
||||
|
||||
bool is_acc = false;
|
||||
if (degeneralized)
|
||||
{
|
||||
twa_succ_iterator* it = tgba_->succ_iter(tgba_state);
|
||||
it->first();
|
||||
if (!it->done())
|
||||
is_acc = it->acc() != 0U;
|
||||
delete it;
|
||||
}
|
||||
bool is_acc = false;
|
||||
if (degeneralized)
|
||||
{
|
||||
twa_succ_iterator* it = tgba_->succ_iter(tgba_state);
|
||||
it->first();
|
||||
if (!it->done())
|
||||
is_acc = it->acc() != 0U;
|
||||
delete it;
|
||||
}
|
||||
|
||||
if (satone_tgba_condition == source->get_tgba_condition())
|
||||
while ((dest_condition =
|
||||
bdd_satoneset(all_props,
|
||||
atomic_propositions_set_, bddtrue))
|
||||
!= bddfalse)
|
||||
{
|
||||
all_props -= dest_condition;
|
||||
state_ta_explicit* new_dest =
|
||||
new state_ta_explicit(tgba_state->clone(),
|
||||
dest_condition, false, is_acc);
|
||||
state_ta_explicit* dest = ta->add_state(new_dest);
|
||||
if (satone_tgba_condition == source->get_tgba_condition())
|
||||
while ((dest_condition =
|
||||
bdd_satoneset(all_props,
|
||||
atomic_propositions_set_, bddtrue))
|
||||
!= bddfalse)
|
||||
{
|
||||
all_props -= dest_condition;
|
||||
state_ta_explicit* new_dest =
|
||||
new state_ta_explicit(tgba_state->clone(),
|
||||
dest_condition, false, is_acc);
|
||||
state_ta_explicit* dest = ta->add_state(new_dest);
|
||||
|
||||
if (dest != new_dest)
|
||||
{
|
||||
// the state dest already exists in the automaton
|
||||
new_dest->get_tgba_state()->destroy();
|
||||
delete new_dest;
|
||||
}
|
||||
else
|
||||
{
|
||||
todo.push(dest);
|
||||
}
|
||||
if (dest != new_dest)
|
||||
{
|
||||
// the state dest already exists in the automaton
|
||||
new_dest->get_tgba_state()->destroy();
|
||||
delete new_dest;
|
||||
}
|
||||
else
|
||||
{
|
||||
todo.push(dest);
|
||||
}
|
||||
|
||||
bdd cs = bdd_setxor(source->get_tgba_condition(),
|
||||
dest->get_tgba_condition());
|
||||
ta->create_transition(source, cs,
|
||||
tgba_acceptance_conditions, dest);
|
||||
}
|
||||
}
|
||||
tgba_state->destroy();
|
||||
}
|
||||
delete twa_succ_it;
|
||||
}
|
||||
bdd cs = bdd_setxor(source->get_tgba_condition(),
|
||||
dest->get_tgba_condition());
|
||||
ta->create_transition(source, cs,
|
||||
tgba_acceptance_conditions, dest);
|
||||
}
|
||||
}
|
||||
tgba_state->destroy();
|
||||
}
|
||||
delete twa_succ_it;
|
||||
}
|
||||
|
||||
if (no_livelock)
|
||||
return ta;
|
||||
return ta;
|
||||
|
||||
state_ta_explicit* artificial_livelock_acc_state = nullptr;
|
||||
|
||||
trace << "*** build_ta: artificial_livelock_acc_state_mode = ***"
|
||||
<< artificial_livelock_state_mode << std::endl;
|
||||
<< artificial_livelock_state_mode << std::endl;
|
||||
|
||||
if (artificial_livelock_state_mode)
|
||||
{
|
||||
single_pass_emptiness_check = true;
|
||||
artificial_livelock_acc_state =
|
||||
new state_ta_explicit(ta->get_tgba()->get_init_state(), bddtrue,
|
||||
false, false, true, nullptr);
|
||||
trace
|
||||
<< "*** build_ta: artificial_livelock_acc_state = ***"
|
||||
<< artificial_livelock_acc_state << std::endl;
|
||||
}
|
||||
{
|
||||
single_pass_emptiness_check = true;
|
||||
artificial_livelock_acc_state =
|
||||
new state_ta_explicit(ta->get_tgba()->get_init_state(), bddtrue,
|
||||
false, false, true, nullptr);
|
||||
trace
|
||||
<< "*** build_ta: artificial_livelock_acc_state = ***"
|
||||
<< artificial_livelock_acc_state << std::endl;
|
||||
}
|
||||
|
||||
compute_livelock_acceptance_states(ta, single_pass_emptiness_check,
|
||||
artificial_livelock_acc_state);
|
||||
artificial_livelock_acc_state);
|
||||
return ta;
|
||||
}
|
||||
}
|
||||
|
||||
ta_explicit_ptr
|
||||
tgba_to_ta(const const_twa_ptr& tgba_, bdd atomic_propositions_set_,
|
||||
bool degeneralized, bool artificial_initial_state_mode,
|
||||
bool single_pass_emptiness_check,
|
||||
bool artificial_livelock_state_mode,
|
||||
bool no_livelock)
|
||||
bool degeneralized, bool artificial_initial_state_mode,
|
||||
bool single_pass_emptiness_check,
|
||||
bool artificial_livelock_state_mode,
|
||||
bool no_livelock)
|
||||
{
|
||||
ta_explicit_ptr ta;
|
||||
|
||||
|
|
@ -555,10 +555,10 @@ namespace spot
|
|||
if (artificial_initial_state_mode)
|
||||
{
|
||||
state_ta_explicit* artificial_init_state =
|
||||
new state_ta_explicit(tgba_init_state->clone(), bddfalse, true);
|
||||
new state_ta_explicit(tgba_init_state->clone(), bddfalse, true);
|
||||
|
||||
ta = make_ta_explicit(tgba_, tgba_->acc().num_sets(),
|
||||
artificial_init_state);
|
||||
artificial_init_state);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -568,8 +568,8 @@ namespace spot
|
|||
|
||||
// build ta automaton
|
||||
build_ta(ta, atomic_propositions_set_, degeneralized,
|
||||
single_pass_emptiness_check, artificial_livelock_state_mode,
|
||||
no_livelock);
|
||||
single_pass_emptiness_check, artificial_livelock_state_mode,
|
||||
no_livelock);
|
||||
|
||||
// (degeneralized=true) => TA
|
||||
if (degeneralized)
|
||||
|
|
@ -589,8 +589,8 @@ namespace spot
|
|||
state_ta_explicit::transitions::iterator it_trans;
|
||||
|
||||
for (it_trans = trans->begin(); it_trans != trans->end();
|
||||
++it_trans)
|
||||
(*it_trans)->acceptance_conditions = ta->acc().all_sets();
|
||||
++it_trans)
|
||||
(*it_trans)->acceptance_conditions = ta->acc().all_sets();
|
||||
|
||||
state->set_accepting_state(false);
|
||||
}
|
||||
|
|
@ -604,11 +604,11 @@ namespace spot
|
|||
{
|
||||
auto tgba_init_state = tgba_->get_init_state();
|
||||
auto artificial_init_state = new state_ta_explicit(tgba_init_state->clone(),
|
||||
bddfalse, true);
|
||||
bddfalse, true);
|
||||
tgba_init_state->destroy();
|
||||
|
||||
auto tgta = make_tgta_explicit(tgba_, tgba_->acc().num_sets(),
|
||||
artificial_init_state);
|
||||
artificial_init_state);
|
||||
|
||||
// build a Generalized TA automaton involving a single_pass_emptiness_check
|
||||
// (without an artificial livelock state):
|
||||
|
|
@ -625,14 +625,14 @@ namespace spot
|
|||
initial_states_iter->first();
|
||||
if (initial_states_iter->done())
|
||||
{
|
||||
delete initial_states_iter;
|
||||
return tgta;
|
||||
delete initial_states_iter;
|
||||
return tgta;
|
||||
}
|
||||
bdd first_state_condition = initial_states_iter->cond();
|
||||
delete initial_states_iter;
|
||||
|
||||
bdd bdd_stutering_transition = bdd_setxor(first_state_condition,
|
||||
first_state_condition);
|
||||
first_state_condition);
|
||||
|
||||
for (it = states_set.begin(); it != states_set.end(); ++it)
|
||||
{
|
||||
|
|
@ -645,13 +645,13 @@ namespace spot
|
|||
if (trans_empty || state->is_accepting_state())
|
||||
{
|
||||
ta->create_transition(state, bdd_stutering_transition,
|
||||
ta->acc().all_sets(), state);
|
||||
ta->acc().all_sets(), state);
|
||||
}
|
||||
}
|
||||
|
||||
if (state->compare(ta->get_artificial_initial_state()))
|
||||
ta->create_transition(state, bdd_stutering_transition,
|
||||
0U, state);
|
||||
0U, state);
|
||||
|
||||
state->set_livelock_accepting_state(false);
|
||||
state->set_accepting_state(false);
|
||||
|
|
|
|||
|
|
@ -83,11 +83,11 @@ namespace spot
|
|||
/// TGBA \a tgba_to_convert.
|
||||
SPOT_API ta_explicit_ptr
|
||||
tgba_to_ta(const const_twa_ptr& tgba_to_convert, bdd atomic_propositions_set,
|
||||
bool degeneralized = true,
|
||||
bool artificial_initial_state_mode = true,
|
||||
bool single_pass_emptiness_check = false,
|
||||
bool artificial_livelock_state_mode = false,
|
||||
bool no_livelock = false);
|
||||
bool degeneralized = true,
|
||||
bool artificial_initial_state_mode = true,
|
||||
bool single_pass_emptiness_check = false,
|
||||
bool artificial_livelock_state_mode = false,
|
||||
bool no_livelock = false);
|
||||
|
||||
/// \ingroup tgba_ta
|
||||
/// \brief Build a spot::tgta_explicit* (TGTA) from an LTL formula.
|
||||
|
|
@ -100,5 +100,5 @@ namespace spot
|
|||
/// language as the TGBA \a tgba_to_convert.
|
||||
SPOT_API tgta_explicit_ptr
|
||||
tgba_to_tgta(const const_twa_ptr& tgba_to_convert,
|
||||
bdd atomic_propositions_set);
|
||||
bdd atomic_propositions_set);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue