postproc: add support for co-Büchi output

* spot/twaalgos/cobuchi.cc, spot/twaalgos/cobuchi.hh (to_nca): New
function.
(weak_to_cobuchi): New internal function, used in to_nca and to_dca
when appropriate.
* spot/twaalgos/postproc.cc, spot/twaalgos/postproc.hh: Implement
the CoBuchi option.
* python/spot/__init__.py: Support it in Python.
* bin/common_post.cc: Add support for --buchi.
* bin/autfilt.cc: Remove the --dca option.
* tests/core/dca.test, tests/python/automata.ipynb: Adjust and add
more tests.  In particular, add more complex persistence and
recurrence formulas to the list of dca.test.
* tests/python/dca.test: Adjust and rename to...
* tests/core/dca2.test: ... this.  Add more tests, to the point
that this is now failing, as described in issue #317.
* tests/python/dca.py: Remove.
* tests/Makefile.am: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2018-01-12 20:53:53 +01:00
parent 9464043d39
commit 61b0a542f1
14 changed files with 618 additions and 531 deletions

25
NEWS
View file

@ -30,6 +30,11 @@ New in spot 2.4.4.dev (net yet released)
output. Different styles can be requested using for instance output. Different styles can be requested using for instance
--parity='min odd' or --parity='max even'. --parity='min odd' or --parity='max even'.
- ltl2tgba, autfilt, and dstar2tgba have some new '--cobuchi' option
to force co-Büchi acceptance on the output. Beware: if the input
language is not co-Büchi realizable the output automaton will
recognize a superset of the input.
- genltl learned to generate six new families of formulas, taken from - genltl learned to generate six new families of formulas, taken from
the SYNTCOMP competition on reactive synthesis, and from from the SYNTCOMP competition on reactive synthesis, and from from
Müller & Sickert's GandALF'17 paper: Müller & Sickert's GandALF'17 paper:
@ -40,11 +45,8 @@ New in spot 2.4.4.dev (net yet released)
--ms-phi-r=RANGE (FGa{n}&GFb{n})|((FGa{n-1}|GFb{n-1})&(...)) --ms-phi-r=RANGE (FGa{n}&GFb{n})|((FGa{n-1}|GFb{n-1})&(...))
--ms-phi-s=RANGE (FGa{n}|GFb{n})&((FGa{n-1}&GFb{n-1})|(...)) --ms-phi-s=RANGE (FGa{n}|GFb{n})&((FGa{n-1}&GFb{n-1})|(...))
- autfilt learned a couple of acceptance transformations: - autfilt learned --streett-like to convert automata with DNF
--streett-like converts automata with DNF acceptance acceptance into automata with Streett-like acceptance.
into automata with Streett-like acceptance.
--dca converts automata with DNF or Streett-like
acceptance into deterministic co-Büchi.
- autfilt learned --acceptance-is=ACC to filter automata by - autfilt learned --acceptance-is=ACC to filter automata by
acceptance condition. ACC can be the name of some acceptance acceptance condition. ACC can be the name of some acceptance
@ -91,10 +93,11 @@ New in spot 2.4.4.dev (net yet released)
- spot::nsa_to_nca(), spot::dfn_to_nca(), spot::dfn_to_dca(), and - spot::nsa_to_nca(), spot::dfn_to_nca(), spot::dfn_to_dca(), and
spot::nsa_to_dca(), convert automata with DNF or Streett-like spot::nsa_to_dca(), convert automata with DNF or Streett-like
acceptance into deterministic or non-deterministic co-Büchi acceptance into deterministic or non-deterministic co-Büchi
automata. spot::to_dca() dispatches between the last two automata. spot::to_dca() and spot::to_nca() dispatches between
functions. The language of produced automata include the original these four functions. The language of produced automata include
language, but may be larger if the original automaton is not the original language, but may be larger if the original automaton
co-Büchi realizable. Based on Boker & Kupferman FOSSACS'11 paper. is not co-Büchi realizable. Based on Boker & Kupferman FOSSACS'11
paper.
- spot::scc_info::states_on_acc_cycle_of() return all states - spot::scc_info::states_on_acc_cycle_of() return all states
visited by any accepting cycle of the specified SCC. It only visited by any accepting cycle of the specified SCC. It only
@ -182,6 +185,10 @@ New in spot 2.4.4.dev (net yet released)
have parity acceptance, it will simply be degeneralized or have parity acceptance, it will simply be degeneralized or
determinized. determinized.
- spot::postprocessor::set_type() can now request co-Büchi
acceptance as output. This calls the aforementioned to_nca() or
to_dca() functions.
- spot::remove_fin() will now call simplify_acceptance(), - spot::remove_fin() will now call simplify_acceptance(),
introduced in 2.4, before attempting its different Fin-removal introduced in 2.4, before attempting its different Fin-removal
strategies. strategies.

View file

@ -359,12 +359,6 @@ static const argp_option options[] =
"solver can be set thanks to the SPOT_SATSOLVER environment variable" "solver can be set thanks to the SPOT_SATSOLVER environment variable"
"(see spot-x)." "(see spot-x)."
, 0 }, , 0 },
{ "dca", OPT_DCA, nullptr, 0,
"convert to deterministic co-Büchi. The resulting automaton will always "
"recognize at least the same language. Actually, it can recognize "
"more if the original language can not be expressed using a co-Büchi "
"acceptance condition."
, 0 },
{ nullptr, 0, nullptr, 0, "Decorations (for -d and -H1.1 output):", 9 }, { nullptr, 0, nullptr, 0, "Decorations (for -d and -H1.1 output):", 9 },
{ "highlight-nondet-states", OPT_HIGHLIGHT_NONDET_STATES, "NUM", { "highlight-nondet-states", OPT_HIGHLIGHT_NONDET_STATES, "NUM",
OPTION_ARG_OPTIONAL, "highlight nondeterministic states with color NUM", OPTION_ARG_OPTIONAL, "highlight nondeterministic states with color NUM",
@ -1440,8 +1434,6 @@ namespace
aut = spot::to_generalized_rabin(aut, opt_gra == GRA_SHARE_INF); aut = spot::to_generalized_rabin(aut, opt_gra == GRA_SHARE_INF);
if (opt_gsa) if (opt_gsa)
aut = spot::to_generalized_streett(aut, opt_gsa == GSA_SHARE_FIN); aut = spot::to_generalized_streett(aut, opt_gsa == GSA_SHARE_FIN);
if (opt_dca)
aut = spot::to_dca(aut, false);
if (opt_streett_like) if (opt_streett_like)
aut = spot::dnf_to_streett(aut); aut = spot::dnf_to_streett(aut);

View file

@ -34,7 +34,8 @@ bool level_set = false;
bool pref_set = false; bool pref_set = false;
enum { enum {
OPT_HIGH = 1, OPT_COBUCHI = 256,
OPT_HIGH,
OPT_LOW, OPT_LOW,
OPT_MEDIUM, OPT_MEDIUM,
OPT_SMALL, OPT_SMALL,
@ -65,6 +66,11 @@ static constexpr const argp_option options[] =
"any|min|max|odd|even|min odd|min even|max odd|max even", "any|min|max|odd|even|min odd|min even|max odd|max even",
OPTION_ARG_OPTIONAL, OPTION_ARG_OPTIONAL,
"colored automaton with parity acceptance", 0, }, "colored automaton with parity acceptance", 0, },
{ "cobuchi", OPT_COBUCHI, nullptr, 0,
"automaton with co-Büchi acceptance (will recognize"
"a superset of the input language if not co-Büchi "
"realizable)", 0 },
{ "coBuchi", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
/**************************************************/ /**************************************************/
{ nullptr, 0, nullptr, 0, "Simplification goal:", 20 }, { nullptr, 0, nullptr, 0, "Simplification goal:", 20 },
{ "small", OPT_SMALL, nullptr, 0, "prefer small automata (default)", 0 }, { "small", OPT_SMALL, nullptr, 0, "prefer small automata (default)", 0 },
@ -123,6 +129,11 @@ static const argp_option options_disabled[] =
"any|min|max|odd|even|min odd|min even|max odd|max even", "any|min|max|odd|even|min odd|min even|max odd|max even",
OPTION_ARG_OPTIONAL, OPTION_ARG_OPTIONAL,
"colored automaton with parity acceptance", 0, }, "colored automaton with parity acceptance", 0, },
{ "cobuchi", OPT_COBUCHI, nullptr, 0,
"automaton with co-Büchi acceptance (will recognize"
"a superset of the input language if not co-Büchi "
"realizable)", 0 },
{ "coBuchi", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
/**************************************************/ /**************************************************/
{ nullptr, 0, nullptr, 0, "Simplification goal:", 20 }, { nullptr, 0, nullptr, 0, "Simplification goal:", 20 },
{ "small", OPT_SMALL, nullptr, 0, "prefer small automata", 0 }, { "small", OPT_SMALL, nullptr, 0, "prefer small automata", 0 },
@ -210,6 +221,9 @@ parse_opt_post(int key, char* arg, struct argp_state*)
case 'S': case 'S':
sbacc = spot::postprocessor::SBAcc; sbacc = spot::postprocessor::SBAcc;
break; break;
case OPT_COBUCHI:
type = spot::postprocessor::CoBuchi;
break;
case OPT_HIGH: case OPT_HIGH:
level = spot::postprocessor::High; level = spot::postprocessor::High;
simplification_level = 3; simplification_level = 3;

View file

@ -503,6 +503,11 @@ def _postproc_translate_options(obj, default_type, *args):
type_ = postprocessor.TGBA type_ = postprocessor.TGBA
elif val == 'ba': elif val == 'ba':
type_ = postprocessor.BA type_ = postprocessor.BA
elif val == 'cobuchi' or val == 'nca':
type_ = postprocessor.CoBuchi
elif val == 'dca':
type_ = postprocessor.CoBuchi
pref_ = postprocessor.Deterministic
elif val == 'parity min odd': elif val == 'parity min odd':
type_ = postprocessor.ParityMinOdd type_ = postprocessor.ParityMinOdd
elif val == 'parity min even': elif val == 'parity min even':
@ -566,14 +571,17 @@ def _postproc_translate_options(obj, default_type, *args):
options = { options = {
'any': pref_set, 'any': pref_set,
'ba': type_set, 'ba': type_set,
'complete': misc_set, 'cobuchi': type_set,
'colored': misc_set, 'colored': misc_set,
'complete': misc_set,
'dca': type_set,
'deterministic': pref_set, 'deterministic': pref_set,
'generic': type_set, 'generic': type_set,
'high': optm_set, 'high': optm_set,
'low': optm_set, 'low': optm_set,
'medium': optm_set, 'medium': optm_set,
'monitor': type_set, 'monitor': type_set,
'nca': type_set,
'parity even': type_set, 'parity even': type_set,
'parity max even': type_set, 'parity max even': type_set,
'parity max odd': type_set, 'parity max odd': type_set,
@ -635,7 +643,7 @@ def translate(formula, *args, dict=_bdd_dict):
- at most one in 'TGBA', 'BA', or 'Monitor', 'generic', - at most one in 'TGBA', 'BA', or 'Monitor', 'generic',
'parity', 'parity min odd', 'parity min even', 'parity', 'parity min odd', 'parity min even',
'parity max odd', 'parity max even' (type of automaton to 'parity max odd', 'parity max even' (type of automaton to
build) build), 'coBuchi'
- at most one in 'Small', 'Deterministic', 'Any' - at most one in 'Small', 'Deterministic', 'Any'
(preferred characteristics of the produced automaton) (preferred characteristics of the produced automaton)
- at most one in 'Low', 'Medium', 'High' - at most one in 'Low', 'Medium', 'High'
@ -668,7 +676,7 @@ def postprocess(automaton, *args, formula=None):
- at most one in 'Generic', 'TGBA', 'BA', or 'Monitor', - at most one in 'Generic', 'TGBA', 'BA', or 'Monitor',
'parity', 'parity min odd', 'parity min even', 'parity', 'parity min odd', 'parity min even',
'parity max odd', 'parity max even' (type of automaton to 'parity max odd', 'parity max even' (type of automaton to
build) build), 'coBuchi'
- at most one in 'Small', 'Deterministic', 'Any' - at most one in 'Small', 'Deterministic', 'Any'
(preferred characteristics of the produced automaton) (preferred characteristics of the produced automaton)
- at most one in 'Low', 'Medium', 'High' - at most one in 'Low', 'Medium', 'High'

View file

@ -29,6 +29,8 @@
#include <spot/twaalgos/product.hh> #include <spot/twaalgos/product.hh>
#include <spot/twaalgos/sccinfo.hh> #include <spot/twaalgos/sccinfo.hh>
#include <spot/twaalgos/totgba.hh> #include <spot/twaalgos/totgba.hh>
#include <spot/twaalgos/isdet.hh>
#include <spot/twaalgos/strength.hh>
#include <stack> #include <stack>
#include <unordered_map> #include <unordered_map>
@ -196,7 +198,7 @@ namespace spot
bool was_rabin = false, bool was_rabin = false,
unsigned orig_num_st = 0) unsigned orig_num_st = 0)
: aut_(ref_prod), : aut_(ref_prod),
state_based_((bool)aut_->prop_state_acc()), state_based_(aut_->prop_state_acc().is_true()),
pairs_(pairs), pairs_(pairs),
nb_pairs_(pairs.size()), nb_pairs_(pairs.size()),
named_states_(named_states), named_states_(named_states),
@ -241,29 +243,30 @@ namespace spot
twa_graph_ptr twa_graph_ptr
nsa_to_nca(const const_twa_graph_ptr& ref, nsa_to_nca(const_twa_graph_ptr ref,
bool named_states, bool named_states,
vect_nca_info* nca_info) vect_nca_info* nca_info)
{ {
twa_graph_ptr ref_tmp = ref->acc().is_parity() ? to_generalized_streett(ref) if (ref->acc().is_parity())
: nullptr; ref = to_generalized_streett(ref);
std::vector<acc_cond::rs_pair> pairs; std::vector<acc_cond::rs_pair> pairs;
if (!(ref_tmp ? ref_tmp : ref)->acc().is_streett_like(pairs)) if (!ref->acc().is_streett_like(pairs))
throw std::runtime_error("nsa_to_nca() only works with Streett-like or " throw std::runtime_error("nsa_to_nca() only works with Streett-like or "
"Parity acceptance condition"); "Parity acceptance condition");
nsa_to_nca_converter nca_converter(ref_tmp ? ref_tmp : ref, // FIXME: At the moment this algorithm does not support
ref_tmp ? ref_tmp : ref, // transition-based acceptance. See issue #317. Once that is
pairs, // fixed we may remove the next line.
named_states, ref = sbacc(std::const_pointer_cast<twa_graph>(ref));
false);
nsa_to_nca_converter nca_converter(ref, ref, pairs, named_states, false);
return nca_converter.run(nca_info); return nca_converter.run(nca_info);
} }
twa_graph_ptr twa_graph_ptr
dnf_to_nca(const const_twa_graph_ptr& ref, dnf_to_nca(const_twa_graph_ptr ref, bool named_states,
bool named_states,
vect_nca_info* nca_info) vect_nca_info* nca_info)
{ {
const acc_cond::acc_code& code = ref->get_acceptance(); const acc_cond::acc_code& code = ref->get_acceptance();
@ -287,6 +290,61 @@ namespace spot
return nca_converter.run(nca_info); return nca_converter.run(nca_info);
} }
namespace
{
twa_graph_ptr
weak_to_cobuchi(const const_twa_graph_ptr& aut)
{
trival iw = aut->prop_inherently_weak();
if (iw.is_false())
return nullptr;
scc_info si(aut);
if (iw.is_maybe() && !is_weak_automaton(aut, &si))
return nullptr;
auto res = make_twa_graph(aut->get_dict());
res->copy_ap_of(aut);
res->prop_copy(aut, twa::prop_set::all());
res->new_states(aut->num_states());
si.determine_unknown_acceptance();
unsigned ns = si.scc_count();
for (unsigned s = 0; s < ns; ++s)
{
acc_cond::mark_t m = 0U;
if (si.is_rejecting_scc(s))
m = acc_cond::mark_t{0};
else
assert(si.is_accepting_scc(s));
for (auto& e: si.edges_of(s))
res->new_edge(e.src, e.dst, e.cond, m);
}
res->set_co_buchi();
res->set_init_state(aut->get_init_state_number());
res->prop_weak(true);
res->prop_state_acc(true);
return res;
}
}
twa_graph_ptr
to_nca(const_twa_graph_ptr aut, bool named_states)
{
if (auto weak = weak_to_cobuchi(aut))
return weak;
const acc_cond::acc_code& code = aut->get_acceptance();
std::vector<acc_cond::rs_pair> pairs;
if (aut->acc().is_streett_like(pairs) || aut->acc().is_parity())
return nsa_to_nca(aut, named_states);
else if (code.is_dnf())
return dnf_to_nca(aut, named_states);
auto tmp = make_twa_graph(aut, twa::prop_set::all());
tmp->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().to_dnf());
return to_nca(tmp, named_states);
}
namespace namespace
{ {
@ -543,7 +601,7 @@ namespace spot
twa_graph_ptr twa_graph_ptr
nsa_to_dca(const const_twa_graph_ptr& aut, bool named_states) nsa_to_dca(const_twa_graph_ptr aut, bool named_states)
{ {
debug << "NSA_to_dca" << std::endl; debug << "NSA_to_dca" << std::endl;
std::vector<acc_cond::rs_pair> pairs; std::vector<acc_cond::rs_pair> pairs;
@ -568,7 +626,7 @@ namespace spot
twa_graph_ptr twa_graph_ptr
dnf_to_dca(const const_twa_graph_ptr& aut, bool named_states) dnf_to_dca(const_twa_graph_ptr aut, bool named_states)
{ {
debug << "DNF_to_dca" << std::endl; debug << "DNF_to_dca" << std::endl;
const acc_cond::acc_code& code = aut->get_acceptance(); const acc_cond::acc_code& code = aut->get_acceptance();
@ -599,8 +657,12 @@ namespace spot
twa_graph_ptr twa_graph_ptr
to_dca(const const_twa_graph_ptr& aut, bool named_states) to_dca(const_twa_graph_ptr aut, bool named_states)
{ {
if (is_deterministic(aut))
if (auto weak = weak_to_cobuchi(aut))
return weak;
const acc_cond::acc_code& code = aut->get_acceptance(); const acc_cond::acc_code& code = aut->get_acceptance();
std::vector<acc_cond::rs_pair> pairs; std::vector<acc_cond::rs_pair> pairs;
@ -608,8 +670,10 @@ namespace spot
return nsa_to_dca(aut, named_states); return nsa_to_dca(aut, named_states);
else if (code.is_dnf()) else if (code.is_dnf())
return dnf_to_dca(aut, named_states); return dnf_to_dca(aut, named_states);
else
throw std::runtime_error("to_dca() only works with Streett-like, Parity " auto tmp = make_twa_graph(aut, twa::prop_set::all());
"or any acceptance condition in DNF"); tmp->set_acceptance(aut->acc().num_sets(),
aut->get_acceptance().to_dnf());
return to_nca(tmp, named_states);
} }
} }

View file

@ -78,7 +78,7 @@ namespace spot
/// \a named_states name each state for easier debugging. /// \a named_states name each state for easier debugging.
/// \a nca_info retrieve information about state visited infinitely often. /// \a nca_info retrieve information about state visited infinitely often.
SPOT_API twa_graph_ptr SPOT_API twa_graph_ptr
nsa_to_nca(const const_twa_graph_ptr& aut, nsa_to_nca(const_twa_graph_ptr aut,
bool named_states = false, bool named_states = false,
vect_nca_info* nca_info = nullptr); vect_nca_info* nca_info = nullptr);
@ -103,10 +103,21 @@ namespace spot
/// \a named_states name each state for easier debugging. /// \a named_states name each state for easier debugging.
/// \a nca_info retrieve information about state visited infinitely often. /// \a nca_info retrieve information about state visited infinitely often.
SPOT_API twa_graph_ptr SPOT_API twa_graph_ptr
dnf_to_nca(const const_twa_graph_ptr& aut, dnf_to_nca(const_twa_graph_ptr aut,
bool named_states = false, bool named_states = false,
vect_nca_info* nca_info = nullptr); vect_nca_info* nca_info = nullptr);
/// \brief Converts any ω-automata to non-deterministic co-buchi
///
/// The language of the resulting automaton always include the
/// original language, and is a superset iff the original language
/// can not be expressed using a co-Büchi acceptance condition.
///
/// The implementation dispatches between dnf_to_nca, nsa_to_nca,
/// and a trivial implementation for weak automata.
SPOT_API twa_graph_ptr
to_nca(const_twa_graph_ptr aut, bool named_states = false);
/// \brief Converts a nondet Streett-like aut. to a det. co-Büchi aut. /// \brief Converts a nondet Streett-like aut. to a det. co-Büchi aut.
/// ///
/// This function calls first nsa_to_nca() in order to retrieve som /// This function calls first nsa_to_nca() in order to retrieve som
@ -127,7 +138,7 @@ namespace spot
/// \a aut The automaton to convert. /// \a aut The automaton to convert.
/// \a named_states name each state for easier debugging. /// \a named_states name each state for easier debugging.
SPOT_API twa_graph_ptr SPOT_API twa_graph_ptr
nsa_to_dca(const const_twa_graph_ptr& aut, bool named_states = false); nsa_to_dca(const_twa_graph_ptr aut, bool named_states = false);
/// \brief Converts an aut. with acceptance in DNF to a det. co-Büchi aut. /// \brief Converts an aut. with acceptance in DNF to a det. co-Büchi aut.
/// ///
@ -149,13 +160,16 @@ namespace spot
/// \a aut The automaton to convert. /// \a aut The automaton to convert.
/// \a named_states name each state for easier debugging. /// \a named_states name each state for easier debugging.
SPOT_API twa_graph_ptr SPOT_API twa_graph_ptr
dnf_to_dca(const const_twa_graph_ptr& aut, bool named_states = false); dnf_to_dca(const_twa_graph_ptr aut, bool named_states = false);
/// \brief Converts any ω-automata to det. co-buchi (when possible) /// \brief Converts any ω-automata to deterministic co-buchi
/// ///
/// The resulting automaton will always recognize at least the same language. /// The language of the resulting automaton always include the
/// Actually, it can recognize more if the original language can not be /// original language, and is a superset iff the original language
/// expressed using a co-Büchi acceptance condition. /// can not be expressed using a co-Büchi acceptance condition.
///
/// The implementation dispatches between dnf_to_dca, nsa_to_dca,
/// and a trivial implementation for deterministic weak automata.
SPOT_API twa_graph_ptr SPOT_API twa_graph_ptr
to_dca(const const_twa_graph_ptr& aut, bool named_states = false); to_dca(const_twa_graph_ptr aut, bool named_states = false);
} }

View file

@ -36,6 +36,8 @@
#include <spot/twaalgos/determinize.hh> #include <spot/twaalgos/determinize.hh>
#include <spot/twaalgos/alternation.hh> #include <spot/twaalgos/alternation.hh>
#include <spot/twaalgos/parity.hh> #include <spot/twaalgos/parity.hh>
#include <spot/twaalgos/cobuchi.hh>
#include <spot/twaalgos/dot.hh>
namespace spot namespace spot
{ {
@ -194,6 +196,7 @@ namespace spot
if (type_ == BA || SBACC_) if (type_ == BA || SBACC_)
state_based_ = true; state_based_ = true;
bool via_gba = (type_ == BA) || (type_ == TGBA) || (type_ == Monitor);
bool want_parity = (type_ & Parity) == Parity; bool want_parity = (type_ & Parity) == Parity;
if (COLORED_ && !want_parity) if (COLORED_ && !want_parity)
throw std::runtime_error("postprocessor: the Colored setting only works " throw std::runtime_error("postprocessor: the Colored setting only works "
@ -234,7 +237,7 @@ namespace spot
!(type_ == Generic && PREF_ == Any && level_ == Low)) !(type_ == Generic && PREF_ == Any && level_ == Low))
a = remove_alternation(a); a = remove_alternation(a);
if ((type_ != Generic && !a->acc().is_generalized_buchi()) if ((via_gba && !a->acc().is_generalized_buchi())
|| (want_parity && !a->acc().is_parity())) || (want_parity && !a->acc().is_parity()))
{ {
a = to_generalized_buchi(a); a = to_generalized_buchi(a);
@ -247,7 +250,8 @@ namespace spot
|| type_ == TGBA || type_ == TGBA
|| (type_ == BA && a->is_sba()) || (type_ == BA && a->is_sba())
|| (type_ == Monitor && a->num_sets() == 0) || (type_ == Monitor && a->num_sets() == 0)
|| (want_parity && a->acc().is_parity()))) || (want_parity && a->acc().is_parity())
|| (type_ == CoBuchi && a->acc().is_co_buchi())))
return finalize(a); return finalize(a);
int original_acc = a->num_sets(); int original_acc = a->num_sets();
@ -290,6 +294,8 @@ namespace spot
{ {
if (type_ == BA) if (type_ == BA)
a = do_degen(a); a = do_degen(a);
else if (type_ == CoBuchi)
a = to_nca(a);
return finalize(a); return finalize(a);
} }
@ -552,6 +558,21 @@ namespace spot
sim = dba ? dba : sim; sim = dba ? dba : sim;
sim->remove_unused_ap(); sim->remove_unused_ap();
if (type_ == CoBuchi)
{
unsigned ns = sim->num_states();
if (PREF_ == Deterministic)
sim = to_dca(sim);
else
sim = to_nca(sim);
// if the input of to_dca/to_nca was weak, the number of
// states has not changed, and running simulation is useless.
if (level_ != Low && ns < sim->num_states())
sim = do_simul(sim, simul_);
}
return finalize(sim); return finalize(sim);
} }
} }

