add a stutter-invariant property to automata

... and show it in the HOA output.  Fixes #60.

* src/tgba/tgba.hh: Add is_stutter_invariant().
* src/tgbaalgos/hoa.cc: Print stutter-invariant
and inherently-weak.
* src/tgbaalgos/ltl2tgba_fm.cc: Set both.
* src/tgbaalgos/are_isomorphic.cc, src/tgbaalgos/complete.cc,
src/tgbaalgos/degen.cc, src/tgbaalgos/dtgbacomp.cc,
src/tgbaalgos/mask.cc, src/tgbaalgos/minimize.cc,
src/tgbaalgos/remfin.cc, src/tgbaalgos/sccfilter.cc,
src/tgbaalgos/simulation.cc, src/tgbaalgos/stutter.cc,
src/tgbatest/hoaparse.test, src/tgbatest/ltldo.test,
src/tgbatest/monitor.test, src/tgbatest/randomize.test,
src/tgbatest/remfin.test, src/tgbatest/sbacc.test: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2015-02-28 16:44:06 +01:00
parent 566118a5be
commit 1f0bb428b0
19 changed files with 110 additions and 40 deletions

View file

@ -112,7 +112,7 @@ namespace spot
{
isomorphism_checker::isomorphism_checker(const const_tgba_digraph_ptr ref)
{
ref_ = make_tgba_digraph(ref, {true, true, true, true});
ref_ = make_tgba_digraph(ref, tgba::prop_set::all());
ref_deterministic_ = ref_->is_deterministic();
if (!ref_deterministic_)
{
@ -144,7 +144,7 @@ namespace spot
}
}
auto tmp = make_tgba_digraph(aut, {true, true, true, true});
auto tmp = make_tgba_digraph(aut, tgba::prop_set::all());
spot::canonicalize(tmp);
return *tmp == *ref_;
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita.
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita.
//
// This file is part of Spot, a model checking library.
//
@ -105,11 +105,12 @@ namespace spot
tgba_digraph_ptr tgba_complete(const const_tgba_ptr& aut)
{
auto res = make_tgba_digraph(aut, {
true, // state based
true, // single acc
true, // inherently_weak
true, // deterministic
});
true, // state based
true, // single acc
true, // inherently_weak
true, // deterministic
true, // stutter inv.
});
tgba_complete_here(res);
return res;
}

View file

@ -204,8 +204,8 @@ namespace spot
res->set_single_acceptance_set();
if (want_sba)
res->prop_state_based_acc();
// Preserve determinism and weakness
res->prop_copy(a, { false, false, true, true });
// Preserve determinism, weakness, and stutter-invariance
res->prop_copy(a, { false, false, true, true, true });
// Create an order of acceptance conditions. Each entry in this
// vector correspond to an acceptance set. Each index can

View file

@ -32,6 +32,7 @@ namespace spot
false, // single acc
false, // inherently_weak
false, // deterministic
true, // stutter inv.
});
// Copy the old acceptance condition before we replace it.
acc_cond oldacc = aut->acc(); // Copy it!
@ -120,6 +121,7 @@ namespace spot
true, // single acc
true, // inherently weak
true, // determinisitic
true, // stutter inv.
});
scc_info si(res);

View file

@ -22,6 +22,7 @@
#include <ostream>
#include <sstream>
#include <cstring>
#include <map>
#include "tgba/tgba.hh"
#include "tgba/tgbagraph.hh"
@ -296,19 +297,41 @@ namespace spot
os << aut->acc().get_acceptance();
os << nl;
os << "properties:";
// Make sure the property line is not too large,
// otherwise our test cases do not fit in 80 columns...
unsigned prop_len = 60;
auto prop = [&](const char* str)
{
if (newline)
{
auto l = strlen(str);
if (prop_len < l)
{
prop_len = 60;
os << "\nproperties:";
}
prop_len -= l;
}
os << str;
};
implicit_labels = md.use_implicit_labels;
if (implicit_labels)
os << " implicit-labels";
prop(" implicit-labels");
else
os << " trans-labels explicit-labels";
prop(" trans-labels explicit-labels");
if (acceptance == Hoa_Acceptance_States)
os << " state-acc";
prop(" state-acc");
else if (acceptance == Hoa_Acceptance_Transitions)
os << " trans-acc";
prop(" trans-acc");
if (md.is_complete)
os << " complete";
prop(" complete");
if (md.is_deterministic)
os << " deterministic";
prop(" deterministic");
if (aut->is_stutter_invariant())
prop(" stutter-invariant");
if (aut->is_inherently_weak())
prop(" inherently-weak");
os << nl;
// If we want to output implicit labels, we have to

View file

@ -2514,6 +2514,9 @@ namespace spot
acc.set_generalized_buchi();
a->prop_inherently_weak(f->is_syntactic_persistence());
a->prop_stutter_invariant(f->is_syntactic_stutter_invariant());
if (!simplifier)
// This should not be deleted before we have registered all propositions.
delete s;

View file

@ -26,7 +26,7 @@ namespace spot
{
auto res = make_tgba_digraph(in->get_dict());
res->copy_ap_of(in);
res->prop_copy(in, { true, false, true, true });
res->prop_copy(in, { true, false, true, true, false });
unsigned na = in->acc().num_sets();
unsigned tr = to_remove.count();
assert(tr <= na);
@ -54,7 +54,7 @@ namespace spot
auto res = make_tgba_digraph(in->get_dict());
res->copy_ap_of(in);
res->prop_copy(in, { true, true, true, true });
res->prop_copy(in, { true, true, true, true, false });
res->copy_acceptance_conditions_of(in);
transform_copy(in, res, [&](unsigned src,
bdd& cond,

View file

@ -485,6 +485,7 @@ namespace spot
// final is empty: there is no acceptance condition
build_state_set(det_a, non_final);
auto res = minimize_dfa(det_a, final, non_final);
res->prop_copy(a, { false, false, false, false, true });
res->prop_deterministic();
res->prop_inherently_weak();
res->prop_state_based_acc();
@ -588,6 +589,7 @@ namespace spot
}
auto res = minimize_dfa(det_a, final, non_final);
res->prop_copy(a, { false, false, false, false, true });
res->prop_deterministic();
res->prop_inherently_weak();
return res;

View file

@ -262,6 +262,7 @@ namespace spot
unsigned nst = aut->num_states();
auto res = make_tgba_digraph(aut->get_dict());
res->copy_ap_of(aut);
res->prop_copy(aut, { false, false, false, false, true });
res->new_states(nst);
res->set_acceptance(aut->acc().num_sets() + extra_sets, new_code);
res->set_init_state(aut->get_init_state_number());

View file

@ -317,7 +317,7 @@ namespace spot
scc_filter_states(const const_tgba_digraph_ptr& aut, scc_info* given_si)
{
auto res = scc_filter_apply<state_filter<>>(aut, given_si);
res->prop_copy(aut, { true, true, true, true });
res->prop_copy(aut, { true, true, true, true, true });
return res;
}
@ -340,6 +340,7 @@ namespace spot
true,
true,
true,
true,
});
return res;
}
@ -372,6 +373,7 @@ namespace spot
true,
true,
false, // determinism may not be preserved
false, // stutter inv. of suspvars probably altered
});
return res;
}

View file

@ -635,6 +635,7 @@ namespace spot
false, // single acc set by set_generalized_buchi
true, // weakness preserved,
false, // determinism checked and set below
true, // stutter inv.
});
if (nb_minato == nb_satoneset && !Cosimulation)
res->prop_deterministic();

View file

@ -432,6 +432,7 @@ namespace spot
true, // single_acc
false, // inherently_weak
false, // deterministic
false, // stutter inv.
});
a->merge_transitions();
return a;
@ -452,6 +453,7 @@ namespace spot
true, // single_acc
false, // inherently_weak
false, // deterministic
false, // stutter inv.
});
unsigned n = a->num_states();
@ -516,7 +518,7 @@ namespace spot
tgba_digraph_ptr
closure(const const_tgba_digraph_ptr& a)
{
return closure(make_tgba_digraph(a, {true, true, true, true}));
return closure(make_tgba_digraph(a, {true, true, true, true, false}));
}
// The stutter check algorithm to use can be overridden via an