diff --git a/spot/twaalgos/translate.cc b/spot/twaalgos/translate.cc index 806aa522b..2123e039a 100644 --- a/spot/twaalgos/translate.cc +++ b/spot/twaalgos/translate.cc @@ -186,6 +186,21 @@ namespace spot rest.push_back(child); } + // Safety formulas are quite easy to translate since they do + // not introduce marks. If rest is non-empty, it seems + // preferable to translate the safety inside rest, as this may + // constrain the translation. + if (!rest.empty() && !oblg.empty()) + { + auto safety = [](formula f) + { + return f.is_syntactic_safety(); + }; + auto i = std::remove_if(oblg.begin(), oblg.end(), safety); + rest.insert(rest.end(), i, oblg.end()); + oblg.erase(i, oblg.end()); + } + if (!susp.empty()) { // The only cases where we accept susp and rest to be both diff --git a/tests/core/ltl2tgba2.test b/tests/core/ltl2tgba2.test index 588e7b57e..4e2d48305 100755 --- a/tests/core/ltl2tgba2.test +++ b/tests/core/ltl2tgba2.test @@ -390,3 +390,13 @@ cat >expected <\n" ], "text/plain": [ - " *' at 0x7f7d6b72ef90> >" + " *' at 0x7f6a44f3f090> >" ] }, "execution_count": 4, @@ -352,7 +352,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654870> >" + " *' at 0x7f6a44edacc0> >" ] }, "execution_count": 5, @@ -462,7 +462,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b72ef90> >" + " *' at 0x7f6a44f3f090> >" ] }, "execution_count": 6, @@ -695,7 +695,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b6542a0> >" + " *' at 0x7f6a44eec0c0> >" ] }, "execution_count": 8, @@ -892,7 +892,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b6542a0> >" + " *' at 0x7f6a44eec0c0> >" ] }, "execution_count": 11, @@ -977,7 +977,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654ab0> >" + " *' at 0x7f6a44e7cb70> >" ] }, "metadata": {}, @@ -1032,7 +1032,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654960> >" + " *' at 0x7f6a44e7c8a0> >" ] }, "metadata": {}, @@ -1126,7 +1126,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654990> >" + " *' at 0x7f6a44e7c960> >" ] }, "execution_count": 13, @@ -1257,7 +1257,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654990> >" + " *' at 0x7f6a44e7c960> >" ] }, "metadata": {}, @@ -1322,7 +1322,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654ab0> >" + " *' at 0x7f6a44e7cb70> >" ] }, "metadata": {}, @@ -1377,7 +1377,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654960> >" + " *' at 0x7f6a44e7c8a0> >" ] }, "metadata": {}, @@ -1609,7 +1609,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654930> >" + " *' at 0x7f6a44e7cf00> >" ] }, "metadata": {}, @@ -1694,7 +1694,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654ba0> >" + " *' at 0x7f6a44e7cf60> >" ] }, "metadata": {}, @@ -1791,7 +1791,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654a80> >" + " *' at 0x7f6a44e7cdb0> >" ] }, "metadata": {}, @@ -1959,7 +1959,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654d20> >" + " *' at 0x7f6a44e7cea0> >" ] }, "execution_count": 18, @@ -2127,7 +2127,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654d20> >" + " *' at 0x7f6a44e7cea0> >" ] }, "execution_count": 19, @@ -2290,7 +2290,7 @@ "\n" ], "text/plain": [ - " *' at 0x7f7d6b654d20> >" + " *' at 0x7f6a44e7cea0> >" ] }, "metadata": {}, @@ -2504,295 +2504,231 @@ { "data": { "image/svg+xml": [ - "\n", - "\n", - "\n", - "Inf(\n", - "\n", - ")\n", - "[Büchi]\n", + "\n", + "\n", + "\n", + "Inf(\n", + "\n", + ")\n", + "[Büchi]\n", "\n", "cluster_0\n", - "\n", + "\n", "\n", "\n", "cluster_1\n", - "\n", + "\n", "\n", "\n", "cluster_2\n", - "\n", + "\n", "\n", "\n", "cluster_3\n", - "\n", + "\n", "\n", "\n", "cluster_4\n", - "\n", - "\n", - "\n", - "cluster_5\n", - "\n", + "\n", "\n", "\n", "\n", "\n", "0\n", - "\n", - "0\n", + "\n", + "0\n", "\n", "\n", "\n", "I->0\n", - "\n", - "\n", + "\n", + "\n", "\n", "\n", - "\n", + "\n", "1\n", - "\n", - "1\n", + "\n", + "1\n", "\n", "\n", "\n", "0->1\n", - "\n", - "\n", - "a & !b\n", + "\n", + "\n", + "!a & !b\n", "\n", "\n", - "\n", + "\n", "2\n", - "\n", - "2\n", + "\n", + "2\n", "\n", "\n", "\n", "0->2\n", - "\n", - "\n", - "a & b\n", + "\n", + "\n", + "!a & b\n", "\n", "\n", - "\n", + "\n", "3\n", - "\n", - "3\n", + "\n", + "3\n", "\n", "\n", "\n", "0->3\n", - "\n", - "\n", - "!a & !b\n", + "\n", + "\n", + "a\n", "\n", "\n", - "\n", + "\n", "4\n", - "\n", - "4\n", - "\n", - "\n", - "\n", - "0->4\n", - "\n", - "\n", - "!a & b & c\n", - "\n", - "\n", - "\n", - "5\n", - "\n", - "5\n", - "\n", - "\n", - "\n", - "0->5\n", - "\n", - "\n", - "!a & b & !c\n", - "\n", - "\n", - "\n", - "1->1\n", - "\n", - "\n", - "1\n", - "\n", - "\n", - "\n", - "\n", - "2->1\n", - "\n", - "\n", - "a | !b\n", - "\n", - "\n", - "\n", - "2->2\n", - "\n", - "\n", - "!a & b\n", - "\n", + "\n", + "4\n", "\n", "\n", - "\n", + "\n", "6\n", - "\n", - "6\n", - "\n", - "\n", - "\n", - "6->6\n", - "\n", - "\n", - "!b & c\n", - "\n", - "\n", - "\n", - "6->6\n", - "\n", - "\n", - "b & c\n", - "\n", - "\n", - "\n", - "\n", - "7\n", - "\n", - "7\n", - "\n", - "\n", - "\n", - "6->7\n", - "\n", - "\n", - "!b & !c\n", - "\n", - "\n", - "\n", - "6->7\n", - "\n", - "\n", - "b & !c\n", - "\n", - "\n", - "\n", - "\n", - "7->6\n", - "\n", - "\n", - "!b & c\n", - "\n", - "\n", - "\n", - "\n", - "7->6\n", - "\n", - "\n", - "b & c\n", - "\n", - "\n", - "\n", - "7->7\n", - "\n", - "\n", - "!b & !c\n", - "\n", - "\n", - "\n", - "\n", - "7->7\n", - "\n", - "\n", - "b & !c\n", - "\n", - "\n", - "\n", - "3->6\n", - "\n", - "\n", - "a & c\n", - "\n", - "\n", - "\n", - "3->7\n", - "\n", - "\n", - "a & !c\n", + "\n", + "6\n", "\n", "\n", - "\n", + "\n", "4->6\n", - "\n", - "\n", - "a & c\n", + "\n", + "\n", + "!c\n", + "\n", + "\n", + "\n", + "7\n", + "\n", + "7\n", "\n", "\n", - "\n", - "4->7\n", - "\n", - "\n", - "a & !c\n", - "\n", - "\n", "\n", - "4->3\n", - "\n", - "\n", - "!a & !b\n", + "4->7\n", + "\n", + "\n", + "c\n", "\n", - "\n", - "\n", - "4->4\n", - "\n", - "\n", - "!a & b & c\n", - "\n", + "\n", + "\n", + "6->4\n", + "\n", + "\n", + "!b\n", + "\n", "\n", - "\n", - "\n", - "4->5\n", - "\n", - "\n", - "!a & b & !c\n", - "\n", - "\n", - "\n", - "\n", - "5->6\n", - "\n", - "\n", - "a & c\n", - "\n", - "\n", - "\n", - "5->7\n", - "\n", - "\n", - "a & !c\n", - "\n", - "\n", + "\n", "\n", - "5->3\n", - "\n", - "\n", - "!a & !b\n", + "6->6\n", + "\n", + "\n", + "b & !c\n", + "\n", + "\n", + "\n", + "6->7\n", + "\n", + "\n", + "b & c\n", + "\n", + "\n", + "\n", + "7->4\n", + "\n", + "\n", + "b\n", + "\n", + "\n", + "\n", + "\n", + "7->6\n", + "\n", + "\n", + "!b & !c\n", + "\n", + "\n", + "\n", + "7->7\n", + "\n", + "\n", + "!b & c\n", + "\n", + "\n", + "\n", + "1->4\n", + "\n", + "\n", + "a\n", + "\n", + "\n", + "\n", + "2->4\n", + "\n", + "\n", + "a\n", + "\n", + "\n", + "\n", + "2->1\n", + "\n", + "\n", + "!a & !b\n", + "\n", + "\n", + "\n", + "2->2\n", + "\n", + "\n", + "!a & b & !c\n", + "\n", + "\n", + "\n", + "5\n", + "\n", + "5\n", + "\n", + "\n", + "\n", + "2->5\n", + "\n", + "\n", + "!a & b & c\n", "\n", "\n", - "\n", + "\n", "5->4\n", - "\n", - "\n", - "!a & b & c\n", + "\n", + "\n", + "a\n", "\n", - "\n", - "\n", - "5->5\n", - "\n", - "\n", - "!a & b & !c\n", + "\n", + "\n", + "5->1\n", + "\n", + "\n", + "!a & !b\n", + "\n", + "\n", + "\n", + "5->2\n", + "\n", + "\n", + "!a & b\n", + "\n", + "\n", + "\n", + "\n", + "3->3\n", + "\n", + "\n", + "1\n", + "\n", "\n", "\n", ""