hoa: detect colored automata
Fixes #84. * src/twaalgos/hoa.cc: Detect and output the colored property. * src/tests/hoaparse.test, src/tests/satmin2.test: Update.
This commit is contained in:
parent
a75a9c091c
commit
97665a584e
3 changed files with 20 additions and 3 deletions
|
|
@ -274,7 +274,7 @@ Start: 0
|
||||||
AP: 2 "a" "b"
|
AP: 2 "a" "b"
|
||||||
acc-name: generalized-Buchi 2
|
acc-name: generalized-Buchi 2
|
||||||
Acceptance: 2 Inf(0)&Inf(1)
|
Acceptance: 2 Inf(0)&Inf(1)
|
||||||
properties: trans-labels explicit-labels state-acc complete
|
properties: trans-labels explicit-labels state-acc colored complete
|
||||||
properties: deterministic
|
properties: deterministic
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0 "foo" {0}
|
State: 0 "foo" {0}
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ States: 1
|
||||||
Start: 0
|
Start: 0
|
||||||
AP: 1 "a"
|
AP: 1 "a"
|
||||||
Acceptance: 2 (Fin(1) & Inf(0)) | (Fin(0) & Inf(1))
|
Acceptance: 2 (Fin(1) & Inf(0)) | (Fin(0) & Inf(1))
|
||||||
properties: trans-labels explicit-labels trans-acc complete
|
properties: trans-labels explicit-labels trans-acc colored complete
|
||||||
properties: deterministic
|
properties: deterministic
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ namespace spot
|
||||||
bool has_state_acc;
|
bool has_state_acc;
|
||||||
bool is_complete;
|
bool is_complete;
|
||||||
bool is_deterministic;
|
bool is_deterministic;
|
||||||
|
bool is_colored;
|
||||||
bool use_implicit_labels;
|
bool use_implicit_labels;
|
||||||
bdd all_ap;
|
bdd all_ap;
|
||||||
|
|
||||||
|
|
@ -95,6 +96,8 @@ namespace spot
|
||||||
bool deterministic = true;
|
bool deterministic = true;
|
||||||
bool complete = true;
|
bool complete = true;
|
||||||
bool state_acc = true;
|
bool state_acc = true;
|
||||||
|
bool nodeadend = true;
|
||||||
|
bool colored = aut->acc().num_sets() >= 1;
|
||||||
for (unsigned src = 0; src < ns; ++src)
|
for (unsigned src = 0; src < ns; ++src)
|
||||||
{
|
{
|
||||||
bdd sum = bddfalse;
|
bdd sum = bddfalse;
|
||||||
|
|
@ -102,6 +105,7 @@ namespace spot
|
||||||
bool st_acc = true;
|
bool st_acc = true;
|
||||||
bool notfirst = false;
|
bool notfirst = false;
|
||||||
acc_cond::mark_t prev = 0U;
|
acc_cond::mark_t prev = 0U;
|
||||||
|
bool has_succ = false;
|
||||||
for (auto& t: aut->out(src))
|
for (auto& t: aut->out(src))
|
||||||
{
|
{
|
||||||
if (complete)
|
if (complete)
|
||||||
|
|
@ -126,7 +130,15 @@ namespace spot
|
||||||
prev = t.acc;
|
prev = t.acc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (colored)
|
||||||
|
{
|
||||||
|
auto a = t.acc;
|
||||||
|
if (!a || a.remove_some(1))
|
||||||
|
colored = false;
|
||||||
}
|
}
|
||||||
|
has_succ = true;
|
||||||
|
}
|
||||||
|
nodeadend &= has_succ;
|
||||||
if (complete)
|
if (complete)
|
||||||
complete &= sum == bddtrue;
|
complete &= sum == bddtrue;
|
||||||
common_acc.push_back(st_acc);
|
common_acc.push_back(st_acc);
|
||||||
|
|
@ -135,7 +147,10 @@ namespace spot
|
||||||
is_deterministic = deterministic;
|
is_deterministic = deterministic;
|
||||||
is_complete = complete;
|
is_complete = complete;
|
||||||
has_state_acc = state_acc;
|
has_state_acc = state_acc;
|
||||||
|
// If the automaton has state-based acceptance and contain
|
||||||
|
// some states without successors do not declare it as
|
||||||
|
// colored.
|
||||||
|
is_colored = colored && (!has_state_acc || nodeadend);
|
||||||
// If the automaton declares that it is deterministic or
|
// If the automaton declares that it is deterministic or
|
||||||
// state-based, make sure that it really is.
|
// state-based, make sure that it really is.
|
||||||
assert(!aut->is_deterministic() || deterministic);
|
assert(!aut->is_deterministic() || deterministic);
|
||||||
|
|
@ -382,6 +397,8 @@ namespace spot
|
||||||
prop(" state-acc");
|
prop(" state-acc");
|
||||||
else if (acceptance == Hoa_Acceptance_Transitions)
|
else if (acceptance == Hoa_Acceptance_Transitions)
|
||||||
prop(" trans-acc");
|
prop(" trans-acc");
|
||||||
|
if (md.is_colored)
|
||||||
|
prop(" colored");
|
||||||
if (md.is_complete)
|
if (md.is_complete)
|
||||||
prop(" complete");
|
prop(" complete");
|
||||||
if (md.is_deterministic)
|
if (md.is_deterministic)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue