Enable -Wmissing-declarations in development mode.
* m4/gccwarn.m4: Add -Wmissing-declarations. * iface/ltsmin/ltsmin.cc, iface/ltsmin/modelcheck.cc, src/bin/common_trans.cc, src/bin/genltl.cc, src/bin/ltlgrind.cc, src/tests/acc.cc, src/tests/bitvect.cc, src/tests/checkpsl.cc, src/tests/checkta.cc, src/tests/complementation.cc, src/tests/consterm.cc, src/tests/emptchk.cc, src/tests/equalsf.cc, src/tests/graph.cc, src/tests/ikwiad.cc, src/tests/intvcmp2.cc, src/tests/intvcomp.cc, src/tests/kind.cc, src/tests/length.cc, src/tests/ltlprod.cc, src/tests/ltlrel.cc, src/tests/ngraph.cc, src/tests/randtgba.cc, src/tests/readltl.cc, src/tests/reduc.cc, src/tests/syntimpl.cc, src/tests/tostring.cc, src/tests/twagraph.cc, src/tl/contain.cc, src/twaalgos/dtgbacomp.cc, src/twaalgos/minimize.cc: Add "static" and move in anonymous namespace when appropriate.
This commit is contained in:
parent
162d8d297d
commit
20365e53f0
32 changed files with 553 additions and 563 deletions
|
|
@ -24,140 +24,145 @@
|
|||
|
||||
namespace spot
|
||||
{
|
||||
twa_graph_ptr dtgba_complement_nonweak(const const_twa_graph_ptr& aut)
|
||||
namespace
|
||||
{
|
||||
// Clone the original automaton.
|
||||
auto res = make_twa_graph(aut,
|
||||
{ false, // state based
|
||||
false, // inherently_weak
|
||||
false, // deterministic
|
||||
true, // stutter inv.
|
||||
});
|
||||
// Copy the old acceptance condition before we replace it.
|
||||
acc_cond oldacc = aut->acc(); // Copy it!
|
||||
static twa_graph_ptr
|
||||
dtgba_complement_nonweak(const const_twa_graph_ptr& aut)
|
||||
{
|
||||
// Clone the original automaton.
|
||||
auto res = make_twa_graph(aut,
|
||||
{ false, // state based
|
||||
false, // inherently_weak
|
||||
false, // deterministic
|
||||
true, // stutter inv.
|
||||
});
|
||||
// Copy the old acceptance condition before we replace it.
|
||||
acc_cond oldacc = aut->acc(); // Copy it!
|
||||
|
||||
// We will modify res in place, and the resulting
|
||||
// automaton will only have one acceptance set.
|
||||
// This changes aut->acc();
|
||||
res->set_buchi();
|
||||
// The resulting automaton is weak.
|
||||
res->prop_inherently_weak();
|
||||
res->prop_state_based_acc();
|
||||
// We will modify res in place, and the resulting
|
||||
// automaton will only have one acceptance set.
|
||||
// This changes aut->acc();
|
||||
res->set_buchi();
|
||||
// The resulting automaton is weak.
|
||||
res->prop_inherently_weak();
|
||||
res->prop_state_based_acc();
|
||||
|
||||
unsigned num_sets = oldacc.num_sets();
|
||||
unsigned n = res->num_states();
|
||||
// We will duplicate the automaton as many times as we have
|
||||
// acceptance sets, and we need one extra sink state.
|
||||
res->new_states(num_sets * n + 1);
|
||||
unsigned sink = res->num_states() - 1;
|
||||
// The sink state has an accepting self-loop.
|
||||
res->new_acc_edge(sink, sink, bddtrue);
|
||||
unsigned num_sets = oldacc.num_sets();
|
||||
unsigned n = res->num_states();
|
||||
// We will duplicate the automaton as many times as we have
|
||||
// acceptance sets, and we need one extra sink state.
|
||||
res->new_states(num_sets * n + 1);
|
||||
unsigned sink = res->num_states() - 1;
|
||||
// The sink state has an accepting self-loop.
|
||||
res->new_acc_edge(sink, sink, bddtrue);
|
||||
|
||||
for (unsigned src = 0; src < n; ++src)
|
||||
{
|
||||
// Keep track of all conditions on edge leaving state
|
||||
// SRC, so we can complete it.
|
||||
bdd missingcond = bddtrue;
|
||||
for (auto& t: res->out(src))
|
||||
{
|
||||
if (t.dst >= n) // Ignore edges we added.
|
||||
break;
|
||||
missingcond -= t.cond;
|
||||
acc_cond::mark_t curacc = t.acc;
|
||||
// The original edge must not accept anymore.
|
||||
t.acc = 0U;
|
||||
for (unsigned src = 0; src < n; ++src)
|
||||
{
|
||||
// Keep track of all conditions on edge leaving state
|
||||
// SRC, so we can complete it.
|
||||
bdd missingcond = bddtrue;
|
||||
for (auto& t: res->out(src))
|
||||
{
|
||||
if (t.dst >= n) // Ignore edges we added.
|
||||
break;
|
||||
missingcond -= t.cond;
|
||||
acc_cond::mark_t curacc = t.acc;
|
||||
// The original edge must not accept anymore.
|
||||
t.acc = 0U;
|
||||
|
||||
// Edge that were fully accepting are never cloned.
|
||||
if (oldacc.accepting(curacc))
|
||||
continue;
|
||||
// Save t.cond and t.dst as the reference to t
|
||||
// is invalided by calls to new_edge().
|
||||
unsigned dst = t.dst;
|
||||
bdd cond = t.cond;
|
||||
// Edge that were fully accepting are never cloned.
|
||||
if (oldacc.accepting(curacc))
|
||||
continue;
|
||||
// Save t.cond and t.dst as the reference to t
|
||||
// is invalided by calls to new_edge().
|
||||
unsigned dst = t.dst;
|
||||
bdd cond = t.cond;
|
||||
|
||||
// Iterate over all the acceptance conditions in 'curacc',
|
||||
// an duplicate it for each clone for which it does not
|
||||
// belong to the acceptance set.
|
||||
unsigned add = 0;
|
||||
for (unsigned set = 0; set < num_sets; ++set)
|
||||
{
|
||||
add += n;
|
||||
if (!oldacc.has(curacc, set))
|
||||
{
|
||||
// Clone the edge
|
||||
res->new_acc_edge(src + add, dst + add, cond);
|
||||
assert(dst + add < sink);
|
||||
// Using `t' is disallowed from now on as it is a
|
||||
// reference to a edge that may have been
|
||||
// reallocated.
|
||||
// Iterate over all the acceptance conditions in 'curacc',
|
||||
// an duplicate it for each clone for which it does not
|
||||
// belong to the acceptance set.
|
||||
unsigned add = 0;
|
||||
for (unsigned set = 0; set < num_sets; ++set)
|
||||
{
|
||||
add += n;
|
||||
if (!oldacc.has(curacc, set))
|
||||
{
|
||||
// Clone the edge
|
||||
res->new_acc_edge(src + add, dst + add, cond);
|
||||
assert(dst + add < sink);
|
||||
// Using `t' is disallowed from now on as it is a
|
||||
// reference to a edge that may have been
|
||||
// reallocated.
|
||||
|
||||
// At least one edge per cycle should have a
|
||||
// nondeterministic copy from the original clone.
|
||||
// We use state numbers to select it, as any cycle
|
||||
// is guaranteed to have at least one edge
|
||||
// with dst <= src. FIXME: Computing a feedback
|
||||
// arc set would be better.
|
||||
if (dst <= src)
|
||||
res->new_edge(src, dst + add, cond);
|
||||
}
|
||||
}
|
||||
assert(add == num_sets * n);
|
||||
}
|
||||
// Complete the original automaton.
|
||||
if (missingcond != bddfalse)
|
||||
res->new_edge(src, sink, missingcond);
|
||||
}
|
||||
res->merge_edges();
|
||||
res->purge_dead_states();
|
||||
return res;
|
||||
}
|
||||
|
||||
twa_graph_ptr dtgba_complement_weak(const const_twa_graph_ptr& aut)
|
||||
{
|
||||
// Clone the original automaton.
|
||||
auto res = make_twa_graph(aut,
|
||||
{ true, // state based
|
||||
true, // inherently weak
|
||||
true, // determinisitic
|
||||
true, // stutter inv.
|
||||
});
|
||||
scc_info si(res);
|
||||
|
||||
// We will modify res in place, and the resulting
|
||||
// automaton will only have one acceptance set.
|
||||
acc_cond::mark_t all_acc = res->set_buchi();
|
||||
res->prop_state_based_acc();
|
||||
|
||||
unsigned sink = res->num_states();
|
||||
|
||||
for (unsigned src = 0; src < sink; ++src)
|
||||
{
|
||||
acc_cond::mark_t acc = 0U;
|
||||
unsigned scc = si.scc_of(src);
|
||||
if (si.is_rejecting_scc(scc) && !si.is_trivial(scc))
|
||||
acc = all_acc;
|
||||
|
||||
// Keep track of all conditions on edge leaving state
|
||||
// SRC, so we can complete it.
|
||||
bdd missingcond = bddtrue;
|
||||
for (auto& t: res->out(src))
|
||||
{
|
||||
missingcond -= t.cond;
|
||||
t.acc = acc;
|
||||
}
|
||||
// Complete the original automaton.
|
||||
if (missingcond != bddfalse)
|
||||
{
|
||||
if (res->num_states() == sink)
|
||||
{
|
||||
res->new_state();
|
||||
res->new_acc_edge(sink, sink, bddtrue);
|
||||
}
|
||||
// At least one edge per cycle should have a
|
||||
// nondeterministic copy from the original clone.
|
||||
// We use state numbers to select it, as any cycle
|
||||
// is guaranteed to have at least one edge
|
||||
// with dst <= src. FIXME: Computing a feedback
|
||||
// arc set would be better.
|
||||
if (dst <= src)
|
||||
res->new_edge(src, dst + add, cond);
|
||||
}
|
||||
}
|
||||
assert(add == num_sets * n);
|
||||
}
|
||||
// Complete the original automaton.
|
||||
if (missingcond != bddfalse)
|
||||
res->new_edge(src, sink, missingcond);
|
||||
}
|
||||
}
|
||||
//res->merge_edges();
|
||||
return res;
|
||||
}
|
||||
res->merge_edges();
|
||||
res->purge_dead_states();
|
||||
return res;
|
||||
}
|
||||
|
||||
static twa_graph_ptr
|
||||
dtgba_complement_weak(const const_twa_graph_ptr& aut)
|
||||
{
|
||||
// Clone the original automaton.
|
||||
auto res = make_twa_graph(aut,
|
||||
{ true, // state based
|
||||
true, // inherently weak
|
||||
true, // determinisitic
|
||||
true, // stutter inv.
|
||||
});
|
||||
scc_info si(res);
|
||||
|
||||
// We will modify res in place, and the resulting
|
||||
// automaton will only have one acceptance set.
|
||||
acc_cond::mark_t all_acc = res->set_buchi();
|
||||
res->prop_state_based_acc();
|
||||
|
||||
unsigned sink = res->num_states();
|
||||
|
||||
for (unsigned src = 0; src < sink; ++src)
|
||||
{
|
||||
acc_cond::mark_t acc = 0U;
|
||||
unsigned scc = si.scc_of(src);
|
||||
if (si.is_rejecting_scc(scc) && !si.is_trivial(scc))
|
||||
acc = all_acc;
|
||||
|
||||
// Keep track of all conditions on edge leaving state
|
||||
// SRC, so we can complete it.
|
||||
bdd missingcond = bddtrue;
|
||||
for (auto& t: res->out(src))
|
||||
{
|
||||
missingcond -= t.cond;
|
||||
t.acc = acc;
|
||||
}
|
||||
// Complete the original automaton.
|
||||
if (missingcond != bddfalse)
|
||||
{
|
||||
if (res->num_states() == sink)
|
||||
{
|
||||
res->new_state();
|
||||
res->new_acc_edge(sink, sink, bddtrue);
|
||||
}
|
||||
res->new_edge(src, sink, missingcond);
|
||||
}
|
||||
}
|
||||
//res->merge_edges();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
twa_graph_ptr dtgba_complement(const const_twa_graph_ptr& aut)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue