translate: add a quick syntactic simplification before relabeling

This fixes #412.

* spot/twaalgos/translate.cc: Add the quick syntactic simplification.
* spot/twaalgos/relabel.cc: Do not register old unused APs.
* tests/core/ltl2tgba2.test: Add test case.
* tests/core/bdd.test, tests/python/automata.ipynb: Adjust.
* NEWS: Mention this.
This commit is contained in:
Alexandre Duret-Lutz 2020-07-22 16:31:53 +02:00
parent 1c5468a93a
commit b17376879d
6 changed files with 108 additions and 70 deletions

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 0x7f9f5d7cbd50> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382c04b0> >"
]
},
"execution_count": 2,
@ -657,7 +657,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7cf480> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382c09f0> >"
]
},
"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 0x7f9f5d7cfc00> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382c00f0> >"
]
},
"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 0x7f9f5d7cf3f0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382c0c00> >"
]
},
"execution_count": 8,
@ -1026,30 +1026,30 @@
"<!-- 1 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"471.88\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"471.88\" cy=\"-22\" rx=\"22\" ry=\"22\"/>\n",
"<text text-anchor=\"middle\" x=\"471.88\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"321.88\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"321.88\" cy=\"-22\" rx=\"22\" ry=\"22\"/>\n",
"<text text-anchor=\"middle\" x=\"321.88\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;1 -->\n",
"<g id=\"edge15\" class=\"edge\">\n",
"<title>6&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M306.14,-211.9C353.18,-212.4 462.08,-205.94 506.88,-139 526.19,-110.15 506.06,-70.3 489.32,-45.61\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"485.16,-39.68 491.76,-43.6 487.17,-42.54 489.18,-45.41 489.18,-45.41 489.18,-45.41 487.17,-42.54 486.6,-47.22 485.16,-39.68 485.16,-39.68\"/>\n",
"<text text-anchor=\"start\" x=\"513.88\" y=\"-113.3\" font-family=\"Lato\" font-size=\"14.00\">a &amp; !b &amp; !c</text>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M296.7,-193.99C300.98,-187.44 305.31,-179.69 307.88,-172 321.33,-131.79 323.32,-82.31 323,-51.71\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"322.87,-44.35 326.14,-51.3 322.93,-47.85 322.99,-51.35 322.99,-51.35 322.99,-51.35 322.93,-47.85 319.84,-51.4 322.87,-44.35 322.87,-44.35\"/>\n",
"<text text-anchor=\"start\" x=\"320.88\" y=\"-113.3\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; b &amp; !c</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>2</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"321.88\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"321.88\" cy=\"-22\" rx=\"22\" ry=\"22\"/>\n",
"<text text-anchor=\"middle\" x=\"321.88\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"471.88\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"471.88\" cy=\"-22\" rx=\"22\" ry=\"22\"/>\n",
"<text text-anchor=\"middle\" x=\"471.88\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;2 -->\n",
"<g id=\"edge16\" class=\"edge\">\n",
"<title>6&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M296.7,-193.99C300.98,-187.44 305.31,-179.69 307.88,-172 321.33,-131.79 323.32,-82.31 323,-51.71\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"322.87,-44.35 326.14,-51.3 322.93,-47.85 322.99,-51.35 322.99,-51.35 322.99,-51.35 322.93,-47.85 319.84,-51.4 322.87,-44.35 322.87,-44.35\"/>\n",
"<text text-anchor=\"start\" x=\"320.88\" y=\"-113.3\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; b &amp; !c</text>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M306.14,-211.9C353.18,-212.4 462.08,-205.94 506.88,-139 526.19,-110.15 506.06,-70.3 489.32,-45.61\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"485.16,-39.68 491.76,-43.6 487.17,-42.54 489.18,-45.41 489.18,-45.41 489.18,-45.41 487.17,-42.54 486.6,-47.22 485.16,-39.68 485.16,-39.68\"/>\n",
"<text text-anchor=\"start\" x=\"513.88\" y=\"-113.3\" font-family=\"Lato\" font-size=\"14.00\">a &amp; !b &amp; !c</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node6\" class=\"node\">\n",
@ -1103,16 +1103,16 @@
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M492.46,-30.37C502.73,-31.53 511.88,-28.74 511.88,-22 511.88,-16.95 506.73,-14.11 499.83,-13.5\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"492.46,-13.63 499.41,-10.36 495.96,-13.57 499.46,-13.51 499.46,-13.51 499.46,-13.51 495.96,-13.57 499.52,-16.66 492.46,-13.63 492.46,-13.63\"/>\n",
"<text text-anchor=\"start\" x=\"511.88\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M342.46,-30.37C352.73,-31.53 361.88,-28.74 361.88,-22 361.88,-16.95 356.73,-14.11 349.83,-13.5\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"342.46,-13.63 349.41,-10.36 345.96,-13.57 349.46,-13.51 349.46,-13.51 349.46,-13.51 345.96,-13.57 349.52,-16.66 342.46,-13.63 342.46,-13.63\"/>\n",
"<text text-anchor=\"start\" x=\"361.88\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M342.46,-30.37C352.73,-31.53 361.88,-28.74 361.88,-22 361.88,-16.95 356.73,-14.11 349.83,-13.5\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"342.46,-13.63 349.41,-10.36 345.96,-13.57 349.46,-13.51 349.46,-13.51 349.46,-13.51 345.96,-13.57 349.52,-16.66 342.46,-13.63 342.46,-13.63\"/>\n",
"<text text-anchor=\"start\" x=\"361.88\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M492.46,-30.37C502.73,-31.53 511.88,-28.74 511.88,-22 511.88,-16.95 506.73,-14.11 499.83,-13.5\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"492.46,-13.63 499.41,-10.36 495.96,-13.57 499.46,-13.51 499.46,-13.51 499.46,-13.51 495.96,-13.57 499.52,-16.66 492.46,-13.63 492.46,-13.63\"/>\n",
"<text text-anchor=\"start\" x=\"511.88\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;0 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
@ -1121,9 +1121,9 @@
"<polygon fill=\"black\" stroke=\"black\" points=\"96.74,-44.05 99.97,-51.02 96.78,-47.55 96.82,-51.05 96.82,-51.05 96.82,-51.05 96.78,-47.55 93.67,-51.09 96.74,-44.05 96.74,-44.05\"/>\n",
"<text text-anchor=\"start\" x=\"97.88\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">!b &amp; c</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<!-- 3&#45;&gt;1 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>3&#45;&gt;2</title>\n",
"<title>3&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M116.32,-99.46C128.01,-85.47 144.37,-66.93 152.88,-62 197.27,-36.27 257.43,-27.51 292.71,-24.54\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"299.85,-23.98 293.11,-27.66 296.36,-24.25 292.87,-24.52 292.87,-24.52 292.87,-24.52 296.36,-24.25 292.63,-21.38 299.85,-23.98 299.85,-23.98\"/>\n",
"<text text-anchor=\"start\" x=\"152.88\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">b &amp; !c</text>\n",
@ -1142,9 +1142,9 @@
"<polygon fill=\"black\" stroke=\"black\" points=\"118.67,-26.76 126.21,-25.3 122.07,-27.56 125.48,-28.37 125.48,-28.37 125.48,-28.37 122.07,-27.56 124.76,-31.43 118.67,-26.76 118.67,-26.76\"/>\n",
"<text text-anchor=\"start\" x=\"202.88\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; c</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;1 -->\n",
"<!-- 4&#45;&gt;2 -->\n",
"<g id=\"edge9\" class=\"edge\">\n",
"<title>4&#45;&gt;1</title>\n",
"<title>4&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M235.16,-107.56C261.77,-96.58 310.02,-77.04 351.88,-62 383.22,-50.74 419.65,-39.11 444.07,-31.51\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"450.94,-29.38 445.19,-34.46 447.6,-30.42 444.25,-31.45 444.25,-31.45 444.25,-31.45 447.6,-30.42 443.32,-28.44 450.94,-29.38 450.94,-29.38\"/>\n",
"<text text-anchor=\"start\" x=\"351.88\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; !c</text>\n",
@ -1159,16 +1159,16 @@
"<!-- 5&#45;&gt;1 -->\n",
"<g id=\"edge11\" class=\"edge\">\n",
"<title>5&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M437.75,-98.1C441.84,-91.59 446.29,-84.09 449.88,-77 454.33,-68.22 458.58,-58.32 462.13,-49.42\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"464.7,-42.84 465.09,-50.51 463.43,-46.1 462.15,-49.36 462.15,-49.36 462.15,-49.36 463.43,-46.1 459.22,-48.21 464.7,-42.84 464.7,-42.84\"/>\n",
"<text text-anchor=\"start\" x=\"455.88\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; !b</text>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M416.48,-96.87C410.32,-85.72 401.46,-71.95 390.88,-62 378.57,-50.41 362.18,-40.96 348.46,-34.27\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"341.97,-31.21 349.65,-31.34 345.14,-32.7 348.3,-34.19 348.3,-34.19 348.3,-34.19 345.14,-32.7 346.96,-37.04 341.97,-31.21 341.97,-31.21\"/>\n",
"<text text-anchor=\"start\" x=\"402.88\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; b</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;2 -->\n",
"<g id=\"edge12\" class=\"edge\">\n",
"<title>5&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M416.48,-96.87C410.32,-85.72 401.46,-71.95 390.88,-62 378.57,-50.41 362.18,-40.96 348.46,-34.27\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"341.97,-31.21 349.65,-31.34 345.14,-32.7 348.3,-34.19 348.3,-34.19 348.3,-34.19 345.14,-32.7 346.96,-37.04 341.97,-31.21 341.97,-31.21\"/>\n",
"<text text-anchor=\"start\" x=\"402.88\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; b</text>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M437.75,-98.1C441.84,-91.59 446.29,-84.09 449.88,-77 454.33,-68.22 458.58,-58.32 462.13,-49.42\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"464.7,-42.84 465.09,-50.51 463.43,-46.1 462.15,-49.36 462.15,-49.36 462.15,-49.36 463.43,-46.1 459.22,-48.21 464.7,-42.84 464.7,-42.84\"/>\n",
"<text text-anchor=\"start\" x=\"455.88\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;5 -->\n",
"<g id=\"edge13\" class=\"edge\">\n",
@ -1349,7 +1349,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7d4930> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382c05a0> >"
]
},
"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 0x7f9f5d7d4cc0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382c0ab0> >"
]
},
"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 0x7f9f5d7d4990> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382df240> >"
]
},
"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 0x7f9f5d7d4b70> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfc90> >"
]
},
"metadata": {},
@ -2012,7 +2012,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7d4e40> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfc30> >"
]
},
"metadata": {},
@ -2191,7 +2191,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7d4c00> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfed0> >"
]
},
"metadata": {},
@ -2339,7 +2339,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f658bbc90> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfa80> >"
]
},
"metadata": {},
@ -2528,7 +2528,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7d4c00> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382df1b0> >"
]
},
"execution_count": 19,
@ -2604,7 +2604,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7e2f90> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfae0> >"
]
},
"execution_count": 20,
@ -3154,7 +3154,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7f18d0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfe10> >"
]
},
"metadata": {},
@ -3254,7 +3254,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7d4b70> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382c0e10> >"
]
},
"execution_count": 24,
@ -3327,7 +3327,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7f1330> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfba0> >"
]
},
"execution_count": 25,
@ -3498,7 +3498,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7f1450> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfc00> >"
]
},
"execution_count": 27,
@ -3581,7 +3581,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7f18d0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfe10> >"
]
},
"metadata": {},
@ -3646,7 +3646,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7f18d0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfe10> >"
]
},
"metadata": {},
@ -3733,7 +3733,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f9f5d7f18d0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f37382dfe10> >"
]
},
"execution_count": 29,
@ -3766,7 +3766,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
"version": "3.8.4"
}
},
"nbformat": 4,