remove_fin: use simplify_acceptance
* spot/twaalgos/remfin.cc: Simplify acceptance before trying the different strategies. * spot/twaalgos/cleanacc.cc: Skip simplify_complementary_marks_here() on generalized Büchi. * tests/core/remfin.test, tests/python/tra2tba.py: Adjust. * spot/twaalgos/totgba.cc: Simplify the result of Streett->GBA. * NEWS: Adjust.
This commit is contained in:
parent
2feba6ad5e
commit
a924bc561a
6 changed files with 43 additions and 42 deletions
11
NEWS
11
NEWS
|
|
@ -186,6 +186,9 @@ New in spot 2.4.4.dev (net yet released)
|
||||||
are not very smart: if the input does not already have parity
|
are not very smart: if the input does not already have parity
|
||||||
acceptance, it will simply be degeneralized or determinized.
|
acceptance, it will simply be degeneralized or determinized.
|
||||||
|
|
||||||
|
- spot::remove_fin() will now call simplify_acceptance(), introduced
|
||||||
|
in 2.4, before attempting its different Fin-removal strategies.
|
||||||
|
|
||||||
- acc_cond::name(fmt) is a new method that name well-known acceptance
|
- acc_cond::name(fmt) is a new method that name well-known acceptance
|
||||||
conditions. The fmt parameter specify the format to use for that
|
conditions. The fmt parameter specify the format to use for that
|
||||||
name (e.g. to the style used in HOA, or that used by print_dot()).
|
name (e.g. to the style used in HOA, or that used by print_dot()).
|
||||||
|
|
@ -258,10 +261,10 @@ New in spot 2.4.4.dev (net yet released)
|
||||||
|
|
||||||
Bugs fixed:
|
Bugs fixed:
|
||||||
|
|
||||||
- spot::simplify_acceptance() could produce incorrect output
|
- spot::simplify_acceptance() could produce incorrect output if the
|
||||||
if the first edge of the automaton was the only one with no
|
first edge of the automaton was the only one with no acceptance
|
||||||
acceptance set. In spot 2.4.x this function was only used
|
set. In spot 2.4.x this function was only used by autfilt
|
||||||
by autfilt --simplify-acceptance.
|
--simplify-acceptance; in 2.5 it is now used in remove_fin().
|
||||||
|
|
||||||
New in spot 2.4.4 (2017-12-25)
|
New in spot 2.4.4 (2017-12-25)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,8 @@ namespace spot
|
||||||
{
|
{
|
||||||
cleanup_acceptance_here(aut, false);
|
cleanup_acceptance_here(aut, false);
|
||||||
merge_identical_marks_here(aut);
|
merge_identical_marks_here(aut);
|
||||||
simplify_complementary_marks_here(aut);
|
if (!aut->acc().is_generalized_buchi())
|
||||||
|
simplify_complementary_marks_here(aut);
|
||||||
cleanup_acceptance_here(aut, true);
|
cleanup_acceptance_here(aut, true);
|
||||||
|
|
||||||
return aut;
|
return aut;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2015-2017 Laboratoire de Recherche et Développement
|
// Copyright (C) 2015-2018 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.
|
||||||
|
|
@ -256,11 +256,8 @@ namespace spot
|
||||||
// TBA-typeness of the SCC, but the resulting automaton should
|
// TBA-typeness of the SCC, but the resulting automaton should
|
||||||
// be correct nonetheless.
|
// be correct nonetheless.
|
||||||
twa_graph_ptr
|
twa_graph_ptr
|
||||||
tra_to_tba(const const_twa_graph_ptr& inaut)
|
tra_to_tba(const const_twa_graph_ptr& aut)
|
||||||
{
|
{
|
||||||
// cleanup acceptance for easy detection of alone fins and infs
|
|
||||||
auto aut = cleanup_acceptance(inaut);
|
|
||||||
|
|
||||||
std::vector<acc_cond::rs_pair> pairs;
|
std::vector<acc_cond::rs_pair> pairs;
|
||||||
if (!aut->acc().is_rabin_like(pairs))
|
if (!aut->acc().is_rabin_like(pairs))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -501,20 +498,6 @@ namespace spot
|
||||||
|
|
||||||
twa_graph_ptr default_strategy(const const_twa_graph_ptr& aut)
|
twa_graph_ptr default_strategy(const const_twa_graph_ptr& aut)
|
||||||
{
|
{
|
||||||
{
|
|
||||||
// We want a clean acceptance condition, i.e., one where all
|
|
||||||
// sets are useful. If that is not the case, clean it first.
|
|
||||||
acc_cond::mark_t unused = aut->acc().all_sets();
|
|
||||||
for (auto& t: aut->edges())
|
|
||||||
{
|
|
||||||
unused -= t.acc;
|
|
||||||
if (!unused)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (unused)
|
|
||||||
return remove_fin(cleanup_acceptance(aut));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<acc_cond::acc_code> code;
|
std::vector<acc_cond::acc_code> code;
|
||||||
std::vector<acc_cond::mark_t> rem;
|
std::vector<acc_cond::mark_t> rem;
|
||||||
std::vector<acc_cond::mark_t> keep;
|
std::vector<acc_cond::mark_t> keep;
|
||||||
|
|
@ -525,10 +508,21 @@ namespace spot
|
||||||
{
|
{
|
||||||
auto acccode = aut->get_acceptance();
|
auto acccode = aut->get_acceptance();
|
||||||
if (!acccode.is_dnf())
|
if (!acccode.is_dnf())
|
||||||
acccode = acccode.to_dnf();
|
{
|
||||||
|
acccode = acccode.to_dnf();
|
||||||
|
|
||||||
|
if (acccode.is_f())
|
||||||
|
{
|
||||||
|
// The original acceptance was equivalent to
|
||||||
|
// "f". Simply return an empty automaton.
|
||||||
|
auto res = make_twa_graph(aut->get_dict());
|
||||||
|
res->set_acceptance(0, acccode);
|
||||||
|
res->set_init_state(res->new_state());
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto split = split_dnf_acc_by_fin(acccode);
|
auto split = split_dnf_acc_by_fin(acccode);
|
||||||
|
|
||||||
auto sz = split.size();
|
auto sz = split.size();
|
||||||
assert(sz > 0);
|
assert(sz > 0);
|
||||||
|
|
||||||
|
|
@ -759,9 +753,11 @@ namespace spot
|
||||||
twa_graph_ptr remove_fin_impl(const const_twa_graph_ptr& aut,
|
twa_graph_ptr remove_fin_impl(const const_twa_graph_ptr& aut,
|
||||||
const strategy_t skip = {})
|
const strategy_t skip = {})
|
||||||
{
|
{
|
||||||
|
auto simp = simplify_acceptance(aut);
|
||||||
|
|
||||||
auto handle = [&](strategy stra, strategy_t type) -> twa_graph_ptr
|
auto handle = [&](strategy stra, strategy_t type) -> twa_graph_ptr
|
||||||
{
|
{
|
||||||
return (type & skip) ? nullptr : stra(aut);
|
return (type & skip) ? nullptr : stra(simp);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (auto maybe = handle(trivial_strategy, strategy_t::trivial))
|
if (auto maybe = handle(trivial_strategy, strategy_t::trivial))
|
||||||
|
|
@ -785,7 +781,7 @@ namespace spot
|
||||||
return maybe;
|
return maybe;
|
||||||
if (auto maybe = handle(streett_strategy, strategy_t::streett))
|
if (auto maybe = handle(streett_strategy, strategy_t::streett))
|
||||||
return maybe;
|
return maybe;
|
||||||
return default_strategy(aut);
|
return default_strategy(simp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2015, 2016, 2017 Laboratoire de Recherche et
|
// Copyright (C) 2015-2018 Laboratoire de Recherche et Développement
|
||||||
// Développement de l'Epita.
|
// de l'Epita.
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
//
|
//
|
||||||
|
|
@ -724,6 +724,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
simplify_acceptance_here(out);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright (C) 2015-2017 Laboratoire de Recherche et Développement de
|
# Copyright (C) 2015-2018 Laboratoire de Recherche et Développement de
|
||||||
# l'Epita (LRDE).
|
# l'Epita (LRDE).
|
||||||
#
|
#
|
||||||
# This file is part of Spot, a model checking library.
|
# This file is part of Spot, a model checking library.
|
||||||
|
|
@ -394,7 +394,8 @@ State: 0
|
||||||
[!0] 0
|
[!0] 0
|
||||||
[0] 1
|
[0] 1
|
||||||
State: 1 {0}
|
State: 1 {0}
|
||||||
[t] 1
|
[!0] 1
|
||||||
|
[0] 1
|
||||||
--END--
|
--END--
|
||||||
HOA: v1
|
HOA: v1
|
||||||
States: 10
|
States: 10
|
||||||
|
|
@ -589,9 +590,8 @@ HOA: v1
|
||||||
States: 37
|
States: 37
|
||||||
Start: 0
|
Start: 0
|
||||||
AP: 2 "a" "b"
|
AP: 2 "a" "b"
|
||||||
acc-name: generalized-Buchi 12
|
acc-name: Buchi
|
||||||
Acceptance: 12 Inf(0)&Inf(1)&Inf(2)&Inf(3)&Inf(4)&Inf(5)&Inf(6)\
|
Acceptance: 1 Inf(0)
|
||||||
&Inf(7)&Inf(8)&Inf(9)&Inf(10)&Inf(11)
|
|
||||||
properties: trans-labels explicit-labels state-acc complete
|
properties: trans-labels explicit-labels state-acc complete
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0
|
||||||
|
|
@ -731,7 +731,7 @@ State: 32
|
||||||
State: 33
|
State: 33
|
||||||
[t] 33
|
[t] 33
|
||||||
[!1] 36
|
[!1] 36
|
||||||
State: 34 {0 1 2 3 4 5 6 7 8 9 10 11}
|
State: 34 {0}
|
||||||
[t] 34
|
[t] 34
|
||||||
State: 35
|
State: 35
|
||||||
[1] 34
|
[1] 34
|
||||||
|
|
@ -750,11 +750,11 @@ properties: trans-labels explicit-labels state-acc complete
|
||||||
properties: deterministic
|
properties: deterministic
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0
|
||||||
[!0] 0
|
|
||||||
[0] 1
|
[0] 1
|
||||||
|
[!0] 0
|
||||||
State: 1 {0}
|
State: 1 {0}
|
||||||
[!0] 0
|
|
||||||
[0] 1
|
[0] 1
|
||||||
|
[!0] 0
|
||||||
--END--
|
--END--
|
||||||
HOA: v1
|
HOA: v1
|
||||||
States: 21
|
States: 21
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,8 @@ exp = """HOA: v1
|
||||||
States: 2
|
States: 2
|
||||||
Start: 0
|
Start: 0
|
||||||
AP: 2 "a" "b"
|
AP: 2 "a" "b"
|
||||||
acc-name: Buchi
|
acc-name: none
|
||||||
Acceptance: 1 Inf(0)
|
Acceptance: 0 f
|
||||||
properties: trans-labels explicit-labels state-acc deterministic
|
properties: trans-labels explicit-labels state-acc deterministic
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0
|
||||||
|
|
@ -383,11 +383,11 @@ Acceptance: 1 Inf(0)
|
||||||
properties: trans-labels explicit-labels state-acc deterministic
|
properties: trans-labels explicit-labels state-acc deterministic
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0 {0}
|
State: 0 {0}
|
||||||
[!1&!2] 0
|
|
||||||
[1&!2] 1
|
[1&!2] 1
|
||||||
|
[!1&!2] 0
|
||||||
State: 1
|
State: 1
|
||||||
[!1&!2] 0
|
|
||||||
[1&!2] 1
|
[1&!2] 1
|
||||||
|
[!1&!2] 0
|
||||||
--END--"""
|
--END--"""
|
||||||
|
|
||||||
res = spot.remove_fin(aut)
|
res = spot.remove_fin(aut)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue