Add a notebook illustrating decompose_strength()
* wrap/python/tests/decompose.ipynb: New file. * wrap/python/tests/Makefile.am: Add it. * src/twaalgos/strength.cc: Fix corner cases. * src/tests/strength.test: Adjust corner case. * NEWS, doc/org/tut.org: Mention the notebook.
This commit is contained in:
parent
a7db0b5435
commit
104a372c41
6 changed files with 4839 additions and 21 deletions
2
NEWS
2
NEWS
|
|
@ -6,6 +6,8 @@ New in spot 1.99.5a (not yet released)
|
||||||
|
|
||||||
* autfilt has a new transformation: --decompose-strength,
|
* autfilt has a new transformation: --decompose-strength,
|
||||||
implementing the decomposition of our TACAS'13 paper.
|
implementing the decomposition of our TACAS'13 paper.
|
||||||
|
A demonstration of this feature via the Python bindings
|
||||||
|
can be found at https://spot.lrde.epita.fr/ipynb/decompose.html
|
||||||
|
|
||||||
* All tools that output HOA files accept a --check=strength option
|
* All tools that output HOA files accept a --check=strength option
|
||||||
to request automata to be marked as "weak" or "terminal" as
|
to request automata to be marked as "weak" or "terminal" as
|
||||||
|
|
|
||||||
|
|
@ -54,5 +54,6 @@ real notebooks instead.
|
||||||
after acceptance simplification
|
after acceptance simplification
|
||||||
- [[https://spot.lrde.epita.fr/ipynb/accparse.html][accparse.ipynb]] exercises the acceptance condition parser
|
- [[https://spot.lrde.epita.fr/ipynb/accparse.html][accparse.ipynb]] exercises the acceptance condition parser
|
||||||
- [[https://spot.lrde.epita.fr/ipynb/randltl.html][randltl.ipynb]] demonstrates a Python-version of [[file:randltl.org][=randltl=]]
|
- [[https://spot.lrde.epita.fr/ipynb/randltl.html][randltl.ipynb]] demonstrates a Python-version of [[file:randltl.org][=randltl=]]
|
||||||
|
- [[https://spot.lrde.epita.fr/ipynb/decompose.html][decompose.ipynb]] illustrates the =decompose_strength()= function
|
||||||
- [[https://spot.lrde.epita.fr/ipynb/testingaut.html][testingaut.ipynb]] shows the step necessary to build a testing
|
- [[https://spot.lrde.epita.fr/ipynb/testingaut.html][testingaut.ipynb]] shows the step necessary to build a testing
|
||||||
automaton
|
automaton
|
||||||
|
|
|
||||||
|
|
@ -535,14 +535,14 @@ HOA: v1
|
||||||
States: 2
|
States: 2
|
||||||
Start: 0
|
Start: 0
|
||||||
AP: 0
|
AP: 0
|
||||||
acc-name: all
|
acc-name: Buchi
|
||||||
Acceptance: 0 t
|
Acceptance: 1 Inf(0)
|
||||||
properties: trans-labels explicit-labels state-acc complete
|
properties: trans-labels explicit-labels state-acc colored complete
|
||||||
properties: deterministic weak
|
properties: deterministic weak
|
||||||
--BODY--
|
--BODY--
|
||||||
State: 0
|
State: 0 {0}
|
||||||
[t] 1
|
[t] 1
|
||||||
State: 1
|
State: 1 {0}
|
||||||
[t] 0
|
[t] 0
|
||||||
--END--
|
--END--
|
||||||
HOA: v1
|
HOA: v1
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,33 @@ namespace spot
|
||||||
(std::string("unknown option for decompose_strength(): ") + c);
|
(std::string("unknown option for decompose_strength(): ") + c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
acc_cond::mark_t wacc = 0U; // Acceptance for weak SCCs
|
||||||
|
acc_cond::mark_t uacc = 0U; // Acceptance for "needed" SCCs, that
|
||||||
|
// we only want to traverse.
|
||||||
|
|
||||||
|
// If the acceptance condition is always satisfiable, we will
|
||||||
|
// consider the automaton has weak (even if that is not the
|
||||||
|
// case syntactically) and not output any strong part.
|
||||||
|
bool all_accepting = false;
|
||||||
|
if (aut->acc().is_tt())
|
||||||
|
{
|
||||||
|
all_accepting = true;
|
||||||
|
}
|
||||||
|
else if (aut->acc().uses_fin_acceptance())
|
||||||
|
{
|
||||||
|
auto p = aut->get_acceptance().unsat_mark();
|
||||||
|
if (p.first)
|
||||||
|
uacc = p.second;
|
||||||
|
else
|
||||||
|
all_accepting = true;
|
||||||
|
}
|
||||||
|
if (all_accepting)
|
||||||
|
{
|
||||||
|
keep &= ~Strong;
|
||||||
|
if (keep == Ignore)
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
scc_info si(aut);
|
scc_info si(aut);
|
||||||
si.determine_unknown_acceptance();
|
si.determine_unknown_acceptance();
|
||||||
|
|
||||||
|
|
@ -160,7 +187,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
if (si.is_accepting_scc(i))
|
if (si.is_accepting_scc(i))
|
||||||
{
|
{
|
||||||
if (is_weak_scc(si, i))
|
if (all_accepting | is_weak_scc(si, i))
|
||||||
{
|
{
|
||||||
if (keep & Weak)
|
if (keep & Weak)
|
||||||
{
|
{
|
||||||
|
|
@ -194,23 +221,10 @@ namespace spot
|
||||||
res->copy_ap_of(aut);
|
res->copy_ap_of(aut);
|
||||||
res->prop_copy(aut, { true, false, true, false });
|
res->prop_copy(aut, { true, false, true, false });
|
||||||
|
|
||||||
acc_cond::mark_t wacc = 0U; // Acceptance for weak SCCs
|
|
||||||
acc_cond::mark_t uacc = 0U; // Acceptance for "needed" SCCs, that
|
|
||||||
// we only want to traverse.
|
|
||||||
if (keep & Strong)
|
if (keep & Strong)
|
||||||
{
|
|
||||||
res->copy_acceptance_of(aut);
|
res->copy_acceptance_of(aut);
|
||||||
auto& ac = res->acc();
|
|
||||||
if (ac.uses_fin_acceptance())
|
|
||||||
// Note that we ignore the cases where the acceptance
|
|
||||||
// condition is always satisfiable. In that case
|
|
||||||
// uacc will be set to 0U, which will be satisfiable
|
|
||||||
uacc = ac.get_acceptance().unsat_mark().second;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
wacc = res->set_buchi();
|
wacc = res->set_buchi();
|
||||||
}
|
|
||||||
|
|
||||||
auto fun = [&si, &want, uacc, wacc, keep]
|
auto fun = [&si, &want, uacc, wacc, keep]
|
||||||
(unsigned src, bdd& cond, acc_cond::mark_t& acc, unsigned dst)
|
(unsigned src, bdd& cond, acc_cond::mark_t& acc, unsigned dst)
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ TESTS = \
|
||||||
automata.ipynb \
|
automata.ipynb \
|
||||||
automata-io.ipynb \
|
automata-io.ipynb \
|
||||||
bddnqueen.py \
|
bddnqueen.py \
|
||||||
|
decompose.ipynb \
|
||||||
formulas.ipynb \
|
formulas.ipynb \
|
||||||
implies.py \
|
implies.py \
|
||||||
interdep.py \
|
interdep.py \
|
||||||
|
|
|
||||||
4800
wrap/python/tests/decompose.ipynb
Normal file
4800
wrap/python/tests/decompose.ipynb
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue