postprocess, translate: add support for Büchi (not state-based)

spot/twaalgos/postproc.hh: Introduce options Buchi and
GeneralizedBuchi.  The latter is similar to TGBA but the former differs
from BA in that it does not imply state-based acceptance, since that
can be specified separately.  Also all other acceptance types are not
abbreviated, so those new names make more sense.
* NEWS: Mention that.
* spot/twaalgos/postproc.cc, spot/twaalgos/translate.cc: Adjust
to support Buchi and GeneralizedBuchi without breaking BA and TGBA.
* bin/autfilt.cc, bin/common_aoutput.cc, bin/common_post.cc,
bin/ltl2tgta.cc, doc/org/tut10.org, doc/org/tut12.org,
doc/org/tut30.org, python/spot/__init__.py,
tests/python/automata.ipynb, tests/python/langmap.py,
tests/python/misc-ec.py, tests/python/satmin.ipynb,
tests/python/satmin.py, tests/python/toweak.py: Use the new names.
* tests/Makefile.am: Add missing langmap.py.
This commit is contained in:
Alexandre Duret-Lutz 2020-10-06 17:46:34 +02:00
parent 72c492b0cf
commit 9cc1bdf10f
19 changed files with 274 additions and 201 deletions

View file

@ -400,6 +400,7 @@ TESTS_python = \
python/interdep.py \
python/intrun.py \
python/kripke.py \
python/langmap.py \
python/ltl2tgba.test \
python/ltlf.py \
python/ltlparse.py \

View file

@ -178,7 +178,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f419a180> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc69c0f16c0> >"
]
},
"execution_count": 2,
@ -187,7 +187,7 @@
}
],
"source": [
"a = spot.translate('(a U b) & GFc & GFd', 'BA', 'complete'); a"
"a = spot.translate('(a U b) & GFc & GFd', 'Buchi', 'state-based', 'complete'); a"
]
},
{
@ -657,7 +657,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f419adb0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d909240> >"
]
},
"execution_count": 6,
@ -733,7 +733,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f41614b0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d9099c0> >"
]
},
"execution_count": 7,
@ -816,7 +816,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f41613f0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc69e19d9c0> >"
]
},
"execution_count": 8,
@ -966,7 +966,7 @@
}
],
"source": [
"f.translate('ba', 'small').show('.v')"
"f.translate('buchi', 'state-based', 'small').show('.v')"
]
},
{
@ -1190,7 +1190,7 @@
}
],
"source": [
"f.translate('ba', 'det').show('v.')"
"f.translate('buchi', 'state-based', 'det').show('v.')"
]
},
{
@ -1349,7 +1349,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f4161ba0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d916150> >"
]
},
"execution_count": 12,
@ -1463,7 +1463,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f416c300> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d916450> >"
]
},
"execution_count": 13,
@ -1594,7 +1594,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f416c5d0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d916a20> >"
]
},
"execution_count": 14,
@ -1816,7 +1816,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f41747b0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91ca20> >"
]
},
"metadata": {},
@ -1974,7 +1974,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f4174720> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91c9c0> >"
]
},
"metadata": {},
@ -2132,7 +2132,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f4174c30> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91cd80> >"
]
},
"metadata": {},
@ -2280,7 +2280,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f4174b10> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91ccc0> >"
]
},
"metadata": {},
@ -2291,8 +2291,8 @@
"a = spot.automaton('example1.aut')\n",
"display(a)\n",
"display(spot.remove_fin(a))\n",
"display(a.postprocess('TGBA', 'complete'))\n",
"display(a.postprocess('BA'))"
"display(a.postprocess('GeneralizedBuchi', 'complete'))\n",
"display(a.postprocess('Buchi', \"SBAcc\"))"
]
},
{
@ -2469,7 +2469,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f41748a0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91cb40> >"
]
},
"execution_count": 19,
@ -2545,7 +2545,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f4179450> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d925690> >"
]
},
"execution_count": 20,
@ -3095,7 +3095,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f416c9f0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91c480> >"
]
},
"metadata": {},
@ -3195,7 +3195,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f4174300> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91c510> >"
]
},
"execution_count": 24,
@ -3268,7 +3268,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f416c510> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91c2d0> >"
]
},
"execution_count": 25,
@ -3439,7 +3439,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f416ccf0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d9164e0> >"
]
},
"execution_count": 27,
@ -3522,7 +3522,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f416c9f0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91c480> >"
]
},
"metadata": {},
@ -3587,7 +3587,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f416c9f0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91c480> >"
]
},
"metadata": {},
@ -3674,7 +3674,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f33f416c9f0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc68d91c480> >"
]
},
"execution_count": 29,
@ -3707,7 +3707,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.6"
}
},
"nbformat": 4,

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016, 2017 Laboratoire de Recherche et Développement
# Copyright (C) 2016, 2017, 2020 Laboratoire de Recherche et Développement
# de l'Epita (LRDE)
#
# This file is part of Spot, a model checking library.
@ -29,7 +29,7 @@ def hstates(txt):
def test(f, opt, expected):
aut = spot.translate(f, opt, 'deterministic')
aut = spot.translate(f, *opt, 'deterministic')
v = spot.language_map(aut)
assert len(v) == aut.num_states()
spot.highlight_languages(aut)
@ -40,15 +40,15 @@ def test(f, opt, expected):
exit(1)
test('GF(a) & GFb & c', 'BA', '1 0 2 0 3 0')
test('GF(a) & c & X!a', 'BA', '2 0 3 0')
test('(a U b) & GF(c & Xd)', 'generic', '1 0 2 0')
test('GF(a <-> Xb) & Fb', 'generic', '0 0 1 1 2 0 3 1 4 1')
test('Xa', 'BA', '')
test('GF(a) & GFb & c', ['Buchi', 'SBAcc'], '1 0 2 0 3 0')
test('GF(a) & c & X!a', ['Buchi', 'SBAcc'], '2 0 3 0')
test('(a U b) & GF(c & Xd)', ['generic'], '1 0 2 0')
test('GF(a <-> Xb) & Fb', ['generic', 'low'], '1 0 2 0 3 0')
test('Xa', ['Buchi', 'SBAcc'], '')
# Non-deterministic automata are not supported
try:
test('FGa', 'BA', '')
test('FGa', ['Buchi'], '')
except RuntimeError as e:
assert 'language_map only works with deterministic automata'in str(e)
else:

View file

@ -1,5 +1,5 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2017 Laboratoire de Recherche et Développement de l'Epita
# Copyright (C) 2017, 2020 Laboratoire de Recherche et Développement de l'Epita
# (LRDE).
#
# This file is part of Spot, a model checking library.
@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import spot
aut = spot.translate("G(p0 | (p0 R Xp0) | XF(!p0 & p1))", 'BA')
aut = spot.translate("G(p0 | (p0 R Xp0) | XF(!p0 & p1))", 'Buchi', 'SBAcc')
ec = spot.make_emptiness_check_instantiator('SE05')[0].instantiate(aut)
n = 0
while True:

View file

@ -265,7 +265,7 @@
}
],
"source": [
"aut = f.translate('det', 'BA'); aut"
"aut = f.translate('det', 'Buchi', 'SBAcc'); aut"
]
},
{

View file

@ -1,5 +1,5 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2015 Laboratoire de Recherche et Développement
# Copyright (C) 2015, 2020 Laboratoire de Recherche et Développement
# de l'Epita
#
# This file is part of Spot, a model checking library.
@ -20,7 +20,7 @@
import spot
aut = spot.translate('GFa & GFb', 'BA')
aut = spot.translate('GFa & GFb', 'Buchi', 'SBAcc')
assert aut.num_sets() == 1
assert aut.num_states() == 3
assert aut.is_deterministic()

View file

@ -1,5 +1,5 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2017, 2018 Laboratoire de Recherche et Développement
# Copyright (C) 2017, 2018, 2020 Laboratoire de Recherche et Développement
# de l'Epita
#
# This file is part of Spot, a model checking library.
@ -31,7 +31,7 @@ b | (a & XF(b R a)) | (!a & XG(!b U !a))"""
def test_phi(phi):
a = spot.translate(phi, 'TGBA', 'SBAcc')
a = spot.translate(phi, 'GeneralizedBuchi', 'SBAcc')
res = spot.to_weak_alternating(spot.dualize(a))
assert res.equivalent_to(spot.formula.Not(spot.formula(phi)))