complete: merge edges going to the sink
* spot/twaalgos/complete.cc: Here. * tests/python/dualize.py, tests/core/complete.test: Adjust test cases.
This commit is contained in:
parent
37f3154f1d
commit
1e9daa73f3
3 changed files with 24 additions and 18 deletions
|
|
@ -108,6 +108,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
bdd missingcond = bddtrue;
|
bdd missingcond = bddtrue;
|
||||||
acc_cond::mark_t acc = 0U;
|
acc_cond::mark_t acc = 0U;
|
||||||
|
unsigned edge_to_sink = 0;
|
||||||
for (auto& t: aut->out(i))
|
for (auto& t: aut->out(i))
|
||||||
{
|
{
|
||||||
missingcond -= t.cond;
|
missingcond -= t.cond;
|
||||||
|
|
@ -125,6 +126,8 @@ namespace spot
|
||||||
// acceptance sets as the last outgoing edge of the
|
// acceptance sets as the last outgoing edge of the
|
||||||
// state.
|
// state.
|
||||||
acc = t.acc;
|
acc = t.acc;
|
||||||
|
if (t.dst == sink)
|
||||||
|
edge_to_sink = aut->edge_number(t);
|
||||||
}
|
}
|
||||||
// If the state has incomplete successors, we need to add a
|
// If the state has incomplete successors, we need to add a
|
||||||
// edge to some sink state.
|
// edge to some sink state.
|
||||||
|
|
@ -136,13 +139,22 @@ namespace spot
|
||||||
sink = aut->new_state();
|
sink = aut->new_state();
|
||||||
aut->new_edge(sink, sink, bddtrue, um.second);
|
aut->new_edge(sink, sink, bddtrue, um.second);
|
||||||
}
|
}
|
||||||
// In case the automaton use state-based acceptance, propagate
|
// If we already have a brother-edge to the sink,
|
||||||
|
// add the missing condition to that edge.
|
||||||
|
if (edge_to_sink)
|
||||||
|
{
|
||||||
|
aut->edge_data(edge_to_sink).cond |= missingcond;
|
||||||
|
}
|
||||||
|
else // otherwise, create the new edge.
|
||||||
|
{
|
||||||
|
// in case the automaton use state-based acceptance, propagate
|
||||||
// the acceptance of the first edge to the one we add.
|
// the acceptance of the first edge to the one we add.
|
||||||
if (aut->prop_state_acc() != true)
|
if (!aut->prop_state_acc().is_true())
|
||||||
acc = 0U;
|
acc = 0U;
|
||||||
aut->new_edge(i, sink, missingcond, acc);
|
aut->new_edge(i, sink, missingcond, acc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
aut->prop_complete(true);
|
aut->prop_complete(true);
|
||||||
// Get rid of any named property if the automaton changed.
|
// Get rid of any named property if the automaton changed.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2015, 2016 Laboratoire de Recherche et Développement
|
# Copyright (C) 2015-2017 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.
|
||||||
|
|
@ -152,11 +152,9 @@ properties: trans-labels explicit-labels state-acc complete
|
||||||
properties: deterministic
|
properties: deterministic
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0
|
||||||
[0] 1
|
[t] 1
|
||||||
[!0] 1
|
|
||||||
State: 1
|
State: 1
|
||||||
[0] 1
|
[t] 1
|
||||||
[!0] 1
|
|
||||||
--END--
|
--END--
|
||||||
HOA: v1
|
HOA: v1
|
||||||
States: 3
|
States: 3
|
||||||
|
|
@ -186,8 +184,7 @@ properties: trans-labels explicit-labels state-acc complete
|
||||||
properties: deterministic
|
properties: deterministic
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0
|
||||||
[0] 1
|
[t] 1
|
||||||
[!0] 1
|
|
||||||
State: 1 {0}
|
State: 1 {0}
|
||||||
[0] 1
|
[0] 1
|
||||||
[!0] 1
|
[!0] 1
|
||||||
|
|
@ -205,8 +202,7 @@ State: 0
|
||||||
[!0 | 1] 0
|
[!0 | 1] 0
|
||||||
[0&!1] 0&1
|
[0&!1] 0&1
|
||||||
State: 1 {0}
|
State: 1 {0}
|
||||||
[0&!1] 1
|
[t] 1
|
||||||
[!0 | 1] 1
|
|
||||||
--END--
|
--END--
|
||||||
HOA: v1
|
HOA: v1
|
||||||
States: 2
|
States: 2
|
||||||
|
|
|
||||||
|
|
@ -408,13 +408,11 @@ properties: deterministic
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0
|
||||||
[0&1] 1
|
[0&1] 1
|
||||||
[0&!1] 2
|
[!0 | !1] 2
|
||||||
[!0] 2
|
|
||||||
State: 1 {0}
|
State: 1 {0}
|
||||||
[t] 1
|
[t] 1
|
||||||
State: 2
|
State: 2
|
||||||
[0] 2
|
[t] 2
|
||||||
[!0] 2
|
|
||||||
--END--"""
|
--END--"""
|
||||||
|
|
||||||
aut = spot.automaton("""
|
aut = spot.automaton("""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue