tgba_digraph: force selection of properties kept on copy

* src/tgba/tgba.hh: Declare a prop_set to specify the types.
* src/tgba/tgbagraph.hh: Use prop_set for all copy constructors.
* iface/ltsmin/ltsmin.cc, src/bin/autfilt.cc, src/bin/randaut.cc,
src/tgbaalgos/are_isomorphic.cc, src/tgbaalgos/closure.cc,
src/tgbaalgos/complete.cc, src/tgbaalgos/degen.cc,
src/tgbaalgos/dotty.cc, src/tgbaalgos/dtgbacomp.cc,
src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh,
src/tgbaalgos/sccfilter.cc, src/tgbaalgos/simulation.cc,
src/tgbaalgos/stutterize.cc, src/tgbatest/checkpsl.cc,
src/tgbatest/emptchk.cc, src/tgbatest/ltl2tgba.cc,
wrap/python/spot.i,src/graphtest/tgbagraph.test: Adjust all uses.
This commit is contained in:
Alexandre Duret-Lutz 2014-12-23 19:35:08 +01:00
parent 77cb836e47
commit 87c2b291ed
21 changed files with 309 additions and 162 deletions

View file

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

View file

@ -28,6 +28,12 @@ namespace spot
tgba_digraph_ptr
closure(tgba_digraph_ptr&& a)
{
a->prop_keep({false, // state_based
true, // single_acc
false, // inherently_weak
false, // deterministic
});
unsigned n = a->num_states();
std::vector<unsigned> todo;
std::vector<std::vector<unsigned> > dst2trans(n);
@ -90,6 +96,6 @@ namespace spot
tgba_digraph_ptr
closure(const const_tgba_digraph_ptr& a)
{
return closure(make_tgba_digraph(a));
return closure(make_tgba_digraph(a, {true, true, true, true}));
}
}

View file

@ -104,12 +104,12 @@ namespace spot
tgba_digraph_ptr tgba_complete(const const_tgba_ptr& aut)
{
auto res = make_tgba_digraph(aut);
res->prop_copy(aut,
true, // state based
true, // single acc
true, // inherently_weak
true); // deterministic
auto res = make_tgba_digraph(aut, {
true, // state based
true, // single acc
true, // inherently_weak
true, // deterministic
});
tgba_complete_here(res);
return res;
}

View file

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

View file

@ -281,7 +281,7 @@ namespace spot
return os;
}
dotty_output d(os, options);
auto aut = make_tgba_digraph(g);
auto aut = make_tgba_digraph(g, tgba::prop_set::all());
if (assume_sba)
aut->prop_state_based_acc();
d.print(aut);

View file

@ -25,12 +25,12 @@ namespace spot
tgba_digraph_ptr dtgba_complement_nonweak(const const_tgba_ptr& aut)
{
// Clone the original automaton.
auto res = make_tgba_digraph(aut);
res->prop_copy(aut,
false, // state based
false, // single acc
false, // inherently_weak
false); // deterministic
auto res = make_tgba_digraph(aut,
{ false, // state based
false, // single acc
false, // inherently_weak
false, // deterministic
});
// Copy the old acceptance condition before we replace it.
acc_cond oldacc = aut->acc(); // Copy it!
@ -113,13 +113,12 @@ namespace spot
tgba_digraph_ptr dtgba_complement_weak(const const_tgba_ptr& aut)
{
// Clone the original automaton.
auto res = make_tgba_digraph(aut);
res->prop_copy(aut,
true, // state based
true, // single acc
true, // inherently_weak
true); // deterministic
auto res = make_tgba_digraph(aut,
{ true, // state based
true, // single acc
true, // inherently weak
true, // determinisitic
});
scc_info si(res);
// We will modify res in place, and the resulting

View file

@ -36,12 +36,12 @@ namespace spot
class dupexp_iter: public T
{
public:
dupexp_iter(const const_tgba_ptr& a)
dupexp_iter(const const_tgba_ptr& a, tgba::prop_set p)
: T(a), out_(make_tgba_digraph(a->get_dict()))
{
out_->copy_acceptance_conditions_of(a);
out_->copy_ap_of(a);
out_->prop_copy(a, true, true, true, true);
out_->prop_copy(a, p);
}
tgba_digraph_ptr
@ -77,8 +77,9 @@ namespace spot
{
public:
dupexp_iter_save(const const_tgba_ptr& a,
tgba::prop_set p,
std::vector<const state*>& relation)
: dupexp_iter<T>(a), relation_(relation)
: dupexp_iter<T>(a, p), relation_(relation)
{
}
@ -96,37 +97,39 @@ namespace spot
} // anonymous
tgba_digraph_ptr
tgba_dupexp_bfs(const const_tgba_ptr& aut)
tgba_dupexp_bfs(const const_tgba_ptr& aut, tgba::prop_set p)
{
dupexp_iter<tgba_reachable_iterator_breadth_first> di(aut);
dupexp_iter<tgba_reachable_iterator_breadth_first> di(aut, p);
di.run();
return di.result();
}
tgba_digraph_ptr
tgba_dupexp_dfs(const const_tgba_ptr& aut)
tgba_dupexp_dfs(const const_tgba_ptr& aut, tgba::prop_set p)
{
dupexp_iter<tgba_reachable_iterator_depth_first> di(aut);
dupexp_iter<tgba_reachable_iterator_depth_first> di(aut, p);
di.run();
return di.result();
}
tgba_digraph_ptr
tgba_dupexp_bfs(const const_tgba_ptr& aut, std::vector<const state*>& rel)
tgba_dupexp_bfs(const const_tgba_ptr& aut, tgba::prop_set p,
std::vector<const state*>& rel)
{
dupexp_iter_save<tgba_reachable_iterator_breadth_first> di(aut, rel);
dupexp_iter_save<tgba_reachable_iterator_breadth_first> di(aut, p, rel);
di.run();
return di.result();
}
tgba_digraph_ptr
tgba_dupexp_dfs(const const_tgba_ptr& aut, std::vector<const state*>& rel)
tgba_dupexp_dfs(const const_tgba_ptr& aut, tgba::prop_set p,
std::vector<const state*>& rel)
{
auto aa = std::dynamic_pointer_cast<const spot::tgba_digraph>(aut);
auto aa = std::dynamic_pointer_cast<const tgba_digraph>(aut);
if (aa)
{
aa->get_init_state_number(); // Create an initial state if needed.
auto res = make_tgba_digraph(aa);
auto res = make_tgba_digraph(aa, p);
unsigned ns = aa->num_states();
rel.reserve(ns);
// The state numbers are common to both automata, but
@ -136,7 +139,7 @@ namespace spot
return res;
}
dupexp_iter_save<tgba_reachable_iterator_depth_first> di(aut, rel);
dupexp_iter_save<tgba_reachable_iterator_depth_first> di(aut, p, rel);
di.run();
return di.result();
}

View file

@ -34,12 +34,12 @@ namespace spot
/// \brief Build an explicit automaton from all states of \a aut,
/// numbering states in bread first order as they are processed.
SPOT_API tgba_digraph_ptr
tgba_dupexp_bfs(const const_tgba_ptr& aut);
tgba_dupexp_bfs(const const_tgba_ptr& aut, tgba::prop_set p);
/// \ingroup tgba_misc
/// \brief Build an explicit automaton from all states of \a aut,
/// numbering states in depth first order as they are processed.
SPOT_API tgba_digraph_ptr
tgba_dupexp_dfs(const const_tgba_ptr& aut);
tgba_dupexp_dfs(const const_tgba_ptr& aut, tgba::prop_set p);
/// \ingroup tgba_misc
/// \brief Build an explicit automaton from all states of \a aut,
@ -48,7 +48,7 @@ namespace spot
/// \a relation a map of all the new states (represented by
/// their number) to the old states.
SPOT_API tgba_digraph_ptr
tgba_dupexp_bfs(const const_tgba_ptr& aut,
tgba_dupexp_bfs(const const_tgba_ptr& aut, tgba::prop_set p,
std::vector<const state*>& relation);
/// \ingroup tgba_misc
@ -58,7 +58,7 @@ namespace spot
/// \a relation a map of all the new states (represented by
/// their number) to the old states.
SPOT_API tgba_digraph_ptr
tgba_dupexp_dfs(const const_tgba_ptr& aut,
tgba_dupexp_dfs(const const_tgba_ptr& aut, tgba::prop_set p,
std::vector<const state*>& relation);
}

View file

@ -313,7 +313,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 });
return res;
}
@ -332,10 +332,11 @@ namespace spot
<acc_filter_simplify<>>>>(aut, given_si);
res->merge_transitions();
res->prop_copy(aut,
false, // state-based acceptance is not preserved
true,
true,
true);
{ false, // state-based acceptance is not preserved
true,
true,
true,
});
return res;
}
@ -363,10 +364,11 @@ namespace spot
early_susp);
res->merge_transitions();
res->prop_copy(aut,
false, // state-based acceptance is not preserved
true,
true,
false); // determinism may not be preserved
{ false, // state-based acceptance is not preserved
true,
true,
false, // determinism may not be preserved
});
return res;
}

View file

@ -252,7 +252,7 @@ namespace spot
// the names (addresses) of the states in the automaton
// returned by dupexp, and in automaton given in argument to
// the constructor.
a_ = tgba_dupexp_dfs(t, new_original_);
a_ = tgba_dupexp_dfs(t, { true, true, true, true }, new_original_);
scc_info_.reset(new scc_info(a_));
old_a_ = a_;
@ -701,10 +701,11 @@ namespace spot
delete gb;
res->prop_copy(original_,
false, // state-based acc forced below
false, // single acc is set by set_acceptance_conditions
true, // weakness preserved,
false); // determinism checked and set below
{ false, // state-based acc forced below
false, // single acc set by set_acceptance_conditions
true, // weakness preserved,
false, // determinism checked and set below
});
if (nb_minato == nb_satoneset)
res->prop_deterministic();
if (Sba)

View file

@ -187,6 +187,7 @@ namespace spot
tgba_digraph_ptr
sl2(const const_tgba_digraph_ptr& a, bdd atomic_propositions)
{
return sl2(make_tgba_digraph(a), atomic_propositions);
return sl2(make_tgba_digraph(a, tgba::prop_set::all()),
atomic_propositions);
}
}