View file

@ -72,8 +72,8 @@ namespace spot
/// options used for debugging or benchmarking. /// options used for debugging or benchmarking.
postprocessor(const option_map* opt = nullptr); postprocessor(const option_map* opt = nullptr);
enum output_type { TGBA = 0, enum output_type { TGBA = 0, // should be renamed GeneralizedBuchi
BA = 1, BA = 1, // should be renamed Buchi and not imply SBAcc
Monitor = 2, Monitor = 2,
Generic = 3, Generic = 3,
Parity = 4, Parity = 4,
@ -85,6 +85,7 @@ namespace spot
ParityMaxOdd = ParityMax | ParityOdd, ParityMaxOdd = ParityMax | ParityOdd,
ParityMinEven = ParityMin | ParityEven, ParityMinEven = ParityMin | ParityEven,
ParityMaxEven = ParityMax | ParityEven, ParityMaxEven = ParityMax | ParityEven,
CoBuchi = 128,
}; };
/// \brief Select the desired output type. /// \brief Select the desired output type.
@ -121,6 +122,10 @@ namespace spot
/// but other parity types can be obtained from there by minor /// but other parity types can be obtained from there by minor
/// adjustments. /// adjustments.
/// ///
/// \a CoBuchi requests a Co-Büchi automaton equivalent to
/// the input, when possible, or a Co-Büchi automaton that
/// recognize a larger language otherwise.
///
/// If set_type() is not called, the default \c output_type is \c TGBA. /// If set_type() is not called, the default \c output_type is \c TGBA.
void void
set_type(output_type type) set_type(output_type type)

View file

@ -309,11 +309,15 @@ TESTS_twa = \
core/cycles.test \ core/cycles.test \
core/acc_word.test \ core/acc_word.test \
core/dca.test \ core/dca.test \
core/dca2.test \
core/dnfstreett.test \ core/dnfstreett.test \
core/parity.test \ core/parity.test \
core/parity2.test \ core/parity2.test \
core/ltlsynt.test core/ltlsynt.test
# Issue #317.
XFAIL_TESTS = core/dca2.test
############################## PYTHON ############################## ############################## PYTHON ##############################
if USE_PYTHON if USE_PYTHON
@ -356,7 +360,6 @@ TESTS_python = \
python/bdditer.py \ python/bdditer.py \
python/bddnqueen.py \ python/bddnqueen.py \
python/bugdet.py \ python/bugdet.py \
python/dca.test \
python/declenv.py \ python/declenv.py \
python/decompose_scc.py \ python/decompose_scc.py \
python/dualize.py \ python/dualize.py \
@ -410,7 +413,6 @@ nb-html: $(TESTS_ipython:.ipynb=.html)
EXTRA_DIST = \ EXTRA_DIST = \
$(TESTS) \ $(TESTS) \
python/ltl2tgba.py \ python/ltl2tgba.py \
python/dca.py \
python/ipnbdoctest.py python/ipnbdoctest.py

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2017 Laboratoire de Recherche et Développement # Copyright (C) 2017, 2018 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.
@ -118,7 +118,6 @@ Xb -> Gb
(b | X!b) W a (b | X!b) W a
b W (!b xor (!a M FXb)) b W (!b xor (!a M FXb))
((b M 1) M 1) xor (a xor Ga) ((b M 1) M 1) xor (a xor Ga)
b <-> (a M 1) b <-> (a M 1)
a xor F(!X!Fa xor (b U Xa)) a xor F(!X!Fa xor (b U Xa))
@ -149,6 +148,36 @@ a M (G!b R Xb)
(!a R a) | (Fa xor XFb) (!a R a) | (Fa xor XFb)
XF(b | Gb) M ((b R a) R !a) XF(b | Gb) M ((b R a) R !a)
!a xor (0 R ((b -> a) -> Gb)) !a xor (0 R ((b -> a) -> Gb))
b & X(b U (F(!b | X(!b M !a)) W a))
G(Fb & ((Gb & (a R F!a)) | (F!b & (!a U Ga))))
G((G!b & (G(!a & b) | (F!b & Fa))) | (Fb&((F!b&G!a) | (Fa&Gb))))
GF(a | b | (!a & XFb))
GF((a & (!b | X(!b R XX!a))) | (!a & b & X(b U XXa)))
F!b | G(a M Fb)
G(a | (!b M (G!a | GFa)))
Ga | (!a & G(b | X(b M Fa)))
GF(Fa R (a | F!b))
G(((b & Fa) | (!b & G!a)) M Fa)
XG!a | G(a M Fb)
G(b | X(b M Fa))
G(b | G(((!a & FG!b) | (a & GFb)) U !a))
G(!a | F((!a & (a W b)) | (a & (!a M !b))))
G((Fa & ((b & Ga) | (!b & F!a))) | (G!a & ((b & F!a) | (!b & Ga))))
G(b | G(!a & !b) | F(!a & Fa))
(b | Ga) & G(Fa & F(!a & b))
G(F!a & Fa)
G(b M Fa)
G(G(a & b) | (F!b & F!a))
Ga R XF((Xa & (!a | Fb)) | (a & G!b & X!a))
G(Fb & ((G!a & XXGb) | (Fa & XXF!b)))
G((b & G(!a | Ga)) | (!b & F(a & F!a)))
G(b & (X!a M Fa))
G(Fa & (X((!a & G!b) | (a & Fb)) M Fb))
G(Fa | G(!b M F!a))
G((Ga & F(!a W b)) | (F!a & G(a M !b)))
G(Fb U a)
G(F!b & Fb)
F(b & F!b) R (!a M Fa)
(Ga | Fb) M 1 (Ga | Fb) M 1
!G(F(b & Fa) W b) !G(F(b & Fa) W b)
@ -180,248 +209,118 @@ Fa -> XXG(1 U Gb)
XXFa U Ga XXFa U Ga
a & F!X(a | XFa) a & F!X(a | XFa)
F(a | Gb) F(a | Gb)
F((XXb&G(!a|(Gb&XG!a)|(F!b&XFa)))|(XX!b&F(a&((Gb&XFa)|(XG!a&F!b)))))
F((!a & F(a W (a R b))) | (a & G(!a M (!a U !b))))
XFb R F((b & F!a) | (!b & Ga))
F((G!b & XX!a) | (Fb & XXa)) W (!a | Ga)
F((a & FG(Ga M b)) | (!a & GF(F!a W !b)))
XF(!a | GF(!b W F!a))
(b & X(b W a)) M (Xb R (Fb & Fa))
F(b | (G!b & FGa) | G(Fb & F!a))
FG(((a & !b) | (!a & b)) & F((F!a & Xb) | (Ga & X!b)))
X(!b | XF((a & F((F!b & G!a) | (Gb & Fa))) | (!a & G(G(!a & b) | (F!b & Fa)))))
F((a & !b & G((b | Fa) U b)) | ((!a | b) & F((!b & G!a) R !b)))
XF(b | GF((b & Fa) | (!b & G!a)))
(FGa R (!b M F!a)) R (!b | FGb)
F(!b | (FGa & F(Gb & X!a)) | G(F!a & (F!b | Xa)))
Xb R (F!b U ((b & XF!a) | (!b & XGa)))
(Fa U ((b & Ga) | (!b & F!a))) W X((a & F!b) | (!a & Gb))
X!a R F(Fb R !a)
Ga | F((a & b & G((!a | F!b) U !a)) | ((!a | !b) & F((a & Gb) R a)))
F(a W Fb) W ((!a & G!b) | (a & Fb))
F((b&G(F((a&b)|(!a&!b))|(G!b U!a)))|(!b&F(G((a&!b)|(!a&b))&(Fb R a))))
F((Fa & G(a | b)) | (G!a & F(!a & !b))) W G!a
F(Fa & G(a | b)) W G!a
F(!b | GF((!b & Fa) | (b & G!a)))
Fa R XF(Xb | (!b M G!a))
F((b & G(F!b & Fa)) | (!b & F(Gb | G!a)))
XX(FGb R (b U ((a & F!b) | (!a & Gb))))
F((a & F(!a W G!b)) | (!a & G(a M Fb)))
Fa R (((a & F!b) | (!a & Gb)) R F(Xb W Fa))
F((b & F(G!b | G!a)) | (!b & G(Fb & Fa)))
F((Fb & G!a) | (G!b & Fa)) W (a | Xb)
EOF EOF
cat formulas | ltlcross \ ltlcross --grind=bugs -F formulas \
--timeout=60 \ --timeout=60 \
'{1} ltl2tgba %f >%T' \ '{1} ltl2tgba %f >%T' \
'{2} case `ltlfilt -f %f --format=%%[w]h` in *P*) ltl2tgba -B %f | autfilt\ '{2} case `ltlfilt -f %f --format=%%[w]h` in *P*) ltl2tgba -B %f | autfilt\
--dca ;; *) ltl2tgba -B %f;; esac >%O' -D --cobuchi ;; *) ltl2tgba -B %f;; esac >%O' \
'{3} case `ltlfilt -f %f --format=%%[w]h` in *P*) ltl2tgba --cobuchi %f;; \
*) ltl2tgba -B %f;; esac >%O'
for i in 4 5 6 7 8 9 10 for i in 4 5 6 7 8 9 10
do do
for acc in "min even" "min odd" "max even" "max odd"; for acc in "min even" "min odd" "max even" "max odd";
do do
randaut -A "parity $acc $i" a b c > input.hoa randaut -A "parity $acc $i" a b c > input.hoa
autfilt --dca input.hoa > res.hoa autfilt -D --cobuchi input.hoa > res.hoa
autfilt input.hoa --included-in=res.hoa autfilt -q input.hoa --included-in=res.hoa
autfilt -q --deterministic --acceptance-is=coBuchi res.hoa
done done
done done
cat formulas | ltlcross \ ltlcross -F formulas \
--timeout=60 \ --timeout=60 \
'{1} ltl2tgba %f | autfilt --gra >%T' \ '{1} ltl2tgba %f | autfilt --gra >%T' \
'{2} case `ltlfilt -f %f --format=%\[w]h` in *P*) ltl2tgba -B %f | autfilt\ '{2} case `ltlfilt -f %f --format=%%[w]h` in *P*) ltl2tgba -B %f | autfilt\
--gra | autfilt --dca ;; *) ltl2tgba -B %f;; esac >%O' --gra | autfilt --cobuchi;; *) ltl2tgba -B %f;; esac >%O' \
'{3} case `ltlfilt -f %f --format=%%[w]h` in *P*) ltl2tgba -B %f | autfilt\
--gra | autfilt --cobuchi -D;; *) ltl2tgba -B %f;; esac >%O'
cat > bigtest.hoa << EOF
HOA: v1 testeq()
States: 29 {
Start: 7 cat >test.hoa
AP: 3 "a" "b" "c" autfilt test.hoa --coBuchi -D > res.hoa
Acceptance: 5 Fin(0) & (Inf(1) | Fin(2)) & (Inf(3) | Fin(4)) autfilt -q res.hoa --is-det --acceptance-is=coBuchi --equivalent-to=test.hoa
properties: trans-labels explicit-labels state-acc complete autfilt test.hoa --coBuchi > res.hoa
properties: deterministic autfilt -q res.hoa --acceptance-is=coBuchi --equivalent-to=test.hoa
--BODY-- }
State: 0 {3}
[0&!1&!2] 0 testeq << EOF
[0&1&!2] 1 HOA: v1 States: 29 Start: 7 AP: 3 "a" "b" "c" Acceptance: 5 Fin(0)
[0&!1&2] 4 & (Inf(1) | Fin(2)) & (Inf(3) | Fin(4)) properties: trans-labels
[!0&1&2] 13 explicit-labels state-acc complete properties: deterministic --BODY--
[!0&!1&2] 15 State: 0 {3} [0&!1&!2] 0 [0&1&!2] 1 [0&!1&2] 4 [!0&1&2] 13 [!0&!1&2] 15
[!0&1&!2] 20 [!0&1&!2] 20 [!0&!1&!2] 21 [0&1&2] 22 State: 1 {3} [0&!1&!2] 0 [0&1&!2]
[!0&!1&!2] 21 1 [!0&2] 13 [!0&1&!2] 20 [!0&!1&!2] 21 [0&2] 22 State: 2 {3} [0&!1&2]
[0&1&2] 22 2 [0&!1&!2] 3 [0&1&!2] 12 [!0&1] 13 [0&1&2] 14 [!0&!1] 15 State: 3 {3}
State: 1 {3} [0&!1&2] 2 [0&!1&!2] 3 [0&1&!2] 12 [!0&1&2] 13 [0&1&2] 14 [!0&!1&2] 15
[0&!1&!2] 0 [!0&!1&!2] 16 [!0&1&!2] 20 State: 4 {3} [0&!1&!2] 3 [0&!1&2] 4 [0&1&!2]
[0&1&!2] 1 12 [!0&1] 13 [!0&!1] 15 [0&1&2] 22 State: 5 {3} [0&!1&2] 5 [0&1&!2] 12
[!0&2] 13 [!0&1] 13 [0&1&2] 14 [!0&!1] 15 [0&!1&!2] 17 State: 6 {3} [0&!1&2] 5
[!0&1&!2] 20 [0&!1&!2] 6 [!0&1&2] 13 [0&1&2] 14 [!0&!1&2] 15 [0&1&!2] 18 [!0&1&!2]
[!0&!1&!2] 21 20 [!0&!1&!2] 28 State: 7 {1 3} [!0 | 2] 13 [0&1&!2] 18 [0&!1&!2] 19
[0&2] 22 State: 8 {1 3} [0&1&!2] 1 [0&!1&2] 8 [0&!1&!2] 9 [!0&1] 13 [0&1&2] 22
State: 2 {3} [!0&!1] 23 State: 9 {1 3} [0&1&!2] 1 [0&!1&2] 8 [0&!1&!2] 9 [!0&1&2]
[0&!1&2] 2 13 [!0&1&!2] 20 [0&1&2] 22 [!0&!1&2] 23 [!0&!1&!2] 24 State: 10 {1 3}
[0&!1&!2] 3 [0&1&!2] 10 [0&!1&!2] 11 [!0&2] 13 [0&2] 22 [!0&1&!2] 25 [!0&!1&!2] 26
[0&1&!2] 12 State: 11 {1 3} [0&!1&2] 8 [0&1&!2] 10 [0&!1&!2] 11 [!0&1&2] 13 [0&1&2]
[!0&1] 13 22 [!0&!1&2] 23 [!0&1&!2] 25 [!0&!1&!2] 26 State: 12 {0 1 3} [0&!1&!2] 0
[0&1&2] 14 [0&1&!2] 1 [!0&2] 13 [!0&1&!2] 20 [!0&!1&!2] 21 [0&2] 22 State: 13 {0 1 3}
[!0&!1] 15 [0&1&!2] 10 [0&!1&!2] 11 [!0 | 2] 13 State: 14 {0 1 3} [!0] 13 [0&1&!2]
State: 3 {3} 18 [0&!1&!2] 19 [0&2] 22 State: 15 {0 1 3} [0&!1&!2] 6 [!0&1 | 1&2]
[0&!1&2] 2 13 [0&1&!2] 18 [!0&!1 | !1&2] 23 State: 16 {0 1 3} [0&!1&!2] 6 [1&2]
[0&!1&!2] 3 13 [0&1&!2] 18 [!0&1&!2] 20 [!1&2] 23 [!0&!1&!2] 24 State: 17 {0 1 3}
[0&1&!2] 12 [0&1&!2] 1 [0&!1&2] 8 [0&!1&!2] 9 [!0&1&2] 13 [!0&1&!2] 20 [0&1&2] 22
[!0&1&2] 13 [!0&!1&2] 23 [!0&!1&!2] 24 State: 18 {0 1 3} [0&1&!2] 10 [0&!1&!2]
[0&1&2] 14 11 [!0&2] 13 [0&2] 22 [!0&1&!2] 25 [!0&!1&!2] 26 State: 19 {0 1 3}
[!0&!1&2] 15 [0&!1&2] 8 [0&1&!2] 10 [0&!1&!2] 11 [!0&1&2] 13 [0&1&2] 22 [!0&!1&2] 23
[!0&!1&!2] 16 [!0&1&!2] 25 [!0&!1&!2] 26 State: 20 {0 1 3} [2] 13 [0&1&!2] 18 [0&!1&!2]
[!0&1&!2] 20 19 [!0&1&!2] 25 [!0&!1&!2] 26 State: 21 {0 1 3} [1&2] 13 [0&1&!2] 18
State: 4 {3} [0&!1&!2] 19 [!1&2] 23 [!0&1&!2] 25 [!0&!1&!2] 26 State: 22 {2 3} [!0]
[0&!1&!2] 3 13 [0&1&!2] 18 [0&!1&!2] 19 [0&2] 22 State: 23 {2 3} [0&!1&!2] 6 [!0&1 |
[0&!1&2] 4 1&2] 13 [0&1&!2] 18 [!0&!1 | !1&2] 23 State: 24 {2 3} [0&!1&!2] 6 [1&2]
[0&1&!2] 12 13 [0&1&!2] 18 [!0&1&!2] 20 [!1&2] 23 [!0&!1&!2] 24 State: 25 {2 3} [2]
[!0&1] 13 13 [0&1&!2] 18 [0&!1&!2] 19 [!0&1&!2] 25 [!0&!1&!2] 26 State: 26 {2 3}
[!0&!1] 15 [1&2] 13 [0&1&!2] 18 [0&!1&!2] 19 [!1&2] 23 [!0&1&!2] 25 [!0&!1&!2] 26
[0&1&2] 22 State: 27 {2 3} [0&!1&2] 5 [0&!1&!2] 6 [!0&1&2] 13 [0&1&2] 14 [!0&!1&2]
State: 5 {3} 15 [0&1&!2] 18 [!0&1&!2] 20 [!0&!1&!2] 28 State: 28 {4} [1&2] 13 [!1&2]
[0&!1&2] 5 15 [0&1&!2] 18 [!0&1&!2] 20 [0&!1&!2] 27 [!0&!1&!2] 28 --END--
[0&1&!2] 12
[!0&1] 13
[0&1&2] 14
[!0&!1] 15
[0&!1&!2] 17
State: 6 {3}
[0&!1&2] 5
[0&!1&!2] 6
[!0&1&2] 13
[0&1&2] 14
[!0&!1&2] 15
[0&1&!2] 18
[!0&1&!2] 20
[!0&!1&!2] 28
State: 7 {1 3}
[!0 | 2] 13
[0&1&!2] 18
[0&!1&!2] 19
State: 8 {1 3}
[0&1&!2] 1
[0&!1&2] 8
[0&!1&!2] 9
[!0&1] 13
[0&1&2] 22
[!0&!1] 23
State: 9 {1 3}
[0&1&!2] 1
[0&!1&2] 8
[0&!1&!2] 9
[!0&1&2] 13
[!0&1&!2] 20
[0&1&2] 22
[!0&!1&2] 23
[!0&!1&!2] 24
State: 10 {1 3}
[0&1&!2] 10
[0&!1&!2] 11
[!0&2] 13
[0&2] 22
[!0&1&!2] 25
[!0&!1&!2] 26
State: 11 {1 3}
[0&!1&2] 8
[0&1&!2] 10
[0&!1&!2] 11
[!0&1&2] 13
[0&1&2] 22
[!0&!1&2] 23
[!0&1&!2] 25
[!0&!1&!2] 26
State: 12 {0 1 3}
[0&!1&!2] 0
[0&1&!2] 1
[!0&2] 13
[!0&1&!2] 20
[!0&!1&!2] 21
[0&2] 22
State: 13 {0 1 3}
[0&1&!2] 10
[0&!1&!2] 11
[!0 | 2] 13
State: 14 {0 1 3}
[!0] 13
[0&1&!2] 18
[0&!1&!2] 19
[0&2] 22
State: 15 {0 1 3}
[0&!1&!2] 6
[!0&1 | 1&2] 13
[0&1&!2] 18
[!0&!1 | !1&2] 23
State: 16 {0 1 3}
[0&!1&!2] 6
[1&2] 13
[0&1&!2] 18
[!0&1&!2] 20
[!1&2] 23
[!0&!1&!2] 24
State: 17 {0 1 3}
[0&1&!2] 1
[0&!1&2] 8
[0&!1&!2] 9
[!0&1&2] 13
[!0&1&!2] 20
[0&1&2] 22
[!0&!1&2] 23
[!0&!1&!2] 24
State: 18 {0 1 3}
[0&1&!2] 10
[0&!1&!2] 11
[!0&2] 13
[0&2] 22
[!0&1&!2] 25
[!0&!1&!2] 26
State: 19 {0 1 3}
[0&!1&2] 8
[0&1&!2] 10
[0&!1&!2] 11
[!0&1&2] 13
[0&1&2] 22
[!0&!1&2] 23
[!0&1&!2] 25
[!0&!1&!2] 26
State: 20 {0 1 3}
[2] 13
[0&1&!2] 18
[0&!1&!2] 19
[!0&1&!2] 25
[!0&!1&!2] 26
State: 21 {0 1 3}
[1&2] 13
[0&1&!2] 18
[0&!1&!2] 19
[!1&2] 23
[!0&1&!2] 25
[!0&!1&!2] 26
State: 22 {2 3}
[!0] 13
[0&1&!2] 18
[0&!1&!2] 19
[0&2] 22
State: 23 {2 3}
[0&!1&!2] 6
[!0&1 | 1&2] 13
[0&1&!2] 18
[!0&!1 | !1&2] 23
State: 24 {2 3}
[0&!1&!2] 6
[1&2] 13
[0&1&!2] 18
[!0&1&!2] 20
[!1&2] 23
[!0&!1&!2] 24
State: 25 {2 3}
[2] 13
[0&1&!2] 18
[0&!1&!2] 19
[!0&1&!2] 25
[!0&!1&!2] 26
State: 26 {2 3}
[1&2] 13
[0&1&!2] 18
[0&!1&!2] 19
[!1&2] 23
[!0&1&!2] 25
[!0&!1&!2] 26
State: 27 {2 3}
[0&!1&2] 5
[0&!1&!2] 6
[!0&1&2] 13
[0&1&2] 14
[!0&!1&2] 15
[0&1&!2] 18
[!0&1&!2] 20
[!0&!1&!2] 28
State: 28 {4}
[1&2] 13
[!1&2] 15
[0&1&!2] 18
[!0&1&!2] 20
[0&!1&!2] 27
[!0&!1&!2] 28
--END--
EOF EOF
autfilt bigtest.hoa --dca > res.hoa
autfilt bigtest.hoa --equivalent-to='res.hoa'
cat >empty.hoa<<EOF testeq <<EOF
HOA: v1 States: 10 Start: 0 AP: 2 "a" "b" acc-name: Rabin 3 Acceptance: HOA: v1 States: 10 Start: 0 AP: 2 "a" "b" acc-name: Rabin 3 Acceptance:
6 (Fin(0) & Inf(1)) | (Fin(2) & Inf(3)) | (Fin(4) & Inf(5)) properties: 6 (Fin(0) & Inf(1)) | (Fin(2) & Inf(3)) | (Fin(4) & Inf(5)) properties:
trans-labels explicit-labels trans-acc --BODY-- State: 0 [0&!1] 8 {0} trans-labels explicit-labels trans-acc --BODY-- State: 0 [0&!1] 8 {0}
@ -431,10 +330,8 @@ trans-labels explicit-labels trans-acc --BODY-- State: 0 [0&!1] 8 {0}
6 [!0&1] 1 {2 3 4} State: 7 [0&!1] 5 {0} [0&!1] 7 State: 8 [!0&1] 4 {0 2} 6 [!0&1] 1 {2 3 4} State: 7 [0&!1] 5 {0} [0&!1] 7 State: 8 [!0&1] 4 {0 2}
State: 9 [0&1] 3 {4} [!0&1] 5 {4} --END-- State: 9 [0&1] 3 {4} [!0&1] 5 {4} --END--
EOF EOF
autfilt empty.hoa --dca > res.hoa
autfilt empty.hoa --equivalent-to='res.hoa'
cat >empty.hoa<<EOF testeq<<EOF
HOA: v1 States: 11 Start: 0 AP: 3 "a" "b" "c" Acceptance: 5 (Fin(0) HOA: v1 States: 11 Start: 0 AP: 3 "a" "b" "c" Acceptance: 5 (Fin(0)
| Inf(1)) & (Fin(2) | Inf(3)) & Fin(4) properties: trans-labels | Inf(1)) & (Fin(2) | Inf(3)) & Fin(4) properties: trans-labels
explicit-labels trans-acc --BODY-- State: 0 [0&!1&!2] 1 {1} [0&!1&!2] explicit-labels trans-acc --BODY-- State: 0 [0&!1&!2] 1 {1} [0&!1&!2]
@ -449,10 +346,8 @@ State: 4 [0&!1&!2] 1 {1 2} [!0&!2] 3 {1 2} [0&1&!2] 4 {1 2} State: 5
8 {1 2 4} State: 9 [0&!1] 9 {0 2} [!0 | 1] 3 {0 2} State: 10 [0&!1] 8 {1 2 4} State: 9 [0&!1] 9 {0 2} [!0 | 1] 3 {0 2} State: 10 [0&!1]
10 {0 2} [!0 | 1] 8 {0 2 4} --END-- 10 {0 2} [!0 | 1] 8 {0 2 4} --END--
EOF EOF
autfilt empty.hoa --dca > res.hoa
autfilt empty.hoa --equivalent-to='res.hoa'
cat >empty.hoa<<EOF testeq<<EOF
HOA: v1 States: 10 Start: 0 AP: 2 "a" "b" acc-name: Streett 3 Acceptance: HOA: v1 States: 10 Start: 0 AP: 2 "a" "b" acc-name: Streett 3 Acceptance:
6 (Fin(0) | Inf(1)) & (Fin(2) | Inf(3)) & (Fin(4) | Inf(5)) properties: 6 (Fin(0) | Inf(1)) & (Fin(2) | Inf(3)) & (Fin(4) | Inf(5)) properties:
trans-labels explicit-labels trans-acc deterministic --BODY-- State: 0 trans-labels explicit-labels trans-acc deterministic --BODY-- State: 0
@ -461,5 +356,3 @@ trans-labels explicit-labels trans-acc deterministic --BODY-- State: 0
4 State: 7 [!0&!1] 3 {2 5} State: 8 [0&!1] 1 {2} [!0&!1] 2 {2} State: 4 State: 7 [!0&!1] 3 {2 5} State: 8 [0&!1] 1 {2} [!0&!1] 2 {2} State:
9 [!0&1] 6 {2 4} --END-- 9 [!0&1] 6 {2 4} --END--
EOF EOF
autfilt empty.hoa --dca > res.hoa
autfilt empty.hoa --equivalent-to='res.hoa'

75
tests/core/dca2.test Executable file
View file

@ -0,0 +1,75 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2017, 2018 Laboratoire de Recherche et
# Développement de l'EPITA.
#
# 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/>.
. ./defs
set -e
cat >l_formulas <<'EOF'
FG!b
FGc
F(a | Gb)
XF(b & Ga)
a | c | FG(!b & !c)
!a | FGb
F((!a & ((c & F!b) | (!c & Gb))) | (a & ((c & Gb) | (!c & F!b))))
F((c & F!b) | (!c & Gb))
F((!c R a) W G!b)
FG(((!b | (c M b)) & X(c & Xa)) | (b & (!c W !b) & X(!c | X!a)))
(Ga M c) M ((!b & Fb) M F(a | !b))
(Gb | X(!b M X!b)) M ((b & c) | (!b & !c))
F(c R (X!c W Fb))
XF!c & F(Fb R a)
(!c M F(b & Ga)) W (b U a)
EOF
cat >r_formulas <<'EOF'
GF(b | GF!c)
!b & G(G!c | XFc)
GF(b | c | (!c & XFb))
GFc | G(!b | !c)
G(Gb | Fc)
G(c | (c R Xc) | XF(b & !c))
Gc R XFb
G(c | (!b M (GFc | G!c)))
F(((c W Xb) & F(b R !c)) | ((!c M X!b) & G(!b U c)))
EOF
while read l_f; do
ltl2tgba --parity='max odd' "$l_f" > l.hoa
autfilt -q --acceptance-is='Fin(0) | Inf(1)' l.hoa
while read r_f; do
# Dualizing a deterministic transition-based parity automaton
# to obtain a transition-based deterministic streett
# automaton. What we want to avoid as much as possible is
# weak automata, because l.hoa is already weak and that would
# make the sum/product weak as well.
ltl2tgba "$r_f" -D --parity='min odd' | autfilt --dualize --gsa > r.hoa
# Streett & Streett
autfilt r.hoa --name="($l_f)&!($r_f)" --product=l.hoa -S > and.hoa
autfilt -q --acceptance-is=Streett and.hoa
# Streett | Streett
autfilt r.hoa --name="($l_f)|!($r_f)" --product-or=l.hoa -S > or.hoa
autfilt -q -v --acceptance-is=Streett or.hoa
autcross --language-preserved --verbose -F or.hoa -F and.hoa \
'autfilt %H --stats=%M | ltl2tgba >%O' \
'autfilt --cobuchi' 'autfilt --cobuchi -D'
done <r_formulas
done <l_formulas

View file

@ -3,9 +3,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [], "outputs": [],
"source": [ "source": [
"from IPython.display import display\n", "from IPython.display import display\n",
@ -23,9 +21,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -149,7 +145,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1043b73f0> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d08673930> >"
] ]
}, },
"execution_count": 2, "execution_count": 2,
@ -171,9 +167,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -312,9 +306,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -468,9 +460,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 5,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -493,9 +483,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -550,7 +538,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042bc900> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0857cbd0> >"
] ]
}, },
"execution_count": 6, "execution_count": 6,
@ -565,9 +553,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -622,7 +608,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce7b0> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d08673960> >"
] ]
}, },
"execution_count": 7, "execution_count": 7,
@ -644,9 +630,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 8,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -700,7 +684,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1043b7390> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d08673b40> >"
] ]
}, },
"execution_count": 8, "execution_count": 8,
@ -722,9 +706,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 9,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -747,9 +729,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -842,9 +822,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 11,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -1041,9 +1019,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 12,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -1168,7 +1144,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce870> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c360> >"
] ]
}, },
"execution_count": 12, "execution_count": 12,
@ -1190,9 +1166,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 13,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -1271,7 +1245,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042bc660> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0857c450> >"
] ]
}, },
"execution_count": 13, "execution_count": 13,
@ -1293,9 +1267,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 14,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -1391,7 +1363,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce6c0> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0857c420> >"
] ]
}, },
"execution_count": 14, "execution_count": 14,
@ -1413,9 +1385,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 15,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -1492,7 +1462,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1043dd600> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0857c480> >"
] ]
}, },
"execution_count": 15, "execution_count": 15,
@ -1507,9 +1477,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 16,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -1964,7 +1932,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce600> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0b183ae0> >"
] ]
}, },
"execution_count": 16, "execution_count": 16,
@ -1979,9 +1947,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 17,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -2008,9 +1974,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 18,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
@ -2047,9 +2011,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 19,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -2588,7 +2550,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042bc8d0> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c600> >"
] ]
}, },
"metadata": {}, "metadata": {},
@ -2606,9 +2568,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 20,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [], "outputs": [],
"source": [ "source": [
"!rm example1.aut" "!rm example1.aut"
@ -2617,9 +2577,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 21,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -2749,7 +2707,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce780> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c450> >"
] ]
}, },
"execution_count": 21, "execution_count": 21,
@ -2764,9 +2722,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 22,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -2821,7 +2777,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce8a0> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c390> >"
] ]
}, },
"execution_count": 22, "execution_count": 22,
@ -2836,9 +2792,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 23,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -3204,9 +3158,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 24,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -3261,7 +3213,7 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce810> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c1b0> >"
] ]
}, },
"metadata": {}, "metadata": {},
@ -3286,9 +3238,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 25,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -3372,72 +3322,69 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 26,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"image/svg+xml": [ "image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", "<svg height=\"140pt\" viewBox=\"0.00 0.00 170.00 140.47\" width=\"170pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", "<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 136.465)\">\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.38.0 (20140413.2041)\n",
" -->\n",
"<!-- Title: G Pages: 1 -->\n",
"<svg width=\"170pt\" height=\"104pt\"\n",
" viewBox=\"0.00 0.00 170.00 104.47\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 100.465)\">\n",
"<title>G</title>\n", "<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-100.465 166,-100.465 166,4 -4,4\"/>\n", "<polygon fill=\"white\" points=\"-4,4 -4,-136.465 166,-136.465 166,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"29\" y=\"-118.265\">Fin(</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"54\" y=\"-118.265\">⓿</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"70\" y=\"-118.265\">) &amp; Inf(</text>\n",
"<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"113\" y=\"-118.265\">❶</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"129\" y=\"-118.265\">)</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"52\" y=\"-104.265\">[Rabin 1]</text>\n",
"<!-- I -->\n", "<!-- I -->\n",
"<!-- 0 -->\n", "<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\"><title>0</title>\n", "<g class=\"node\" id=\"node2\"><title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-30.4654\" rx=\"18\" ry=\"18\"/>\n", "<ellipse cx=\"56\" cy=\"-30.4654\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-26.7654\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n", "<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"56\" y=\"-26.7654\">0</text>\n",
"</g>\n", "</g>\n",
"<!-- I&#45;&gt;0 -->\n", "<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\"><title>I&#45;&gt;0</title>\n", "<g class=\"edge\" id=\"edge1\"><title>I-&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15491,-30.4654C2.79388,-30.4654 17.1543,-30.4654 30.6317,-30.4654\"/>\n", "<path d=\"M1.15491,-30.4654C2.79388,-30.4654 17.1543,-30.4654 30.6317,-30.4654\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.9419,-30.4654 30.9419,-33.6155 34.4419,-30.4655 30.9419,-30.4655 30.9419,-30.4655 30.9419,-30.4655 34.4419,-30.4655 30.9418,-27.3155 37.9419,-30.4654 37.9419,-30.4654\"/>\n", "<polygon fill=\"black\" points=\"37.9419,-30.4654 30.9419,-33.6155 34.4419,-30.4655 30.9419,-30.4655 30.9419,-30.4655 30.9419,-30.4655 34.4419,-30.4655 30.9418,-27.3155 37.9419,-30.4654 37.9419,-30.4654\" stroke=\"black\"/>\n",
"</g>\n", "</g>\n",
"<!-- 0&#45;&gt;0 -->\n", "<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\"><title>0&#45;&gt;0</title>\n", "<g class=\"edge\" id=\"edge2\"><title>0-&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M49.6208,-47.5027C48.3189,-57.3234 50.4453,-66.4654 56,-66.4654 60.166,-66.4654 62.4036,-61.323 62.7128,-54.6087\"/>\n", "<path d=\"M49.6208,-47.5027C48.3189,-57.3234 50.4453,-66.4654 56,-66.4654 60.166,-66.4654 62.4036,-61.323 62.7128,-54.6087\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"62.3792,-47.5027 65.8541,-54.3473 62.5434,-50.9989 62.7076,-54.495 62.7076,-54.495 62.7076,-54.495 62.5434,-50.9989 59.561,-54.6428 62.3792,-47.5027 62.3792,-47.5027\"/>\n", "<polygon fill=\"black\" points=\"62.3792,-47.5027 65.8541,-54.3473 62.5434,-50.9989 62.7076,-54.495 62.7076,-54.495 62.7076,-54.495 62.5434,-50.9989 59.561,-54.6428 62.3792,-47.5027 62.3792,-47.5027\" stroke=\"black\"/>\n",
"<text text-anchor=\"start\" x=\"50.5\" y=\"-70.2654\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n", "<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"50.5\" y=\"-70.2654\">!a</text>\n",
"</g>\n", "</g>\n",
"<!-- 1 -->\n", "<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\"><title>1</title>\n", "<g class=\"node\" id=\"node3\"><title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"144\" cy=\"-30.4654\" rx=\"18\" ry=\"18\"/>\n", "<ellipse cx=\"144\" cy=\"-30.4654\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text text-anchor=\"middle\" x=\"144\" y=\"-26.7654\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n", "<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"144\" y=\"-26.7654\">1</text>\n",
"</g>\n", "</g>\n",
"<!-- 0&#45;&gt;1 -->\n", "<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge3\" class=\"edge\"><title>0&#45;&gt;1</title>\n", "<g class=\"edge\" id=\"edge3\"><title>0-&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M74.0378,-33.3939C79.731,-34.2402 86.1223,-35.0477 92,-35.4654 99.0932,-35.9695 100.907,-35.9695 108,-35.4654 111.49,-35.2174 115.161,-34.832 118.759,-34.3826\"/>\n", "<path d=\"M74.0378,-33.3939C79.731,-34.2402 86.1223,-35.0477 92,-35.4654 99.0932,-35.9695 100.907,-35.9695 108,-35.4654 111.49,-35.2174 115.161,-34.832 118.759,-34.3826\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"125.962,-33.3939 119.456,-37.4666 122.495,-33.8699 119.027,-34.3459 119.027,-34.3459 119.027,-34.3459 122.495,-33.8699 118.599,-31.2251 125.962,-33.3939 125.962,-33.3939\"/>\n", "<polygon fill=\"black\" points=\"125.962,-33.3939 119.456,-37.4666 122.495,-33.8699 119.027,-34.3459 119.027,-34.3459 119.027,-34.3459 122.495,-33.8699 118.599,-31.2251 125.962,-33.3939 125.962,-33.3939\" stroke=\"black\"/>\n",
"<text text-anchor=\"start\" x=\"96.5\" y=\"-54.2654\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n", "<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"96.5\" y=\"-54.2654\">a</text>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-39.2654\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n", "<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"92\" y=\"-39.2654\">❶</text>\n",
"</g>\n", "</g>\n",
"<!-- 1&#45;&gt;0 -->\n", "<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge4\" class=\"edge\"><title>1&#45;&gt;0</title>\n", "<g class=\"edge\" id=\"edge4\"><title>1-&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M131.404,-17.3266C125.156,-11.2493 116.908,-4.67653 108,-1.46544 95.985,2.86544 83.5046,-4.00369 73.8973,-12.1402\"/>\n", "<path d=\"M131.404,-17.3266C125.156,-11.2493 116.908,-4.67653 108,-1.46544 95.985,2.86544 83.5046,-4.00369 73.8973,-12.1402\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"68.5978,-17.0022 71.6264,-9.94872 71.1769,-14.636 73.7559,-12.2699 73.7559,-12.2699 73.7559,-12.2699 71.1769,-14.636 75.8855,-14.591 68.5978,-17.0022 68.5978,-17.0022\"/>\n", "<polygon fill=\"black\" points=\"68.5978,-17.0022 71.6264,-9.94872 71.1769,-14.636 73.7559,-12.2699 73.7559,-12.2699 73.7559,-12.2699 71.1769,-14.636 75.8855,-14.591 68.5978,-17.0022 68.5978,-17.0022\" stroke=\"black\"/>\n",
"<text text-anchor=\"start\" x=\"94.5\" y=\"-20.2654\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n", "<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"94.5\" y=\"-20.2654\">!a</text>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-5.26544\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n", "<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"92\" y=\"-5.26544\">⓿</text>\n",
"</g>\n", "</g>\n",
"<!-- 1&#45;&gt;1 -->\n", "<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge5\" class=\"edge\"><title>1&#45;&gt;1</title>\n", "<g class=\"edge\" id=\"edge5\"><title>1-&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M136.332,-46.7557C134.483,-56.8546 137.039,-66.4654 144,-66.4654 149.221,-66.4654 151.964,-61.0593 152.229,-54.0958\"/>\n", "<path d=\"M136.332,-46.7557C134.483,-56.8546 137.039,-66.4654 144,-66.4654 149.221,-66.4654 151.964,-61.0593 152.229,-54.0958\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"151.668,-46.7557 155.342,-53.4954 151.935,-50.2455 152.201,-53.7354 152.201,-53.7354 152.201,-53.7354 151.935,-50.2455 149.06,-53.9754 151.668,-46.7557 151.668,-46.7557\"/>\n", "<polygon fill=\"black\" points=\"151.668,-46.7557 155.342,-53.4954 151.935,-50.2455 152.201,-53.7354 152.201,-53.7354 152.201,-53.7354 151.935,-50.2455 149.06,-53.9754 151.668,-46.7557 151.668,-46.7557\" stroke=\"black\"/>\n",
"<text text-anchor=\"start\" x=\"140.5\" y=\"-85.2654\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n", "<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"140.5\" y=\"-85.2654\">a</text>\n",
"<text text-anchor=\"start\" x=\"136\" y=\"-70.2654\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n", "<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"136\" y=\"-70.2654\">❶</text>\n",
"</g>\n", "</g>\n",
"</g>\n", "</g>\n",
"</svg>\n" "</svg>"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce7e0> >" "<IPython.core.display.SVG object>"
] ]
}, },
"execution_count": 26, "execution_count": 26,
@ -3446,7 +3393,155 @@
} }
], ],
"source": [ "source": [
"aut = spot.translate('FGa', 'generic', 'deterministic'); aut" "aut = spot.translate('FGa', 'generic', 'deterministic'); aut.show('.ba')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Translation to co-Büchi automaton"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"131pt\" viewBox=\"0.00 0.00 178.74 130.74\" width=\"179pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 126.74)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-126.74 174.74,-126.74 174.74,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"62.8701\" y=\"-108.54\">Fin(</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"87.8701\" y=\"-108.54\">⓿</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"103.87\" y=\"-108.54\">)</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"52.8701\" y=\"-94.5401\">[co-Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g class=\"node\" id=\"node2\"><title>0</title>\n",
"<ellipse cx=\"64.8701\" cy=\"-26.8701\" fill=\"#ffffaa\" rx=\"26.7407\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"60.3701\" y=\"-30.6701\">0</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"56.8701\" y=\"-15.6701\">⓿</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>I-&gt;0</title>\n",
"<path d=\"M1.04557,-26.8701C1.94668,-26.8701 16.0699,-26.8701 30.6965,-26.8701\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"37.8616,-26.8701 30.8617,-30.0202 34.3616,-26.8701 30.8616,-26.8702 30.8616,-26.8702 30.8616,-26.8702 34.3616,-26.8701 30.8616,-23.7202 37.8616,-26.8701 37.8616,-26.8701\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>0-&gt;0</title>\n",
"<path d=\"M56.6704,-52.6914C56.2072,-63.0476 58.9404,-71.7401 64.8701,-71.7401 69.3173,-71.7401 71.9666,-66.8506 72.8178,-60.0368\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"73.0697,-52.6914 75.9779,-59.7953 72.9497,-56.1893 72.8297,-59.6873 72.8297,-59.6873 72.8297,-59.6873 72.9497,-56.1893 69.6816,-59.5793 73.0697,-52.6914 73.0697,-52.6914\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"60.3701\" y=\"-75.5401\">1</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node3\"><title>1</title>\n",
"<ellipse cx=\"152.74\" cy=\"-26.8701\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"148.24\" y=\"-23.1701\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>0-&gt;1</title>\n",
"<path d=\"M92.1005,-26.8701C103.321,-26.8701 116.345,-26.8701 127.355,-26.8701\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"134.608,-26.8701 127.608,-30.0202 131.108,-26.8701 127.608,-26.8702 127.608,-26.8702 127.608,-26.8702 131.108,-26.8701 127.608,-23.7202 134.608,-26.8701 134.608,-26.8701\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"109.74\" y=\"-30.6701\">a</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>1-&gt;1</title>\n",
"<path d=\"M146.007,-43.9074C144.632,-53.728 146.877,-62.8701 152.74,-62.8701 157.138,-62.8701 159.499,-57.7276 159.826,-51.0134\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"159.474,-43.9074 162.966,-50.7428 159.647,-47.4031 159.82,-50.8988 159.82,-50.8988 159.82,-50.8988 159.647,-47.4031 156.674,-51.0547 159.474,-43.9074 159.474,-43.9074\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"149.24\" y=\"-66.6701\">a</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.translate('FGa', 'coBuchi').show('.ba')"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"131pt\" viewBox=\"0.00 0.00 170.00 130.75\" width=\"170pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 126.75)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-126.75 166,-126.75 166,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"58.5\" y=\"-108.55\">Fin(</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"83.5\" y=\"-108.55\">⓿</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"99.5\" y=\"-108.55\">)</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"48.5\" y=\"-94.5502\">[co-Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g class=\"node\" id=\"node2\"><title>0</title>\n",
"<ellipse cx=\"56\" cy=\"-20.7502\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"56\" y=\"-17.0502\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>I-&gt;0</title>\n",
"<path d=\"M1.15491,-20.7502C2.79388,-20.7502 17.1543,-20.7502 30.6317,-20.7502\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"37.9419,-20.7502 30.9419,-23.9003 34.4419,-20.7502 30.9419,-20.7503 30.9419,-20.7503 30.9419,-20.7503 34.4419,-20.7502 30.9418,-17.6003 37.9419,-20.7502 37.9419,-20.7502\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>0-&gt;0</title>\n",
"<path d=\"M49.6208,-37.7875C48.3189,-47.6081 50.4453,-56.7502 56,-56.7502 60.166,-56.7502 62.4036,-51.6077 62.7128,-44.8935\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"62.3792,-37.7875 65.8541,-44.632 62.5434,-41.2836 62.7076,-44.7798 62.7076,-44.7798 62.7076,-44.7798 62.5434,-41.2836 59.561,-44.9275 62.3792,-37.7875 62.3792,-37.7875\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"50.5\" y=\"-75.5502\">!a</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"48\" y=\"-60.5502\">⓿</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node3\"><title>1</title>\n",
"<ellipse cx=\"144\" cy=\"-20.7502\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"144\" y=\"-17.0502\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>0-&gt;1</title>\n",
"<path d=\"M74.4034,-20.7502C87.1928,-20.7502 104.732,-20.7502 118.874,-20.7502\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"125.916,-20.7502 118.916,-23.9003 122.416,-20.7502 118.916,-20.7503 118.916,-20.7503 118.916,-20.7503 122.416,-20.7502 118.916,-17.6003 125.916,-20.7502 125.916,-20.7502\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"96.5\" y=\"-39.5502\">a</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"92\" y=\"-24.5502\">⓿</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>1-&gt;0</title>\n",
"<path d=\"M128.689,-10.8844C122.598,-7.25669 115.237,-3.58794 108,-1.75016 101.108,-0 98.8924,-0 92,-1.75016 87.1374,-2.98492 82.2193,-5.0462 77.668,-7.36626\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"71.3113,-10.8844 75.9105,-4.73864 74.3736,-9.18956 77.4359,-7.49469 77.4359,-7.49469 77.4359,-7.49469 74.3736,-9.18956 78.9613,-10.2507 71.3113,-10.8844 71.3113,-10.8844\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"94.5\" y=\"-5.55016\">!a</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge5\"><title>1-&gt;1</title>\n",
"<path d=\"M136.332,-37.0404C134.483,-47.1393 137.039,-56.7502 144,-56.7502 149.221,-56.7502 151.964,-51.3441 152.229,-44.3805\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"151.668,-37.0404 155.342,-43.7801 151.935,-40.5303 152.201,-44.0201 152.201,-44.0201 152.201,-44.0201 151.935,-40.5303 149.06,-44.2601 151.668,-37.0404 151.668,-37.0404\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"140.5\" y=\"-60.5502\">a</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.translate('FGa', 'coBuchi', 'deterministic').show('.ba')"
] ]
}, },
{ {
@ -3458,10 +3553,8 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 29,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -3524,10 +3617,10 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce7e0> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c570> >"
] ]
}, },
"execution_count": 27, "execution_count": 29,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -3549,10 +3642,8 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 30,
"metadata": { "metadata": {},
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@ -3615,10 +3706,10 @@
"</svg>\n" "</svg>\n"
], ],
"text/plain": [ "text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce7e0> >" "<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c570> >"
] ]
}, },
"execution_count": 28, "execution_count": 30,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -3648,7 +3739,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.6.3" "version": "3.6.4"
} }
}, },
"nbformat": 4, "nbformat": 4,

View file

@ -1,37 +0,0 @@
#!/usr/bin/python3
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2017 Laboratoire de Recherche et Développement de
# l'EPITA.
#
# 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/>.
import sys
import spot
def gen_streett(formula):
aut = spot.translate(formula, 'BA')
aut.set_acceptance(2, 'Fin(0) | Inf(1)')
for e in aut.edges():
if (e.acc):
e.acc = spot.mark_t([0,1])
else:
e.acc = spot.mark_t([0])
return aut
aut = gen_streett(sys.argv[1])
print(aut.to_str('hoa'))

View file

@ -1,62 +0,0 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Laboratoire de Recherche et
# Développement de l'EPITA.
#
# 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/>.
set -e
# Skip this test if ltl2dstar is not installed.
(ltl2dstar --version) || exit 77
DIR=dca.dir
mkdir -p $DIR
cat >$DIR/ba_formulas << 'EOF'
FG((Xc & XXa) <-> !(b xor (c M b)))
F!FGFb
XF(b & Ga)
FG(F(b R Fc) R Gc)
(!c M F(b M Ga)) W (b U a)
(c xor Gb) M 1
X!Gc M ((Fb R a) M 1)
!a | F(b W 0)
F(!a -> Gb)
(Gb <-> X(b W Xb)) M (b xor !c)
(c R (X!c W Fb)) M 1
!a -> (FX!(0 R F(b | c)) W c)
XF((!c R a) W !Fb)
(!a <-> !(c <-> Gb)) M 1
((0 R a) M c) M ((b xor Fb) M F(b -> a))
EOF
cat >$DIR/dsa_formulas <<'EOF'
(!b U b) U X(!a -> Fb)
1 U (a xor b)
X(!(!b | (a M b)) -> XXa)
!Gb
F(XF!a & (Fb U !a))
EOF
while read ba_f; do
../run "$srcdir/dca.py" "$ba_f" > $DIR/ba
while read dsa_f; do
ltldo -f "$dsa_f" "ltl2dstar --automata=streett\
--ltl2nba=spin:ltl2tgba@-Ds" -H |
autfilt --product=$DIR/ba > $DIR/input.hoa
autfilt --dca $DIR/input.hoa > $DIR/res.hoa
autfilt $DIR/input.hoa --equivalent-to $DIR/res.hoa
done <$DIR/dsa_formulas
done <$DIR/ba_formulas