Fixes #260. Reported by František Blahoudek. The simplification F(f)|q = F(f|q), where q designates an event_univ formula, was not always applied because of a couple of issue: (1) the mospliter was ignoring event_univ unless favor_event_univ was set, (2) when processing formulas from res_EventUniv they were not put back into res_F or res_G to be subject to the F/G rules. * spot/tl/simplify.cc: Improve handling of the above points. * tests/core/reduccmp.test: Adjust and add test case. * tests/core/ltl2tgba2.test, tests/python/atva16-fig2a.ipynb: Adjust.
244 lines
12 KiB
Text
244 lines
12 KiB
Text
{
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.5.3"
|
|
},
|
|
"name": ""
|
|
},
|
|
"nbformat": 3,
|
|
"nbformat_minor": 0,
|
|
"worksheets": [
|
|
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"This example is the left part of Fig.2 in our ATVA'16 paper titled \"*Spot 2.0 \u2014 a framework for LTL and \u03c9-automata manipulation*\"."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": true,
|
|
"input": [
|
|
"import spot\n",
|
|
"spot.setup(show_default='.abr')"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"prompt_number": 1
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.formula('GFa <-> GFb'); f"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"latex": [
|
|
"$\\mathsf{G} \\mathsf{F} a \\leftrightarrow \\mathsf{G} \\mathsf{F} b$"
|
|
],
|
|
"metadata": {},
|
|
"output_type": "pyout",
|
|
"prompt_number": 2,
|
|
"text": [
|
|
"GFa <-> GFb"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 2
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f.translate()"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"metadata": {},
|
|
"output_type": "pyout",
|
|
"prompt_number": 3,
|
|
"svg": [
|
|
"<?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=\"198pt\" height=\"342pt\"\n",
|
|
" viewBox=\"0.00 0.00 197.50 342.00\" 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 338)\">\n",
|
|
"<title>G</title>\n",
|
|
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-338 193.5,-338 193.5,4 -4,4\"/>\n",
|
|
"<text text-anchor=\"start\" x=\"47.75\" y=\"-319.8\" font-family=\"Lato\" font-size=\"14.00\">Inf(</text>\n",
|
|
"<text text-anchor=\"start\" x=\"69.75\" y=\"-319.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#5da5da\">\u24ff</text>\n",
|
|
"<text text-anchor=\"start\" x=\"85.75\" y=\"-319.8\" font-family=\"Lato\" font-size=\"14.00\">)&Inf(</text>\n",
|
|
"<text text-anchor=\"start\" x=\"121.75\" y=\"-319.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#f17cb0\">\u2776</text>\n",
|
|
"<text text-anchor=\"start\" x=\"137.75\" y=\"-319.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
|
|
"<!-- I -->\n",
|
|
"<!-- 1 -->\n",
|
|
"<g id=\"node2\" class=\"node\"><title>1</title>\n",
|
|
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-156\" rx=\"18\" ry=\"18\"/>\n",
|
|
"<text text-anchor=\"middle\" x=\"56\" y=\"-152.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
|
|
"</g>\n",
|
|
"<!-- I->1 -->\n",
|
|
"<g id=\"edge1\" class=\"edge\"><title>I->1</title>\n",
|
|
"<path fill=\"none\" stroke=\"black\" d=\"M1.15491,-156C2.79388,-156 17.1543,-156 30.6317,-156\"/>\n",
|
|
"<polygon fill=\"black\" stroke=\"black\" points=\"37.9419,-156 30.9419,-159.15 34.4419,-156 30.9419,-156 30.9419,-156 30.9419,-156 34.4419,-156 30.9418,-152.85 37.9419,-156 37.9419,-156\"/>\n",
|
|
"</g>\n",
|
|
"<!-- 1->1 -->\n",
|
|
"<g id=\"edge4\" class=\"edge\"><title>1->1</title>\n",
|
|
"<path fill=\"none\" stroke=\"black\" d=\"M49.6208,-173.037C48.3189,-182.858 50.4453,-192 56,-192 60.166,-192 62.4036,-186.858 62.7128,-180.143\"/>\n",
|
|
"<polygon fill=\"black\" stroke=\"black\" points=\"62.3792,-173.037 65.8541,-179.882 62.5434,-176.533 62.7076,-180.03 62.7076,-180.03 62.7076,-180.03 62.5434,-176.533 59.561,-180.177 62.3792,-173.037 62.3792,-173.037\"/>\n",
|
|
"<text text-anchor=\"middle\" x=\"56\" y=\"-195.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
|
|
"</g>\n",
|
|
"<!-- 0 -->\n",
|
|
"<g id=\"node3\" class=\"node\"><title>0</title>\n",
|
|
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"169\" cy=\"-247\" rx=\"18\" ry=\"18\"/>\n",
|
|
"<text text-anchor=\"middle\" x=\"169\" y=\"-243.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
|
|
"</g>\n",
|
|
"<!-- 1->0 -->\n",
|
|
"<g id=\"edge3\" class=\"edge\"><title>1->0</title>\n",
|
|
"<path fill=\"none\" stroke=\"black\" d=\"M70.6108,-167.158C90.2734,-183.278 126.706,-213.147 149.007,-231.429\"/>\n",
|
|
"<polygon fill=\"black\" stroke=\"black\" points=\"154.625,-236.035 147.214,-234.033 151.918,-233.816 149.211,-231.597 149.211,-231.597 149.211,-231.597 151.918,-233.816 151.208,-229.161 154.625,-236.035 154.625,-236.035\"/>\n",
|
|
"<text text-anchor=\"start\" x=\"92\" y=\"-220.8\" font-family=\"Lato\" font-size=\"14.00\">!a & !b</text>\n",
|
|
"</g>\n",
|
|
"<!-- 2 -->\n",
|
|
"<g id=\"node4\" class=\"node\"><title>2</title>\n",
|
|
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"169\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
|
|
"<text text-anchor=\"middle\" x=\"169\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
|
|
"</g>\n",
|
|
"<!-- 1->2 -->\n",
|
|
"<g id=\"edge5\" class=\"edge\"><title>1->2</title>\n",
|
|
"<path fill=\"none\" stroke=\"black\" d=\"M68.0489,-142.264C87.9125,-117.568 129.699,-65.6173 152.446,-37.3378\"/>\n",
|
|
"<polygon fill=\"black\" stroke=\"black\" points=\"156.996,-31.6809 155.063,-39.1098 154.802,-34.4082 152.608,-37.1354 152.608,-37.1354 152.608,-37.1354 154.802,-34.4082 150.154,-35.1611 156.996,-31.6809 156.996,-31.6809\"/>\n",
|
|
"<text text-anchor=\"start\" x=\"99\" y=\"-114.8\" font-family=\"Lato\" font-size=\"14.00\">a | b</text>\n",
|
|
"</g>\n",
|
|
"<!-- 0->0 -->\n",
|
|
"<g id=\"edge2\" class=\"edge\"><title>0->0</title>\n",
|
|
"<path fill=\"none\" stroke=\"black\" d=\"M159.425,-262.541C156.73,-272.909 159.922,-283 169,-283 175.95,-283 179.45,-277.085 179.499,-269.659\"/>\n",
|
|
"<polygon fill=\"black\" stroke=\"black\" points=\"178.575,-262.541 182.6,-269.077 179.026,-266.012 179.477,-269.483 179.477,-269.483 179.477,-269.483 179.026,-266.012 176.353,-269.889 178.575,-262.541 178.575,-262.541\"/>\n",
|
|
"<text text-anchor=\"start\" x=\"148.5\" y=\"-300.8\" font-family=\"Lato\" font-size=\"14.00\">!a & !b</text>\n",
|
|
"<text text-anchor=\"start\" x=\"153\" y=\"-286.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#5da5da\">\u24ff</text>\n",
|
|
"<text text-anchor=\"start\" x=\"169\" y=\"-286.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#f17cb0\">\u2776</text>\n",
|
|
"</g>\n",
|
|
"<!-- 2->2 -->\n",
|
|
"<g id=\"edge6\" class=\"edge\"><title>2->2</title>\n",
|
|
"<path fill=\"none\" stroke=\"black\" d=\"M166.467,-36.1527C166.078,-45.5391 166.922,-54 169,-54 170.526,-54 171.387,-49.437 171.582,-43.2953\"/>\n",
|
|
"<polygon fill=\"black\" stroke=\"black\" points=\"171.533,-36.1527 174.731,-43.1307 171.557,-39.6526 171.581,-43.1525 171.581,-43.1525 171.581,-43.1525 171.557,-39.6526 168.431,-43.1743 171.533,-36.1527 171.533,-36.1527\"/>\n",
|
|
"<text text-anchor=\"start\" x=\"150.5\" y=\"-72.8\" font-family=\"Lato\" font-size=\"14.00\">!a & b</text>\n",
|
|
"<text text-anchor=\"start\" x=\"161\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#f17cb0\">\u2776</text>\n",
|
|
"</g>\n",
|
|
"<!-- 2->2 -->\n",
|
|
"<g id=\"edge7\" class=\"edge\"><title>2->2</title>\n",
|
|
"<path fill=\"none\" stroke=\"black\" d=\"M165.104,-35.5771C162.424,-56.718 163.723,-84 169,-84 173.7,-84 175.244,-62.3596 173.633,-42.6907\"/>\n",
|
|
"<polygon fill=\"black\" stroke=\"black\" points=\"172.896,-35.5771 176.75,-42.2155 173.257,-39.0585 173.617,-42.5399 173.617,-42.5399 173.617,-42.5399 173.257,-39.0585 170.484,-42.8644 172.896,-35.5771 172.896,-35.5771\"/>\n",
|
|
"<text text-anchor=\"start\" x=\"148.5\" y=\"-87.8\" font-family=\"Lato\" font-size=\"14.00\">!a & !b</text>\n",
|
|
"</g>\n",
|
|
"<!-- 2->2 -->\n",
|
|
"<g id=\"edge8\" class=\"edge\"><title>2->2</title>\n",
|
|
"<path fill=\"none\" stroke=\"black\" d=\"M164.049,-35.4671C158.901,-63.1487 160.551,-102 169,-102 176.756,-102 178.783,-69.2613 175.081,-42.4773\"/>\n",
|
|
"<polygon fill=\"black\" stroke=\"black\" points=\"173.951,-35.4671 178.174,-41.8767 174.508,-38.9225 175.065,-42.3779 175.065,-42.3779 175.065,-42.3779 174.508,-38.9225 171.955,-42.8792 173.951,-35.4671 173.951,-35.4671\"/>\n",
|
|
"<text text-anchor=\"start\" x=\"152\" y=\"-119.8\" font-family=\"Lato\" font-size=\"14.00\">a & b</text>\n",
|
|
"<text text-anchor=\"start\" x=\"153\" y=\"-105.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#5da5da\">\u24ff</text>\n",
|
|
"<text text-anchor=\"start\" x=\"169\" y=\"-105.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#f17cb0\">\u2776</text>\n",
|
|
"</g>\n",
|
|
"<!-- 2->2 -->\n",
|
|
"<g id=\"edge9\" class=\"edge\"><title>2->2</title>\n",
|
|
"<path fill=\"none\" stroke=\"black\" d=\"M163.463,-35.3599C155.342,-71.623 157.188,-130 169,-130 180.074,-130 182.389,-78.6921 175.943,-42.3988\"/>\n",
|
|
"<polygon fill=\"black\" stroke=\"black\" points=\"174.537,-35.3599 178.997,-41.6073 175.223,-38.7921 175.908,-42.2243 175.908,-42.2243 175.908,-42.2243 175.223,-38.7921 172.819,-42.8414 174.537,-35.3599 174.537,-35.3599\"/>\n",
|
|
"<text text-anchor=\"start\" x=\"150.5\" y=\"-148.8\" font-family=\"Lato\" font-size=\"14.00\">a & !b</text>\n",
|
|
"<text text-anchor=\"start\" x=\"161\" y=\"-133.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#5da5da\">\u24ff</text>\n",
|
|
"</g>\n",
|
|
"</g>\n",
|
|
"</svg>\n"
|
|
],
|
|
"text": [
|
|
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79506d2900> >"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 3
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": true,
|
|
"input": [
|
|
"def implies(f, g):\n",
|
|
" f = spot.formula(f)\n",
|
|
" g = spot.formula_Not(spot.formula(g))\n",
|
|
" return spot.product(f.translate(), g.translate()).is_empty()\n",
|
|
"def equiv(f, g):\n",
|
|
" return implies(f, g) and implies(g, f)"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"prompt_number": 4
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"equiv('a U (b U a)', 'b U a')"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"metadata": {},
|
|
"output_type": "pyout",
|
|
"prompt_number": 5,
|
|
"text": [
|
|
"True"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 5
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"equiv('!(a U b)', '!a U !b')"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"metadata": {},
|
|
"output_type": "pyout",
|
|
"prompt_number": 6,
|
|
"text": [
|
|
"False"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 6
|
|
}
|
|
],
|
|
"metadata": {}
|
|
}
|
|
]
|
|
}
|