postproc: add support for co-Büchi output

* spot/twaalgos/cobuchi.cc, spot/twaalgos/cobuchi.hh (to_nca): New
function.
(weak_to_cobuchi): New internal function, used in to_nca and to_dca
when appropriate.
* spot/twaalgos/postproc.cc, spot/twaalgos/postproc.hh: Implement
the CoBuchi option.
* python/spot/__init__.py: Support it in Python.
* bin/common_post.cc: Add support for --buchi.
* bin/autfilt.cc: Remove the --dca option.
* tests/core/dca.test, tests/python/automata.ipynb: Adjust and add
more tests.  In particular, add more complex persistence and
recurrence formulas to the list of dca.test.
* tests/python/dca.test: Adjust and rename to...
* tests/core/dca2.test: ... this.  Add more tests, to the point
that this is now failing, as described in issue #317.
* tests/python/dca.py: Remove.
* tests/Makefile.am: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2018-01-12 20:53:53 +01:00
parent 9464043d39
commit 61b0a542f1
14 changed files with 618 additions and 531 deletions

View file

@ -3,9 +3,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import display\n",
@ -23,9 +21,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -149,7 +145,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1043b73f0> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d08673930> >"
]
},
"execution_count": 2,
@ -171,9 +167,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -312,9 +306,7 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -468,9 +460,7 @@
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -493,9 +483,7 @@
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -550,7 +538,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042bc900> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0857cbd0> >"
]
},
"execution_count": 6,
@ -565,9 +553,7 @@
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -622,7 +608,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce7b0> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d08673960> >"
]
},
"execution_count": 7,
@ -644,9 +630,7 @@
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -700,7 +684,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1043b7390> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d08673b40> >"
]
},
"execution_count": 8,
@ -722,9 +706,7 @@
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -747,9 +729,7 @@
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -842,9 +822,7 @@
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -1041,9 +1019,7 @@
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -1168,7 +1144,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce870> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c360> >"
]
},
"execution_count": 12,
@ -1190,9 +1166,7 @@
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -1271,7 +1245,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042bc660> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0857c450> >"
]
},
"execution_count": 13,
@ -1293,9 +1267,7 @@
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -1391,7 +1363,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce6c0> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0857c420> >"
]
},
"execution_count": 14,
@ -1413,9 +1385,7 @@
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -1492,7 +1462,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1043dd600> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0857c480> >"
]
},
"execution_count": 15,
@ -1507,9 +1477,7 @@
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -1964,7 +1932,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce600> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0b183ae0> >"
]
},
"execution_count": 16,
@ -1979,9 +1947,7 @@
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -2008,9 +1974,7 @@
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@ -2047,9 +2011,7 @@
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -2588,7 +2550,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042bc8d0> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c600> >"
]
},
"metadata": {},
@ -2606,9 +2568,7 @@
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!rm example1.aut"
@ -2617,9 +2577,7 @@
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -2749,7 +2707,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce780> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c450> >"
]
},
"execution_count": 21,
@ -2764,9 +2722,7 @@
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -2821,7 +2777,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce8a0> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c390> >"
]
},
"execution_count": 22,
@ -2836,9 +2792,7 @@
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -3204,9 +3158,7 @@
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -3261,7 +3213,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce810> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c1b0> >"
]
},
"metadata": {},
@ -3286,9 +3238,7 @@
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -3372,72 +3322,69 @@
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.38.0 (20140413.2041)\n",
" -->\n",
"<!-- Title: G Pages: 1 -->\n",
"<svg width=\"170pt\" height=\"104pt\"\n",
" viewBox=\"0.00 0.00 170.00 104.47\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 100.465)\">\n",
"<svg height=\"140pt\" viewBox=\"0.00 0.00 170.00 140.47\" width=\"170pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 136.465)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-100.465 166,-100.465 166,4 -4,4\"/>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-136.465 166,-136.465 166,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"29\" y=\"-118.265\">Fin(</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"54\" y=\"-118.265\">⓿</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"70\" y=\"-118.265\">) &amp; Inf(</text>\n",
"<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"113\" y=\"-118.265\">❶</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"129\" y=\"-118.265\">)</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"52\" y=\"-104.265\">[Rabin 1]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\"><title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-30.4654\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-26.7654\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"<g class=\"node\" id=\"node2\"><title>0</title>\n",
"<ellipse cx=\"56\" cy=\"-30.4654\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"56\" y=\"-26.7654\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\"><title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15491,-30.4654C2.79388,-30.4654 17.1543,-30.4654 30.6317,-30.4654\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.9419,-30.4654 30.9419,-33.6155 34.4419,-30.4655 30.9419,-30.4655 30.9419,-30.4655 30.9419,-30.4655 34.4419,-30.4655 30.9418,-27.3155 37.9419,-30.4654 37.9419,-30.4654\"/>\n",
"<g class=\"edge\" id=\"edge1\"><title>I-&gt;0</title>\n",
"<path d=\"M1.15491,-30.4654C2.79388,-30.4654 17.1543,-30.4654 30.6317,-30.4654\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"37.9419,-30.4654 30.9419,-33.6155 34.4419,-30.4655 30.9419,-30.4655 30.9419,-30.4655 30.9419,-30.4655 34.4419,-30.4655 30.9418,-27.3155 37.9419,-30.4654 37.9419,-30.4654\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\"><title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M49.6208,-47.5027C48.3189,-57.3234 50.4453,-66.4654 56,-66.4654 60.166,-66.4654 62.4036,-61.323 62.7128,-54.6087\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"62.3792,-47.5027 65.8541,-54.3473 62.5434,-50.9989 62.7076,-54.495 62.7076,-54.495 62.7076,-54.495 62.5434,-50.9989 59.561,-54.6428 62.3792,-47.5027 62.3792,-47.5027\"/>\n",
"<text text-anchor=\"start\" x=\"50.5\" y=\"-70.2654\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"<g class=\"edge\" id=\"edge2\"><title>0-&gt;0</title>\n",
"<path d=\"M49.6208,-47.5027C48.3189,-57.3234 50.4453,-66.4654 56,-66.4654 60.166,-66.4654 62.4036,-61.323 62.7128,-54.6087\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"62.3792,-47.5027 65.8541,-54.3473 62.5434,-50.9989 62.7076,-54.495 62.7076,-54.495 62.7076,-54.495 62.5434,-50.9989 59.561,-54.6428 62.3792,-47.5027 62.3792,-47.5027\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"50.5\" y=\"-70.2654\">!a</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\"><title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"144\" cy=\"-30.4654\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"144\" y=\"-26.7654\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"<g class=\"node\" id=\"node3\"><title>1</title>\n",
"<ellipse cx=\"144\" cy=\"-30.4654\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"144\" y=\"-26.7654\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge3\" class=\"edge\"><title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M74.0378,-33.3939C79.731,-34.2402 86.1223,-35.0477 92,-35.4654 99.0932,-35.9695 100.907,-35.9695 108,-35.4654 111.49,-35.2174 115.161,-34.832 118.759,-34.3826\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"125.962,-33.3939 119.456,-37.4666 122.495,-33.8699 119.027,-34.3459 119.027,-34.3459 119.027,-34.3459 122.495,-33.8699 118.599,-31.2251 125.962,-33.3939 125.962,-33.3939\"/>\n",
"<text text-anchor=\"start\" x=\"96.5\" y=\"-54.2654\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-39.2654\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"<g class=\"edge\" id=\"edge3\"><title>0-&gt;1</title>\n",
"<path d=\"M74.0378,-33.3939C79.731,-34.2402 86.1223,-35.0477 92,-35.4654 99.0932,-35.9695 100.907,-35.9695 108,-35.4654 111.49,-35.2174 115.161,-34.832 118.759,-34.3826\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"125.962,-33.3939 119.456,-37.4666 122.495,-33.8699 119.027,-34.3459 119.027,-34.3459 119.027,-34.3459 122.495,-33.8699 118.599,-31.2251 125.962,-33.3939 125.962,-33.3939\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"96.5\" y=\"-54.2654\">a</text>\n",
"<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"92\" y=\"-39.2654\">❶</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge4\" class=\"edge\"><title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M131.404,-17.3266C125.156,-11.2493 116.908,-4.67653 108,-1.46544 95.985,2.86544 83.5046,-4.00369 73.8973,-12.1402\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"68.5978,-17.0022 71.6264,-9.94872 71.1769,-14.636 73.7559,-12.2699 73.7559,-12.2699 73.7559,-12.2699 71.1769,-14.636 75.8855,-14.591 68.5978,-17.0022 68.5978,-17.0022\"/>\n",
"<text text-anchor=\"start\" x=\"94.5\" y=\"-20.2654\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-5.26544\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<g class=\"edge\" id=\"edge4\"><title>1-&gt;0</title>\n",
"<path d=\"M131.404,-17.3266C125.156,-11.2493 116.908,-4.67653 108,-1.46544 95.985,2.86544 83.5046,-4.00369 73.8973,-12.1402\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"68.5978,-17.0022 71.6264,-9.94872 71.1769,-14.636 73.7559,-12.2699 73.7559,-12.2699 73.7559,-12.2699 71.1769,-14.636 75.8855,-14.591 68.5978,-17.0022 68.5978,-17.0022\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"94.5\" y=\"-20.2654\">!a</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"92\" y=\"-5.26544\">⓿</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge5\" class=\"edge\"><title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M136.332,-46.7557C134.483,-56.8546 137.039,-66.4654 144,-66.4654 149.221,-66.4654 151.964,-61.0593 152.229,-54.0958\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"151.668,-46.7557 155.342,-53.4954 151.935,-50.2455 152.201,-53.7354 152.201,-53.7354 152.201,-53.7354 151.935,-50.2455 149.06,-53.9754 151.668,-46.7557 151.668,-46.7557\"/>\n",
"<text text-anchor=\"start\" x=\"140.5\" y=\"-85.2654\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"136\" y=\"-70.2654\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"<g class=\"edge\" id=\"edge5\"><title>1-&gt;1</title>\n",
"<path d=\"M136.332,-46.7557C134.483,-56.8546 137.039,-66.4654 144,-66.4654 149.221,-66.4654 151.964,-61.0593 152.229,-54.0958\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"151.668,-46.7557 155.342,-53.4954 151.935,-50.2455 152.201,-53.7354 152.201,-53.7354 152.201,-53.7354 151.935,-50.2455 149.06,-53.9754 151.668,-46.7557 151.668,-46.7557\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"140.5\" y=\"-85.2654\">a</text>\n",
"<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"136\" y=\"-70.2654\">❶</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
"</svg>"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce7e0> >"
"<IPython.core.display.SVG object>"
]
},
"execution_count": 26,
@ -3446,7 +3393,155 @@
}
],
"source": [
"aut = spot.translate('FGa', 'generic', 'deterministic'); aut"
"aut = spot.translate('FGa', 'generic', 'deterministic'); aut.show('.ba')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Translation to co-Büchi automaton"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"131pt\" viewBox=\"0.00 0.00 178.74 130.74\" width=\"179pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 126.74)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-126.74 174.74,-126.74 174.74,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"62.8701\" y=\"-108.54\">Fin(</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"87.8701\" y=\"-108.54\">⓿</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"103.87\" y=\"-108.54\">)</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"52.8701\" y=\"-94.5401\">[co-Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g class=\"node\" id=\"node2\"><title>0</title>\n",
"<ellipse cx=\"64.8701\" cy=\"-26.8701\" fill=\"#ffffaa\" rx=\"26.7407\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"60.3701\" y=\"-30.6701\">0</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"56.8701\" y=\"-15.6701\">⓿</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>I-&gt;0</title>\n",
"<path d=\"M1.04557,-26.8701C1.94668,-26.8701 16.0699,-26.8701 30.6965,-26.8701\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"37.8616,-26.8701 30.8617,-30.0202 34.3616,-26.8701 30.8616,-26.8702 30.8616,-26.8702 30.8616,-26.8702 34.3616,-26.8701 30.8616,-23.7202 37.8616,-26.8701 37.8616,-26.8701\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>0-&gt;0</title>\n",
"<path d=\"M56.6704,-52.6914C56.2072,-63.0476 58.9404,-71.7401 64.8701,-71.7401 69.3173,-71.7401 71.9666,-66.8506 72.8178,-60.0368\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"73.0697,-52.6914 75.9779,-59.7953 72.9497,-56.1893 72.8297,-59.6873 72.8297,-59.6873 72.8297,-59.6873 72.9497,-56.1893 69.6816,-59.5793 73.0697,-52.6914 73.0697,-52.6914\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"60.3701\" y=\"-75.5401\">1</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node3\"><title>1</title>\n",
"<ellipse cx=\"152.74\" cy=\"-26.8701\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"148.24\" y=\"-23.1701\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>0-&gt;1</title>\n",
"<path d=\"M92.1005,-26.8701C103.321,-26.8701 116.345,-26.8701 127.355,-26.8701\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"134.608,-26.8701 127.608,-30.0202 131.108,-26.8701 127.608,-26.8702 127.608,-26.8702 127.608,-26.8702 131.108,-26.8701 127.608,-23.7202 134.608,-26.8701 134.608,-26.8701\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"109.74\" y=\"-30.6701\">a</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>1-&gt;1</title>\n",
"<path d=\"M146.007,-43.9074C144.632,-53.728 146.877,-62.8701 152.74,-62.8701 157.138,-62.8701 159.499,-57.7276 159.826,-51.0134\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"159.474,-43.9074 162.966,-50.7428 159.647,-47.4031 159.82,-50.8988 159.82,-50.8988 159.82,-50.8988 159.647,-47.4031 156.674,-51.0547 159.474,-43.9074 159.474,-43.9074\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"149.24\" y=\"-66.6701\">a</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.translate('FGa', 'coBuchi').show('.ba')"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"131pt\" viewBox=\"0.00 0.00 170.00 130.75\" width=\"170pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 126.75)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-126.75 166,-126.75 166,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"58.5\" y=\"-108.55\">Fin(</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"83.5\" y=\"-108.55\">⓿</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"99.5\" y=\"-108.55\">)</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"48.5\" y=\"-94.5502\">[co-Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g class=\"node\" id=\"node2\"><title>0</title>\n",
"<ellipse cx=\"56\" cy=\"-20.7502\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"56\" y=\"-17.0502\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>I-&gt;0</title>\n",
"<path d=\"M1.15491,-20.7502C2.79388,-20.7502 17.1543,-20.7502 30.6317,-20.7502\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"37.9419,-20.7502 30.9419,-23.9003 34.4419,-20.7502 30.9419,-20.7503 30.9419,-20.7503 30.9419,-20.7503 34.4419,-20.7502 30.9418,-17.6003 37.9419,-20.7502 37.9419,-20.7502\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>0-&gt;0</title>\n",
"<path d=\"M49.6208,-37.7875C48.3189,-47.6081 50.4453,-56.7502 56,-56.7502 60.166,-56.7502 62.4036,-51.6077 62.7128,-44.8935\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"62.3792,-37.7875 65.8541,-44.632 62.5434,-41.2836 62.7076,-44.7798 62.7076,-44.7798 62.7076,-44.7798 62.5434,-41.2836 59.561,-44.9275 62.3792,-37.7875 62.3792,-37.7875\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"50.5\" y=\"-75.5502\">!a</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"48\" y=\"-60.5502\">⓿</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node3\"><title>1</title>\n",
"<ellipse cx=\"144\" cy=\"-20.7502\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"144\" y=\"-17.0502\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>0-&gt;1</title>\n",
"<path d=\"M74.4034,-20.7502C87.1928,-20.7502 104.732,-20.7502 118.874,-20.7502\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"125.916,-20.7502 118.916,-23.9003 122.416,-20.7502 118.916,-20.7503 118.916,-20.7503 118.916,-20.7503 122.416,-20.7502 118.916,-17.6003 125.916,-20.7502 125.916,-20.7502\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"96.5\" y=\"-39.5502\">a</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"92\" y=\"-24.5502\">⓿</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>1-&gt;0</title>\n",
"<path d=\"M128.689,-10.8844C122.598,-7.25669 115.237,-3.58794 108,-1.75016 101.108,-0 98.8924,-0 92,-1.75016 87.1374,-2.98492 82.2193,-5.0462 77.668,-7.36626\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"71.3113,-10.8844 75.9105,-4.73864 74.3736,-9.18956 77.4359,-7.49469 77.4359,-7.49469 77.4359,-7.49469 74.3736,-9.18956 78.9613,-10.2507 71.3113,-10.8844 71.3113,-10.8844\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"94.5\" y=\"-5.55016\">!a</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge5\"><title>1-&gt;1</title>\n",
"<path d=\"M136.332,-37.0404C134.483,-47.1393 137.039,-56.7502 144,-56.7502 149.221,-56.7502 151.964,-51.3441 152.229,-44.3805\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"151.668,-37.0404 155.342,-43.7801 151.935,-40.5303 152.201,-44.0201 152.201,-44.0201 152.201,-44.0201 151.935,-40.5303 149.06,-44.2601 151.668,-37.0404 151.668,-37.0404\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"140.5\" y=\"-60.5502\">a</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.translate('FGa', 'coBuchi', 'deterministic').show('.ba')"
]
},
{
@ -3458,10 +3553,8 @@
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
@ -3524,10 +3617,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce7e0> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c570> >"
]
},
"execution_count": 27,
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
@ -3549,10 +3642,8 @@
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
@ -3615,10 +3706,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb1042ce7e0> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9d0858c570> >"
]
},
"execution_count": 28,
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
@ -3648,7 +3739,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
"version": "3.6.4"
}
},
"nbformat": 4,

View file

@ -1,37 +0,0 @@
#!/usr/bin/python3
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2017 Laboratoire de Recherche et Développement de
# l'EPITA.
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import spot
def gen_streett(formula):
aut = spot.translate(formula, 'BA')
aut.set_acceptance(2, 'Fin(0) | Inf(1)')
for e in aut.edges():
if (e.acc):
e.acc = spot.mark_t([0,1])
else:
e.acc = spot.mark_t([0])
return aut
aut = gen_streett(sys.argv[1])
print(aut.to_str('hoa'))

View file

@ -1,62 +0,0 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Laboratoire de Recherche et
# Développement de l'EPITA.
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -e
# Skip this test if ltl2dstar is not installed.
(ltl2dstar --version) || exit 77
DIR=dca.dir
mkdir -p $DIR
cat >$DIR/ba_formulas << 'EOF'
FG((Xc & XXa) <-> !(b xor (c M b)))
F!FGFb
XF(b & Ga)
FG(F(b R Fc) R Gc)
(!c M F(b M Ga)) W (b U a)
(c xor Gb) M 1
X!Gc M ((Fb R a) M 1)
!a | F(b W 0)
F(!a -> Gb)
(Gb <-> X(b W Xb)) M (b xor !c)
(c R (X!c W Fb)) M 1
!a -> (FX!(0 R F(b | c)) W c)
XF((!c R a) W !Fb)
(!a <-> !(c <-> Gb)) M 1
((0 R a) M c) M ((b xor Fb) M F(b -> a))
EOF
cat >$DIR/dsa_formulas <<'EOF'
(!b U b) U X(!a -> Fb)
1 U (a xor b)
X(!(!b | (a M b)) -> XXa)
!Gb
F(XF!a & (Fb U !a))
EOF
while read ba_f; do
../run "$srcdir/dca.py" "$ba_f" > $DIR/ba
while read dsa_f; do
ltldo -f "$dsa_f" "ltl2dstar --automata=streett\
--ltl2nba=spin:ltl2tgba@-Ds" -H |
autfilt --product=$DIR/ba > $DIR/input.hoa
autfilt --dca $DIR/input.hoa > $DIR/res.hoa
autfilt $DIR/input.hoa --equivalent-to $DIR/res.hoa
done <$DIR/dsa_formulas
done <$DIR/ba_formulas