Handle all automata through shared_ptr. (monstro patch)
A type such as 'const tgba_digraph*' and 'tgba_digraph*' are replaced by 'const_tgba_digraph_ptr' and 'tgba_digraph_ptr'. Additionally 'new tgba_digraph(...)' is replaced by 'make_tgba_digraph(...)'. This convention is followed by all automata types. Those smart pointers should normally be passed by const reference as input of function to avoid the atomic increments/decrements, but I probably missed a few, as this huge patch took me nearly 12h. * src/kripke/fwd.hh, src/tgba/fwd.hh: New files. * src/kripke/Makefile.am, src/tgba/Makefile.am: Adjust. * iface/dve2/dve2.cc, iface/dve2/dve2.hh, iface/dve2/dve2check.cc, src/bin/common_output.hh, src/bin/dstar2tgba.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc, src/bin/ltlcross.cc, src/bin/ltlfilt.cc, src/dstarparse/dra2ba.cc, src/dstarparse/dstar2tgba.cc, src/dstarparse/dstarparse.yy, src/dstarparse/nra2nba.cc, src/dstarparse/nsa2tgba.cc, src/dstarparse/public.hh, src/graphtest/tgbagraph.cc, src/kripke/fairkripke.hh, src/kripke/kripke.hh, src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh, src/kripke/kripkeprint.cc, src/kripke/kripkeprint.hh, src/kripkeparse/kripkeparse.yy, src/kripkeparse/public.hh, src/kripketest/parse_print_test.cc, src/ltlvisit/apcollect.cc, src/ltlvisit/apcollect.hh, src/ltlvisit/contain.cc, src/ltlvisit/contain.hh, src/neverparse/neverclaimparse.yy, src/neverparse/public.hh, src/priv/accmap.hh, src/priv/countstates.cc, src/priv/countstates.hh, src/saba/saba.hh, src/saba/sabacomplementtgba.cc, src/saba/sabacomplementtgba.hh, src/sabaalgos/sabadotty.cc, src/sabaalgos/sabadotty.hh, src/sabaalgos/sabareachiter.cc, src/sabaalgos/sabareachiter.hh, src/sabatest/sabacomplementtgba.cc, src/ta/ta.hh, src/ta/taexplicit.cc, src/ta/taexplicit.hh, src/ta/taproduct.cc, src/ta/taproduct.hh, src/ta/tgta.hh, src/ta/tgtaexplicit.cc, src/ta/tgtaexplicit.hh, src/ta/tgtaproduct.cc, src/ta/tgtaproduct.hh, src/taalgos/dotty.cc, src/taalgos/dotty.hh, src/taalgos/emptinessta.cc, src/taalgos/emptinessta.hh, src/taalgos/minimize.cc, src/taalgos/minimize.hh, src/taalgos/reachiter.cc, src/taalgos/reachiter.hh, src/taalgos/statessetbuilder.cc, src/taalgos/statessetbuilder.hh, src/taalgos/stats.cc, src/taalgos/stats.hh, src/taalgos/tgba2ta.cc, src/taalgos/tgba2ta.hh, src/tgba/bdddict.cc, src/tgba/bdddict.hh, src/tgba/formula2bdd.hh, src/tgba/futurecondcol.cc, src/tgba/futurecondcol.hh, src/tgba/taatgba.hh, src/tgba/tgba.cc, src/tgba/tgba.hh, src/tgba/tgbagraph.hh, src/tgba/tgbakvcomplement.cc, src/tgba/tgbakvcomplement.hh, src/tgba/tgbamask.cc, src/tgba/tgbamask.hh, src/tgba/tgbaproduct.cc, src/tgba/tgbaproduct.hh, src/tgba/tgbaproxy.cc, src/tgba/tgbaproxy.hh, src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh, src/tgba/tgbascc.cc, src/tgba/tgbascc.hh, src/tgba/tgbasgba.cc, src/tgba/tgbasgba.hh, src/tgba/wdbacomp.cc, src/tgba/wdbacomp.hh, src/tgbaalgos/bfssteps.cc, src/tgbaalgos/bfssteps.hh, src/tgbaalgos/complete.cc, src/tgbaalgos/complete.hh, src/tgbaalgos/compsusp.cc, src/tgbaalgos/compsusp.hh, src/tgbaalgos/cycles.hh, src/tgbaalgos/degen.cc, src/tgbaalgos/degen.hh, src/tgbaalgos/dotty.cc, src/tgbaalgos/dotty.hh, src/tgbaalgos/dottydec.cc, src/tgbaalgos/dottydec.hh, src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtbasat.hh, src/tgbaalgos/dtgbacomp.cc, src/tgbaalgos/dtgbacomp.hh, src/tgbaalgos/dtgbasat.cc, src/tgbaalgos/dtgbasat.hh, src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh, src/tgbaalgos/emptiness.cc, src/tgbaalgos/emptiness.hh, src/tgbaalgos/gtec/gtec.cc, src/tgbaalgos/gtec/gtec.hh, src/tgbaalgos/gtec/status.cc, src/tgbaalgos/gtec/status.hh, src/tgbaalgos/gv04.cc, src/tgbaalgos/gv04.hh, src/tgbaalgos/isdet.cc, src/tgbaalgos/isdet.hh, src/tgbaalgos/isweakscc.cc, src/tgbaalgos/lbtt.cc, src/tgbaalgos/lbtt.hh, src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2taa.hh, src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/magic.cc, src/tgbaalgos/magic.hh, src/tgbaalgos/minimize.cc, src/tgbaalgos/minimize.hh, src/tgbaalgos/ndfs_result.hxx, src/tgbaalgos/neverclaim.cc, src/tgbaalgos/neverclaim.hh, src/tgbaalgos/postproc.cc, src/tgbaalgos/postproc.hh, src/tgbaalgos/powerset.cc, src/tgbaalgos/powerset.hh, src/tgbaalgos/projrun.cc, src/tgbaalgos/projrun.hh, src/tgbaalgos/randomgraph.cc, src/tgbaalgos/randomgraph.hh, src/tgbaalgos/reachiter.cc, src/tgbaalgos/reachiter.hh, src/tgbaalgos/reducerun.cc, src/tgbaalgos/reducerun.hh, src/tgbaalgos/replayrun.cc, src/tgbaalgos/replayrun.hh, src/tgbaalgos/rundotdec.cc, src/tgbaalgos/rundotdec.hh, src/tgbaalgos/safety.cc, src/tgbaalgos/safety.hh, src/tgbaalgos/save.cc, src/tgbaalgos/save.hh, src/tgbaalgos/scc.cc, src/tgbaalgos/scc.hh, src/tgbaalgos/sccfilter.cc, src/tgbaalgos/sccfilter.hh, src/tgbaalgos/sccinfo.cc, src/tgbaalgos/sccinfo.hh, src/tgbaalgos/se05.cc, src/tgbaalgos/se05.hh, src/tgbaalgos/simulation.cc, src/tgbaalgos/simulation.hh, src/tgbaalgos/stats.cc, src/tgbaalgos/stats.hh, src/tgbaalgos/stripacc.cc, src/tgbaalgos/stripacc.hh, src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03.hh, src/tgbaalgos/tau03opt.cc, src/tgbaalgos/tau03opt.hh, src/tgbaalgos/translate.cc, src/tgbaalgos/translate.hh, src/tgbaparse/public.hh, src/tgbaparse/tgbaparse.yy, src/tgbatest/complementation.cc, src/tgbatest/explprod.cc, src/tgbatest/ltl2tgba.cc, src/tgbatest/ltlprod.cc, src/tgbatest/maskacc.cc, src/tgbatest/powerset.cc, src/tgbatest/randtgba.cc, src/tgbatest/taatgba.cc, src/tgbatest/tgbaread.cc, src/tgbatest/tripprod.cc, wrap/python/ajax/spot.in, wrap/python/spot.i, wrap/python/tests/interdep.py: Use shared pointers for automata.
This commit is contained in:
parent
ca85d4184d
commit
51151ab271
195 changed files with 1792 additions and 1837 deletions
|
|
@ -997,7 +997,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
kripke*
|
kripke_ptr
|
||||||
load_dve2(const std::string& file_arg, bdd_dict_ptr dict,
|
load_dve2(const std::string& file_arg, bdd_dict_ptr dict,
|
||||||
const ltl::atomic_prop_set* to_observe,
|
const ltl::atomic_prop_set* to_observe,
|
||||||
const ltl::formula* dead,
|
const ltl::formula* dead,
|
||||||
|
|
@ -1112,6 +1112,6 @@ namespace spot
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new dve2_kripke(d, dict, ps, dead, compress);
|
return std::make_shared<dve2_kripke>(d, dict, ps, dead, compress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ namespace spot
|
||||||
// \a dead an atomic proposition or constant to use for looping on
|
// \a dead an atomic proposition or constant to use for looping on
|
||||||
// dead states
|
// dead states
|
||||||
// \a verbose whether to output verbose messages
|
// \a verbose whether to output verbose messages
|
||||||
SPOT_API kripke*
|
SPOT_API kripke_ptr
|
||||||
load_dve2(const std::string& file, bdd_dict_ptr dict,
|
load_dve2(const std::string& file, bdd_dict_ptr dict,
|
||||||
const ltl::atomic_prop_set* to_observe,
|
const ltl::atomic_prop_set* to_observe,
|
||||||
const ltl::formula* dead = ltl::constant::true_instance(),
|
const ltl::formula* dead = ltl::constant::true_instance(),
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ Options:\n\
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
checked_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
spot::timer_map tm;
|
spot::timer_map tm;
|
||||||
|
|
||||||
|
|
@ -157,14 +157,14 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
spot::ltl::atomic_prop_set ap;
|
spot::ltl::atomic_prop_set ap;
|
||||||
auto dict = spot::make_bdd_dict();
|
auto dict = spot::make_bdd_dict();
|
||||||
spot::kripke* model = 0;
|
spot::const_kripke_ptr model = 0;
|
||||||
const spot::tgba* prop = 0;
|
spot::const_tgba_ptr prop = 0;
|
||||||
spot::tgba* product = 0;
|
spot::const_tgba_ptr product = 0;
|
||||||
spot::emptiness_check_instantiator* echeck_inst = 0;
|
spot::emptiness_check_instantiator* echeck_inst = 0;
|
||||||
int exit_code = 0;
|
int exit_code = 0;
|
||||||
const spot::ltl::formula* f = 0;
|
|
||||||
const spot::ltl::formula* deadf = 0;
|
|
||||||
spot::postprocessor post;
|
spot::postprocessor post;
|
||||||
|
const spot::ltl::formula* deadf = 0;
|
||||||
|
const spot::ltl::formula* f = 0;
|
||||||
|
|
||||||
if (dead == 0 || !strcasecmp(dead, "true"))
|
if (dead == 0 || !strcasecmp(dead, "true"))
|
||||||
{
|
{
|
||||||
|
|
@ -252,7 +252,7 @@ main(int argc, char **argv)
|
||||||
goto safe_exit;
|
goto safe_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
product = new spot::tgba_product(model, prop);
|
product = spot::product(model, prop);
|
||||||
|
|
||||||
if (output == DotProduct)
|
if (output == DotProduct)
|
||||||
{
|
{
|
||||||
|
|
@ -362,9 +362,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
safe_exit:
|
safe_exit:
|
||||||
delete echeck_inst;
|
delete echeck_inst;
|
||||||
delete product;
|
|
||||||
delete prop;
|
|
||||||
delete model;
|
|
||||||
if (f)
|
if (f)
|
||||||
f->destroy();
|
f->destroy();
|
||||||
|
|
||||||
|
|
@ -373,15 +370,24 @@ main(int argc, char **argv)
|
||||||
if (use_timer)
|
if (use_timer)
|
||||||
tm.print(std::cout);
|
tm.print(std::cout);
|
||||||
tm.reset_all(); // This helps valgrind.
|
tm.reset_all(); // This helps valgrind.
|
||||||
|
return exit_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
auto exit_code = checked_main(argc, argv);
|
||||||
|
|
||||||
|
// Additional checks to debug reference counts in formulas.
|
||||||
spot::ltl::atomic_prop::dump_instances(std::cerr);
|
spot::ltl::atomic_prop::dump_instances(std::cerr);
|
||||||
spot::ltl::unop::dump_instances(std::cerr);
|
spot::ltl::unop::dump_instances(std::cerr);
|
||||||
spot::ltl::binop::dump_instances(std::cerr);
|
spot::ltl::binop::dump_instances(std::cerr);
|
||||||
spot::ltl::multop::dump_instances(std::cerr);
|
spot::ltl::multop::dump_instances(std::cerr);
|
||||||
|
spot::ltl::bunop::dump_instances(std::cerr);
|
||||||
assert(spot::ltl::atomic_prop::instance_count() == 0);
|
assert(spot::ltl::atomic_prop::instance_count() == 0);
|
||||||
assert(spot::ltl::unop::instance_count() == 0);
|
assert(spot::ltl::unop::instance_count() == 0);
|
||||||
assert(spot::ltl::binop::instance_count() == 0);
|
assert(spot::ltl::binop::instance_count() == 0);
|
||||||
assert(spot::ltl::multop::instance_count() == 0);
|
assert(spot::ltl::multop::instance_count() == 0);
|
||||||
|
assert(spot::ltl::bunop::instance_count() == 0);
|
||||||
exit(exit_code);
|
exit(exit_code);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Développement
|
// Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et Développement
|
||||||
// de l'Epita (LRDE).
|
// de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -73,7 +73,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
print(const spot::tgba* aut, const spot::ltl::formula* f = 0,
|
print(const spot::const_tgba_ptr& aut,
|
||||||
|
const spot::ltl::formula* f = 0,
|
||||||
double run_time = -1.)
|
double run_time = -1.)
|
||||||
{
|
{
|
||||||
formula_ = f;
|
formula_ = f;
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,8 @@ namespace
|
||||||
/// The \a f argument is not needed if the Formula does not need
|
/// The \a f argument is not needed if the Formula does not need
|
||||||
/// to be output.
|
/// to be output.
|
||||||
std::ostream&
|
std::ostream&
|
||||||
print(const spot::dstar_aut* daut, const spot::tgba* aut,
|
print(const spot::const_dstar_aut_ptr& daut,
|
||||||
|
const spot::const_tgba_ptr& aut,
|
||||||
const char* filename, double run_time)
|
const char* filename, double run_time)
|
||||||
{
|
{
|
||||||
filename_ = filename;
|
filename_ = filename;
|
||||||
|
|
@ -292,17 +293,11 @@ namespace
|
||||||
process_file(const char* filename)
|
process_file(const char* filename)
|
||||||
{
|
{
|
||||||
spot::dstar_parse_error_list pel;
|
spot::dstar_parse_error_list pel;
|
||||||
spot::dstar_aut* daut;
|
auto daut = spot::dstar_parse(filename, pel, spot::make_bdd_dict());
|
||||||
daut = spot::dstar_parse(filename, pel, spot::make_bdd_dict());
|
|
||||||
if (spot::format_dstar_parse_errors(std::cerr, filename, pel))
|
if (spot::format_dstar_parse_errors(std::cerr, filename, pel))
|
||||||
{
|
|
||||||
delete daut;
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
|
||||||
if (!daut)
|
if (!daut)
|
||||||
{
|
|
||||||
error(2, 0, "failed to read automaton from %s", filename);
|
error(2, 0, "failed to read automaton from %s", filename);
|
||||||
}
|
|
||||||
|
|
||||||
const xtime_t before = gethrxtime();
|
const xtime_t before = gethrxtime();
|
||||||
|
|
||||||
|
|
@ -336,8 +331,6 @@ namespace
|
||||||
statistics.print(daut, aut, filename, conversion_time) << '\n';
|
statistics.print(daut, aut, filename, conversion_time) << '\n';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delete aut;
|
|
||||||
delete daut;
|
|
||||||
flush_cout();
|
flush_cout();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ namespace
|
||||||
const char* filename = 0, int linenum = 0)
|
const char* filename = 0, int linenum = 0)
|
||||||
{
|
{
|
||||||
const xtime_t before = gethrxtime();
|
const xtime_t before = gethrxtime();
|
||||||
const spot::tgba* aut = trans.run(&f);
|
auto aut = trans.run(&f);
|
||||||
const xtime_t after = gethrxtime();
|
const xtime_t after = gethrxtime();
|
||||||
const double prec = XTIME_PRECISION;
|
const double prec = XTIME_PRECISION;
|
||||||
const double translation_time = (after - before) / prec;
|
const double translation_time = (after - before) / prec;
|
||||||
|
|
@ -254,7 +254,6 @@ namespace
|
||||||
statistics.print(aut, f, translation_time) << '\n';
|
statistics.print(aut, f, translation_time) << '\n';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delete aut;
|
|
||||||
f->destroy();
|
f->destroy();
|
||||||
flush_cout();
|
flush_cout();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ namespace
|
||||||
process_formula(const spot::ltl::formula* f,
|
process_formula(const spot::ltl::formula* f,
|
||||||
const char* filename = 0, int linenum = 0)
|
const char* filename = 0, int linenum = 0)
|
||||||
{
|
{
|
||||||
const spot::tgba* aut = trans.run(&f);
|
auto aut = trans.run(&f);
|
||||||
|
|
||||||
// This should not happen, because the parser we use can only
|
// This should not happen, because the parser we use can only
|
||||||
// read PSL/LTL formula, but since our ltl::formula* type can
|
// read PSL/LTL formula, but since our ltl::formula* type can
|
||||||
|
|
@ -189,36 +189,22 @@ namespace
|
||||||
|
|
||||||
if (ta_type != TGTA)
|
if (ta_type != TGTA)
|
||||||
{
|
{
|
||||||
spot::ta* testing_automaton =
|
auto testing_automaton =
|
||||||
tgba_to_ta(aut, ap_set, type == spot::postprocessor::BA,
|
tgba_to_ta(aut, ap_set, type == spot::postprocessor::BA,
|
||||||
opt_with_artificial_initial_state,
|
opt_with_artificial_initial_state,
|
||||||
opt_single_pass_emptiness_check,
|
opt_single_pass_emptiness_check,
|
||||||
opt_with_artificial_livelock);
|
opt_with_artificial_livelock);
|
||||||
if (level != spot::postprocessor::Low)
|
if (level != spot::postprocessor::Low)
|
||||||
{
|
|
||||||
spot::ta* testing_automaton_nm = testing_automaton;
|
|
||||||
testing_automaton = spot::minimize_ta(testing_automaton);
|
testing_automaton = spot::minimize_ta(testing_automaton);
|
||||||
delete testing_automaton_nm;
|
|
||||||
}
|
|
||||||
spot::dotty_reachable(std::cout, testing_automaton);
|
spot::dotty_reachable(std::cout, testing_automaton);
|
||||||
delete testing_automaton;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spot::tgta_explicit* tgta = tgba_to_tgta(aut, ap_set);
|
auto tgta = tgba_to_tgta(aut, ap_set);
|
||||||
if (level != spot::postprocessor::Low)
|
if (level != spot::postprocessor::Low)
|
||||||
{
|
tgta = spot::minimize_tgta(tgta);
|
||||||
spot::tgta_explicit* a = spot::minimize_tgta(tgta);
|
spot::dotty_reachable(std::cout, tgta->get_ta());
|
||||||
delete tgta;
|
|
||||||
tgta = a;
|
|
||||||
}
|
}
|
||||||
spot::dotty_reachable(std::cout,
|
|
||||||
dynamic_cast<spot::tgta_explicit*>(tgta)
|
|
||||||
->get_ta());
|
|
||||||
delete tgta;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete aut;
|
|
||||||
f->destroy();
|
f->destroy();
|
||||||
flush_cout();
|
flush_cout();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -848,7 +848,7 @@ namespace
|
||||||
string_to_tmp(string_ltl_wring, serial, filename_ltl_wring);
|
string_to_tmp(string_ltl_wring, serial, filename_ltl_wring);
|
||||||
}
|
}
|
||||||
|
|
||||||
const spot::tgba*
|
spot::const_tgba_ptr
|
||||||
translate(unsigned int translator_num, char l, statistics_formula* fstats)
|
translate(unsigned int translator_num, char l, statistics_formula* fstats)
|
||||||
{
|
{
|
||||||
output.reset(translator_num);
|
output.reset(translator_num);
|
||||||
|
|
@ -867,7 +867,7 @@ namespace
|
||||||
|
|
||||||
const char* status_str = 0;
|
const char* status_str = 0;
|
||||||
|
|
||||||
const spot::tgba* res = 0;
|
spot::const_tgba_ptr res = 0;
|
||||||
if (timed_out)
|
if (timed_out)
|
||||||
{
|
{
|
||||||
// This is not considered to be a global error.
|
// This is not considered to be a global error.
|
||||||
|
|
@ -911,8 +911,7 @@ namespace
|
||||||
err << "error: failed to parse the produced neverclaim.\n";
|
err << "error: failed to parse the produced neverclaim.\n";
|
||||||
spot::format_neverclaim_parse_errors(err, filename, pel);
|
spot::format_neverclaim_parse_errors(err, filename, pel);
|
||||||
end_error();
|
end_error();
|
||||||
delete res;
|
res = nullptr;
|
||||||
res = 0;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -947,8 +946,7 @@ namespace
|
||||||
{
|
{
|
||||||
spot::dstar_parse_error_list pel;
|
spot::dstar_parse_error_list pel;
|
||||||
std::string filename = output.val()->name();
|
std::string filename = output.val()->name();
|
||||||
spot::dstar_aut* aut;
|
auto aut = spot::dstar_parse(filename, pel, dict);
|
||||||
aut = spot::dstar_parse(filename, pel, dict);
|
|
||||||
if (!pel.empty())
|
if (!pel.empty())
|
||||||
{
|
{
|
||||||
status_str = "parse error";
|
status_str = "parse error";
|
||||||
|
|
@ -958,8 +956,7 @@ namespace
|
||||||
" output.\n";
|
" output.\n";
|
||||||
spot::format_dstar_parse_errors(err, filename, pel);
|
spot::format_dstar_parse_errors(err, filename, pel);
|
||||||
end_error();
|
end_error();
|
||||||
delete aut;
|
res = nullptr;
|
||||||
res = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -992,7 +989,6 @@ namespace
|
||||||
}
|
}
|
||||||
// convert it into TGBA for further processing
|
// convert it into TGBA for further processing
|
||||||
res = dstar_to_tgba(aut);
|
res = dstar_to_tgba(aut);
|
||||||
delete aut;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1049,10 +1045,11 @@ namespace
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_empty_prod(const spot::tgba* aut_i, const spot::tgba* aut_j,
|
check_empty_prod(const spot::const_tgba_ptr& aut_i,
|
||||||
|
const spot::const_tgba_ptr& aut_j,
|
||||||
size_t i, size_t j, bool icomp, bool jcomp)
|
size_t i, size_t j, bool icomp, bool jcomp)
|
||||||
{
|
{
|
||||||
spot::tgba_product* prod = new spot::tgba_product(aut_i, aut_j);
|
auto prod = spot::product(aut_i, aut_j);
|
||||||
spot::emptiness_check* ec = spot::couvreur99(prod);
|
spot::emptiness_check* ec = spot::couvreur99(prod);
|
||||||
spot::emptiness_check_result* res = ec->check();
|
spot::emptiness_check_result* res = ec->check();
|
||||||
|
|
||||||
|
|
@ -1090,7 +1087,6 @@ namespace
|
||||||
}
|
}
|
||||||
delete res;
|
delete res;
|
||||||
delete ec;
|
delete ec;
|
||||||
delete prod;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1154,16 +1150,18 @@ namespace
|
||||||
// Collect all the states of SSPACE that appear in the accepting SCCs
|
// Collect all the states of SSPACE that appear in the accepting SCCs
|
||||||
// of PROD.
|
// of PROD.
|
||||||
static void
|
static void
|
||||||
states_in_acc(const spot::scc_map* m, const spot::tgba* sspace,
|
states_in_acc(const spot::scc_map* m,
|
||||||
|
const spot::const_tgba_ptr& sspace,
|
||||||
state_set& s)
|
state_set& s)
|
||||||
{
|
{
|
||||||
const spot::tgba* aut = m->get_aut();
|
auto aut = m->get_aut();
|
||||||
unsigned c = m->scc_count();
|
unsigned c = m->scc_count();
|
||||||
for (unsigned n = 0; n < c; ++n)
|
for (unsigned n = 0; n < c; ++n)
|
||||||
if (m->accepting(n))
|
if (m->accepting(n))
|
||||||
for (auto i: m->states_of(n))
|
for (auto i: m->states_of(n))
|
||||||
{
|
{
|
||||||
spot::state* x = aut->project_state(i, sspace);
|
spot::state* x = aut->project_state(i, sspace);
|
||||||
|
assert(x);
|
||||||
if (!s.insert(x).second)
|
if (!s.insert(x).second)
|
||||||
x->destroy();
|
x->destroy();
|
||||||
}
|
}
|
||||||
|
|
@ -1171,7 +1169,7 @@ namespace
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
consistency_check(const spot::scc_map* pos, const spot::scc_map* neg,
|
consistency_check(const spot::scc_map* pos, const spot::scc_map* neg,
|
||||||
const spot::tgba* sspace)
|
const spot::const_tgba_ptr& sspace)
|
||||||
{
|
{
|
||||||
// the states of SSPACE should appear in the accepting SCC of at
|
// the states of SSPACE should appear in the accepting SCC of at
|
||||||
// least one of POS or NEG. Maybe both.
|
// least one of POS or NEG. Maybe both.
|
||||||
|
|
@ -1266,12 +1264,12 @@ namespace
|
||||||
// These store the result of the translation of the positive and
|
// These store the result of the translation of the positive and
|
||||||
// negative formulas.
|
// negative formulas.
|
||||||
size_t m = translators.size();
|
size_t m = translators.size();
|
||||||
std::vector<const spot::tgba*> pos(m);
|
std::vector<spot::const_tgba_ptr> pos(m);
|
||||||
std::vector<const spot::tgba*> neg(m);
|
std::vector<spot::const_tgba_ptr> neg(m);
|
||||||
// These store the complement of the above results, when we can
|
// These store the complement of the above results, when we can
|
||||||
// compute it easily.
|
// compute it easily.
|
||||||
std::vector<const spot::tgba*> comp_pos(m);
|
std::vector<spot::const_tgba_ptr> comp_pos(m);
|
||||||
std::vector<const spot::tgba*> comp_neg(m);
|
std::vector<spot::const_tgba_ptr> comp_neg(m);
|
||||||
|
|
||||||
|
|
||||||
unsigned n = vstats.size();
|
unsigned n = vstats.size();
|
||||||
|
|
@ -1400,20 +1398,19 @@ namespace
|
||||||
{
|
{
|
||||||
// build a random state-space.
|
// build a random state-space.
|
||||||
spot::srand(seed);
|
spot::srand(seed);
|
||||||
spot::tgba* statespace = spot::random_graph(states, density,
|
auto statespace = spot::random_graph(states, density, ap, dict);
|
||||||
ap, dict);
|
|
||||||
|
|
||||||
// Products of the state space with the positive automata.
|
// Products of the state space with the positive automata.
|
||||||
std::vector<spot::tgba*> pos_prod(m);
|
std::vector<spot::const_tgba_ptr> pos_prod(m);
|
||||||
// Products of the state space with the negative automata.
|
// Products of the state space with the negative automata.
|
||||||
std::vector<spot::tgba*> neg_prod(m);
|
std::vector<spot::const_tgba_ptr> neg_prod(m);
|
||||||
// Associated SCC maps.
|
// Associated SCC maps.
|
||||||
std::vector<spot::scc_map*> pos_map(m);
|
std::vector<spot::scc_map*> pos_map(m);
|
||||||
std::vector<spot::scc_map*> neg_map(m);
|
std::vector<spot::scc_map*> neg_map(m);
|
||||||
for (size_t i = 0; i < m; ++i)
|
for (size_t i = 0; i < m; ++i)
|
||||||
if (pos[i])
|
if (pos[i])
|
||||||
{
|
{
|
||||||
spot::tgba* p = new spot::tgba_product(pos[i], statespace);
|
auto p = spot::product(pos[i], statespace);
|
||||||
pos_prod[i] = p;
|
pos_prod[i] = p;
|
||||||
spot::scc_map* sm = new spot::scc_map(p);
|
spot::scc_map* sm = new spot::scc_map(p);
|
||||||
sm->build_map();
|
sm->build_map();
|
||||||
|
|
@ -1433,7 +1430,7 @@ namespace
|
||||||
for (size_t i = 0; i < m; ++i)
|
for (size_t i = 0; i < m; ++i)
|
||||||
if (neg[i])
|
if (neg[i])
|
||||||
{
|
{
|
||||||
spot::tgba* p = new spot::tgba_product(neg[i], statespace);
|
auto p = spot::product(neg[i], statespace);
|
||||||
neg_prod[i] = p;
|
neg_prod[i] = p;
|
||||||
spot::scc_map* sm = new spot::scc_map(p);
|
spot::scc_map* sm = new spot::scc_map(p);
|
||||||
sm->build_map();
|
sm->build_map();
|
||||||
|
|
@ -1475,31 +1472,14 @@ namespace
|
||||||
// Cleanup.
|
// Cleanup.
|
||||||
if (!no_checks)
|
if (!no_checks)
|
||||||
for (size_t i = 0; i < m; ++i)
|
for (size_t i = 0; i < m; ++i)
|
||||||
{
|
|
||||||
delete neg_map[i];
|
delete neg_map[i];
|
||||||
delete neg_prod[i];
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < m; ++i)
|
for (size_t i = 0; i < m; ++i)
|
||||||
{
|
|
||||||
delete pos_map[i];
|
delete pos_map[i];
|
||||||
delete pos_prod[i];
|
|
||||||
}
|
|
||||||
delete statespace;
|
|
||||||
++seed;
|
++seed;
|
||||||
}
|
}
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
delete ap;
|
delete ap;
|
||||||
|
|
||||||
if (!no_checks)
|
|
||||||
for (size_t i = 0; i < m; ++i)
|
|
||||||
{
|
|
||||||
delete neg[i];
|
|
||||||
delete comp_neg[i];
|
|
||||||
delete comp_pos[i];
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < m; ++i)
|
|
||||||
delete pos[i];
|
|
||||||
|
|
||||||
// Shall we stop processing formulas now?
|
// Shall we stop processing formulas now?
|
||||||
abort_run = global_error_flag && stop_on_error;
|
abort_run = global_error_flag && stop_on_error;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -560,9 +560,7 @@ namespace
|
||||||
{
|
{
|
||||||
matched &= !guarantee || is_guarantee_automaton(min);
|
matched &= !guarantee || is_guarantee_automaton(min);
|
||||||
matched &= !safety || is_safety_mwdba(min);
|
matched &= !safety || is_safety_mwdba(min);
|
||||||
delete min;
|
|
||||||
}
|
}
|
||||||
delete aut;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
matched ^= invert;
|
matched ^= invert;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,8 @@ namespace spot
|
||||||
|
|
||||||
// This function is defined in nra2nba.cc, and used only here.
|
// This function is defined in nra2nba.cc, and used only here.
|
||||||
SPOT_LOCAL
|
SPOT_LOCAL
|
||||||
tgba_digraph* nra_to_nba(const dstar_aut* nra, const tgba* aut);
|
tgba_digraph_ptr nra_to_nba(const const_dstar_aut_ptr& nra,
|
||||||
|
const const_tgba_ptr& aut);
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -63,15 +64,15 @@ namespace spot
|
||||||
// retrive acceptances.
|
// retrive acceptances.
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
filter_states(const tgba* aut,
|
filter_states(const const_tgba_ptr& aut,
|
||||||
const dstar_aut* dra,
|
const const_dstar_aut_ptr& dra,
|
||||||
const state_list& sl,
|
const state_list& sl,
|
||||||
state_list& final,
|
state_list& final,
|
||||||
state_list& nonfinal);
|
state_list& nonfinal);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
filter_scc(const tgba* aut,
|
filter_scc(const const_tgba_ptr& aut,
|
||||||
const dstar_aut* dra,
|
const const_dstar_aut_ptr& dra,
|
||||||
state_list& final,
|
state_list& final,
|
||||||
state_list& nonfinal)
|
state_list& nonfinal)
|
||||||
{
|
{
|
||||||
|
|
@ -97,8 +98,8 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
filter_states(const tgba* aut,
|
filter_states(const const_tgba_ptr& aut,
|
||||||
const dstar_aut* dra,
|
const const_dstar_aut_ptr& dra,
|
||||||
const state_list& sl,
|
const state_list& sl,
|
||||||
state_list& final,
|
state_list& final,
|
||||||
state_list& nonfinal)
|
state_list& nonfinal)
|
||||||
|
|
@ -146,15 +147,11 @@ namespace spot
|
||||||
// could be improved.
|
// could be improved.
|
||||||
{
|
{
|
||||||
state_set keep(sl.begin(), sl.end());
|
state_set keep(sl.begin(), sl.end());
|
||||||
const tgba* masked =
|
auto masked = build_tgba_mask_keep(dra->aut, keep, sl.front());
|
||||||
build_tgba_mask_keep(dra->aut, keep, sl.front());
|
emptiness_check* ec = couvreur99(nra_to_nba(dra, masked));
|
||||||
const tgba* nba = nra_to_nba(dra, masked);
|
|
||||||
emptiness_check* ec = couvreur99(nba);
|
|
||||||
emptiness_check_result* ecr = ec->check();
|
emptiness_check_result* ecr = ec->check();
|
||||||
delete ecr;
|
delete ecr;
|
||||||
delete ec;
|
delete ec;
|
||||||
delete nba;
|
|
||||||
delete masked;
|
|
||||||
if (ecr)
|
if (ecr)
|
||||||
{
|
{
|
||||||
// This SCC is not DBA-realizable.
|
// This SCC is not DBA-realizable.
|
||||||
|
|
@ -197,13 +194,11 @@ namespace spot
|
||||||
//std::cerr << "unknown\n";
|
//std::cerr << "unknown\n";
|
||||||
// Build a sub-automaton for just the unknown states,
|
// Build a sub-automaton for just the unknown states,
|
||||||
// starting from any state in the SCC.
|
// starting from any state in the SCC.
|
||||||
const tgba* scc_mask =
|
auto scc_mask = build_tgba_mask_keep(aut, unknown, *unknown.begin());
|
||||||
build_tgba_mask_keep(aut, unknown, *unknown.begin());
|
|
||||||
state_list local_final;
|
state_list local_final;
|
||||||
state_list local_nonfinal;
|
state_list local_nonfinal;
|
||||||
bool dbarealizable =
|
bool dbarealizable =
|
||||||
filter_scc(scc_mask, dra, local_final, local_nonfinal);
|
filter_scc(scc_mask, dra, local_final, local_nonfinal);
|
||||||
delete scc_mask;
|
|
||||||
if (!dbarealizable)
|
if (!dbarealizable)
|
||||||
return false;
|
return false;
|
||||||
for (state_list::const_iterator i = local_final.begin();
|
for (state_list::const_iterator i = local_final.begin();
|
||||||
|
|
@ -223,13 +218,13 @@ namespace spot
|
||||||
class dra_to_ba_worker: public tgba_reachable_iterator_depth_first
|
class dra_to_ba_worker: public tgba_reachable_iterator_depth_first
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
dra_to_ba_worker(const dstar_aut* a,
|
dra_to_ba_worker(const const_dstar_aut_ptr& a,
|
||||||
const state_set& final,
|
const state_set& final,
|
||||||
const scc_map& sm,
|
const scc_map& sm,
|
||||||
const std::vector<bool>& realizable):
|
const std::vector<bool>& realizable):
|
||||||
tgba_reachable_iterator_depth_first(a->aut),
|
tgba_reachable_iterator_depth_first(a->aut),
|
||||||
in_(a),
|
in_(a),
|
||||||
out_(new tgba_digraph(a->aut->get_dict())),
|
out_(make_tgba_digraph(a->aut->get_dict())),
|
||||||
final_(final),
|
final_(final),
|
||||||
num_states_(a->aut->num_states()),
|
num_states_(a->aut->num_states()),
|
||||||
sm_(sm),
|
sm_(sm),
|
||||||
|
|
@ -242,7 +237,7 @@ namespace spot
|
||||||
out_->set_init_state(a->aut->get_init_state_number());
|
out_->set_init_state(a->aut->get_init_state_number());
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba_digraph*
|
tgba_digraph_ptr
|
||||||
result()
|
result()
|
||||||
{
|
{
|
||||||
return out_;
|
return out_;
|
||||||
|
|
@ -301,8 +296,8 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const dstar_aut* in_;
|
const const_dstar_aut_ptr& in_;
|
||||||
tgba_digraph* out_;
|
tgba_digraph_ptr out_;
|
||||||
const state_set& final_;
|
const state_set& final_;
|
||||||
size_t num_states_;
|
size_t num_states_;
|
||||||
bdd acc_;
|
bdd acc_;
|
||||||
|
|
@ -313,7 +308,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tgba_digraph* dra_to_ba(const dstar_aut* dra, bool* dba)
|
tgba_digraph_ptr dra_to_ba(const const_dstar_aut_ptr& dra, bool* dba)
|
||||||
{
|
{
|
||||||
assert(dra->type == Rabin);
|
assert(dra->type == Rabin);
|
||||||
|
|
||||||
|
|
@ -358,10 +353,7 @@ namespace spot
|
||||||
state_set fs(final.begin(), final.end());
|
state_set fs(final.begin(), final.end());
|
||||||
dra_to_ba_worker w(dra, fs, sm, realizable);
|
dra_to_ba_worker w(dra, fs, sm, realizable);
|
||||||
w.run();
|
w.run();
|
||||||
auto res1 = w.result();
|
return scc_filter_states(w.result());
|
||||||
auto res2 = scc_filter_states(res1);
|
|
||||||
delete res1;
|
|
||||||
return res2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
tgba_digraph*
|
tgba_digraph_ptr
|
||||||
dstar_to_tgba(const dstar_aut* daut)
|
dstar_to_tgba(const const_dstar_aut_ptr& daut)
|
||||||
{
|
{
|
||||||
switch (daut->type)
|
switch (daut->type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
struct result_
|
struct result_
|
||||||
{
|
{
|
||||||
spot::dstar_aut* d;
|
spot::dstar_aut_ptr d;
|
||||||
spot::ltl::environment* env;
|
spot::ltl::environment* env;
|
||||||
std::vector<bdd> guards;
|
std::vector<bdd> guards;
|
||||||
std::vector<bdd>::const_iterator cur_guard;
|
std::vector<bdd>::const_iterator cur_guard;
|
||||||
|
|
@ -143,8 +143,7 @@ header: auttype opt_eols V2 opt_eols EXPLICIT opt_eols sizes
|
||||||
}
|
}
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
delete result.d->aut;
|
result.d->aut = nullptr;
|
||||||
result.d->aut = 0;
|
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
result.d->aut->new_states(result.state_count);;
|
result.d->aut->new_states(result.state_count);;
|
||||||
|
|
@ -313,10 +312,10 @@ dstaryy::parser::error(const location_type& location,
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
dstar_aut*
|
dstar_aut_ptr
|
||||||
dstar_parse(const std::string& name,
|
dstar_parse(const std::string& name,
|
||||||
dstar_parse_error_list& error_list,
|
dstar_parse_error_list& error_list,
|
||||||
bdd_dict_ptr dict,
|
const bdd_dict_ptr& dict,
|
||||||
ltl::environment& env,
|
ltl::environment& env,
|
||||||
bool debug)
|
bool debug)
|
||||||
{
|
{
|
||||||
|
|
@ -327,8 +326,8 @@ namespace spot
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
result_ r;
|
result_ r;
|
||||||
r.d = new dstar_aut;
|
r.d = std::make_shared<spot::dstar_aut>();
|
||||||
r.d->aut = new tgba_digraph(dict);
|
r.d->aut = make_tgba_digraph(dict);
|
||||||
r.d->accsets = 0;
|
r.d->accsets = 0;
|
||||||
r.env = &env;
|
r.env = &env;
|
||||||
dstaryy::parser parser(error_list, r);
|
dstaryy::parser parser(error_list, r);
|
||||||
|
|
@ -337,10 +336,7 @@ namespace spot
|
||||||
dstaryyclose();
|
dstaryyclose();
|
||||||
|
|
||||||
if (!r.d->aut || !r.d->accsets)
|
if (!r.d->aut || !r.d->accsets)
|
||||||
{
|
return nullptr;
|
||||||
delete r.d;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return r.d;
|
return r.d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ namespace spot
|
||||||
// AUT is the automate we iterate on, while A is the automaton
|
// AUT is the automate we iterate on, while A is the automaton
|
||||||
// we read the acceptance conditions from. Separating the two
|
// we read the acceptance conditions from. Separating the two
|
||||||
// makes its possible to mask AUT, as needed in dra_to_ba().
|
// makes its possible to mask AUT, as needed in dra_to_ba().
|
||||||
nra_to_nba_worker(const dstar_aut* a, const tgba* aut):
|
nra_to_nba_worker(const const_dstar_aut_ptr& a, const_tgba_ptr aut):
|
||||||
tgba_reachable_iterator_depth_first(aut),
|
tgba_reachable_iterator_depth_first(aut),
|
||||||
out_(new tgba_digraph(aut->get_dict())),
|
out_(make_tgba_digraph(aut->get_dict())),
|
||||||
d_(a),
|
d_(a),
|
||||||
num_states_(a->aut->num_states())
|
num_states_(a->aut->num_states())
|
||||||
{
|
{
|
||||||
|
|
@ -54,7 +54,7 @@ namespace spot
|
||||||
i->destroy();
|
i->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba_digraph*
|
tgba_digraph_ptr
|
||||||
result()
|
result()
|
||||||
{
|
{
|
||||||
return out_;
|
return out_;
|
||||||
|
|
@ -104,8 +104,8 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
tgba_digraph* out_;
|
tgba_digraph_ptr out_;
|
||||||
const dstar_aut* d_;
|
const_dstar_aut_ptr d_;
|
||||||
size_t num_states_;
|
size_t num_states_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -114,19 +114,17 @@ namespace spot
|
||||||
// In dra_to_dba() we call this function with a second argument
|
// In dra_to_dba() we call this function with a second argument
|
||||||
// that is a masked version of nra->aut.
|
// that is a masked version of nra->aut.
|
||||||
SPOT_LOCAL
|
SPOT_LOCAL
|
||||||
tgba_digraph* nra_to_nba(const dstar_aut* nra, const tgba* aut)
|
tgba_digraph_ptr nra_to_nba(const const_dstar_aut_ptr& nra,
|
||||||
|
const const_tgba_ptr& aut)
|
||||||
{
|
{
|
||||||
assert(nra->type == Rabin);
|
assert(nra->type == Rabin);
|
||||||
nra_to_nba_worker w(nra, aut);
|
nra_to_nba_worker w(nra, aut);
|
||||||
w.run();
|
w.run();
|
||||||
auto res1 = w.result();
|
return scc_filter_states(w.result());
|
||||||
auto res2 = scc_filter_states(res1);
|
|
||||||
delete res1;
|
|
||||||
return res2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SPOT_API
|
SPOT_API
|
||||||
tgba_digraph* nra_to_nba(const dstar_aut* nra)
|
tgba_digraph_ptr nra_to_nba(const const_dstar_aut_ptr& nra)
|
||||||
{
|
{
|
||||||
return nra_to_nba(nra, nra->aut);
|
return nra_to_nba(nra, nra->aut);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,11 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
SPOT_API
|
SPOT_API
|
||||||
tgba_digraph* nsa_to_tgba(const dstar_aut* nsa)
|
tgba_digraph_ptr nsa_to_tgba(const const_dstar_aut_ptr& nsa)
|
||||||
{
|
{
|
||||||
assert(nsa->type == Streett);
|
assert(nsa->type == Streett);
|
||||||
auto a = nsa->aut;
|
auto a = nsa->aut;
|
||||||
auto res = new tgba_digraph(a->get_dict());
|
auto res = make_tgba_digraph(a->get_dict());
|
||||||
res->copy_ap_of(a);
|
res->copy_ap_of(a);
|
||||||
|
|
||||||
// Create accpair_count acceptance sets for the output.
|
// Create accpair_count acceptance sets for the output.
|
||||||
|
|
@ -204,4 +204,3 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
// Transition structure of the automaton.
|
// Transition structure of the automaton.
|
||||||
// This is encoded as a TGBA without acceptance condition.
|
// This is encoded as a TGBA without acceptance condition.
|
||||||
tgba_digraph* aut;
|
tgba_digraph_ptr aut;
|
||||||
/// Type of the acceptance.
|
/// Type of the acceptance.
|
||||||
dstar_type type;
|
dstar_type type;
|
||||||
/// Number of acceptance pairs.
|
/// Number of acceptance pairs.
|
||||||
|
|
@ -62,11 +62,12 @@ namespace spot
|
||||||
|
|
||||||
~dstar_aut()
|
~dstar_aut()
|
||||||
{
|
{
|
||||||
delete aut;
|
|
||||||
delete accsets;
|
delete accsets;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<dstar_aut> dstar_aut_ptr;
|
||||||
|
typedef std::shared_ptr<const dstar_aut> const_dstar_aut_ptr;
|
||||||
|
|
||||||
/// \brief Build a spot::tgba_digraph from ltl2dstar's output.
|
/// \brief Build a spot::tgba_digraph from ltl2dstar's output.
|
||||||
/// \param filename The name of the file to parse.
|
/// \param filename The name of the file to parse.
|
||||||
|
|
@ -85,10 +86,10 @@ namespace spot
|
||||||
/// was parsed succesfully, check \a error_list for emptiness.
|
/// was parsed succesfully, check \a error_list for emptiness.
|
||||||
///
|
///
|
||||||
/// \warning This function is not reentrant.
|
/// \warning This function is not reentrant.
|
||||||
SPOT_API dstar_aut*
|
SPOT_API dstar_aut_ptr
|
||||||
dstar_parse(const std::string& filename,
|
dstar_parse(const std::string& filename,
|
||||||
dstar_parse_error_list& error_list,
|
dstar_parse_error_list& error_list,
|
||||||
bdd_dict_ptr dict,
|
const bdd_dict_ptr& dict,
|
||||||
ltl::environment& env = ltl::default_environment::instance(),
|
ltl::environment& env = ltl::default_environment::instance(),
|
||||||
bool debug = false);
|
bool debug = false);
|
||||||
|
|
||||||
|
|
@ -106,15 +107,15 @@ namespace spot
|
||||||
|
|
||||||
/// \brief Convert a non-deterministic Rabin automaton into a
|
/// \brief Convert a non-deterministic Rabin automaton into a
|
||||||
/// non-deterministic Büchi automaton.
|
/// non-deterministic Büchi automaton.
|
||||||
SPOT_API tgba_digraph*
|
SPOT_API tgba_digraph_ptr
|
||||||
nra_to_nba(const dstar_aut* nra);
|
nra_to_nba(const const_dstar_aut_ptr& nra);
|
||||||
|
|
||||||
/// \brief Convert a non-deterministic Rabin automaton into a
|
/// \brief Convert a non-deterministic Rabin automaton into a
|
||||||
/// non-deterministic Büchi automaton.
|
/// non-deterministic Büchi automaton.
|
||||||
///
|
///
|
||||||
/// This version simply ignores all states in \a ignore.
|
/// This version simply ignores all states in \a ignore.
|
||||||
SPOT_API tgba_digraph*
|
SPOT_API tgba_digraph_ptr
|
||||||
nra_to_nba(const dstar_aut* nra, const state_set* ignore);
|
nra_to_nba(const const_dstar_aut_ptr& nra, const state_set* ignore);
|
||||||
|
|
||||||
/// \brief Convert a deterministic Rabin automaton into a
|
/// \brief Convert a deterministic Rabin automaton into a
|
||||||
/// Büchi automaton, deterministic when possible.
|
/// Büchi automaton, deterministic when possible.
|
||||||
|
|
@ -132,19 +133,19 @@ namespace spot
|
||||||
/// If the optional \a dba_output argument is non-null, the
|
/// If the optional \a dba_output argument is non-null, the
|
||||||
/// pointed Boolean will be updated to indicate whether the
|
/// pointed Boolean will be updated to indicate whether the
|
||||||
/// returned Büchi automaton is deterministic.
|
/// returned Büchi automaton is deterministic.
|
||||||
SPOT_API tgba_digraph*
|
SPOT_API tgba_digraph_ptr
|
||||||
dra_to_ba(const dstar_aut* dra, bool* dba_output = 0);
|
dra_to_ba(const const_dstar_aut_ptr& dra, bool* dba_output = 0);
|
||||||
|
|
||||||
/// \brief Convert a non-deterministic Streett automaton into a
|
/// \brief Convert a non-deterministic Streett automaton into a
|
||||||
/// non-deterministic tgba.
|
/// non-deterministic tgba.
|
||||||
SPOT_API tgba_digraph*
|
SPOT_API tgba_digraph_ptr
|
||||||
nsa_to_tgba(const dstar_aut* nra);
|
nsa_to_tgba(const const_dstar_aut_ptr& nra);
|
||||||
|
|
||||||
/// \brief Convert a Rabin or Streett automaton into a TGBA.
|
/// \brief Convert a Rabin or Streett automaton into a TGBA.
|
||||||
///
|
///
|
||||||
/// This function calls dra_to_ba() or nsa_to_tgba().
|
/// This function calls dra_to_ba() or nsa_to_tgba().
|
||||||
SPOT_API tgba_digraph*
|
SPOT_API tgba_digraph_ptr
|
||||||
dstar_to_tgba(const dstar_aut* dstar);
|
dstar_to_tgba(const const_dstar_aut_ptr& dstar);
|
||||||
|
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
||||||
|
|
@ -29,64 +29,64 @@ void f1()
|
||||||
|
|
||||||
auto& e = spot::ltl::default_environment::instance();
|
auto& e = spot::ltl::default_environment::instance();
|
||||||
|
|
||||||
spot::tgba_digraph tg(d);
|
auto tg = make_tgba_digraph(d);
|
||||||
|
|
||||||
auto* f1 = e.require("p1");
|
auto* f1 = e.require("p1");
|
||||||
auto* f2 = e.require("p2");
|
auto* f2 = e.require("p2");
|
||||||
bdd p1 = bdd_ithvar(d->register_proposition(f1, &tg));
|
bdd p1 = bdd_ithvar(d->register_proposition(f1, tg));
|
||||||
bdd p2 = bdd_ithvar(d->register_proposition(f2, &tg));
|
bdd p2 = bdd_ithvar(d->register_proposition(f2, tg));
|
||||||
bdd a1 = bdd_ithvar(d->register_acceptance_variable(f1, &tg));
|
bdd a1 = bdd_ithvar(d->register_acceptance_variable(f1, tg));
|
||||||
bdd a2 = bdd_ithvar(d->register_acceptance_variable(f2, &tg));
|
bdd a2 = bdd_ithvar(d->register_acceptance_variable(f2, tg));
|
||||||
f1->destroy();
|
f1->destroy();
|
||||||
f2->destroy();
|
f2->destroy();
|
||||||
|
|
||||||
auto s1 = tg.new_state();
|
auto s1 = tg->new_state();
|
||||||
auto s2 = tg.new_state();
|
auto s2 = tg->new_state();
|
||||||
auto s3 = tg.new_state();
|
auto s3 = tg->new_state();
|
||||||
tg.new_transition(s1, s1, bddfalse, bddfalse);
|
tg->new_transition(s1, s1, bddfalse, bddfalse);
|
||||||
tg.new_transition(s1, s2, p1, bddfalse);
|
tg->new_transition(s1, s2, p1, bddfalse);
|
||||||
tg.new_transition(s1, s3, p2, !a1 & a2);
|
tg->new_transition(s1, s3, p2, !a1 & a2);
|
||||||
tg.new_transition(s2, s3, p1 & p2, a1 & !a2);
|
tg->new_transition(s2, s3, p1 & p2, a1 & !a2);
|
||||||
tg.new_transition(s3, s1, p1 | p2, (!a1 & a2) | (a1 & !a2));
|
tg->new_transition(s3, s1, p1 | p2, (!a1 & a2) | (a1 & !a2));
|
||||||
tg.new_transition(s3, s2, p1 >> p2, bddfalse);
|
tg->new_transition(s3, s2, p1 >> p2, bddfalse);
|
||||||
tg.new_transition(s3, s3, bddtrue, (!a1 & a2) | (a1 & !a2));
|
tg->new_transition(s3, s3, bddtrue, (!a1 & a2) | (a1 & !a2));
|
||||||
|
|
||||||
spot::dotty_reachable(std::cout, &tg);
|
spot::dotty_reachable(std::cout, tg);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto i = tg.get_graph().out_iteraser(s3);
|
auto i = tg->get_graph().out_iteraser(s3);
|
||||||
++i;
|
++i;
|
||||||
i.erase();
|
i.erase();
|
||||||
i.erase();
|
i.erase();
|
||||||
assert(!i);
|
assert(!i);
|
||||||
spot::dotty_reachable(std::cout, &tg);
|
spot::dotty_reachable(std::cout, tg);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto i = tg.get_graph().out_iteraser(s3);
|
auto i = tg->get_graph().out_iteraser(s3);
|
||||||
i.erase();
|
i.erase();
|
||||||
assert(!i);
|
assert(!i);
|
||||||
spot::dotty_reachable(std::cout, &tg);
|
spot::dotty_reachable(std::cout, tg);
|
||||||
}
|
}
|
||||||
|
|
||||||
tg.new_transition(s3, s1, p1 | p2, (!a1 & a2) | (a1 & !a2));
|
tg->new_transition(s3, s1, p1 | p2, (!a1 & a2) | (a1 & !a2));
|
||||||
tg.new_transition(s3, s2, p1 >> p2, bddfalse);
|
tg->new_transition(s3, s2, p1 >> p2, bddfalse);
|
||||||
tg.new_transition(s3, s1, bddtrue, (!a1 & a2) | (a1 & !a2));
|
tg->new_transition(s3, s1, bddtrue, (!a1 & a2) | (a1 & !a2));
|
||||||
|
|
||||||
std::cerr << tg.num_transitions() << '\n';
|
std::cerr << tg->num_transitions() << '\n';
|
||||||
assert(tg.num_transitions() == 7);
|
assert(tg->num_transitions() == 7);
|
||||||
|
|
||||||
spot::dotty_reachable(std::cout, &tg);
|
spot::dotty_reachable(std::cout, tg);
|
||||||
tg.merge_transitions();
|
tg->merge_transitions();
|
||||||
spot::dotty_reachable(std::cout, &tg);
|
spot::dotty_reachable(std::cout, tg);
|
||||||
|
|
||||||
std::cerr << tg.num_transitions() << '\n';
|
std::cerr << tg->num_transitions() << '\n';
|
||||||
assert(tg.num_transitions() == 5);
|
assert(tg->num_transitions() == 5);
|
||||||
|
|
||||||
// Add enough states so that the state vector is reallocated.
|
// Add enough states so that the state vector is reallocated.
|
||||||
for (unsigned i = 0; i < 100; ++i)
|
for (unsigned i = 0; i < 100; ++i)
|
||||||
tg.new_state();
|
tg->new_state();
|
||||||
spot::dotty_reachable(std::cout, &tg);
|
spot::dotty_reachable(std::cout, tg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
## -*- coding: utf-8 -*-
|
## -*- coding: utf-8 -*-
|
||||||
## Copyright (C) 2009, 2011, 2013 Laboratoire de Recherche et
|
## Copyright (C) 2009, 2011, 2013, 2014 Laboratoire de Recherche et
|
||||||
## Developpement de l'Epita (LRDE).
|
## Developpement de l'Epita (LRDE).
|
||||||
##
|
##
|
||||||
## This file is part of Spot, a model checking library.
|
## This file is part of Spot, a model checking library.
|
||||||
|
|
@ -24,6 +24,7 @@ kripkedir = $(pkgincludedir)/kripke
|
||||||
|
|
||||||
kripke_HEADERS = \
|
kripke_HEADERS = \
|
||||||
fairkripke.hh \
|
fairkripke.hh \
|
||||||
|
fwd.hh \
|
||||||
kripke.hh \
|
kripke.hh \
|
||||||
kripkeexplicit.hh \
|
kripkeexplicit.hh \
|
||||||
kripkeprint.hh
|
kripkeprint.hh
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,13 @@
|
||||||
|
|
||||||
#include "tgba/tgba.hh"
|
#include "tgba/tgba.hh"
|
||||||
#include "tgba/succiter.hh"
|
#include "tgba/succiter.hh"
|
||||||
|
#include "fwd.hh"
|
||||||
|
|
||||||
/// \addtogroup kripke Kripke Structures
|
/// \addtogroup kripke Kripke Structures
|
||||||
/// \ingroup tgba
|
/// \ingroup tgba
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
class fair_kripke;
|
|
||||||
|
|
||||||
/// \ingroup kripke
|
/// \ingroup kripke
|
||||||
/// \brief Iterator code for a Fair Kripke structure.
|
/// \brief Iterator code for a Fair Kripke structure.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
40
src/kripke/fwd.hh
Normal file
40
src/kripke/fwd.hh
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
// -*- coding: utf-8 -*-
|
||||||
|
// Copyright (C) 2014 Laboratoire de Recherche et Développement de
|
||||||
|
// l'Epita (LRDE).
|
||||||
|
//
|
||||||
|
// This file is part of Spot, a model checking library.
|
||||||
|
//
|
||||||
|
// Spot is free software; you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
// License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef SPOT_KRIPKE_FWD_HH
|
||||||
|
# define SPOT_KRIPKE_FWD_HH
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace spot
|
||||||
|
{
|
||||||
|
class fair_kripke;
|
||||||
|
typedef std::shared_ptr<fair_kripke> fair_kripke_ptr;
|
||||||
|
typedef std::shared_ptr<const fair_kripke> const_fair_kripke_ptr;
|
||||||
|
|
||||||
|
class kripke;
|
||||||
|
typedef std::shared_ptr<const kripke> const_kripke_ptr;
|
||||||
|
typedef std::shared_ptr<kripke> tgba_kripke_ptr;
|
||||||
|
|
||||||
|
class kripke_explicit;
|
||||||
|
typedef std::shared_ptr<const kripke_explicit> const_kripke_explicit_ptr;
|
||||||
|
typedef std::shared_ptr<kripke_explicit> kripke_explicit_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SPOT_KRIPKE_FWD_HH
|
||||||
|
|
@ -98,6 +98,10 @@ namespace spot
|
||||||
virtual bdd neg_acceptance_conditions() const;
|
virtual bdd neg_acceptance_conditions() const;
|
||||||
virtual bdd all_acceptance_conditions() const;
|
virtual bdd all_acceptance_conditions() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef std::shared_ptr<kripke> kripke_ptr;
|
||||||
|
typedef std::shared_ptr<const kripke> const_kripke_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_KRIPKE_KRIPKE_HH
|
#endif // SPOT_KRIPKE_KRIPKE_HH
|
||||||
|
|
|
||||||
|
|
@ -126,12 +126,6 @@ namespace spot
|
||||||
// kripke_explicit
|
// kripke_explicit
|
||||||
|
|
||||||
|
|
||||||
kripke_explicit::kripke_explicit(bdd_dict_ptr dict)
|
|
||||||
: dict_(dict),
|
|
||||||
init_(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
kripke_explicit::kripke_explicit(bdd_dict_ptr dict,
|
kripke_explicit::kripke_explicit(bdd_dict_ptr dict,
|
||||||
state_kripke* init)
|
state_kripke* init)
|
||||||
: dict_(dict),
|
: dict_(dict),
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,7 @@ namespace spot
|
||||||
class SPOT_API kripke_explicit : public kripke
|
class SPOT_API kripke_explicit : public kripke
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
kripke_explicit(bdd_dict_ptr);
|
kripke_explicit(bdd_dict_ptr, state_kripke* = nullptr);
|
||||||
kripke_explicit(bdd_dict_ptr, state_kripke*);
|
|
||||||
~kripke_explicit();
|
~kripke_explicit();
|
||||||
|
|
||||||
bdd_dict_ptr get_dict() const;
|
bdd_dict_ptr get_dict() const;
|
||||||
|
|
@ -180,5 +179,12 @@ namespace spot
|
||||||
std::map<const std::string, state_kripke*> ns_nodes_;
|
std::map<const std::string, state_kripke*> ns_nodes_;
|
||||||
std::map<const state_kripke*, std::string> sn_nodes_;
|
std::map<const state_kripke*, std::string> sn_nodes_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline kripke_explicit_ptr
|
||||||
|
make_kripke_explicit(const bdd_dict_ptr& d,
|
||||||
|
state_kripke* init = nullptr)
|
||||||
|
{
|
||||||
|
return std::make_shared<kripke_explicit>(d, init);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // SPOT_KRIPKE_KRIPKEEXPLICIT_HH
|
#endif // SPOT_KRIPKE_KRIPKEEXPLICIT_HH
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace spot
|
||||||
class kripke_printer : public tgba_reachable_iterator_breadth_first
|
class kripke_printer : public tgba_reachable_iterator_breadth_first
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
kripke_printer(const kripke* a, std::ostream& os)
|
kripke_printer(const const_kripke_ptr& a, std::ostream& os)
|
||||||
: tgba_reachable_iterator_breadth_first(a), os_(os)
|
: tgba_reachable_iterator_breadth_first(a), os_(os)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -45,10 +45,9 @@ namespace spot
|
||||||
os_ << '"';
|
os_ << '"';
|
||||||
escape_str(os_, aut_->format_state(s));
|
escape_str(os_, aut_->format_state(s));
|
||||||
os_ << "\", \"";
|
os_ << "\", \"";
|
||||||
const kripke* automata = down_cast<const kripke*> (aut_);
|
auto aut = std::static_pointer_cast<const kripke> (aut_);
|
||||||
assert(automata);
|
assert(aut);
|
||||||
escape_str(os_, bdd_format_formula(d,
|
escape_str(os_, bdd_format_formula(d, aut->state_condition(s)));
|
||||||
automata->state_condition(s)));
|
|
||||||
|
|
||||||
os_ << "\",";
|
os_ << "\",";
|
||||||
for (si->first(); !si->done(); si->next())
|
for (si->first(); !si->done(); si->next())
|
||||||
|
|
@ -69,7 +68,7 @@ namespace spot
|
||||||
public tgba_reachable_iterator_breadth_first
|
public tgba_reachable_iterator_breadth_first
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
kripke_printer_renumbered(const kripke* a, std::ostream& os)
|
kripke_printer_renumbered(const const_kripke_ptr& a, std::ostream& os)
|
||||||
: tgba_reachable_iterator_breadth_first(a), os_(os),
|
: tgba_reachable_iterator_breadth_first(a), os_(os),
|
||||||
notfirst(false)
|
notfirst(false)
|
||||||
{
|
{
|
||||||
|
|
@ -90,10 +89,10 @@ namespace spot
|
||||||
|
|
||||||
const bdd_dict_ptr d = aut_->get_dict();
|
const bdd_dict_ptr d = aut_->get_dict();
|
||||||
os_ << 'S' << in_s << ", \"";
|
os_ << 'S' << in_s << ", \"";
|
||||||
const kripke* automata = down_cast<const kripke*>(aut_);
|
auto aut = std::static_pointer_cast<const kripke>(aut_);
|
||||||
assert(automata);
|
assert(aut);
|
||||||
escape_str(os_, bdd_format_formula(d,
|
escape_str(os_, bdd_format_formula(d,
|
||||||
automata->state_condition(s)));
|
aut->state_condition(s)));
|
||||||
os_ << "\",";
|
os_ << "\",";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,7 +118,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
kripke_save_reachable(std::ostream& os, const kripke* k)
|
kripke_save_reachable(std::ostream& os, const const_kripke_ptr& k)
|
||||||
{
|
{
|
||||||
kripke_printer p(k, os);
|
kripke_printer p(k, os);
|
||||||
p.run();
|
p.run();
|
||||||
|
|
@ -127,7 +126,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
kripke_save_reachable_renumbered(std::ostream& os, const kripke* k)
|
kripke_save_reachable_renumbered(std::ostream& os, const const_kripke_ptr& k)
|
||||||
{
|
{
|
||||||
kripke_printer_renumbered p(k, os);
|
kripke_printer_renumbered p(k, os);
|
||||||
p.run();
|
p.run();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement
|
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et Developpement
|
||||||
// de l'Epita (LRDE)
|
// de l'Epita (LRDE)
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -23,12 +23,11 @@
|
||||||
|
|
||||||
# include "misc/common.hh"
|
# include "misc/common.hh"
|
||||||
# include <iosfwd>
|
# include <iosfwd>
|
||||||
|
# include "kripke.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
||||||
class kripke;
|
|
||||||
|
|
||||||
/// \ingroup tgba_io
|
/// \ingroup tgba_io
|
||||||
/// \brief Save the reachable part of Kripke structure in text format.
|
/// \brief Save the reachable part of Kripke structure in text format.
|
||||||
///
|
///
|
||||||
|
|
@ -39,7 +38,7 @@ namespace spot
|
||||||
/// kripke_save_reachable_renumbered() for large output.
|
/// kripke_save_reachable_renumbered() for large output.
|
||||||
///
|
///
|
||||||
SPOT_API std::ostream&
|
SPOT_API std::ostream&
|
||||||
kripke_save_reachable(std::ostream& os, const kripke* k);
|
kripke_save_reachable(std::ostream& os, const const_kripke_ptr& k);
|
||||||
|
|
||||||
/// \ingroup tgba_io
|
/// \ingroup tgba_io
|
||||||
/// \brief Save the reachable part of Kripke structure in text format.
|
/// \brief Save the reachable part of Kripke structure in text format.
|
||||||
|
|
@ -50,7 +49,7 @@ namespace spot
|
||||||
/// the state name is lost.
|
/// the state name is lost.
|
||||||
///
|
///
|
||||||
SPOT_API std::ostream&
|
SPOT_API std::ostream&
|
||||||
kripke_save_reachable_renumbered(std::ostream& os, const kripke* k);
|
kripke_save_reachable_renumbered(std::ostream& os, const const_kripke_ptr& k);
|
||||||
|
|
||||||
} // End namespace spot
|
} // End namespace spot
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ typedef std::map<std::string, bdd> formula_cache;
|
||||||
|
|
||||||
%parse-param {spot::kripke_parse_error_list& error_list}
|
%parse-param {spot::kripke_parse_error_list& error_list}
|
||||||
%parse-param {spot::ltl::environment& parse_environment}
|
%parse-param {spot::ltl::environment& parse_environment}
|
||||||
%parse-param {spot::kripke_explicit*& result}
|
%parse-param {spot::kripke_explicit_ptr& result}
|
||||||
%parse-param {formula_cache& fcache}
|
%parse-param {formula_cache& fcache}
|
||||||
|
|
||||||
%union
|
%union
|
||||||
|
|
@ -195,10 +195,10 @@ kripkeyy::parser::error(const location_type& location,
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
kripke_explicit*
|
kripke_explicit_ptr
|
||||||
kripke_parse(const std::string& name,
|
kripke_parse(const std::string& name,
|
||||||
kripke_parse_error_list& error_list,
|
kripke_parse_error_list& error_list,
|
||||||
bdd_dict_ptr dict,
|
const bdd_dict_ptr& dict,
|
||||||
environment& env,
|
environment& env,
|
||||||
bool debug)
|
bool debug)
|
||||||
{
|
{
|
||||||
|
|
@ -210,7 +210,7 @@ namespace spot
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
formula_cache fcache;
|
formula_cache fcache;
|
||||||
kripke_explicit* result = new kripke_explicit(dict);
|
auto result = make_kripke_explicit(dict);
|
||||||
kripkeyy::parser parser(error_list, env, result, fcache);
|
kripkeyy::parser parser(error_list, env, result, fcache);
|
||||||
parser.set_debug_level(debug);
|
parser.set_debug_level(debug);
|
||||||
parser.parse();
|
parser.parse();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement
|
// -*- coding: utf-8 -*_
|
||||||
// de l'Epita (LRDE)
|
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
|
||||||
|
// Developpement de l'Epita (LRDE)
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -38,10 +39,10 @@ namespace spot
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SPOT_API kripke_explicit*
|
SPOT_API kripke_explicit_ptr
|
||||||
kripke_parse(const std::string& name,
|
kripke_parse(const std::string& name,
|
||||||
kripke_parse_error_list& error_list,
|
kripke_parse_error_list& error_list,
|
||||||
bdd_dict_ptr dict,
|
const bdd_dict_ptr& dict,
|
||||||
ltl::environment& env
|
ltl::environment& env
|
||||||
= ltl::default_environment::instance(),
|
= ltl::default_environment::instance(),
|
||||||
bool debug = false);
|
bool debug = false);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ int main(int argc, char** argv)
|
||||||
int return_value = 0;
|
int return_value = 0;
|
||||||
kripke_parse_error_list pel;
|
kripke_parse_error_list pel;
|
||||||
|
|
||||||
kripke_explicit* k = kripke_parse(argv[1], pel, make_bdd_dict());
|
{
|
||||||
|
auto k = kripke_parse(argv[1], pel, make_bdd_dict());
|
||||||
if (!pel.empty())
|
if (!pel.empty())
|
||||||
{
|
{
|
||||||
format_kripke_parse_errors(std::cerr, argv[1], pel);
|
format_kripke_parse_errors(std::cerr, argv[1], pel);
|
||||||
|
|
@ -38,8 +39,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if (!return_value)
|
if (!return_value)
|
||||||
kripke_save_reachable(std::cout, k);
|
kripke_save_reachable(std::cout, k);
|
||||||
|
}
|
||||||
|
|
||||||
delete k;
|
|
||||||
assert(ltl::atomic_prop::instance_count() == 0);
|
assert(ltl::atomic_prop::instance_count() == 0);
|
||||||
assert(ltl::unop::instance_count() == 0);
|
assert(ltl::unop::instance_count() == 0);
|
||||||
assert(ltl::binop::instance_count() == 0);
|
assert(ltl::binop::instance_count() == 0);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
bdd
|
bdd
|
||||||
atomic_prop_collect_as_bdd(const formula* f, const tgba* a)
|
atomic_prop_collect_as_bdd(const formula* f, const_tgba_ptr a)
|
||||||
{
|
{
|
||||||
spot::ltl::atomic_prop_set aps;
|
spot::ltl::atomic_prop_set aps;
|
||||||
atomic_prop_collect(f, &aps);
|
atomic_prop_collect(f, &aps);
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,10 @@
|
||||||
#include "ltlast/atomic_prop.hh"
|
#include "ltlast/atomic_prop.hh"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "bdd.h"
|
#include "bdd.h"
|
||||||
|
#include "tgba/fwd.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
class tgba;
|
|
||||||
|
|
||||||
namespace ltl
|
namespace ltl
|
||||||
{
|
{
|
||||||
/// \addtogroup ltl_misc
|
/// \addtogroup ltl_misc
|
||||||
|
|
@ -65,7 +64,7 @@ namespace spot
|
||||||
/// \param a that automaton that should register the BDD variables used.
|
/// \param a that automaton that should register the BDD variables used.
|
||||||
/// \return A conjunction the atomic propositions.
|
/// \return A conjunction the atomic propositions.
|
||||||
SPOT_API bdd
|
SPOT_API bdd
|
||||||
atomic_prop_collect_as_bdd(const formula* f, const tgba* a);
|
atomic_prop_collect_as_bdd(const formula* f, const_tgba_ptr a);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ namespace spot
|
||||||
while (!translated_.empty())
|
while (!translated_.empty())
|
||||||
{
|
{
|
||||||
trans_map::iterator i = translated_.begin();
|
trans_map::iterator i = translated_.begin();
|
||||||
delete i->second.translation;
|
|
||||||
const formula* f = i->first;
|
const formula* f = i->first;
|
||||||
translated_.erase(i);
|
translated_.erase(i);
|
||||||
f->destroy();
|
f->destroy();
|
||||||
|
|
@ -70,9 +69,8 @@ namespace spot
|
||||||
if (i != l->incompatible.end())
|
if (i != l->incompatible.end())
|
||||||
return i->second;
|
return i->second;
|
||||||
|
|
||||||
const tgba* p = new tgba_product(l->translation, g->translation);
|
auto ec = couvreur99(product(l->translation, g->translation));
|
||||||
emptiness_check* ec = couvreur99(p);
|
auto ecr = ec->check();
|
||||||
emptiness_check_result* ecr = ec->check();
|
|
||||||
if (!ecr)
|
if (!ecr)
|
||||||
{
|
{
|
||||||
l->incompatible[g] = true;
|
l->incompatible[g] = true;
|
||||||
|
|
@ -85,7 +83,6 @@ namespace spot
|
||||||
delete ecr;
|
delete ecr;
|
||||||
}
|
}
|
||||||
delete ec;
|
delete ec;
|
||||||
delete p;
|
|
||||||
return !ecr;
|
return !ecr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
struct record_
|
struct record_
|
||||||
{
|
{
|
||||||
const tgba* translation;
|
const_tgba_ptr translation;
|
||||||
typedef std::map<const record_*, bool> incomp_map;
|
typedef std::map<const record_*, bool> incomp_map;
|
||||||
incomp_map incompatible;
|
incomp_map incompatible;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
%parse-param {spot::neverclaim_parse_error_list& error_list}
|
%parse-param {spot::neverclaim_parse_error_list& error_list}
|
||||||
%parse-param {spot::ltl::environment& parse_environment}
|
%parse-param {spot::ltl::environment& parse_environment}
|
||||||
%parse-param {spot::tgba_digraph*& result}
|
%parse-param {spot::tgba_digraph_ptr& result}
|
||||||
%parse-param {named_tgba_t*& namer}
|
%parse-param {named_tgba_t*& namer}
|
||||||
%parse-param {formula_cache& fcache}
|
%parse-param {formula_cache& fcache}
|
||||||
%union
|
%union
|
||||||
|
|
@ -286,7 +286,7 @@ neverclaimyy::parser::error(const location_type& location,
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
tgba_digraph*
|
tgba_digraph_ptr
|
||||||
neverclaim_parse(const std::string& name,
|
neverclaim_parse(const std::string& name,
|
||||||
neverclaim_parse_error_list& error_list,
|
neverclaim_parse_error_list& error_list,
|
||||||
bdd_dict_ptr dict,
|
bdd_dict_ptr dict,
|
||||||
|
|
@ -300,7 +300,7 @@ namespace spot
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
formula_cache fcache;
|
formula_cache fcache;
|
||||||
tgba_digraph* result = new tgba_digraph(dict);
|
tgba_digraph_ptr result = make_tgba_digraph(dict);
|
||||||
auto namer = result->create_namer<std::string>();
|
auto namer = result->create_namer<std::string>();
|
||||||
result->set_single_acceptance_set();
|
result->set_single_acceptance_set();
|
||||||
result->set_bprop(tgba_digraph::SBA);
|
result->set_bprop(tgba_digraph::SBA);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ namespace spot
|
||||||
/// was parsed succesfully, check \a error_list for emptiness.
|
/// was parsed succesfully, check \a error_list for emptiness.
|
||||||
///
|
///
|
||||||
/// \warning This function is not reentrant.
|
/// \warning This function is not reentrant.
|
||||||
SPOT_API tgba_digraph*
|
SPOT_API tgba_digraph_ptr
|
||||||
neverclaim_parse(const std::string& filename,
|
neverclaim_parse(const std::string& filename,
|
||||||
neverclaim_parse_error_list&
|
neverclaim_parse_error_list&
|
||||||
error_list,
|
error_list,
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,11 @@ namespace spot
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
bdd_dict_ptr dict_;
|
bdd_dict_ptr dict_;
|
||||||
tgba_digraph* aut_;
|
tgba_digraph_ptr aut_;
|
||||||
ltl::environment& env_;
|
ltl::environment& env_;
|
||||||
bdd neg_;
|
bdd neg_;
|
||||||
|
|
||||||
acc_mapper_common(tgba_digraph *aut, ltl::environment& env)
|
acc_mapper_common(const tgba_digraph_ptr& aut, ltl::environment& env)
|
||||||
: dict_(aut->get_dict()), aut_(aut), env_(env), neg_(bddtrue)
|
: dict_(aut->get_dict()), aut_(aut), env_(env), neg_(bddtrue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ namespace spot
|
||||||
std::unordered_map<std::string, int> map_;
|
std::unordered_map<std::string, int> map_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
acc_mapper_string(tgba_digraph *aut,
|
acc_mapper_string(const tgba_digraph_ptr& aut,
|
||||||
ltl::environment& env
|
ltl::environment& env
|
||||||
= ltl::default_environment::instance())
|
= ltl::default_environment::instance())
|
||||||
: acc_mapper_common(aut, env)
|
: acc_mapper_common(aut, env)
|
||||||
|
|
@ -102,7 +102,7 @@ namespace spot
|
||||||
std::map<int, bdd> map_;
|
std::map<int, bdd> map_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
acc_mapper_consecutive_int(tgba_digraph *aut,
|
acc_mapper_consecutive_int(const tgba_digraph_ptr& aut,
|
||||||
unsigned count,
|
unsigned count,
|
||||||
ltl::environment& env =
|
ltl::environment& env =
|
||||||
ltl::default_environment::instance())
|
ltl::default_environment::instance())
|
||||||
|
|
@ -144,7 +144,7 @@ namespace spot
|
||||||
std::map<int, bdd> map_;
|
std::map<int, bdd> map_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
acc_mapper_int(tgba_digraph *aut,
|
acc_mapper_int(const tgba_digraph_ptr& aut,
|
||||||
unsigned count,
|
unsigned count,
|
||||||
ltl::environment& env =
|
ltl::environment& env =
|
||||||
ltl::default_environment::instance())
|
ltl::default_environment::instance())
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
unsigned count_states(const tgba* a)
|
unsigned count_states(const const_tgba_ptr& a)
|
||||||
{
|
{
|
||||||
if (auto b = dynamic_cast<const tgba_digraph*>(a))
|
if (auto b = std::dynamic_pointer_cast<const tgba_digraph>(a))
|
||||||
return b->num_states();
|
return b->num_states();
|
||||||
return stats_reachable(a).states;
|
return stats_reachable(a).states;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,16 +20,15 @@
|
||||||
#ifndef SPOT_PRIV_COUNTSTATES_HH
|
#ifndef SPOT_PRIV_COUNTSTATES_HH
|
||||||
# define SPOT_PRIV_COUNTSTATES_HH
|
# define SPOT_PRIV_COUNTSTATES_HH
|
||||||
|
|
||||||
|
#include "tgba/fwd.hh"
|
||||||
#include "misc/common.hh"
|
#include "misc/common.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
class tgba;
|
unsigned count_states(const const_tgba_ptr& a);
|
||||||
unsigned count_states(const tgba* a);
|
|
||||||
|
|
||||||
class tgba_digraph;
|
|
||||||
// Call a->num_states() directly!
|
// Call a->num_states() directly!
|
||||||
unsigned count_states(const tgba_digraph* a) SPOT_DEPRECATED;
|
unsigned count_states(const_tgba_digraph_ptr a) SPOT_DEPRECATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_PRIV_COUNTSTATES_HH
|
#endif // SPOT_PRIV_COUNTSTATES_HH
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2009, 2010, 2013 Laboratoire de Recherche et
|
// Copyright (C) 2009, 2010, 2013, 2014 Laboratoire de Recherche et
|
||||||
// Développement de l'Epita (LRDE).
|
// Développement de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -109,6 +109,9 @@ namespace spot
|
||||||
mutable int num_acc_;
|
mutable int num_acc_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<saba> saba_ptr;
|
||||||
|
typedef std::shared_ptr<const saba> const_saba_ptr;
|
||||||
|
|
||||||
} // end namespace spot.
|
} // end namespace spot.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include "bdd.h"
|
#include "bdd.h"
|
||||||
#include <tgba/bddprint.hh>
|
#include <tgba/bddprint.hh>
|
||||||
#include <tgba/state.hh>
|
#include <tgba/state.hh>
|
||||||
|
#include "tgba/tgba.hh"
|
||||||
#include "misc/hash.hh"
|
#include "misc/hash.hh"
|
||||||
#include "misc/bddlt.hh"
|
#include "misc/bddlt.hh"
|
||||||
#include "tgbaalgos/degen.hh"
|
#include "tgbaalgos/degen.hh"
|
||||||
|
|
@ -151,7 +152,8 @@ namespace spot
|
||||||
typedef std::map<bdd, state_conjunction_list_t, bdd_less_than>
|
typedef std::map<bdd, state_conjunction_list_t, bdd_less_than>
|
||||||
bdd_list_t;
|
bdd_list_t;
|
||||||
|
|
||||||
saba_complement_tgba_succ_iterator(const tgba_digraph* automaton,
|
saba_complement_tgba_succ_iterator(const const_tgba_digraph_ptr&
|
||||||
|
automaton,
|
||||||
bdd the_acceptance_cond,
|
bdd the_acceptance_cond,
|
||||||
const saba_state_complement_tgba*
|
const saba_state_complement_tgba*
|
||||||
origin);
|
origin);
|
||||||
|
|
@ -168,7 +170,7 @@ namespace spot
|
||||||
void state_conjunction();
|
void state_conjunction();
|
||||||
void delete_condition_list();
|
void delete_condition_list();
|
||||||
|
|
||||||
const tgba_digraph* automaton_;
|
const_tgba_digraph_ptr automaton_;
|
||||||
bdd the_acceptance_cond_;
|
bdd the_acceptance_cond_;
|
||||||
const saba_state_complement_tgba* origin_;
|
const saba_state_complement_tgba* origin_;
|
||||||
bdd_list_t condition_list_;
|
bdd_list_t condition_list_;
|
||||||
|
|
@ -178,7 +180,7 @@ namespace spot
|
||||||
};
|
};
|
||||||
|
|
||||||
saba_complement_tgba_succ_iterator::
|
saba_complement_tgba_succ_iterator::
|
||||||
saba_complement_tgba_succ_iterator(const tgba_digraph* automaton,
|
saba_complement_tgba_succ_iterator(const const_tgba_digraph_ptr& automaton,
|
||||||
bdd the_acceptance_cond,
|
bdd the_acceptance_cond,
|
||||||
const saba_state_complement_tgba* origin)
|
const saba_state_complement_tgba* origin)
|
||||||
: automaton_(automaton), the_acceptance_cond_(the_acceptance_cond),
|
: automaton_(automaton), the_acceptance_cond_(the_acceptance_cond),
|
||||||
|
|
@ -366,7 +368,7 @@ namespace spot
|
||||||
|
|
||||||
} // end namespace anonymous.
|
} // end namespace anonymous.
|
||||||
|
|
||||||
saba_complement_tgba::saba_complement_tgba(const tgba* a)
|
saba_complement_tgba::saba_complement_tgba(const const_tgba_ptr& a)
|
||||||
: automaton_(degeneralize(a))
|
: automaton_(degeneralize(a))
|
||||||
{
|
{
|
||||||
get_dict()->register_all_variables_of(automaton_, this);
|
get_dict()->register_all_variables_of(automaton_, this);
|
||||||
|
|
@ -379,7 +381,6 @@ namespace spot
|
||||||
saba_complement_tgba::~saba_complement_tgba()
|
saba_complement_tgba::~saba_complement_tgba()
|
||||||
{
|
{
|
||||||
get_dict()->unregister_all_my_variables(this);
|
get_dict()->unregister_all_my_variables(this);
|
||||||
delete automaton_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saba_state*
|
saba_state*
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,11 @@
|
||||||
#ifndef SPOT_SABA_SABACOMPLEMENTTGBA_HH
|
#ifndef SPOT_SABA_SABACOMPLEMENTTGBA_HH
|
||||||
#define SPOT_SABA_SABACOMPLEMENTTGBA_HH
|
#define SPOT_SABA_SABACOMPLEMENTTGBA_HH
|
||||||
|
|
||||||
#include <tgba/tgba.hh>
|
#include "tgba/fwd.hh"
|
||||||
#include "saba.hh"
|
#include "saba.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
class tgba_digraph;
|
|
||||||
|
|
||||||
/// \ingroup saba
|
/// \ingroup saba
|
||||||
/// \brief Complement a TGBA and produce a SABA.
|
/// \brief Complement a TGBA and produce a SABA.
|
||||||
///
|
///
|
||||||
|
|
@ -55,7 +53,7 @@ namespace spot
|
||||||
class SPOT_API saba_complement_tgba : public saba
|
class SPOT_API saba_complement_tgba : public saba
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
saba_complement_tgba(const tgba* a);
|
saba_complement_tgba(const const_tgba_ptr& a);
|
||||||
virtual ~saba_complement_tgba();
|
virtual ~saba_complement_tgba();
|
||||||
|
|
||||||
// tgba interface
|
// tgba interface
|
||||||
|
|
@ -67,11 +65,20 @@ namespace spot
|
||||||
virtual std::string format_state(const saba_state* state) const;
|
virtual std::string format_state(const saba_state* state) const;
|
||||||
virtual bdd all_acceptance_conditions() const;
|
virtual bdd all_acceptance_conditions() const;
|
||||||
private:
|
private:
|
||||||
const tgba_digraph* automaton_;
|
const_tgba_digraph_ptr automaton_;
|
||||||
bdd the_acceptance_cond_;
|
bdd the_acceptance_cond_;
|
||||||
unsigned nb_states_;
|
unsigned nb_states_;
|
||||||
}; // end class tgba_saba_complement.
|
}; // end class tgba_saba_complement.
|
||||||
|
|
||||||
|
typedef std::shared_ptr<saba_complement_tgba> saba_complement_tgba_ptr;
|
||||||
|
typedef std::shared_ptr<const saba_complement_tgba>
|
||||||
|
const_saba_complement_tgba_ptr;
|
||||||
|
inline saba_complement_tgba_ptr make_saba_complement(const const_tgba_ptr& a)
|
||||||
|
{
|
||||||
|
return std::make_shared<saba_complement_tgba>(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // end namespace spot.
|
} // end namespace spot.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include "saba/saba.hh"
|
|
||||||
#include "sabadotty.hh"
|
#include "sabadotty.hh"
|
||||||
#include "tgba/bddprint.hh"
|
#include "tgba/bddprint.hh"
|
||||||
#include "sabareachiter.hh"
|
#include "sabareachiter.hh"
|
||||||
|
|
@ -31,7 +30,7 @@ namespace spot
|
||||||
class saba_dotty_bfs : public saba_reachable_iterator_breadth_first
|
class saba_dotty_bfs : public saba_reachable_iterator_breadth_first
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
saba_dotty_bfs(std::ostream& os, const saba* a)
|
saba_dotty_bfs(std::ostream& os, const const_saba_ptr& a)
|
||||||
: saba_reachable_iterator_breadth_first(a), os_(os)
|
: saba_reachable_iterator_breadth_first(a), os_(os)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -96,7 +95,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
saba_dotty_reachable(std::ostream& os, const saba* g)
|
saba_dotty_reachable(std::ostream& os, const const_saba_ptr& g)
|
||||||
{
|
{
|
||||||
saba_dotty_bfs d(os, g);
|
saba_dotty_bfs d(os, g);
|
||||||
d.run();
|
d.run();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2009, 2013 Laboratoire de Recherche et Développement
|
// Copyright (C) 2009, 2013, 2014 Laboratoire de Recherche et
|
||||||
// de l'Epita (LRDE).
|
// Développement de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -22,16 +22,15 @@
|
||||||
|
|
||||||
#include "misc/common.hh"
|
#include "misc/common.hh"
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
#include "saba/saba.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
class saba;
|
|
||||||
|
|
||||||
/// \ingroup saba_io
|
/// \ingroup saba_io
|
||||||
/// \brief Print reachable states in dot format.
|
/// \brief Print reachable states in dot format.
|
||||||
SPOT_API std::ostream&
|
SPOT_API std::ostream&
|
||||||
saba_dotty_reachable(std::ostream& os,
|
saba_dotty_reachable(std::ostream& os,
|
||||||
const saba* g);
|
const const_saba_ptr& g);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_SABAALGOS_SABADOTTY_HH
|
#endif // SPOT_SABAALGOS_SABADOTTY_HH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright (C) 2009 Laboratoire de Recherche et Développement
|
// -*- coding: utf-8 -*-
|
||||||
|
// Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
|
||||||
// de l'Epita (LRDE).
|
// de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -24,7 +25,7 @@ namespace spot
|
||||||
// saba_reachable_iterator
|
// saba_reachable_iterator
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
saba_reachable_iterator::saba_reachable_iterator(const saba* a)
|
saba_reachable_iterator::saba_reachable_iterator(const const_saba_ptr& a)
|
||||||
: automata_(a)
|
: automata_(a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -137,7 +138,7 @@ namespace spot
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
saba_reachable_iterator_depth_first::
|
saba_reachable_iterator_depth_first::
|
||||||
saba_reachable_iterator_depth_first(const saba* a)
|
saba_reachable_iterator_depth_first(const const_saba_ptr& a)
|
||||||
: saba_reachable_iterator(a)
|
: saba_reachable_iterator(a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +163,7 @@ namespace spot
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
saba_reachable_iterator_breadth_first::
|
saba_reachable_iterator_breadth_first::
|
||||||
saba_reachable_iterator_breadth_first(const saba* a)
|
saba_reachable_iterator_breadth_first(const const_saba_ptr& a)
|
||||||
: saba_reachable_iterator(a)
|
: saba_reachable_iterator(a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2009, 2010, 2013 Laboratoire de Recherche et
|
// Copyright (C) 2009, 2010, 2013, 2014 Laboratoire de Recherche et
|
||||||
// Développement de l'Epita (LRDE).
|
// Développement de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -32,7 +32,7 @@ namespace spot
|
||||||
class SPOT_API saba_reachable_iterator
|
class SPOT_API saba_reachable_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
saba_reachable_iterator(const saba* a);
|
saba_reachable_iterator(const const_saba_ptr& a);
|
||||||
virtual ~saba_reachable_iterator();
|
virtual ~saba_reachable_iterator();
|
||||||
|
|
||||||
/// \brief Iterate over all reachable states of a spot::saba.
|
/// \brief Iterate over all reachable states of a spot::saba.
|
||||||
|
|
@ -106,7 +106,7 @@ namespace spot
|
||||||
const saba_succ_iterator* si);
|
const saba_succ_iterator* si);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const saba* automata_; ///< The spot::saba to explore.
|
const_saba_ptr automata_; ///< The spot::saba to explore.
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
std::unordered_map<const saba_state*, int,
|
std::unordered_map<const saba_state*, int,
|
||||||
|
|
@ -121,7 +121,7 @@ namespace spot
|
||||||
public saba_reachable_iterator
|
public saba_reachable_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
saba_reachable_iterator_depth_first(const saba* a);
|
saba_reachable_iterator_depth_first(const const_saba_ptr& a);
|
||||||
|
|
||||||
virtual void add_state(const saba_state* s);
|
virtual void add_state(const saba_state* s);
|
||||||
virtual const saba_state* next_state();
|
virtual const saba_state* next_state();
|
||||||
|
|
@ -137,7 +137,7 @@ namespace spot
|
||||||
public saba_reachable_iterator
|
public saba_reachable_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
saba_reachable_iterator_breadth_first(const saba* a);
|
saba_reachable_iterator_breadth_first(const const_saba_ptr& a);
|
||||||
|
|
||||||
virtual void add_state(const saba_state* s);
|
virtual void add_state(const saba_state* s);
|
||||||
virtual const saba_state* next_state();
|
virtual const saba_state* next_state();
|
||||||
|
|
|
||||||
|
|
@ -70,13 +70,7 @@ int main(int argc, char* argv[])
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
auto a = spot::ltl_to_tgba_fm(f1, spot::make_bdd_dict());
|
auto a = spot::ltl_to_tgba_fm(f1, spot::make_bdd_dict());
|
||||||
|
auto complement = spot::make_saba_complement(a);
|
||||||
spot::saba_complement_tgba* complement =
|
|
||||||
new spot::saba_complement_tgba(a);
|
|
||||||
|
|
||||||
spot::saba_dotty_reachable(std::cout, complement);
|
spot::saba_dotty_reachable(std::cout, complement);
|
||||||
|
|
||||||
delete complement;
|
|
||||||
delete a;
|
|
||||||
f1->destroy();
|
f1->destroy();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,9 @@ namespace spot
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<ta> ta_ptr;
|
||||||
|
typedef std::shared_ptr<const ta> const_ta_ptr;
|
||||||
|
|
||||||
/// \ingroup ta_essentials
|
/// \ingroup ta_essentials
|
||||||
/// \brief Iterate over the successors of a state.
|
/// \brief Iterate over the successors of a state.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -351,13 +351,12 @@ namespace spot
|
||||||
// ta_explicit
|
// ta_explicit
|
||||||
|
|
||||||
|
|
||||||
ta_explicit::ta_explicit(const tgba* tgba, bdd all_acceptance_conditions,
|
ta_explicit::ta_explicit(const const_tgba_ptr& tgba,
|
||||||
state_ta_explicit* artificial_initial_state,
|
bdd all_acceptance_conditions,
|
||||||
bool own_tgba) :
|
state_ta_explicit* artificial_initial_state):
|
||||||
tgba_(tgba),
|
tgba_(tgba),
|
||||||
all_acceptance_conditions_(all_acceptance_conditions),
|
all_acceptance_conditions_(all_acceptance_conditions),
|
||||||
artificial_initial_state_(artificial_initial_state),
|
artificial_initial_state_(artificial_initial_state)
|
||||||
own_tgba_(own_tgba)
|
|
||||||
{
|
{
|
||||||
get_dict()->register_all_variables_of(&tgba_, this);
|
get_dict()->register_all_variables_of(&tgba_, this);
|
||||||
if (artificial_initial_state != 0)
|
if (artificial_initial_state != 0)
|
||||||
|
|
@ -379,8 +378,6 @@ namespace spot
|
||||||
delete s;
|
delete s;
|
||||||
}
|
}
|
||||||
get_dict()->unregister_all_my_variables(this);
|
get_dict()->unregister_all_my_variables(this);
|
||||||
if (own_tgba_)
|
|
||||||
delete tgba_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state_ta_explicit*
|
state_ta_explicit*
|
||||||
|
|
@ -496,7 +493,7 @@ namespace spot
|
||||||
return tgba_->get_dict();
|
return tgba_->get_dict();
|
||||||
}
|
}
|
||||||
|
|
||||||
const tgba*
|
const_tgba_ptr
|
||||||
ta_explicit::get_tgba() const
|
ta_explicit::get_tgba() const
|
||||||
{
|
{
|
||||||
return tgba_;
|
return tgba_;
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,10 @@ namespace spot
|
||||||
class SPOT_API ta_explicit : public ta
|
class SPOT_API ta_explicit : public ta
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ta_explicit(const tgba* tgba, bdd all_acceptance_conditions,
|
ta_explicit(const const_tgba_ptr& tgba, bdd all_acceptance_conditions,
|
||||||
state_ta_explicit* artificial_initial_state = 0,
|
state_ta_explicit* artificial_initial_state = 0);
|
||||||
bool own_tgba = false);
|
|
||||||
|
|
||||||
const tgba*
|
const_tgba_ptr
|
||||||
get_tgba() const;
|
get_tgba() const;
|
||||||
|
|
||||||
state_ta_explicit*
|
state_ta_explicit*
|
||||||
|
|
@ -135,12 +134,11 @@ namespace spot
|
||||||
ta_explicit(const ta_explicit& other) SPOT_DELETED;
|
ta_explicit(const ta_explicit& other) SPOT_DELETED;
|
||||||
ta_explicit& operator=(const ta_explicit& other) SPOT_DELETED;
|
ta_explicit& operator=(const ta_explicit& other) SPOT_DELETED;
|
||||||
|
|
||||||
const tgba* tgba_;
|
const_tgba_ptr tgba_;
|
||||||
bdd all_acceptance_conditions_;
|
bdd all_acceptance_conditions_;
|
||||||
state_ta_explicit* artificial_initial_state_;
|
state_ta_explicit* artificial_initial_state_;
|
||||||
ta::states_set_t states_set_;
|
ta::states_set_t states_set_;
|
||||||
ta::states_set_t initial_states_set_;
|
ta::states_set_t initial_states_set_;
|
||||||
bool own_tgba_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// states used by spot::ta_explicit.
|
/// states used by spot::ta_explicit.
|
||||||
|
|
@ -265,6 +263,19 @@ namespace spot
|
||||||
state_ta_explicit::transitions::const_iterator i_;
|
state_ta_explicit::transitions::const_iterator i_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<ta_explicit> ta_explicit_ptr;
|
||||||
|
typedef std::shared_ptr<const ta_explicit> const_ta_explicit_ptr;
|
||||||
|
|
||||||
|
inline ta_explicit_ptr make_ta_explicit(const const_tgba_ptr& tgba,
|
||||||
|
bdd all_acceptance_conditions,
|
||||||
|
state_ta_explicit*
|
||||||
|
artificial_initial_state = 0)
|
||||||
|
{
|
||||||
|
return std::make_shared<ta_explicit>(tgba,
|
||||||
|
all_acceptance_conditions,
|
||||||
|
artificial_initial_state);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TA_TAEXPLICIT_HH
|
#endif // SPOT_TA_TAEXPLICIT_HH
|
||||||
|
|
|
||||||
|
|
@ -242,15 +242,15 @@ namespace spot
|
||||||
// ta_product
|
// ta_product
|
||||||
|
|
||||||
|
|
||||||
ta_product::ta_product(const ta* testing_automata,
|
ta_product::ta_product(const const_ta_ptr& testing_automata,
|
||||||
const kripke* kripke_structure) :
|
const const_kripke_ptr& kripke_structure):
|
||||||
dict_(testing_automata->get_dict()), ta_(testing_automata), kripke_(
|
dict_(testing_automata->get_dict()),
|
||||||
kripke_structure)
|
ta_(testing_automata),
|
||||||
|
kripke_(kripke_structure)
|
||||||
{
|
{
|
||||||
assert(dict_ == kripke_structure->get_dict());
|
assert(dict_ == kripke_structure->get_dict());
|
||||||
dict_->register_all_variables_of(&ta_, this);
|
dict_->register_all_variables_of(ta_, this);
|
||||||
dict_->register_all_variables_of(&kripke_, this);
|
dict_->register_all_variables_of(kripke_, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ta_product::~ta_product()
|
ta_product::~ta_product()
|
||||||
|
|
@ -314,7 +314,7 @@ namespace spot
|
||||||
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|
||||||
return new ta_succ_iterator_product(stp, ta_, kripke_);
|
return new ta_succ_iterator_product(stp, ta_.get(), kripke_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -323,7 +323,8 @@ namespace spot
|
||||||
{
|
{
|
||||||
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
||||||
assert(s);
|
assert(s);
|
||||||
return new ta_succ_iterator_product_by_changeset(stp, ta_, kripke_,
|
return new ta_succ_iterator_product_by_changeset(stp,
|
||||||
|
ta_.get(), kripke_.get(),
|
||||||
changeset);
|
changeset);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,8 @@ namespace spot
|
||||||
/// \brief Constructor.
|
/// \brief Constructor.
|
||||||
/// \param testing_automaton The TA component in the product.
|
/// \param testing_automaton The TA component in the product.
|
||||||
/// \param kripke_structure The Kripke component in the product.
|
/// \param kripke_structure The Kripke component in the product.
|
||||||
ta_product(const ta* testing_automaton, const kripke* kripke_structure);
|
ta_product(const const_ta_ptr& testing_automaton,
|
||||||
|
const const_kripke_ptr& kripke_structure);
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
~ta_product();
|
~ta_product();
|
||||||
|
|
@ -179,13 +180,13 @@ namespace spot
|
||||||
virtual void
|
virtual void
|
||||||
free_state(const spot::state* s) const;
|
free_state(const spot::state* s) const;
|
||||||
|
|
||||||
const ta*
|
const const_ta_ptr&
|
||||||
get_ta() const
|
get_ta() const
|
||||||
{
|
{
|
||||||
return ta_;
|
return ta_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const kripke*
|
const const_kripke_ptr&
|
||||||
get_kripke() const
|
get_kripke() const
|
||||||
{
|
{
|
||||||
return kripke_;
|
return kripke_;
|
||||||
|
|
@ -193,8 +194,8 @@ namespace spot
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bdd_dict_ptr dict_;
|
bdd_dict_ptr dict_;
|
||||||
const ta* ta_;
|
const_ta_ptr ta_;
|
||||||
const kripke* kripke_;
|
const_kripke_ptr kripke_;
|
||||||
|
|
||||||
// Disallow copy.
|
// Disallow copy.
|
||||||
ta_product(const ta_product&) SPOT_DELETED;
|
ta_product(const ta_product&) SPOT_DELETED;
|
||||||
|
|
@ -202,6 +203,14 @@ namespace spot
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef std::shared_ptr<ta_product> ta_product_ptr;
|
||||||
|
typedef std::shared_ptr<const ta_product> const_ta_product_ptr;
|
||||||
|
inline ta_product_ptr product(const const_ta_ptr& testing_automaton,
|
||||||
|
const const_kripke_ptr& kripke_structure)
|
||||||
|
{
|
||||||
|
return std::make_shared<ta_product>(testing_automaton, kripke_structure);
|
||||||
|
}
|
||||||
|
|
||||||
class SPOT_API ta_succ_iterator_product_by_changeset :
|
class SPOT_API ta_succ_iterator_product_by_changeset :
|
||||||
public ta_succ_iterator_product
|
public ta_succ_iterator_product
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2010, 2011, 2012, 2013 Laboratoire de Recherche et
|
// Copyright (C) 2010, 2011, 2012, 2013, 2014 Laboratoire de Recherche
|
||||||
// Développement de l'Epita (LRDE).
|
// et Développement de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -78,9 +78,10 @@ namespace spot
|
||||||
///
|
///
|
||||||
virtual tgba_succ_iterator*
|
virtual tgba_succ_iterator*
|
||||||
succ_iter_by_changeset(const spot::state* s, bdd change_set) const =0;
|
succ_iter_by_changeset(const spot::state* s, bdd change_set) const =0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<tgta> tgta_ptr;
|
||||||
|
typedef std::shared_ptr<const tgta> const_tgta_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TA_TGTA_HH
|
#endif // SPOT_TA_TGTA_HH
|
||||||
|
|
|
||||||
|
|
@ -29,23 +29,24 @@
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
||||||
tgta_explicit::tgta_explicit(const tgba* tgba, bdd all_acceptance_conditions,
|
tgta_explicit::tgta_explicit(const const_tgba_ptr& tgba,
|
||||||
state_ta_explicit* artificial_initial_state,
|
bdd all_acceptance_conditions,
|
||||||
bool own_tgba) :
|
state_ta_explicit* artificial_initial_state) :
|
||||||
ta_(tgba, all_acceptance_conditions, artificial_initial_state, own_tgba)
|
ta_(make_ta_explicit(tgba, all_acceptance_conditions,
|
||||||
|
artificial_initial_state))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
state*
|
state*
|
||||||
tgta_explicit::get_init_state() const
|
tgta_explicit::get_init_state() const
|
||||||
{
|
{
|
||||||
return ta_.get_artificial_initial_state();
|
return ta_->get_artificial_initial_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba_succ_iterator*
|
tgba_succ_iterator*
|
||||||
tgta_explicit::succ_iter(const spot::state* state) const
|
tgta_explicit::succ_iter(const spot::state* state) const
|
||||||
{
|
{
|
||||||
return ta_.succ_iter(state);
|
return ta_->succ_iter(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
bdd
|
bdd
|
||||||
|
|
@ -53,37 +54,37 @@ namespace spot
|
||||||
{
|
{
|
||||||
const state_ta_explicit* s = down_cast<const state_ta_explicit*>(in);
|
const state_ta_explicit* s = down_cast<const state_ta_explicit*>(in);
|
||||||
assert(s);
|
assert(s);
|
||||||
return ta_.get_tgba()->support_conditions(s->get_tgba_state());
|
return ta_->get_tgba()->support_conditions(s->get_tgba_state());
|
||||||
}
|
}
|
||||||
|
|
||||||
bdd_dict_ptr
|
bdd_dict_ptr
|
||||||
tgta_explicit::get_dict() const
|
tgta_explicit::get_dict() const
|
||||||
{
|
{
|
||||||
return ta_.get_dict();
|
return ta_->get_dict();
|
||||||
}
|
}
|
||||||
|
|
||||||
bdd
|
bdd
|
||||||
tgta_explicit::all_acceptance_conditions() const
|
tgta_explicit::all_acceptance_conditions() const
|
||||||
{
|
{
|
||||||
return ta_.all_acceptance_conditions();
|
return ta_->all_acceptance_conditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bdd
|
bdd
|
||||||
tgta_explicit::neg_acceptance_conditions() const
|
tgta_explicit::neg_acceptance_conditions() const
|
||||||
{
|
{
|
||||||
return ta_.get_tgba()->neg_acceptance_conditions();
|
return ta_->get_tgba()->neg_acceptance_conditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
tgta_explicit::format_state(const spot::state* s) const
|
tgta_explicit::format_state(const spot::state* s) const
|
||||||
{
|
{
|
||||||
return ta_.format_state(s);
|
return ta_->format_state(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
spot::tgba_succ_iterator*
|
spot::tgba_succ_iterator*
|
||||||
tgta_explicit::succ_iter_by_changeset(const spot::state* s, bdd chngset) const
|
tgta_explicit::succ_iter_by_changeset(const spot::state* s, bdd chngset) const
|
||||||
{
|
{
|
||||||
return ta_.succ_iter(s, chngset);
|
return ta_->succ_iter(s, chngset);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ namespace spot
|
||||||
class SPOT_API tgta_explicit : public tgta
|
class SPOT_API tgta_explicit : public tgta
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tgta_explicit(const tgba* tgba, bdd all_acceptance_conditions,
|
tgta_explicit(const const_tgba_ptr& tgba,
|
||||||
state_ta_explicit* artificial_initial_state,
|
bdd all_acceptance_conditions,
|
||||||
bool own_tgba = false);
|
state_ta_explicit* artificial_initial_state);
|
||||||
|
|
||||||
// tgba interface
|
// tgba interface
|
||||||
virtual spot::state* get_init_state() const;
|
virtual spot::state* get_init_state() const;
|
||||||
|
|
@ -51,8 +51,8 @@ namespace spot
|
||||||
virtual bdd_dict_ptr
|
virtual bdd_dict_ptr
|
||||||
get_dict() const;
|
get_dict() const;
|
||||||
|
|
||||||
const ta_explicit* get_ta() const { return &ta_; }
|
const_ta_explicit_ptr get_ta() const { return ta_; }
|
||||||
ta_explicit* get_ta() { return &ta_; }
|
ta_explicit_ptr get_ta() { return ta_; }
|
||||||
|
|
||||||
virtual bdd all_acceptance_conditions() const;
|
virtual bdd all_acceptance_conditions() const;
|
||||||
virtual bdd neg_acceptance_conditions() const;
|
virtual bdd neg_acceptance_conditions() const;
|
||||||
|
|
@ -64,9 +64,21 @@ namespace spot
|
||||||
protected:
|
protected:
|
||||||
virtual bdd compute_support_conditions(const spot::state* state) const;
|
virtual bdd compute_support_conditions(const spot::state* state) const;
|
||||||
|
|
||||||
ta_explicit ta_;
|
ta_explicit_ptr ta_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<tgta_explicit> tgta_explicit_ptr;
|
||||||
|
typedef std::shared_ptr<const tgta_explicit> const_tgta_explicit_ptr;
|
||||||
|
|
||||||
|
inline tgta_explicit_ptr make_tgta_explicit(const const_tgba_ptr& tgba,
|
||||||
|
bdd all_acceptance_conditions,
|
||||||
|
state_ta_explicit*
|
||||||
|
artificial_initial_state = 0)
|
||||||
|
{
|
||||||
|
return std::make_shared<tgta_explicit>(tgba,
|
||||||
|
all_acceptance_conditions,
|
||||||
|
artificial_initial_state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TA_TGTAEXPLICIT_HH
|
#endif // SPOT_TA_TGTAEXPLICIT_HH
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ namespace spot
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// tgta_product
|
// tgta_product
|
||||||
|
|
||||||
tgta_product::tgta_product(const kripke* left, const tgta* right) :
|
tgta_product::tgta_product(const const_kripke_ptr& left,
|
||||||
|
const const_tgta_ptr& right):
|
||||||
tgba_product(left, right)
|
tgba_product(left, right)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -64,15 +65,16 @@ namespace spot
|
||||||
|
|
||||||
fixed_size_pool* p = const_cast<fixed_size_pool*> (&pool_);
|
fixed_size_pool* p = const_cast<fixed_size_pool*> (&pool_);
|
||||||
|
|
||||||
return new tgta_succ_iterator_product(s,
|
auto l = std::static_pointer_cast<const kripke>(left_);
|
||||||
down_cast<const kripke*>(left_),
|
auto r = std::static_pointer_cast<const tgta>(right_);
|
||||||
down_cast<const tgta*>(right_), p);
|
return new tgta_succ_iterator_product(s, l, r, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// tgbtgta_succ_iterator_product
|
// tgbtgta_succ_iterator_product
|
||||||
tgta_succ_iterator_product::tgta_succ_iterator_product(
|
tgta_succ_iterator_product::tgta_succ_iterator_product(
|
||||||
const state_product* s, const kripke* k, const tgta* t,
|
const state_product* s,
|
||||||
|
const const_kripke_ptr& k, const const_tgta_ptr& t,
|
||||||
fixed_size_pool* pool)
|
fixed_size_pool* pool)
|
||||||
: source_(s), tgta_(t), kripke_(k), pool_(pool)
|
: source_(s), tgta_(t), kripke_(k), pool_(pool)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ namespace spot
|
||||||
class SPOT_API tgta_product : public tgba_product
|
class SPOT_API tgta_product : public tgba_product
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tgta_product(const kripke* left, const tgta* right);
|
tgta_product(const const_kripke_ptr& left,
|
||||||
|
const const_tgta_ptr& right);
|
||||||
|
|
||||||
virtual state*
|
virtual state*
|
||||||
get_init_state() const;
|
get_init_state() const;
|
||||||
|
|
@ -42,12 +43,20 @@ namespace spot
|
||||||
succ_iter(const state* local_state) const;
|
succ_iter(const state* local_state) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline tgba_ptr product(const const_kripke_ptr& left,
|
||||||
|
const const_tgta_ptr& right)
|
||||||
|
{
|
||||||
|
return std::make_shared<tgta_product>(left, right);
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Iterate over the successors of a product computed on the fly.
|
/// \brief Iterate over the successors of a product computed on the fly.
|
||||||
class SPOT_API tgta_succ_iterator_product : public tgba_succ_iterator
|
class SPOT_API tgta_succ_iterator_product : public tgba_succ_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tgta_succ_iterator_product(const state_product* s, const kripke* k,
|
tgta_succ_iterator_product(const state_product* s,
|
||||||
const tgta* tgta, fixed_size_pool* pool);
|
const const_kripke_ptr& k,
|
||||||
|
const const_tgta_ptr& tgta,
|
||||||
|
fixed_size_pool* pool);
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
~tgta_succ_iterator_product();
|
~tgta_succ_iterator_product();
|
||||||
|
|
@ -80,8 +89,8 @@ namespace spot
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const state_product* source_;
|
const state_product* source_;
|
||||||
const tgta* tgta_;
|
const_tgta_ptr tgta_;
|
||||||
const kripke* kripke_;
|
const_kripke_ptr kripke_;
|
||||||
fixed_size_pool* pool_;
|
fixed_size_pool* pool_;
|
||||||
tgba_succ_iterator* tgta_succ_it_;
|
tgba_succ_iterator* tgta_succ_it_;
|
||||||
tgba_succ_iterator* kripke_succ_it_;
|
tgba_succ_iterator* kripke_succ_it_;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace spot
|
||||||
class dotty_bfs : public ta_reachable_iterator_breadth_first
|
class dotty_bfs : public ta_reachable_iterator_breadth_first
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
dotty_bfs(std::ostream& os, const ta* a) :
|
dotty_bfs(std::ostream& os, const const_ta_ptr& a) :
|
||||||
ta_reachable_iterator_breadth_first(a), os_(os)
|
ta_reachable_iterator_breadth_first(a), os_(os)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +123,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
dotty_reachable(std::ostream& os, const ta* a)
|
dotty_reachable(std::ostream& os, const const_ta_ptr& a)
|
||||||
{
|
{
|
||||||
dotty_bfs d(os, a);
|
dotty_bfs d(os, a);
|
||||||
d.run();
|
d.run();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2010, 2013 Laboratoire de Recherche et Développement
|
// Copyright (C) 2010, 2013, 2014 Laboratoire de Recherche et Développement
|
||||||
// de l'Epita (LRDE).
|
// de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -25,10 +25,8 @@
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
class ta;
|
|
||||||
|
|
||||||
SPOT_API std::ostream&
|
SPOT_API std::ostream&
|
||||||
dotty_reachable(std::ostream& os, const ta* a);
|
dotty_reachable(std::ostream& os, const const_ta_ptr& a);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TAALGOS_DOTTY_HH
|
#endif // SPOT_TAALGOS_DOTTY_HH
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
||||||
ta_check::ta_check(const ta_product* a, option_map o) :
|
ta_check::ta_check(const const_ta_product_ptr& a, option_map o) :
|
||||||
a_(a), o_(o)
|
a_(a), o_(o)
|
||||||
{
|
{
|
||||||
is_full_2_pass_ = o.get("is_full_2_pass", 0);
|
is_full_2_pass_ = o.get("is_full_2_pass", 0);
|
||||||
|
|
@ -89,8 +89,8 @@ namespace spot
|
||||||
&& (is_full_2_pass_ == disable_second_pass);
|
&& (is_full_2_pass_ == disable_second_pass);
|
||||||
|
|
||||||
// Setup depth-first search from initial states.
|
// Setup depth-first search from initial states.
|
||||||
const ta* ta_ = a_->get_ta();
|
auto& ta_ = a_->get_ta();
|
||||||
const kripke* kripke_ = a_->get_kripke();
|
auto& kripke_ = a_->get_kripke();
|
||||||
state* kripke_init_state = kripke_->get_init_state();
|
state* kripke_init_state = kripke_->get_init_state();
|
||||||
bdd kripke_init_state_condition = kripke_->state_condition(
|
bdd kripke_init_state_condition = kripke_->state_condition(
|
||||||
kripke_init_state);
|
kripke_init_state);
|
||||||
|
|
@ -383,7 +383,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ta_check::livelock_detection(const ta_product* t)
|
ta_check::livelock_detection(const const_ta_product_ptr& t)
|
||||||
{
|
{
|
||||||
// We use five main data in this algorithm:
|
// We use five main data in this algorithm:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ namespace spot
|
||||||
typedef std::unordered_map<const state*, int,
|
typedef std::unordered_map<const state*, int,
|
||||||
state_ptr_hash, state_ptr_equal> hash_type;
|
state_ptr_hash, state_ptr_equal> hash_type;
|
||||||
public:
|
public:
|
||||||
ta_check(const ta_product* a, option_map o = option_map());
|
ta_check(const const_ta_product_ptr& a, option_map o = option_map());
|
||||||
virtual
|
virtual
|
||||||
~ta_check();
|
~ta_check();
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ namespace spot
|
||||||
/// Return false if the product automaton accepts no livelock-accepting run,
|
/// Return false if the product automaton accepts no livelock-accepting run,
|
||||||
/// otherwise true
|
/// otherwise true
|
||||||
virtual bool
|
virtual bool
|
||||||
livelock_detection(const ta_product* t);
|
livelock_detection(const const_ta_product_ptr& t);
|
||||||
|
|
||||||
/// Print statistics, if any.
|
/// Print statistics, if any.
|
||||||
virtual std::ostream&
|
virtual std::ostream&
|
||||||
|
|
@ -141,7 +141,7 @@ namespace spot
|
||||||
hash_type& h, int h_livelock_root, std::set<const state*,
|
hash_type& h, int h_livelock_root, std::set<const state*,
|
||||||
state_ptr_less_than> liveset_curr);
|
state_ptr_less_than> liveset_curr);
|
||||||
|
|
||||||
const ta_product* a_; ///< The automaton.
|
const_ta_product_ptr a_; ///< The automaton.
|
||||||
option_map o_; ///< The options
|
option_map o_; ///< The options
|
||||||
|
|
||||||
// Force the second pass
|
// Force the second pass
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ namespace spot
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static std::ostream&
|
static std::ostream&
|
||||||
dump_hash_set(const hash_set* hs, const ta* aut, std::ostream& out)
|
dump_hash_set(const hash_set* hs,
|
||||||
|
const const_ta_ptr& aut,
|
||||||
|
std::ostream& out)
|
||||||
{
|
{
|
||||||
out << '{';
|
out << '{';
|
||||||
const char* sep = "";
|
const char* sep = "";
|
||||||
|
|
@ -63,7 +65,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string
|
static std::string
|
||||||
format_hash_set(const hash_set* hs, const ta* aut)
|
format_hash_set(const hash_set* hs, const const_ta_ptr& aut)
|
||||||
{
|
{
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
dump_hash_set(hs, aut, s);
|
dump_hash_set(hs, aut, s);
|
||||||
|
|
@ -73,8 +75,8 @@ namespace spot
|
||||||
// From the base automaton and the list of sets, build the minimal
|
// From the base automaton and the list of sets, build the minimal
|
||||||
// automaton
|
// automaton
|
||||||
static void
|
static void
|
||||||
build_result(const ta* a, std::list<hash_set*>& sets,
|
build_result(const const_ta_ptr& a, std::list<hash_set*>& sets,
|
||||||
tgba_digraph* result_tgba, ta_explicit* result)
|
tgba_digraph_ptr result_tgba, const ta_explicit_ptr& result)
|
||||||
{
|
{
|
||||||
// For each set, create a state in the tgbaulting automaton.
|
// 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
|
// For a state s, state_num[s] is the number of the state in the minimal
|
||||||
|
|
@ -181,7 +183,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
static partition_t
|
static partition_t
|
||||||
build_partition(const ta* ta_)
|
build_partition(const const_ta_ptr& ta_)
|
||||||
{
|
{
|
||||||
partition_t cur_run;
|
partition_t cur_run;
|
||||||
partition_t next_run;
|
partition_t next_run;
|
||||||
|
|
@ -482,13 +484,12 @@ namespace spot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ta*
|
ta_explicit_ptr
|
||||||
minimize_ta(const ta* ta_)
|
minimize_ta(const const_ta_ptr& ta_)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto tgba = new tgba_digraph(ta_->get_dict());
|
auto tgba = make_tgba_digraph(ta_->get_dict());
|
||||||
auto res = new ta_explicit(tgba, ta_->all_acceptance_conditions(),
|
auto res = make_ta_explicit(tgba, ta_->all_acceptance_conditions(), 0);
|
||||||
0, /* own_tgba = */ true);
|
|
||||||
|
|
||||||
partition_t partition = build_partition(ta_);
|
partition_t partition = build_partition(ta_);
|
||||||
|
|
||||||
|
|
@ -503,15 +504,14 @@ namespace spot
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
tgta_explicit*
|
tgta_explicit_ptr
|
||||||
minimize_tgta(const tgta_explicit* tgta_)
|
minimize_tgta(const const_tgta_explicit_ptr& tgta_)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto tgba = new tgba_digraph(tgta_->get_dict());
|
auto tgba = make_tgba_digraph(tgta_->get_dict());
|
||||||
auto res = new tgta_explicit(tgba, tgta_->all_acceptance_conditions(),
|
auto res = make_tgta_explicit(tgba, tgta_->all_acceptance_conditions(), 0);
|
||||||
0, /* own_tgba = */ true);
|
|
||||||
|
|
||||||
const ta_explicit* ta = tgta_->get_ta();
|
auto ta = tgta_->get_ta();
|
||||||
|
|
||||||
partition_t partition = build_partition(ta);
|
partition_t partition = build_partition(ta);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2009, 2010, 2011, 2012, 2013 Laboratoire de Recherche
|
// Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire de
|
||||||
// et Développement de l'Epita (LRDE).
|
// Recherche et Développement de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -56,8 +56,8 @@ namespace spot
|
||||||
\endverbatim */
|
\endverbatim */
|
||||||
///
|
///
|
||||||
/// \param ta_ the TA automaton to convert into a simplified TA
|
/// \param ta_ the TA automaton to convert into a simplified TA
|
||||||
SPOT_API ta*
|
SPOT_API ta_explicit_ptr
|
||||||
minimize_ta(const ta* ta_);
|
minimize_ta(const const_ta_ptr& ta_);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -70,8 +70,8 @@ namespace spot
|
||||||
/// the acceptance conditions of the outgoing transitions.
|
/// the acceptance conditions of the outgoing transitions.
|
||||||
///
|
///
|
||||||
/// \param tgta_ the TGTA automaton to convert into a simplified TGTA
|
/// \param tgta_ the TGTA automaton to convert into a simplified TGTA
|
||||||
SPOT_API tgta_explicit*
|
SPOT_API tgta_explicit_ptr
|
||||||
minimize_tgta(const tgta_explicit* tgta_);
|
minimize_tgta(const const_tgta_explicit_ptr& tgta_);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2010, 2012 Laboratoire de Recherche et Développement
|
// Copyright (C) 2010, 2012, 2014 Laboratoire de Recherche et Développement
|
||||||
// de l Epita (LRDE).
|
// de l'Epita (LRDE).
|
||||||
//
|
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -29,7 +28,7 @@ namespace spot
|
||||||
// ta_reachable_iterator
|
// ta_reachable_iterator
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ta_reachable_iterator::ta_reachable_iterator(const ta* a) :
|
ta_reachable_iterator::ta_reachable_iterator(const const_ta_ptr& a) :
|
||||||
t_automata_(a)
|
t_automata_(a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -139,7 +138,7 @@ namespace spot
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ta_reachable_iterator_depth_first::ta_reachable_iterator_depth_first(
|
ta_reachable_iterator_depth_first::ta_reachable_iterator_depth_first(
|
||||||
const ta* a) :
|
const const_ta_ptr& a) :
|
||||||
ta_reachable_iterator(a)
|
ta_reachable_iterator(a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +163,7 @@ namespace spot
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ta_reachable_iterator_breadth_first::ta_reachable_iterator_breadth_first(
|
ta_reachable_iterator_breadth_first::ta_reachable_iterator_breadth_first(
|
||||||
const ta* a) :
|
const const_ta_ptr& a) :
|
||||||
ta_reachable_iterator(a)
|
ta_reachable_iterator(a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2010, 2011, 2012, 2013 Laboratoire de Recherche et
|
// Copyright (C) 2010, 2011, 2012, 2013, 2014 Laboratoire de Recherche
|
||||||
// Développement de l'Epita (LRDE).
|
// et Développement de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -32,7 +32,7 @@ namespace spot
|
||||||
class SPOT_API ta_reachable_iterator
|
class SPOT_API ta_reachable_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ta_reachable_iterator(const ta* a);
|
ta_reachable_iterator(const const_ta_ptr& a);
|
||||||
virtual
|
virtual
|
||||||
~ta_reachable_iterator();
|
~ta_reachable_iterator();
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ namespace spot
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
const ta* t_automata_; ///< The spot::ta to explore.
|
const_ta_ptr t_automata_; ///< The spot::ta to explore.
|
||||||
|
|
||||||
typedef std::unordered_map<const state*, int,
|
typedef std::unordered_map<const state*, int,
|
||||||
state_ptr_hash, state_ptr_equal> seen_map;
|
state_ptr_hash, state_ptr_equal> seen_map;
|
||||||
|
|
@ -101,7 +101,7 @@ namespace spot
|
||||||
: public ta_reachable_iterator
|
: public ta_reachable_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ta_reachable_iterator_depth_first(const ta* a);
|
ta_reachable_iterator_depth_first(const const_ta_ptr& a);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
add_state(const state* s);
|
add_state(const state* s);
|
||||||
|
|
@ -119,7 +119,7 @@ namespace spot
|
||||||
: public ta_reachable_iterator
|
: public ta_reachable_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ta_reachable_iterator_breadth_first(const ta* a);
|
ta_reachable_iterator_breadth_first(const const_ta_ptr& a);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
add_state(const state* s);
|
add_state(const state* s);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright (C) 2010 Laboratoire de Recherche et Développement
|
// -*- coding: utf-8 -*-
|
||||||
|
// Copyright (C) 2010, 2014 Laboratoire de Recherche et Développement
|
||||||
// de l'Epita (LRDE).
|
// de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -28,7 +29,7 @@ namespace spot
|
||||||
class states_set_builder_bfs : public ta_reachable_iterator_breadth_first
|
class states_set_builder_bfs : public ta_reachable_iterator_breadth_first
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
states_set_builder_bfs(const ta* a) :
|
states_set_builder_bfs(const const_ta_ptr& a) :
|
||||||
ta_reachable_iterator_breadth_first(a)
|
ta_reachable_iterator_breadth_first(a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +59,7 @@ namespace spot
|
||||||
|
|
||||||
|
|
||||||
std::set<const state*>
|
std::set<const state*>
|
||||||
get_states_set(const ta* t)
|
get_states_set(const const_ta_ptr& t)
|
||||||
{
|
{
|
||||||
states_set_builder_bfs d(t);
|
states_set_builder_bfs d(t);
|
||||||
d.run();
|
d.run();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2010, 2013 Laboratoire de Recherche et Développement
|
// Copyright (C) 2010, 2013, 2014 Laboratoire de Recherche et
|
||||||
// de l'Epita (LRDE).
|
// Développement de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -26,7 +26,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
|
|
||||||
/// \brief Compute states set for an automaton.
|
/// \brief Compute states set for an automaton.
|
||||||
SPOT_API std::set<const state*> get_states_set(const ta* t);
|
SPOT_API std::set<const state*> get_states_set(const const_ta_ptr& t);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
// Copyright (C) 2008 Laboratoire de Recherche et Développement
|
// -*- coding: utf-8 -*-
|
||||||
|
// Copyright (C) 2008, 2014 Laboratoire de Recherche et Développement
|
||||||
// de l'Epita (LRDE).
|
// de l'Epita (LRDE).
|
||||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
// et Marie Curie.
|
// et Marie Curie.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -31,7 +32,7 @@ namespace spot
|
||||||
class stats_bfs : public ta_reachable_iterator_breadth_first
|
class stats_bfs : public ta_reachable_iterator_breadth_first
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
stats_bfs(const ta* a, ta_statistics& s) :
|
stats_bfs(const const_ta_ptr a, ta_statistics& s) :
|
||||||
ta_reachable_iterator_breadth_first(a), s_(s)
|
ta_reachable_iterator_breadth_first(a), s_(s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +67,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
ta_statistics
|
ta_statistics
|
||||||
stats_reachable(const ta* t)
|
stats_reachable(const const_ta_ptr& t)
|
||||||
{
|
{
|
||||||
ta_statistics s =
|
ta_statistics s =
|
||||||
{ 0, 0, 0};
|
{ 0, 0, 0};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Développement
|
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et Développement
|
||||||
// de l'Epita (LRDE).
|
// de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -39,7 +39,7 @@ namespace spot
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Compute statistics for an automaton.
|
/// \brief Compute statistics for an automaton.
|
||||||
SPOT_API ta_statistics stats_reachable(const ta* t);
|
SPOT_API ta_statistics stats_reachable(const const_ta_ptr& t);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace spot
|
||||||
|
|
||||||
static void
|
static void
|
||||||
transform_to_single_pass_automaton
|
transform_to_single_pass_automaton
|
||||||
(ta_explicit* testing_automata,
|
(const ta_explicit_ptr& testing_automata,
|
||||||
state_ta_explicit* artificial_livelock_acc_state = 0)
|
state_ta_explicit* artificial_livelock_acc_state = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -148,7 +148,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compute_livelock_acceptance_states(ta_explicit* testing_automata,
|
compute_livelock_acceptance_states(const ta_explicit_ptr& testing_automata,
|
||||||
bool single_pass_emptiness_check,
|
bool single_pass_emptiness_check,
|
||||||
state_ta_explicit*
|
state_ta_explicit*
|
||||||
artificial_livelock_acc_state)
|
artificial_livelock_acc_state)
|
||||||
|
|
@ -408,14 +408,15 @@ namespace spot
|
||||||
artificial_livelock_acc_state);
|
artificial_livelock_acc_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
ta_explicit*
|
ta_explicit_ptr
|
||||||
build_ta(ta_explicit* ta, bdd atomic_propositions_set_, bool degeneralized,
|
build_ta(const ta_explicit_ptr& ta, bdd atomic_propositions_set_,
|
||||||
|
bool degeneralized,
|
||||||
bool single_pass_emptiness_check,
|
bool single_pass_emptiness_check,
|
||||||
bool artificial_livelock_state_mode)
|
bool artificial_livelock_state_mode)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::stack<state_ta_explicit*> todo;
|
std::stack<state_ta_explicit*> todo;
|
||||||
const tgba* tgba_ = ta->get_tgba();
|
const_tgba_ptr tgba_ = ta->get_tgba();
|
||||||
|
|
||||||
// build Initial states set:
|
// build Initial states set:
|
||||||
state* tgba_init_state = tgba_->get_init_state();
|
state* tgba_init_state = tgba_->get_init_state();
|
||||||
|
|
@ -540,12 +541,12 @@ namespace spot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ta_explicit*
|
ta_explicit_ptr
|
||||||
tgba_to_ta(const tgba* tgba_, bdd atomic_propositions_set_,
|
tgba_to_ta(const const_tgba_ptr& tgba_, bdd atomic_propositions_set_,
|
||||||
bool degeneralized, bool artificial_initial_state_mode,
|
bool degeneralized, bool artificial_initial_state_mode,
|
||||||
bool single_pass_emptiness_check, bool artificial_livelock_state_mode)
|
bool single_pass_emptiness_check, bool artificial_livelock_state_mode)
|
||||||
{
|
{
|
||||||
ta_explicit* ta;
|
ta_explicit_ptr ta;
|
||||||
|
|
||||||
state* tgba_init_state = tgba_->get_init_state();
|
state* tgba_init_state = tgba_->get_init_state();
|
||||||
if (artificial_initial_state_mode)
|
if (artificial_initial_state_mode)
|
||||||
|
|
@ -553,16 +554,16 @@ namespace spot
|
||||||
state_ta_explicit* artificial_init_state =
|
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 = new spot::ta_explicit(tgba_, tgba_->all_acceptance_conditions(),
|
ta = make_ta_explicit(tgba_, tgba_->all_acceptance_conditions(),
|
||||||
artificial_init_state);
|
artificial_init_state);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ta = new spot::ta_explicit(tgba_, tgba_->all_acceptance_conditions());
|
ta = make_ta_explicit(tgba_, tgba_->all_acceptance_conditions());
|
||||||
}
|
}
|
||||||
tgba_init_state->destroy();
|
tgba_init_state->destroy();
|
||||||
|
|
||||||
// build ta automata:
|
// build ta automaton
|
||||||
build_ta(ta, atomic_propositions_set_, degeneralized,
|
build_ta(ta, atomic_propositions_set_, degeneralized,
|
||||||
single_pass_emptiness_check, artificial_livelock_state_mode);
|
single_pass_emptiness_check, artificial_livelock_state_mode);
|
||||||
|
|
||||||
|
|
@ -597,20 +598,20 @@ namespace spot
|
||||||
return ta;
|
return ta;
|
||||||
}
|
}
|
||||||
|
|
||||||
tgta_explicit*
|
tgta_explicit_ptr
|
||||||
tgba_to_tgta(const tgba* tgba_, bdd atomic_propositions_set_)
|
tgba_to_tgta(const const_tgba_ptr& tgba_, bdd atomic_propositions_set_)
|
||||||
{
|
{
|
||||||
state* tgba_init_state = tgba_->get_init_state();
|
state* tgba_init_state = tgba_->get_init_state();
|
||||||
state_ta_explicit* artificial_init_state = new state_ta_explicit(
|
auto artificial_init_state = new state_ta_explicit(tgba_init_state->clone(),
|
||||||
tgba_init_state->clone(), bddfalse, true);
|
bddfalse, true);
|
||||||
tgba_init_state->destroy();
|
tgba_init_state->destroy();
|
||||||
|
|
||||||
tgta_explicit* tgta = new spot::tgta_explicit(tgba_,
|
auto tgta = make_tgta_explicit(tgba_, tgba_->all_acceptance_conditions(),
|
||||||
tgba_->all_acceptance_conditions(), artificial_init_state);
|
artificial_init_state);
|
||||||
|
|
||||||
// build a Generalized TA automaton involving a single_pass_emptiness_check
|
// build a Generalized TA automaton involving a single_pass_emptiness_check
|
||||||
// (without an artificial livelock state):
|
// (without an artificial livelock state):
|
||||||
ta_explicit* ta = tgta->get_ta();
|
auto ta = tgta->get_ta();
|
||||||
build_ta(ta, atomic_propositions_set_, false, true, false);
|
build_ta(ta, atomic_propositions_set_, false, true, false);
|
||||||
|
|
||||||
trace << "***tgba_to_tgbta: POST build_ta***" << std::endl;
|
trace << "***tgba_to_tgbta: POST build_ta***" << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2010, 2012, 2013 Laboratoire de Recherche et
|
// Copyright (C) 2010, 2012, 2013, 2014 Laboratoire de Recherche et
|
||||||
// Développement de l'Epita (LRDE).
|
// Développement de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -79,9 +79,10 @@ namespace spot
|
||||||
///
|
///
|
||||||
/// \return A spot::ta_explicit that recognizes the same language as the
|
/// \return A spot::ta_explicit that recognizes the same language as the
|
||||||
/// TGBA \a tgba_to_convert.
|
/// TGBA \a tgba_to_convert.
|
||||||
SPOT_API ta_explicit*
|
SPOT_API ta_explicit_ptr
|
||||||
tgba_to_ta(const tgba* tgba_to_convert, bdd atomic_propositions_set,
|
tgba_to_ta(const const_tgba_ptr& tgba_to_convert, bdd atomic_propositions_set,
|
||||||
bool degeneralized = true, bool artificial_initial_state_mode = true,
|
bool degeneralized = true,
|
||||||
|
bool artificial_initial_state_mode = true,
|
||||||
bool single_pass_emptiness_check = false,
|
bool single_pass_emptiness_check = false,
|
||||||
bool artificial_livelock_state_mode = false);
|
bool artificial_livelock_state_mode = false);
|
||||||
|
|
||||||
|
|
@ -94,8 +95,9 @@ namespace spot
|
||||||
///
|
///
|
||||||
/// \return A spot::tgta_explicit (spot::tgta) that recognizes the same
|
/// \return A spot::tgta_explicit (spot::tgta) that recognizes the same
|
||||||
/// language as the TGBA \a tgba_to_convert.
|
/// language as the TGBA \a tgba_to_convert.
|
||||||
SPOT_API tgta_explicit*
|
SPOT_API tgta_explicit_ptr
|
||||||
tgba_to_tgta(const tgba* tgba_to_convert, bdd atomic_propositions_set);
|
tgba_to_tgta(const const_tgba_ptr& tgba_to_convert,
|
||||||
|
bdd atomic_propositions_set);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ tgba_HEADERS = \
|
||||||
bddprint.hh \
|
bddprint.hh \
|
||||||
formula2bdd.hh \
|
formula2bdd.hh \
|
||||||
futurecondcol.hh \
|
futurecondcol.hh \
|
||||||
|
fwd.hh \
|
||||||
state.hh \
|
state.hh \
|
||||||
succiter.hh \
|
succiter.hh \
|
||||||
taatgba.hh \
|
taatgba.hh \
|
||||||
|
|
|
||||||
|
|
@ -349,27 +349,6 @@ namespace spot
|
||||||
priv_->free_anonymous_list_of.erase(me);
|
priv_->free_anonymous_list_of.erase(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
bdd_dict::is_registered_proposition(const ltl::formula* f, const void* by_me)
|
|
||||||
{
|
|
||||||
fv_map::iterator fi = var_map.find(f);
|
|
||||||
if (fi == var_map.end())
|
|
||||||
return false;
|
|
||||||
ref_set& s = bdd_map[fi->second].refs;
|
|
||||||
return s.find(by_me) != s.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
bdd_dict::is_registered_acceptance_variable(const ltl::formula* f,
|
|
||||||
const void* by_me)
|
|
||||||
{
|
|
||||||
fv_map::iterator fi = acc_map.find(f);
|
|
||||||
if (fi == acc_map.end())
|
|
||||||
return false;
|
|
||||||
ref_set& s = bdd_map[fi->second].refs;
|
|
||||||
return s.find(by_me) != s.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
bdd_dict::dump(std::ostream& os) const
|
bdd_dict::dump(std::ostream& os) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,17 @@ namespace spot
|
||||||
///
|
///
|
||||||
/// \return The variable number. Use bdd_ithvar() or bdd_nithvar()
|
/// \return The variable number. Use bdd_ithvar() or bdd_nithvar()
|
||||||
/// to convert this to a BDD.
|
/// to convert this to a BDD.
|
||||||
|
/// @{
|
||||||
int register_proposition(const ltl::formula* f, const void* for_me);
|
int register_proposition(const ltl::formula* f, const void* for_me);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
int register_proposition(const ltl::formula* f,
|
||||||
|
std::shared_ptr<T> for_me)
|
||||||
|
{
|
||||||
|
return register_proposition(f, for_me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Register BDD variables as atomic propositions.
|
/// \brief Register BDD variables as atomic propositions.
|
||||||
///
|
///
|
||||||
/// Register all variables occurring in \a f as atomic propositions
|
/// Register all variables occurring in \a f as atomic propositions
|
||||||
|
|
@ -108,8 +117,16 @@ namespace spot
|
||||||
/// are already known from the dictionary (i.e., they have already
|
/// are already known from the dictionary (i.e., they have already
|
||||||
/// been registered by register_proposition() for another
|
/// been registered by register_proposition() for another
|
||||||
/// automaton).
|
/// automaton).
|
||||||
|
/// @{
|
||||||
void register_propositions(bdd f, const void* for_me);
|
void register_propositions(bdd f, const void* for_me);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void register_propositions(bdd f, std::shared_ptr<T> for_me)
|
||||||
|
{
|
||||||
|
register_propositions(f, for_me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Register an atomic proposition.
|
/// \brief Register an atomic proposition.
|
||||||
///
|
///
|
||||||
/// Return (and maybe allocate) a BDD variable designating an
|
/// Return (and maybe allocate) a BDD variable designating an
|
||||||
|
|
@ -120,15 +137,32 @@ namespace spot
|
||||||
///
|
///
|
||||||
/// \return The variable number. Use bdd_ithvar() or bdd_nithvar()
|
/// \return The variable number. Use bdd_ithvar() or bdd_nithvar()
|
||||||
/// to convert this to a BDD.
|
/// to convert this to a BDD.
|
||||||
|
/// @{
|
||||||
int register_acceptance_variable(const ltl::formula* f, const void* for_me);
|
int register_acceptance_variable(const ltl::formula* f, const void* for_me);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
int register_acceptance_variable(const ltl::formula* f,
|
||||||
|
std::shared_ptr<T> for_me)
|
||||||
|
{
|
||||||
|
return register_acceptance_variable(f, for_me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Clone an acceptance variable VAR for FOR_ME.
|
/// \brief Clone an acceptance variable VAR for FOR_ME.
|
||||||
///
|
///
|
||||||
/// This is used in products TGBAs when both operands share the
|
/// This is used in products TGBAs when both operands share the
|
||||||
/// same acceptance variables but they need to be distinguished in
|
/// same acceptance variables but they need to be distinguished in
|
||||||
/// the result.
|
/// the result.
|
||||||
|
/// @{
|
||||||
int register_clone_acc(int var, const void* for_me);
|
int register_clone_acc(int var, const void* for_me);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
int register_clone_acc(int var, std::shared_ptr<T> for_me)
|
||||||
|
{
|
||||||
|
return register_clone_acc(var, for_me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Register BDD variables as acceptance variables.
|
/// \brief Register BDD variables as acceptance variables.
|
||||||
///
|
///
|
||||||
/// Register all variables occurring in \a f as acceptance variables
|
/// Register all variables occurring in \a f as acceptance variables
|
||||||
|
|
@ -136,8 +170,16 @@ namespace spot
|
||||||
/// are already known from the dictionary (i.e., they have already
|
/// are already known from the dictionary (i.e., they have already
|
||||||
/// been registered by register_acceptance_variable() for another
|
/// been registered by register_acceptance_variable() for another
|
||||||
/// automaton).
|
/// automaton).
|
||||||
|
/// @{
|
||||||
void register_acceptance_variables(bdd f, const void* for_me);
|
void register_acceptance_variables(bdd f, const void* for_me);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void register_acceptance_variables(bdd f, std::shared_ptr<T> for_me)
|
||||||
|
{
|
||||||
|
register_acceptance_variables(f, for_me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Convert one acceptance condition into the associated
|
/// \brief Convert one acceptance condition into the associated
|
||||||
/// formula.
|
/// formula.
|
||||||
///
|
///
|
||||||
|
|
@ -166,16 +208,47 @@ namespace spot
|
||||||
///
|
///
|
||||||
/// \return The variable number. Use bdd_ithvar() or bdd_nithvar()
|
/// \return The variable number. Use bdd_ithvar() or bdd_nithvar()
|
||||||
/// to convert this to a BDD.
|
/// to convert this to a BDD.
|
||||||
|
/// @{
|
||||||
int register_anonymous_variables(int n, const void* for_me);
|
int register_anonymous_variables(int n, const void* for_me);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
int register_anonymous_variables(int n, std::shared_ptr<T> for_me)
|
||||||
|
{
|
||||||
|
return register_anonymous_variables(n, for_me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Duplicate the variable usage of another object.
|
/// \brief Duplicate the variable usage of another object.
|
||||||
///
|
///
|
||||||
/// This tells this dictionary that the \a for_me object will be
|
/// This tells this dictionary that the \a for_me object will be
|
||||||
/// using the same BDD variables as the \a from_other objects.
|
/// using the same BDD variables as the \a from_other objects.
|
||||||
/// This ensures that the variables won't be freed when \a
|
/// This ensures that the variables won't be freed when \a
|
||||||
/// from_other is deleted if \a from_other is still alive.
|
/// from_other is deleted if \a from_other is still alive.
|
||||||
|
/// @{
|
||||||
void register_all_variables_of(const void* from_other, const void* for_me);
|
void register_all_variables_of(const void* from_other, const void* for_me);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void register_all_variables_of(const void* from_other,
|
||||||
|
std::shared_ptr<T> for_me)
|
||||||
|
{
|
||||||
|
register_all_variables_of(from_other, for_me.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void register_all_variables_of(std::shared_ptr<T> from_other,
|
||||||
|
const void* for_me)
|
||||||
|
{
|
||||||
|
register_all_variables_of(from_other.get(), for_me);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
void register_all_variables_of(std::shared_ptr<T> from_other,
|
||||||
|
std::shared_ptr<U> for_me)
|
||||||
|
{
|
||||||
|
register_all_variables_of(from_other.get(), for_me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Register the same propositions as another object.
|
/// \brief Register the same propositions as another object.
|
||||||
///
|
///
|
||||||
/// This tells this dictionary that the \a for_me object will be
|
/// This tells this dictionary that the \a for_me object will be
|
||||||
|
|
@ -183,9 +256,32 @@ namespace spot
|
||||||
/// the \a from_other object. This ensures that the variables
|
/// the \a from_other object. This ensures that the variables
|
||||||
/// won't be freed when \a from_other is deleted if \a from_other
|
/// won't be freed when \a from_other is deleted if \a from_other
|
||||||
/// is still alive.
|
/// is still alive.
|
||||||
|
/// @{
|
||||||
void register_all_propositions_of(const void* from_other,
|
void register_all_propositions_of(const void* from_other,
|
||||||
const void* for_me);
|
const void* for_me);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void register_all_propositions_of(const void* from_other,
|
||||||
|
std::shared_ptr<T> for_me)
|
||||||
|
{
|
||||||
|
register_all_propositions_of(from_other, for_me.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void register_all_propositions_of(std::shared_ptr<T> from_other,
|
||||||
|
const void* for_me)
|
||||||
|
{
|
||||||
|
register_all_propositions_of(from_other.get(), for_me);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
void register_all_propositions_of(std::shared_ptr<T> from_other,
|
||||||
|
std::shared_ptr<U> for_me)
|
||||||
|
{
|
||||||
|
register_all_propositions_of(from_other.get(), for_me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Release all variables used by an object.
|
/// \brief Release all variables used by an object.
|
||||||
///
|
///
|
||||||
/// Usually called in the destructor if \a me.
|
/// Usually called in the destructor if \a me.
|
||||||
|
|
@ -193,16 +289,25 @@ namespace spot
|
||||||
|
|
||||||
/// \brief Release all variables of a given type, used by an
|
/// \brief Release all variables of a given type, used by an
|
||||||
/// object.
|
/// object.
|
||||||
|
/// @{
|
||||||
void unregister_all_typed_variables(var_type type, const void* me);
|
void unregister_all_typed_variables(var_type type, const void* me);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void unregister_all_typed_variables(var_type type, std::shared_ptr<T> me)
|
||||||
|
{
|
||||||
|
unregister_all_typed_variables(type, me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Release a variable used by \a me.
|
/// \brief Release a variable used by \a me.
|
||||||
|
/// @{
|
||||||
void unregister_variable(int var, const void* me);
|
void unregister_variable(int var, const void* me);
|
||||||
|
|
||||||
/// @{
|
template <typename T>
|
||||||
/// Check whether formula \a f has already been registered by \a by_me.
|
void unregister_variable(int var, std::shared_ptr<T> me)
|
||||||
bool is_registered_proposition(const ltl::formula* f, const void* by_me);
|
{
|
||||||
bool is_registered_acceptance_variable(const ltl::formula* f,
|
unregister_variable(var, me.get());
|
||||||
const void* by_me);
|
}
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// \brief Dump all variables for debugging.
|
/// \brief Dump all variables for debugging.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Développement de
|
// Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et Développement de
|
||||||
// l'Epita (LRDE).
|
// l'Epita (LRDE).
|
||||||
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
|
|
@ -38,9 +38,19 @@ namespace spot
|
||||||
/// passing it right away to bdd_to_formula(), you should not forget
|
/// passing it right away to bdd_to_formula(), you should not forget
|
||||||
/// to unregister the variables that have been registered for \a
|
/// to unregister the variables that have been registered for \a
|
||||||
/// for_me. See bdd_dict::unregister_all_my_variables().
|
/// for_me. See bdd_dict::unregister_all_my_variables().
|
||||||
|
/// @{
|
||||||
SPOT_API bdd
|
SPOT_API bdd
|
||||||
formula_to_bdd(const ltl::formula* f, bdd_dict_ptr d, void* for_me);
|
formula_to_bdd(const ltl::formula* f, bdd_dict_ptr d, void* for_me);
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
SPOT_API bdd
|
||||||
|
formula_to_bdd(const ltl::formula* f, bdd_dict_ptr d,
|
||||||
|
const std::shared_ptr<T>& for_me)
|
||||||
|
{
|
||||||
|
return formula_to_bdd(f, d, for_me.get());
|
||||||
|
}
|
||||||
|
/// @}
|
||||||
|
|
||||||
/// \brief Convert a BDD into a formula.
|
/// \brief Convert a BDD into a formula.
|
||||||
///
|
///
|
||||||
/// Format the BDD as an irredundant sum of product (see the
|
/// Format the BDD as an irredundant sum of product (see the
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ namespace spot
|
||||||
future_conds_[src] = res;
|
future_conds_[src] = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
future_conditions_collector::future_conditions_collector(const tgba* aut,
|
future_conditions_collector::future_conditions_collector
|
||||||
bool show)
|
(const const_tgba_ptr& aut, bool show)
|
||||||
: tgba_scc(aut, show),
|
: tgba_scc(aut, show),
|
||||||
// Initialize future_conds_ with as much empty
|
// Initialize future_conds_ with as much empty
|
||||||
// "cond_set"s as there are SCCs.
|
// "cond_set"s as there are SCCs.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2009, 2013 Laboratoire de recherche et développement
|
// Copyright (C) 2009, 2013, 2014 Laboratoire de recherche et développement
|
||||||
// de l'Epita.
|
// de l'Epita.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -45,7 +45,7 @@ namespace spot
|
||||||
/// If \a show is set to true, then the format_state() method will
|
/// If \a show is set to true, then the format_state() method will
|
||||||
/// include the set of conditions computed for the given state in
|
/// include the set of conditions computed for the given state in
|
||||||
/// its output string.
|
/// its output string.
|
||||||
future_conditions_collector(const tgba* aut, bool show = false);
|
future_conditions_collector(const const_tgba_ptr& aut, bool show = false);
|
||||||
virtual ~future_conditions_collector();
|
virtual ~future_conditions_collector();
|
||||||
|
|
||||||
/// Returns the set of future conditions visible after \a s
|
/// Returns the set of future conditions visible after \a s
|
||||||
|
|
@ -65,6 +65,17 @@ namespace spot
|
||||||
// strongly connected component.
|
// strongly connected component.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<future_conditions_collector>
|
||||||
|
future_conditions_collector_ptr;
|
||||||
|
typedef std::shared_ptr<const future_conditions_collector>
|
||||||
|
const_future_conditions_collector_ptr;
|
||||||
|
|
||||||
|
inline future_conditions_collector_ptr
|
||||||
|
make_future_conditions_collector(const const_tgba_ptr& aut, bool show = false)
|
||||||
|
{
|
||||||
|
return std::make_shared<future_conditions_collector>(aut, show);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TGBA_FUTURECONDCOL_HH
|
#endif // SPOT_TGBA_FUTURECONDCOL_HH
|
||||||
|
|
|
||||||
44
src/tgba/fwd.hh
Normal file
44
src/tgba/fwd.hh
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
// -*- coding: utf-8 -*-
|
||||||
|
// Copyright (C) 2014 Laboratoire de Recherche et Développement de
|
||||||
|
// l'Epita (LRDE).
|
||||||
|
//
|
||||||
|
// This file is part of Spot, a model checking library.
|
||||||
|
//
|
||||||
|
// Spot is free software; you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
// License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef SPOT_TGBA_FWD_HH
|
||||||
|
# define SPOT_TGBA_FWD_HH
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace spot
|
||||||
|
{
|
||||||
|
class tgba;
|
||||||
|
typedef std::shared_ptr<tgba> tgba_ptr;
|
||||||
|
typedef std::shared_ptr<const tgba> const_tgba_ptr;
|
||||||
|
|
||||||
|
class tgba_digraph;
|
||||||
|
typedef std::shared_ptr<const tgba_digraph> const_tgba_digraph_ptr;
|
||||||
|
typedef std::shared_ptr<tgba_digraph> tgba_digraph_ptr;
|
||||||
|
|
||||||
|
class tgba_product;
|
||||||
|
typedef std::shared_ptr<const tgba_product> const_tgba_product_ptr;
|
||||||
|
typedef std::shared_ptr<tgba_product> tgba_product_ptr;
|
||||||
|
|
||||||
|
class tgba_sgba_proxy;
|
||||||
|
typedef std::shared_ptr<const tgba_sgba_proxy> const_tgba_sgba_proxy_ptr;
|
||||||
|
typedef std::shared_ptr<tgba_sgba_proxy> tgba_sgba_proxy_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SPOT_TGBA_FWD_HH
|
||||||
|
|
@ -151,7 +151,7 @@ namespace spot
|
||||||
class SPOT_API taa_tgba_labelled : public taa_tgba
|
class SPOT_API taa_tgba_labelled : public taa_tgba
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
taa_tgba_labelled(bdd_dict_ptr dict) : taa_tgba(dict) {};
|
taa_tgba_labelled(const bdd_dict_ptr& dict) : taa_tgba(dict) {};
|
||||||
|
|
||||||
void set_init_state(const label& s)
|
void set_init_state(const label& s)
|
||||||
{
|
{
|
||||||
|
|
@ -319,10 +319,14 @@ namespace spot
|
||||||
};
|
};
|
||||||
|
|
||||||
class SPOT_API taa_tgba_string :
|
class SPOT_API taa_tgba_string :
|
||||||
|
#ifndef SWIG
|
||||||
public taa_tgba_labelled<std::string, string_hash>
|
public taa_tgba_labelled<std::string, string_hash>
|
||||||
|
#else
|
||||||
|
public taa_tgba
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
taa_tgba_string(bdd_dict_ptr dict) :
|
taa_tgba_string(const bdd_dict_ptr& dict) :
|
||||||
taa_tgba_labelled<std::string, string_hash>(dict) {};
|
taa_tgba_labelled<std::string, string_hash>(dict) {};
|
||||||
~taa_tgba_string();
|
~taa_tgba_string();
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -330,17 +334,38 @@ namespace spot
|
||||||
virtual std::string clone_if(const std::string& label) const;
|
virtual std::string clone_if(const std::string& label) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<taa_tgba_string> taa_tgba_string_ptr;
|
||||||
|
typedef std::shared_ptr<const taa_tgba_string> const_taa_tgba_string_ptr;
|
||||||
|
|
||||||
|
inline taa_tgba_string_ptr make_taa_tgba_string(const bdd_dict_ptr& dict)
|
||||||
|
{
|
||||||
|
return std::make_shared<taa_tgba_string>(dict);
|
||||||
|
}
|
||||||
|
|
||||||
class SPOT_API taa_tgba_formula :
|
class SPOT_API taa_tgba_formula :
|
||||||
|
#ifndef SWIG
|
||||||
public taa_tgba_labelled<const ltl::formula*, ltl::formula_ptr_hash>
|
public taa_tgba_labelled<const ltl::formula*, ltl::formula_ptr_hash>
|
||||||
|
#else
|
||||||
|
public taa_tgba
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
taa_tgba_formula(bdd_dict_ptr dict) :
|
taa_tgba_formula(const bdd_dict_ptr& dict) :
|
||||||
taa_tgba_labelled<const ltl::formula*, ltl::formula_ptr_hash>(dict) {};
|
taa_tgba_labelled<const ltl::formula*, ltl::formula_ptr_hash>(dict) {};
|
||||||
~taa_tgba_formula();
|
~taa_tgba_formula();
|
||||||
protected:
|
protected:
|
||||||
virtual std::string label_to_string(const label_t& label) const;
|
virtual std::string label_to_string(const label_t& label) const;
|
||||||
virtual const ltl::formula* clone_if(const label_t& label) const;
|
virtual const ltl::formula* clone_if(const label_t& label) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<taa_tgba_formula> taa_tgba_formula_ptr;
|
||||||
|
typedef std::shared_ptr<const taa_tgba_formula> const_taa_tgba_formula_ptr;
|
||||||
|
|
||||||
|
inline taa_tgba_formula_ptr make_taa_tgba_formula(const bdd_dict_ptr& dict)
|
||||||
|
{
|
||||||
|
return std::make_shared<taa_tgba_formula>(dict);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TGBA_TAATGBA_HH
|
#endif // SPOT_TGBA_TAATGBA_HH
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,10 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
state*
|
state*
|
||||||
tgba::project_state(const state* s, const tgba* t) const
|
tgba::project_state(const state* s,
|
||||||
|
const const_tgba_ptr& t) const
|
||||||
{
|
{
|
||||||
if (t == this)
|
if (t.get() == this)
|
||||||
return s->clone();
|
return s->clone();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "state.hh"
|
#include "state.hh"
|
||||||
#include "bdddict.hh"
|
#include "bdddict.hh"
|
||||||
#include "succiter.hh"
|
#include "succiter.hh"
|
||||||
|
#include "fwd.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
@ -215,7 +216,8 @@ namespace spot
|
||||||
/// \return 0 if the projection fails (\a s is unrelated to \a t),
|
/// \return 0 if the projection fails (\a s is unrelated to \a t),
|
||||||
/// or a new \c state* (the projected state) that must be
|
/// or a new \c state* (the projected state) that must be
|
||||||
/// destroyed by the caller.
|
/// destroyed by the caller.
|
||||||
virtual state* project_state(const state* s, const tgba* t) const;
|
virtual state* project_state(const state* s,
|
||||||
|
const const_tgba_ptr& t) const;
|
||||||
|
|
||||||
/// \brief Return the set of all acceptance conditions used
|
/// \brief Return the set of all acceptance conditions used
|
||||||
/// by this automaton.
|
/// by this automaton.
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef SPOT_TGBA_TGBAGRAPH_HH
|
#ifndef SPOT_TGBA_TGBAGRAPH_HH
|
||||||
# define SPOT_TGBA_TGBAGRAPH_HH
|
# define SPOT_TGBA_TGBAGRAPH_HH
|
||||||
|
|
||||||
|
#include "fwd.hh"
|
||||||
#include "graph/graph.hh"
|
#include "graph/graph.hh"
|
||||||
#include "graph/ngraph.hh"
|
#include "graph/ngraph.hh"
|
||||||
#include "tgba/bdddict.hh"
|
#include "tgba/bdddict.hh"
|
||||||
|
|
@ -302,6 +303,17 @@ namespace spot
|
||||||
return g_.trans_data(t);
|
return g_.trans_data(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tgba_graph_trans_data& trans_data(const tgba_succ_iterator* it) const
|
||||||
|
{
|
||||||
|
auto* i = down_cast<const tgba_digraph_succ_iterator<graph_t>*>(it);
|
||||||
|
return g_.trans_data(i->pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
const tgba_graph_trans_data& trans_data(unsigned t) const
|
||||||
|
{
|
||||||
|
return g_.trans_data(t);
|
||||||
|
}
|
||||||
|
|
||||||
void set_acceptance_conditions(bdd all);
|
void set_acceptance_conditions(bdd all);
|
||||||
bdd set_single_acceptance_set();
|
bdd set_single_acceptance_set();
|
||||||
|
|
||||||
|
|
@ -346,12 +358,12 @@ namespace spot
|
||||||
SPOT_RETURN(g_.transitions());
|
SPOT_RETURN(g_.transitions());
|
||||||
|
|
||||||
/// \brief Copy the acceptance conditions of another tgba.
|
/// \brief Copy the acceptance conditions of another tgba.
|
||||||
void copy_acceptance_conditions_of(const tgba *a)
|
void copy_acceptance_conditions_of(const const_tgba_ptr& a)
|
||||||
{
|
{
|
||||||
set_acceptance_conditions(a->neg_acceptance_conditions());
|
set_acceptance_conditions(a->neg_acceptance_conditions());
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_ap_of(const tgba* a)
|
void copy_ap_of(const const_tgba_ptr& a)
|
||||||
{
|
{
|
||||||
dict_->register_all_propositions_of(a, this);
|
dict_->register_all_propositions_of(a, this);
|
||||||
}
|
}
|
||||||
|
|
@ -420,6 +432,10 @@ namespace spot
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline tgba_digraph_ptr make_tgba_digraph(bdd_dict_ptr dict)
|
||||||
|
{
|
||||||
|
return std::make_shared<tgba_digraph>(dict);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TGBA_TGBAGRAPH_HH
|
#endif // SPOT_TGBA_TGBAGRAPH_HH
|
||||||
|
|
|
||||||
|
|
@ -72,14 +72,14 @@ namespace spot
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string format(const tgba* a) const
|
std::string format(const bdd_dict_ptr& d) const
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "{rank: " << rank;
|
ss << "{rank: " << rank;
|
||||||
if (rank & 1)
|
if (rank & 1)
|
||||||
{
|
{
|
||||||
ss << ", bdd: {" << condition.order() << ", "
|
ss << ", bdd: {" << condition.order() << ", "
|
||||||
<< bdd_format_accset(a->get_dict(), condition.get_bdd())
|
<< bdd_format_accset(d, condition.get_bdd())
|
||||||
<< "} ";
|
<< "} ";
|
||||||
}
|
}
|
||||||
ss << '}';
|
ss << '}';
|
||||||
|
|
@ -588,8 +588,8 @@ namespace spot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba_kv_complement::tgba_kv_complement(const tgba* a)
|
tgba_kv_complement::tgba_kv_complement(const const_tgba_ptr& a)
|
||||||
: automaton_(new tgba_sgba_proxy(a))
|
: automaton_(make_sgba(a))
|
||||||
{
|
{
|
||||||
get_dict()->register_all_variables_of(automaton_, this);
|
get_dict()->register_all_variables_of(automaton_, this);
|
||||||
int v = get_dict()
|
int v = get_dict()
|
||||||
|
|
@ -602,7 +602,6 @@ namespace spot
|
||||||
tgba_kv_complement::~tgba_kv_complement()
|
tgba_kv_complement::~tgba_kv_complement()
|
||||||
{
|
{
|
||||||
get_dict()->unregister_all_my_variables(this);
|
get_dict()->unregister_all_my_variables(this);
|
||||||
delete automaton_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state*
|
state*
|
||||||
|
|
@ -622,7 +621,7 @@ namespace spot
|
||||||
down_cast<const state_kv_complement*>(state);
|
down_cast<const state_kv_complement*>(state);
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|
||||||
return new tgba_kv_complement_succ_iterator(automaton_,
|
return new tgba_kv_complement_succ_iterator(automaton_.get(),
|
||||||
the_acceptance_cond_,
|
the_acceptance_cond_,
|
||||||
acc_list_, s);
|
acc_list_, s);
|
||||||
}
|
}
|
||||||
|
|
@ -650,7 +649,7 @@ namespace spot
|
||||||
++i)
|
++i)
|
||||||
{
|
{
|
||||||
ss << " {" << automaton_->format_state(i->first.get())
|
ss << " {" << automaton_->format_state(i->first.get())
|
||||||
<< ", " << i->second.format(this) << "}\n";
|
<< ", " << i->second.format(get_dict()) << "}\n";
|
||||||
}
|
}
|
||||||
ss << "} odd-less: {";
|
ss << "} odd-less: {";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ namespace spot
|
||||||
class SPOT_API tgba_kv_complement : public tgba
|
class SPOT_API tgba_kv_complement : public tgba
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tgba_kv_complement(const tgba* a);
|
tgba_kv_complement(const const_tgba_ptr& a);
|
||||||
virtual ~tgba_kv_complement();
|
virtual ~tgba_kv_complement();
|
||||||
|
|
||||||
// tgba interface
|
// tgba interface
|
||||||
|
|
@ -104,12 +104,20 @@ namespace spot
|
||||||
/// They are inserted into \a acc_list_.
|
/// They are inserted into \a acc_list_.
|
||||||
void get_acc_list();
|
void get_acc_list();
|
||||||
private:
|
private:
|
||||||
const tgba_sgba_proxy* automaton_;
|
const_tgba_sgba_proxy_ptr automaton_;
|
||||||
bdd the_acceptance_cond_;
|
bdd the_acceptance_cond_;
|
||||||
unsigned nb_states_;
|
unsigned nb_states_;
|
||||||
acc_list_t acc_list_;
|
acc_list_t acc_list_;
|
||||||
}; // end class tgba_kv_complement.
|
}; // end class tgba_kv_complement.
|
||||||
|
|
||||||
|
typedef std::shared_ptr<tgba_kv_complement> tgba_kv_complement_ptr;
|
||||||
|
typedef std::shared_ptr<const tgba_kv_complement>
|
||||||
|
const_tgba_kv_complement_ptr;
|
||||||
|
inline tgba_kv_complement_ptr
|
||||||
|
make_kv_complement(const const_tgba_ptr& a)
|
||||||
|
{
|
||||||
|
return std::make_shared<tgba_kv_complement>(a);
|
||||||
|
}
|
||||||
} // end namespace spot.
|
} // end namespace spot.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,29 +76,43 @@ namespace spot
|
||||||
transitions::const_iterator it_;
|
transitions::const_iterator it_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
/// \ingroup tgba_on_the_fly_algorithms
|
||||||
|
/// \brief A masked TGBA (abstract).
|
||||||
tgba_mask::tgba_mask(const tgba* masked,
|
///
|
||||||
const state* init)
|
/// Ignores some states from a TGBA. What state are preserved or
|
||||||
: tgba_proxy(masked),
|
/// ignored is controlled by the wanted() method.
|
||||||
|
///
|
||||||
|
/// This is an abstract class. You should inherit from it and
|
||||||
|
/// supply a wanted() method to specify which states to keep.
|
||||||
|
class tgba_mask: public tgba_proxy
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
/// \brief Constructor.
|
||||||
|
/// \param masked The automaton to mask
|
||||||
|
/// \param init Any state to use as initial state. This state will be
|
||||||
|
/// destroyed by the destructor.
|
||||||
|
tgba_mask(const const_tgba_ptr& masked, const state* init = 0):
|
||||||
|
tgba_proxy(masked),
|
||||||
init_(init)
|
init_(init)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
init_ = masked->get_init_state();
|
init_ = masked->get_init_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba_mask::~tgba_mask()
|
|
||||||
|
public:
|
||||||
|
virtual ~tgba_mask()
|
||||||
{
|
{
|
||||||
init_->destroy();
|
init_->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
state* tgba_mask::get_init_state() const
|
virtual state* get_init_state() const
|
||||||
{
|
{
|
||||||
return init_->clone();
|
return init_->clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba_succ_iterator*
|
virtual tgba_succ_iterator*
|
||||||
tgba_mask::succ_iter(const state* state) const
|
succ_iter(const state* local_state) const
|
||||||
{
|
{
|
||||||
succ_iter_filtered* res;
|
succ_iter_filtered* res;
|
||||||
if (iter_cache_)
|
if (iter_cache_)
|
||||||
|
|
@ -111,7 +125,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
res = new succ_iter_filtered;
|
res = new succ_iter_filtered;
|
||||||
}
|
}
|
||||||
for (auto it: original_->succ(state))
|
for (auto it: original_->succ(local_state))
|
||||||
{
|
{
|
||||||
const spot::state* s = it->current_state();
|
const spot::state* s = it->current_state();
|
||||||
bdd acc = it->current_acceptance_conditions();
|
bdd acc = it->current_acceptance_conditions();
|
||||||
|
|
@ -120,19 +134,23 @@ namespace spot
|
||||||
s->destroy();
|
s->destroy();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
res->trans_.emplace_back(transition {s, it->current_condition(), acc});
|
res->trans_.emplace_back(transition {s, it->current_condition(),
|
||||||
|
acc});
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
virtual bool wanted(const state* s, const bdd& acc) const = 0;
|
||||||
{
|
|
||||||
|
protected:
|
||||||
|
const state* init_;
|
||||||
|
};
|
||||||
|
|
||||||
class tgba_mask_keep: public tgba_mask
|
class tgba_mask_keep: public tgba_mask
|
||||||
{
|
{
|
||||||
const state_set& mask_;
|
const state_set& mask_;
|
||||||
public:
|
public:
|
||||||
tgba_mask_keep(const tgba* masked,
|
tgba_mask_keep(const const_tgba_ptr& masked,
|
||||||
const state_set& mask,
|
const state_set& mask,
|
||||||
const state* init)
|
const state* init)
|
||||||
: tgba_mask(masked, init),
|
: tgba_mask(masked, init),
|
||||||
|
|
@ -151,7 +169,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
const state_set& mask_;
|
const state_set& mask_;
|
||||||
public:
|
public:
|
||||||
tgba_mask_ignore(const tgba* masked,
|
tgba_mask_ignore(const const_tgba_ptr& masked,
|
||||||
const state_set& mask,
|
const state_set& mask,
|
||||||
const state* init)
|
const state* init)
|
||||||
: tgba_mask(masked, init),
|
: tgba_mask(masked, init),
|
||||||
|
|
@ -170,7 +188,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
const bdd& mask_;
|
const bdd& mask_;
|
||||||
public:
|
public:
|
||||||
tgba_mask_acc_ignore(const tgba* masked,
|
tgba_mask_acc_ignore(const const_tgba_ptr& masked,
|
||||||
const bdd& mask,
|
const bdd& mask,
|
||||||
const state* init)
|
const state* init)
|
||||||
: tgba_mask(masked, init),
|
: tgba_mask(masked, init),
|
||||||
|
|
@ -184,32 +202,30 @@ namespace spot
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const_tgba_ptr
|
||||||
const tgba*
|
build_tgba_mask_keep(const const_tgba_ptr& to_mask,
|
||||||
build_tgba_mask_keep(const tgba* to_mask,
|
|
||||||
const state_set& to_keep,
|
const state_set& to_keep,
|
||||||
const state* init)
|
const state* init)
|
||||||
{
|
{
|
||||||
return new tgba_mask_keep(to_mask, to_keep, init);
|
return std::make_shared<tgba_mask_keep>(to_mask, to_keep, init);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tgba*
|
const_tgba_ptr
|
||||||
build_tgba_mask_ignore(const tgba* to_mask,
|
build_tgba_mask_ignore(const const_tgba_ptr& to_mask,
|
||||||
const state_set& to_ignore,
|
const state_set& to_ignore,
|
||||||
const state* init)
|
const state* init)
|
||||||
{
|
{
|
||||||
return new tgba_mask_ignore(to_mask, to_ignore, init);
|
return std::make_shared<tgba_mask_ignore>(to_mask, to_ignore, init);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tgba*
|
const_tgba_ptr
|
||||||
build_tgba_mask_acc_ignore(const tgba* to_mask,
|
build_tgba_mask_acc_ignore(const const_tgba_ptr& to_mask,
|
||||||
const bdd to_ignore,
|
const bdd to_ignore,
|
||||||
const state* init)
|
const state* init)
|
||||||
{
|
{
|
||||||
return new tgba_mask_acc_ignore(to_mask, to_ignore, init);
|
return std::make_shared<tgba_mask_acc_ignore>(to_mask, to_ignore, init);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,45 +26,14 @@
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
||||||
/// \ingroup tgba_on_the_fly_algorithms
|
|
||||||
/// \brief A masked TGBA (abstract).
|
|
||||||
///
|
|
||||||
/// Ignores some states from a TGBA. What state are preserved or
|
|
||||||
/// ignored is controlled by the wanted() method.
|
|
||||||
///
|
|
||||||
/// This is an abstract class. You should inherit from it and
|
|
||||||
/// supply a wanted() method to specify which states to keep.
|
|
||||||
class SPOT_API tgba_mask: public tgba_proxy
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
/// \brief Constructor.
|
|
||||||
/// \param masked The automaton to mask
|
|
||||||
/// \param init Any state to use as initial state. This state will be
|
|
||||||
/// destroyed by the destructor.
|
|
||||||
tgba_mask(const tgba* masked, const state* init = 0);
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual ~tgba_mask();
|
|
||||||
|
|
||||||
virtual state* get_init_state() const;
|
|
||||||
|
|
||||||
virtual tgba_succ_iterator*
|
|
||||||
succ_iter(const state* local_state) const;
|
|
||||||
|
|
||||||
virtual bool wanted(const state* s, const bdd& acc) const = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const state* init_;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// \ingroup tgba_on_the_fly_algorithms
|
/// \ingroup tgba_on_the_fly_algorithms
|
||||||
/// \brief Mask a TGBA, keeping a given set of states.
|
/// \brief Mask a TGBA, keeping a given set of states.
|
||||||
///
|
///
|
||||||
/// Mask the TGBA \a to_mask, keeping only the
|
/// Mask the TGBA \a to_mask, keeping only the
|
||||||
/// states from \a to_keep. The initial state
|
/// states from \a to_keep. The initial state
|
||||||
/// can optionally be reset to \a init.
|
/// can optionally be reset to \a init.
|
||||||
SPOT_API const tgba*
|
SPOT_API const_tgba_ptr
|
||||||
build_tgba_mask_keep(const tgba* to_mask,
|
build_tgba_mask_keep(const const_tgba_ptr& to_mask,
|
||||||
const state_set& to_keep,
|
const state_set& to_keep,
|
||||||
const state* init = 0);
|
const state* init = 0);
|
||||||
|
|
||||||
|
|
@ -74,8 +43,8 @@ namespace spot
|
||||||
/// Mask the TGBA \a to_mask, keeping only the states that are not
|
/// Mask the TGBA \a to_mask, keeping only the states that are not
|
||||||
/// in \a to_ignore. The initial state can optionally be reset to
|
/// in \a to_ignore. The initial state can optionally be reset to
|
||||||
/// \a init.
|
/// \a init.
|
||||||
SPOT_API const tgba*
|
SPOT_API const_tgba_ptr
|
||||||
build_tgba_mask_ignore(const tgba* to_mask,
|
build_tgba_mask_ignore(const const_tgba_ptr& to_mask,
|
||||||
const state_set& to_ignore,
|
const state_set& to_ignore,
|
||||||
const state* init = 0);
|
const state* init = 0);
|
||||||
|
|
||||||
|
|
@ -91,8 +60,8 @@ namespace spot
|
||||||
/// set of all acceptance set) is not changed, because so far this
|
/// set of all acceptance set) is not changed, because so far this
|
||||||
/// function is only needed in graph algorithms that do not call
|
/// function is only needed in graph algorithms that do not call
|
||||||
/// all_acceptance_conditions().
|
/// all_acceptance_conditions().
|
||||||
SPOT_API const tgba*
|
SPOT_API const_tgba_ptr
|
||||||
build_tgba_mask_acc_ignore(const tgba* to_mask,
|
build_tgba_mask_acc_ignore(const const_tgba_ptr& to_mask,
|
||||||
const bdd to_ignore,
|
const bdd to_ignore,
|
||||||
const state* init = 0);
|
const state* init = 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ namespace spot
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void recycle(const tgba* l, tgba_succ_iterator* left,
|
void recycle(const const_tgba_ptr& l, tgba_succ_iterator* left,
|
||||||
const tgba* r, tgba_succ_iterator* right)
|
const_tgba_ptr r, tgba_succ_iterator* right)
|
||||||
{
|
{
|
||||||
l->release_iter(left_);
|
l->release_iter(left_);
|
||||||
left_ = left;
|
left_ = left;
|
||||||
|
|
@ -284,7 +284,8 @@ namespace spot
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// tgba_product
|
// tgba_product
|
||||||
|
|
||||||
tgba_product::tgba_product(const tgba* left, const tgba* right)
|
tgba_product::tgba_product(const const_tgba_ptr& left,
|
||||||
|
const const_tgba_ptr& right)
|
||||||
: dict_(left->get_dict()), left_(left), right_(right),
|
: dict_(left->get_dict()), left_(left), right_(right),
|
||||||
pool_(sizeof(state_product))
|
pool_(sizeof(state_product))
|
||||||
{
|
{
|
||||||
|
|
@ -293,11 +294,11 @@ namespace spot
|
||||||
// If one of the side is a Kripke structure, it is easier to deal
|
// If one of the side is a Kripke structure, it is easier to deal
|
||||||
// with (we don't have to fix the acceptance conditions, and
|
// with (we don't have to fix the acceptance conditions, and
|
||||||
// computing the successors can be improved a bit).
|
// computing the successors can be improved a bit).
|
||||||
if (dynamic_cast<const kripke*>(left_))
|
if (dynamic_cast<const kripke*>(left_.get()))
|
||||||
{
|
{
|
||||||
left_kripke_ = true;
|
left_kripke_ = true;
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<const kripke*>(right_))
|
else if (dynamic_cast<const kripke*>(right_.get()))
|
||||||
{
|
{
|
||||||
std::swap(left_, right_);
|
std::swap(left_, right_);
|
||||||
left_kripke_ = true;
|
left_kripke_ = true;
|
||||||
|
|
@ -428,11 +429,11 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
state*
|
state*
|
||||||
tgba_product::project_state(const state* s, const tgba* t) const
|
tgba_product::project_state(const state* s, const const_tgba_ptr& t) const
|
||||||
{
|
{
|
||||||
const state_product* s2 = down_cast<const state_product*>(s);
|
const state_product* s2 = down_cast<const state_product*>(s);
|
||||||
assert(s2);
|
assert(s2);
|
||||||
if (t == this)
|
if (t.get() == this)
|
||||||
return s2->clone();
|
return s2->clone();
|
||||||
state* res = left_->project_state(s2->left(), t);
|
state* res = left_->project_state(s2->left(), t);
|
||||||
if (res)
|
if (res)
|
||||||
|
|
@ -470,7 +471,8 @@ namespace spot
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// tgba_product_init
|
// tgba_product_init
|
||||||
|
|
||||||
tgba_product_init::tgba_product_init(const tgba* left, const tgba* right,
|
tgba_product_init::tgba_product_init(const const_tgba_ptr& left,
|
||||||
|
const const_tgba_ptr& right,
|
||||||
const state* left_init,
|
const state* left_init,
|
||||||
const state* right_init)
|
const state* right_init)
|
||||||
: tgba_product(left, right),
|
: tgba_product(left, right),
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ namespace spot
|
||||||
/// \param left The left automata in the product.
|
/// \param left The left automata in the product.
|
||||||
/// \param right The right automata in the product.
|
/// \param right The right automata in the product.
|
||||||
/// Do not be fooled by these arguments: a product is commutative.
|
/// Do not be fooled by these arguments: a product is commutative.
|
||||||
tgba_product(const tgba* left, const tgba* right);
|
tgba_product(const const_tgba_ptr& left, const const_tgba_ptr& right);
|
||||||
|
|
||||||
virtual ~tgba_product();
|
virtual ~tgba_product();
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ namespace spot
|
||||||
virtual std::string
|
virtual std::string
|
||||||
transition_annotation(const tgba_succ_iterator* t) const;
|
transition_annotation(const tgba_succ_iterator* t) const;
|
||||||
|
|
||||||
virtual state* project_state(const state* s, const tgba* t) const;
|
virtual state* project_state(const state* s, const const_tgba_ptr& t) const;
|
||||||
|
|
||||||
virtual bdd all_acceptance_conditions() const;
|
virtual bdd all_acceptance_conditions() const;
|
||||||
virtual bdd neg_acceptance_conditions() const;
|
virtual bdd neg_acceptance_conditions() const;
|
||||||
|
|
@ -111,8 +111,8 @@ namespace spot
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bdd_dict_ptr dict_;
|
bdd_dict_ptr dict_;
|
||||||
const tgba* left_;
|
const_tgba_ptr left_;
|
||||||
const tgba* right_;
|
const_tgba_ptr right_;
|
||||||
bool left_kripke_;
|
bool left_kripke_;
|
||||||
bdd left_acc_complement_;
|
bdd left_acc_complement_;
|
||||||
bdd right_acc_complement_;
|
bdd right_acc_complement_;
|
||||||
|
|
@ -131,7 +131,7 @@ namespace spot
|
||||||
class SPOT_API tgba_product_init: public tgba_product
|
class SPOT_API tgba_product_init: public tgba_product
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tgba_product_init(const tgba* left, const tgba* right,
|
tgba_product_init(const const_tgba_ptr& left, const const_tgba_ptr& right,
|
||||||
const state* left_init, const state* right_init);
|
const state* left_init, const state* right_init);
|
||||||
virtual state* get_init_state() const;
|
virtual state* get_init_state() const;
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -139,6 +139,20 @@ namespace spot
|
||||||
const state* right_init_;
|
const state* right_init_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline tgba_product_ptr product(const const_tgba_ptr& left,
|
||||||
|
const const_tgba_ptr& right)
|
||||||
|
{
|
||||||
|
return std::make_shared<tgba_product>(left, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline tgba_product_ptr product_at(const const_tgba_ptr& left,
|
||||||
|
const const_tgba_ptr& right,
|
||||||
|
const state* left_init,
|
||||||
|
const state* right_init)
|
||||||
|
{
|
||||||
|
return std::make_shared<tgba_product_init>(left, right,
|
||||||
|
left_init, right_init);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TGBA_TGBAPRODUCT_HH
|
#endif // SPOT_TGBA_TGBAPRODUCT_HH
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
tgba_proxy::tgba_proxy(const tgba* original)
|
tgba_proxy::tgba_proxy(const const_tgba_ptr& original)
|
||||||
: original_(original)
|
: original_(original)
|
||||||
{
|
{
|
||||||
get_dict()->register_all_variables_of(original, this);
|
get_dict()->register_all_variables_of(original, this);
|
||||||
|
|
@ -67,7 +67,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
state*
|
state*
|
||||||
tgba_proxy::project_state(const state* s, const tgba* t) const
|
tgba_proxy::project_state(const state* s, const const_tgba_ptr& t) const
|
||||||
{
|
{
|
||||||
return original_->project_state(s, t);
|
return original_->project_state(s, t);
|
||||||
}
|
}
|
||||||
|
|
@ -90,4 +90,3 @@ namespace spot
|
||||||
return original_->support_conditions(state);
|
return original_->support_conditions(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace spot
|
||||||
class SPOT_API tgba_proxy: public tgba
|
class SPOT_API tgba_proxy: public tgba
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
tgba_proxy(const tgba* original);
|
tgba_proxy(const const_tgba_ptr& original);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~tgba_proxy();
|
virtual ~tgba_proxy();
|
||||||
|
|
@ -53,7 +53,7 @@ namespace spot
|
||||||
virtual std::string
|
virtual std::string
|
||||||
transition_annotation(const tgba_succ_iterator* t) const;
|
transition_annotation(const tgba_succ_iterator* t) const;
|
||||||
|
|
||||||
virtual state* project_state(const state* s, const tgba* t) const;
|
virtual state* project_state(const state* s, const const_tgba_ptr& t) const;
|
||||||
|
|
||||||
virtual bdd all_acceptance_conditions() const;
|
virtual bdd all_acceptance_conditions() const;
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ namespace spot
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bdd compute_support_conditions(const state* state) const;
|
virtual bdd compute_support_conditions(const state* state) const;
|
||||||
const tgba* original_;
|
const_tgba_ptr original_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ namespace spot
|
||||||
/// \brief Automaton with Safra's tree as states.
|
/// \brief Automaton with Safra's tree as states.
|
||||||
struct safra_tree_automaton
|
struct safra_tree_automaton
|
||||||
{
|
{
|
||||||
safra_tree_automaton(const tgba_digraph* sba);
|
safra_tree_automaton(const const_tgba_digraph_ptr& sba);
|
||||||
~safra_tree_automaton();
|
~safra_tree_automaton();
|
||||||
typedef std::map<bdd, const safra_tree*, bdd_less_than> transition_list;
|
typedef std::map<bdd, const safra_tree*, bdd_less_than> transition_list;
|
||||||
typedef
|
typedef
|
||||||
|
|
@ -66,14 +66,14 @@ namespace spot
|
||||||
int get_nb_acceptance_pairs() const;
|
int get_nb_acceptance_pairs() const;
|
||||||
safra_tree* get_initial_state() const;
|
safra_tree* get_initial_state() const;
|
||||||
void set_initial_state(safra_tree* s);
|
void set_initial_state(safra_tree* s);
|
||||||
const tgba_digraph* get_sba(void) const
|
const const_tgba_digraph_ptr& get_sba(void) const
|
||||||
{
|
{
|
||||||
return a_;
|
return a_;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
mutable int max_nb_pairs_;
|
mutable int max_nb_pairs_;
|
||||||
safra_tree* initial_state;
|
safra_tree* initial_state;
|
||||||
const tgba_digraph* a_;
|
const_tgba_digraph_ptr a_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief A Safra tree, used as state during the determinization
|
/// \brief A Safra tree, used as state during the determinization
|
||||||
|
|
@ -569,12 +569,13 @@ namespace spot
|
||||||
class safra_determinisation
|
class safra_determinisation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static safra_tree_automaton* create_safra_automaton(const tgba* a);
|
static safra_tree_automaton*
|
||||||
|
create_safra_automaton(const const_tgba_ptr& a);
|
||||||
private:
|
private:
|
||||||
typedef std::set<int> atomic_list_t;
|
typedef std::set<int> atomic_list_t;
|
||||||
typedef std::set<bdd, bdd_less_than> conjunction_list_t;
|
typedef std::set<bdd, bdd_less_than> conjunction_list_t;
|
||||||
static void retrieve_atomics(const safra_tree* node,
|
static void retrieve_atomics(const safra_tree* node,
|
||||||
tgba_digraph* sba_aut,
|
tgba_digraph_ptr sba_aut,
|
||||||
safra_tree::cache_t& cache,
|
safra_tree::cache_t& cache,
|
||||||
atomic_list_t& atomic_list);
|
atomic_list_t& atomic_list);
|
||||||
static void set_atomic_list(atomic_list_t& list, bdd condition);
|
static void set_atomic_list(atomic_list_t& list, bdd condition);
|
||||||
|
|
@ -584,7 +585,7 @@ namespace spot
|
||||||
|
|
||||||
/// \brief The body of Safra's construction.
|
/// \brief The body of Safra's construction.
|
||||||
safra_tree_automaton*
|
safra_tree_automaton*
|
||||||
safra_determinisation::create_safra_automaton(const tgba* a)
|
safra_determinisation::create_safra_automaton(const const_tgba_ptr& a)
|
||||||
{
|
{
|
||||||
// initialization.
|
// initialization.
|
||||||
auto sba_aut = degeneralize(a);
|
auto sba_aut = degeneralize(a);
|
||||||
|
|
@ -664,7 +665,7 @@ namespace spot
|
||||||
/// of the states in the label of the node.
|
/// of the states in the label of the node.
|
||||||
void
|
void
|
||||||
safra_determinisation::retrieve_atomics(const safra_tree* node,
|
safra_determinisation::retrieve_atomics(const safra_tree* node,
|
||||||
tgba_digraph* sba_aut,
|
tgba_digraph_ptr sba_aut,
|
||||||
safra_tree::cache_t& cache,
|
safra_tree::cache_t& cache,
|
||||||
atomic_list_t& atomic_list)
|
atomic_list_t& atomic_list)
|
||||||
{
|
{
|
||||||
|
|
@ -1031,7 +1032,7 @@ namespace spot
|
||||||
// safra_tree_automaton
|
// safra_tree_automaton
|
||||||
////////////////////////
|
////////////////////////
|
||||||
|
|
||||||
safra_tree_automaton::safra_tree_automaton(const tgba_digraph* a)
|
safra_tree_automaton::safra_tree_automaton(const const_tgba_digraph_ptr& a)
|
||||||
: max_nb_pairs_(-1), initial_state(0), a_(a)
|
: max_nb_pairs_(-1), initial_state(0), a_(a)
|
||||||
{
|
{
|
||||||
a->get_dict()->register_all_variables_of(a, this);
|
a->get_dict()->register_all_variables_of(a, this);
|
||||||
|
|
@ -1041,7 +1042,6 @@ namespace spot
|
||||||
{
|
{
|
||||||
for (auto& p: automaton)
|
for (auto& p: automaton)
|
||||||
delete p.first;
|
delete p.first;
|
||||||
delete a_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -1074,7 +1074,7 @@ namespace spot
|
||||||
// tgba_safra_complement
|
// tgba_safra_complement
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|
||||||
tgba_safra_complement::tgba_safra_complement(const tgba* a)
|
tgba_safra_complement::tgba_safra_complement(const const_tgba_ptr& a)
|
||||||
: automaton_(a), safra_(safra_determinisation::create_safra_automaton(a))
|
: automaton_(a), safra_(safra_determinisation::create_safra_automaton(a))
|
||||||
{
|
{
|
||||||
assert(safra_ || !"safra construction fails");
|
assert(safra_ || !"safra construction fails");
|
||||||
|
|
@ -1304,7 +1304,7 @@ namespace spot
|
||||||
|
|
||||||
// display_safra: debug routine.
|
// display_safra: debug routine.
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
void display_safra(const tgba_safra_complement* a)
|
void display_safra(const const_tgba_safra_complement_ptr& a)
|
||||||
{
|
{
|
||||||
test::print_safra_automaton(static_cast<safra_tree_automaton*>
|
test::print_safra_automaton(static_cast<safra_tree_automaton*>
|
||||||
(a->get_safra()));
|
(a->get_safra()));
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace spot
|
||||||
class SPOT_API tgba_safra_complement : public tgba
|
class SPOT_API tgba_safra_complement : public tgba
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tgba_safra_complement(const tgba* a);
|
tgba_safra_complement(const const_tgba_ptr& a);
|
||||||
virtual ~tgba_safra_complement();
|
virtual ~tgba_safra_complement();
|
||||||
|
|
||||||
// tgba interface.
|
// tgba interface.
|
||||||
|
|
@ -70,7 +70,7 @@ namespace spot
|
||||||
protected:
|
protected:
|
||||||
virtual bdd compute_support_conditions(const state* state) const;
|
virtual bdd compute_support_conditions(const state* state) const;
|
||||||
private:
|
private:
|
||||||
const tgba* automaton_;
|
const_tgba_ptr automaton_;
|
||||||
void* safra_;
|
void* safra_;
|
||||||
#if TRANSFORM_TO_TBA
|
#if TRANSFORM_TO_TBA
|
||||||
bdd the_acceptance_cond_;
|
bdd the_acceptance_cond_;
|
||||||
|
|
@ -83,12 +83,21 @@ namespace spot
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<tgba_safra_complement> tgba_safra_complement_ptr;
|
||||||
|
typedef std::shared_ptr<const tgba_safra_complement>
|
||||||
|
const_tgba_safra_complement_ptr;
|
||||||
|
inline tgba_safra_complement_ptr
|
||||||
|
make_safra_complement(const const_tgba_ptr& a)
|
||||||
|
{
|
||||||
|
return std::make_shared<tgba_safra_complement>(a);
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Produce a dot output of the Safra automaton associated
|
/// \brief Produce a dot output of the Safra automaton associated
|
||||||
/// to \a a.
|
/// to \a a.
|
||||||
///
|
///
|
||||||
/// \param a The \c tgba_safra_complement with an intermediate Safra
|
/// \param a The \c tgba_safra_complement with an intermediate Safra
|
||||||
/// automaton to display
|
/// automaton to display
|
||||||
void SPOT_API display_safra(const tgba_safra_complement* a);
|
void SPOT_API display_safra(const const_tgba_safra_complement_ptr& a);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TGBA_TGBASAFRACOMPLEMENT_HH
|
#endif // SPOT_TGBA_TGBASAFRACOMPLEMENT_HH
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
||||||
tgba_scc::tgba_scc(const tgba* aut, bool show)
|
tgba_scc::tgba_scc(const const_tgba_ptr& aut, bool show)
|
||||||
: aut_(aut), scc_map_(aut), show_(show)
|
: aut_(aut), scc_map_(aut), show_(show)
|
||||||
{
|
{
|
||||||
scc_map_.build_map();
|
scc_map_.build_map();
|
||||||
|
|
@ -82,7 +82,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
state*
|
state*
|
||||||
tgba_scc::project_state(const state* s, const tgba* t) const
|
tgba_scc::project_state(const state* s, const const_tgba_ptr& t) const
|
||||||
{
|
{
|
||||||
return aut_->project_state(s, t);
|
return aut_->project_state(s, t);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace spot
|
||||||
/// If \a show is set to true, then the format_state() method will
|
/// If \a show is set to true, then the format_state() method will
|
||||||
/// include the SCC number computed for the given state in its
|
/// include the SCC number computed for the given state in its
|
||||||
/// output string.
|
/// output string.
|
||||||
tgba_scc(const tgba* aut, bool show = false);
|
tgba_scc(const const_tgba_ptr& aut, bool show = false);
|
||||||
virtual ~tgba_scc();
|
virtual ~tgba_scc();
|
||||||
|
|
||||||
/// Returns the number of the SCC \a s belongs to.
|
/// Returns the number of the SCC \a s belongs to.
|
||||||
|
|
@ -62,14 +62,14 @@ namespace spot
|
||||||
|
|
||||||
virtual std::string
|
virtual std::string
|
||||||
transition_annotation(const tgba_succ_iterator* t) const;
|
transition_annotation(const tgba_succ_iterator* t) const;
|
||||||
virtual state* project_state(const state* s, const tgba* t) const;
|
virtual state* project_state(const state* s, const const_tgba_ptr& t) const;
|
||||||
virtual bdd all_acceptance_conditions() const;
|
virtual bdd all_acceptance_conditions() const;
|
||||||
virtual bdd neg_acceptance_conditions() const;
|
virtual bdd neg_acceptance_conditions() const;
|
||||||
|
|
||||||
virtual bdd compute_support_conditions(const state* state) const;
|
virtual bdd compute_support_conditions(const state* state) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const tgba* aut_; // The wrapped TGBA.
|
const_tgba_ptr aut_; // The wrapped TGBA.
|
||||||
scc_map scc_map_; // SCC informations.
|
scc_map scc_map_; // SCC informations.
|
||||||
bool show_; // Wether to show future conditions
|
bool show_; // Wether to show future conditions
|
||||||
// in the output of format_state().
|
// in the output of format_state().
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,8 @@ namespace spot
|
||||||
|
|
||||||
} // anonymous
|
} // anonymous
|
||||||
|
|
||||||
tgba_sgba_proxy::tgba_sgba_proxy(const tgba* a, bool no_zero_acc)
|
tgba_sgba_proxy::tgba_sgba_proxy(const const_tgba_ptr& a,
|
||||||
|
bool no_zero_acc)
|
||||||
: a_(a), emulate_acc_cond_(false)
|
: a_(a), emulate_acc_cond_(false)
|
||||||
{
|
{
|
||||||
if (no_zero_acc && a_->number_of_acceptance_conditions() == 0)
|
if (no_zero_acc && a_->number_of_acceptance_conditions() == 0)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace spot
|
||||||
class SPOT_API tgba_sgba_proxy : public tgba
|
class SPOT_API tgba_sgba_proxy : public tgba
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tgba_sgba_proxy(const tgba* a, bool no_zero_acc = true);
|
tgba_sgba_proxy(const const_tgba_ptr& a, bool no_zero_acc = true);
|
||||||
|
|
||||||
virtual ~tgba_sgba_proxy();
|
virtual ~tgba_sgba_proxy();
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ namespace spot
|
||||||
virtual bdd compute_support_conditions(const state* state) const;
|
virtual bdd compute_support_conditions(const state* state) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const tgba* a_;
|
const_tgba_ptr a_;
|
||||||
// If the automaton has no acceptance condition,
|
// If the automaton has no acceptance condition,
|
||||||
// every state is accepting.
|
// every state is accepting.
|
||||||
bool emulate_acc_cond_;
|
bool emulate_acc_cond_;
|
||||||
|
|
@ -67,5 +67,10 @@ namespace spot
|
||||||
tgba_sgba_proxy& operator=(const tgba_sgba_proxy&) SPOT_DELETED;
|
tgba_sgba_proxy& operator=(const tgba_sgba_proxy&) SPOT_DELETED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline tgba_sgba_proxy_ptr make_sgba(const const_tgba_ptr& a,
|
||||||
|
bool no_zero_acc = true)
|
||||||
|
{
|
||||||
|
return std::make_shared<tgba_sgba_proxy>(a, no_zero_acc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // SPOT_TGBA_TGBASGBA_HH
|
#endif // SPOT_TGBA_TGBASGBA_HH
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void recycle(const tgba* a, tgba_succ_iterator* it)
|
void recycle(const const_tgba_ptr& a, tgba_succ_iterator* it)
|
||||||
{
|
{
|
||||||
a->release_iter(it_);
|
a->release_iter(it_);
|
||||||
it_ = it;
|
it_ = it;
|
||||||
|
|
@ -183,7 +183,7 @@ namespace spot
|
||||||
class tgba_wdba_comp_proxy: public tgba
|
class tgba_wdba_comp_proxy: public tgba
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tgba_wdba_comp_proxy(const tgba* a)
|
tgba_wdba_comp_proxy(const const_tgba_ptr& a)
|
||||||
: a_(a), the_acceptance_cond_(a->all_acceptance_conditions())
|
: a_(a), the_acceptance_cond_(a->all_acceptance_conditions())
|
||||||
{
|
{
|
||||||
if (the_acceptance_cond_ == bddfalse)
|
if (the_acceptance_cond_ == bddfalse)
|
||||||
|
|
@ -247,12 +247,12 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual state*
|
virtual state*
|
||||||
project_state(const state* s, const tgba* t) const
|
project_state(const state* s, const const_tgba_ptr& t) const
|
||||||
{
|
{
|
||||||
const state_wdba_comp_proxy* s2 =
|
const state_wdba_comp_proxy* s2 =
|
||||||
down_cast<const state_wdba_comp_proxy*>(s);
|
down_cast<const state_wdba_comp_proxy*>(s);
|
||||||
assert(s2);
|
assert(s2);
|
||||||
if (t == this)
|
if (t.get() == this)
|
||||||
return s2->clone();
|
return s2->clone();
|
||||||
return a_->project_state(s2->real_state(), t);
|
return a_->project_state(s2->real_state(), t);
|
||||||
}
|
}
|
||||||
|
|
@ -277,7 +277,7 @@ namespace spot
|
||||||
return bddtrue;
|
return bddtrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tgba* a_;
|
const_tgba_ptr a_;
|
||||||
private:
|
private:
|
||||||
bdd the_acceptance_cond_;
|
bdd the_acceptance_cond_;
|
||||||
|
|
||||||
|
|
@ -288,9 +288,9 @@ namespace spot
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba*
|
const_tgba_ptr
|
||||||
wdba_complement(const tgba* aut)
|
wdba_complement(const const_tgba_ptr& aut)
|
||||||
{
|
{
|
||||||
return new tgba_wdba_comp_proxy(aut);
|
return std::make_shared<tgba_wdba_comp_proxy>(aut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Développement
|
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et Développement
|
||||||
// de l'Epita.
|
// de l'Epita.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -28,8 +28,8 @@ namespace spot
|
||||||
/// \brief Complement a weak deterministic Büchi automaton
|
/// \brief Complement a weak deterministic Büchi automaton
|
||||||
/// \param aut a weak deterministic Büchi automaton to complement
|
/// \param aut a weak deterministic Büchi automaton to complement
|
||||||
/// \return a new automaton that recognizes the complement language
|
/// \return a new automaton that recognizes the complement language
|
||||||
SPOT_API tgba*
|
SPOT_API const_tgba_ptr
|
||||||
wdba_complement(const tgba* aut);
|
wdba_complement(const const_tgba_ptr& aut);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
||||||
bfs_steps::bfs_steps(const tgba* a)
|
bfs_steps::bfs_steps(const const_tgba_ptr& a)
|
||||||
: a_(a)
|
: a_(a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de
|
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et Developpement de
|
||||||
// l'Epita (LRDE).
|
// l'Epita (LRDE).
|
||||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
|
|
@ -42,7 +42,7 @@ namespace spot
|
||||||
class SPOT_API bfs_steps
|
class SPOT_API bfs_steps
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bfs_steps(const tgba* a);
|
bfs_steps(const const_tgba_ptr& a);
|
||||||
virtual ~bfs_steps();
|
virtual ~bfs_steps();
|
||||||
|
|
||||||
/// \brief Start the search from \a start, and append the
|
/// \brief Start the search from \a start, and append the
|
||||||
|
|
@ -99,7 +99,7 @@ namespace spot
|
||||||
tgba_run::steps& l);
|
tgba_run::steps& l);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const tgba* a_; ///< The spot::tgba we are searching into.
|
const_tgba_ptr a_; ///< The spot::tgba we are searching into.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
unsigned tgba_complete_here(tgba_digraph* aut)
|
unsigned tgba_complete_here(tgba_digraph_ptr aut)
|
||||||
{
|
{
|
||||||
unsigned n = aut->num_states();
|
unsigned n = aut->num_states();
|
||||||
unsigned sink = -1U;
|
unsigned sink = -1U;
|
||||||
|
|
@ -99,9 +99,9 @@ namespace spot
|
||||||
return sink;
|
return sink;
|
||||||
}
|
}
|
||||||
|
|
||||||
tgba_digraph* tgba_complete(const tgba* aut)
|
tgba_digraph_ptr tgba_complete(const const_tgba_ptr& aut)
|
||||||
{
|
{
|
||||||
tgba_digraph* res = tgba_dupexp_dfs(aut);
|
tgba_digraph_ptr res = tgba_dupexp_dfs(aut);
|
||||||
tgba_complete_here(res);
|
tgba_complete_here(res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ namespace spot
|
||||||
/// state added for completion, or an existing non-accepting state
|
/// state added for completion, or an existing non-accepting state
|
||||||
/// that has been reused as sink state because it had not outgoing
|
/// that has been reused as sink state because it had not outgoing
|
||||||
/// transitions apart from self-loops.)
|
/// transitions apart from self-loops.)
|
||||||
SPOT_API unsigned tgba_complete_here(tgba_digraph* aut);
|
SPOT_API unsigned tgba_complete_here(tgba_digraph_ptr aut);
|
||||||
|
|
||||||
/// \brief Clone a tgba and complete it.
|
/// \brief Clone a tgba and complete it.
|
||||||
///
|
///
|
||||||
/// If the tgba has no acceptance set, one will be added.
|
/// If the tgba has no acceptance set, one will be added.
|
||||||
SPOT_API tgba_digraph* tgba_complete(const tgba* aut);
|
SPOT_API tgba_digraph_ptr tgba_complete(const const_tgba_ptr& aut);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SPOT_TGBAALGOS_COMPLETE_HH
|
#endif // SPOT_TGBAALGOS_COMPLETE_HH
|
||||||
|
|
|
||||||
|
|
@ -212,18 +212,15 @@ namespace spot
|
||||||
typedef std::deque<state_pair> pair_queue;
|
typedef std::deque<state_pair> pair_queue;
|
||||||
|
|
||||||
static
|
static
|
||||||
tgba_digraph*
|
tgba_digraph_ptr
|
||||||
susp_prod(tgba* left, const ltl::formula* f, bdd v)
|
susp_prod(const const_tgba_ptr& left, const ltl::formula* f, bdd v)
|
||||||
{
|
{
|
||||||
bdd_dict_ptr dict = left->get_dict();
|
bdd_dict_ptr dict = left->get_dict();
|
||||||
const tgba_digraph* a1 = ltl_to_tgba_fm(f, dict, true, true);
|
auto right =
|
||||||
|
iterated_simulations(scc_filter(ltl_to_tgba_fm(f, dict, true, true),
|
||||||
|
false));
|
||||||
|
|
||||||
const tgba_digraph* a2 = scc_filter(a1, false);
|
tgba_digraph_ptr res = make_tgba_digraph(dict);
|
||||||
delete a1;
|
|
||||||
const tgba_digraph* right = iterated_simulations(a2);
|
|
||||||
delete a2;
|
|
||||||
|
|
||||||
tgba_digraph* res = new tgba_digraph(dict);
|
|
||||||
dict->register_all_variables_of(left, res);
|
dict->register_all_variables_of(left, res);
|
||||||
dict->register_all_variables_of(right, res);
|
dict->register_all_variables_of(right, res);
|
||||||
dict->unregister_variable(bdd_var(v), res);
|
dict->unregister_variable(bdd_var(v), res);
|
||||||
|
|
@ -342,14 +339,12 @@ namespace spot
|
||||||
right->release_iter(ri);
|
right->release_iter(ri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete left;
|
|
||||||
delete right;
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tgba_digraph*
|
tgba_digraph_ptr
|
||||||
compsusp(const ltl::formula* f, bdd_dict_ptr dict,
|
compsusp(const ltl::formula* f, bdd_dict_ptr dict,
|
||||||
bool no_wdba, bool no_simulation,
|
bool no_wdba, bool no_simulation,
|
||||||
bool early_susp, bool no_susp_product, bool wdba_smaller,
|
bool early_susp, bool no_susp_product, bool wdba_smaller,
|
||||||
|
|
@ -360,32 +355,23 @@ namespace spot
|
||||||
ltl_suspender_visitor v(g2s, a2o, oblig);
|
ltl_suspender_visitor v(g2s, a2o, oblig);
|
||||||
const ltl::formula* g = v.recurse(f);
|
const ltl::formula* g = v.recurse(f);
|
||||||
|
|
||||||
tgba_digraph* res;
|
|
||||||
{
|
|
||||||
// Translate the patched formula, and remove useless SCCs.
|
// Translate the patched formula, and remove useless SCCs.
|
||||||
tgba_digraph* aut =
|
tgba_digraph_ptr res =
|
||||||
spot::ltl_to_tgba_fm(g, dict, true, true, false, false, 0, 0);
|
scc_filter(ltl_to_tgba_fm(g, dict, true, true, false, false, 0, 0),
|
||||||
res = scc_filter(aut, false);
|
false);
|
||||||
delete aut;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!no_wdba)
|
if (!no_wdba)
|
||||||
{
|
{
|
||||||
tgba_digraph* min = minimize_obligation(res, g, 0, wdba_smaller);
|
tgba_digraph_ptr min = minimize_obligation(res, g, 0, wdba_smaller);
|
||||||
if (min != res)
|
if (min != res)
|
||||||
{
|
{
|
||||||
delete res;
|
|
||||||
res = min;
|
res = min;
|
||||||
no_simulation = true;
|
no_simulation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!no_simulation)
|
if (!no_simulation)
|
||||||
{
|
res = iterated_simulations(res);
|
||||||
tgba_digraph* sim = spot::iterated_simulations(res);
|
|
||||||
delete res;
|
|
||||||
res = sim;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a map of suspended formulae to BDD variables.
|
// Create a map of suspended formulae to BDD variables.
|
||||||
spot::formula_bdd_map susp;
|
spot::formula_bdd_map susp;
|
||||||
|
|
@ -409,9 +395,8 @@ namespace spot
|
||||||
suspvars &= i->second;
|
suspvars &= i->second;
|
||||||
|
|
||||||
bdd allaccap = bddtrue; // set of atomic prop used in accepting SCCs.
|
bdd allaccap = bddtrue; // set of atomic prop used in accepting SCCs.
|
||||||
tgba_digraph* aut = res;
|
|
||||||
{
|
{
|
||||||
scc_info si(aut);
|
scc_info si(res);
|
||||||
|
|
||||||
// Restrict suspvars to the set of suspension labels that occur
|
// Restrict suspvars to the set of suspension labels that occur
|
||||||
// in accepting SCC.
|
// in accepting SCC.
|
||||||
|
|
@ -422,9 +407,8 @@ namespace spot
|
||||||
|
|
||||||
bdd ignored = bdd_exist(suspvars, allaccap);
|
bdd ignored = bdd_exist(suspvars, allaccap);
|
||||||
suspvars = bdd_existcomp(suspvars, allaccap);
|
suspvars = bdd_existcomp(suspvars, allaccap);
|
||||||
res = scc_filter_susp(aut, false, suspvars, ignored, early_susp, &si);
|
res = scc_filter_susp(res, false, suspvars, ignored, early_susp, &si);
|
||||||
}
|
}
|
||||||
delete aut;
|
|
||||||
|
|
||||||
// Do we need to synchronize any suspended formula?
|
// Do we need to synchronize any suspended formula?
|
||||||
if (!susp.empty() && !no_susp_product)
|
if (!susp.empty() && !no_susp_product)
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue