From abe2c08b789b59b1fe2ab56d7534bb964aaca9a4 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 25 Jul 2017 17:38:24 +0200 Subject: [PATCH] acc: make &= and |= symmetrical Operator &= used to always move Fin to the front, it does not anymore. The only thing it does now is to merge Inf(x)&Inf(y) as Inf({x,y}). Operator |= is now symmetrical and merges Fin()s. Fixes #253. * spot/twa/acc.cc, spot/twa/acc.hh: Simplify &= and make |= symmetrical. * spot/twaalgos/cleanacc.cc: Fix conjunction order. * tests/core/acc.test, tests/core/acc2.test, tests/core/parseaut.test, tests/core/readsave.test, tests/core/satmin2.test, tests/core/sccdot.test, tests/python/acc_cond.ipynb, tests/python/accparse.ipynb, tests/python/automata.ipynb, tests/python/product.ipynb, tests/python/randaut.ipynb: Adjust test cases. --- NEWS | 6 + spot/twa/acc.cc | 18 +-- spot/twa/acc.hh | 212 ++++++++++++++---------------------- spot/twaalgos/cleanacc.cc | 6 +- tests/core/acc.test | 16 +-- tests/core/acc2.test | 10 +- tests/core/parseaut.test | 10 +- tests/core/readsave.test | 4 +- tests/core/satmin2.test | 2 +- tests/core/sccdot.test | 4 +- tests/python/acc_cond.ipynb | 12 +- tests/python/accparse.ipynb | 11 +- tests/python/automata.ipynb | 46 ++++---- tests/python/product.ipynb | 130 +++++++++++----------- tests/python/randaut.ipynb | 62 ++++++----- 15 files changed, 254 insertions(+), 295 deletions(-) diff --git a/NEWS b/NEWS index 2391f79ca..471136894 100644 --- a/NEWS +++ b/NEWS @@ -156,6 +156,12 @@ New in spot 2.3.5.dev (not yet released) - If the SPOT_BDD_TRACE envorinment variable is set, statistics about BDD garbage collection and table resizing are shown. + - The & and | operators for acceptannce conditions have been changed + slightly to be more symmetrical. In older version, operator & + would move Fin() terms to the front, but that is not the case + anymore. Also operator & was already grouping all Inf() terms + (for efficiency reasons), in this version operator | is + symmetrically grouping all Fin() terms. Python: diff --git a/spot/twa/acc.cc b/spot/twa/acc.cc index 9bd502d0a..1c9d1bd2e 100644 --- a/spot/twa/acc.cc +++ b/spot/twa/acc.cc @@ -914,7 +914,7 @@ namespace spot while ((cube = isop.next()) != bddfalse) { mark_t i = 0U; - acc_code c; + acc_code f; while (cube != bddtrue) { // The acceptance set associated to this BDD variable @@ -928,8 +928,7 @@ namespace spot // The strange order here make sure we can smaller set // numbers at the end of the acceptance code, i.e., at // the front of the output. - auto a = fin(s) & std::move(c); - std::swap(a, c); + f = fin(s) & f; } else // Positive variable? -> Inf { @@ -937,10 +936,8 @@ namespace spot cube = h; } } - c &= inf(i); // See comment above for the order. - c |= std::move(rescode); - std::swap(c, rescode); + rescode = (inf(i) & f) | rescode; } return rescode; @@ -986,7 +983,7 @@ namespace spot while ((cube = isop.next()) != bddfalse) { mark_t m = 0U; - acc_code c = f(); + acc_code i = f(); while (cube != bddtrue) { // The acceptance set associated to this BDD variable @@ -1000,8 +997,7 @@ namespace spot // The strange order here make sure we can smaller set // numbers at the end of the acceptance code, i.e., at // the front of the output. - auto a = inf(s) | std::move(c); - std::swap(a, c); + i = inf(s) | i; } else // Positive variable? -> Fin { @@ -1009,10 +1005,8 @@ namespace spot cube = h; } } - c |= fin(m); // See comment above for the order. - c &= std::move(rescode); - std::swap(c, rescode); + rescode = (fin(m) | i) & rescode; } return rescode; } diff --git a/spot/twa/acc.hh b/spot/twa/acc.hh index eb1c0f67b..b552e907c 100644 --- a/spot/twa/acc.hh +++ b/spot/twa/acc.hh @@ -578,11 +578,11 @@ namespace spot unsigned n = 0; for (Iterator i = begin; i != end; ++i) { - acc_cond::acc_code pair = fin({n++}); + unsigned f = n++; acc_cond::mark_t m = 0U; for (unsigned ni = *i; ni > 0; --ni) m.set(n++); - pair &= inf(m); + auto pair = inf(m) & fin({f}); std::swap(pair, res); res |= std::move(pair); } @@ -596,100 +596,6 @@ namespace spot // acceptance formula. static acc_code random(unsigned n, double reuse = 0.0); - acc_code& operator&=(acc_code&& r) - { - if (is_t() || r.is_f()) - { - *this = std::move(r); - return *this; - } - if (is_f() || r.is_t()) - return *this; - unsigned s = size() - 1; - unsigned rs = r.size() - 1; - // We want to group all Inf(x) operators: - // Inf(a) & Inf(b) = Inf(a & b) - if (((*this)[s].sub.op == acc_op::Inf - && r[rs].sub.op == acc_op::Inf) - || ((*this)[s].sub.op == acc_op::InfNeg - && r[rs].sub.op == acc_op::InfNeg)) - { - (*this)[s - 1].mark |= r[rs - 1].mark; - return *this; - } - - // In the more complex scenarios, left and right may both - // be conjunctions, and Inf(x) might be a member of each - // side. Find it if it exists. - // left_inf points to the left Inf mark if any. - // right_inf points to the right Inf mark if any. - acc_word* left_inf = nullptr; - if ((*this)[s].sub.op == acc_op::And) - { - auto start = &(*this)[s] - (*this)[s].sub.size; - auto pos = &(*this)[s] - 1; - pop_back(); - while (pos > start) - { - if (pos->sub.op == acc_op::Inf) - { - left_inf = pos - 1; - break; - } - pos -= pos->sub.size + 1; - } - } - else if ((*this)[s].sub.op == acc_op::Inf) - { - left_inf = &(*this)[s - 1]; - } - - acc_word* right_inf = nullptr; - auto right_end = &r.back(); - if (right_end->sub.op == acc_op::And) - { - auto start = &r[0]; - auto pos = --right_end; - while (pos > start) - { - if (pos->sub.op == acc_op::Inf) - { - right_inf = pos - 1; - break; - } - pos -= pos->sub.size + 1; - } - } - else if (right_end->sub.op == acc_op::Inf) - { - right_inf = right_end - 1; - } - - if (left_inf && right_inf) - { - left_inf->mark |= right_inf->mark; - insert(this->end(), &r[0], right_inf); - insert(this->end(), right_inf + 2, right_end + 1); - } - else if (right_inf) - { - // Always insert Inf() at the very first entry. - insert(this->begin(), right_inf, right_inf + 2); - insert(this->end(), &r[0], right_inf); - insert(this->end(), right_inf + 2, right_end + 1); - } - else - { - insert(this->end(), &r[0], right_end + 1); - } - - acc_word w; - w.sub.op = acc_op::And; - w.sub.size = size(); - emplace_back(w); - return *this; - } - acc_code& operator&=(const acc_code& r) { if (is_t() || r.is_f()) @@ -701,7 +607,8 @@ namespace spot return *this; unsigned s = size() - 1; unsigned rs = r.size() - 1; - // Inf(a) & Inf(b) = Inf(a & b) + // We want to group all Inf(x) operators: + // Inf(a) & Inf(b) = Inf(a & b) if (((*this)[s].sub.op == acc_op::Inf && r[rs].sub.op == acc_op::Inf) || ((*this)[s].sub.op == acc_op::InfNeg @@ -758,23 +665,17 @@ namespace spot right_inf = right_end - 1; } + acc_cond::mark_t carry = 0U; if (left_inf && right_inf) { - left_inf->mark |= right_inf->mark; - insert(this->end(), &r[0], right_inf); - insert(this->end(), right_inf + 2, right_end + 1); - } - else if (right_inf) - { - // Always insert Inf() at the very first entry. - insert(this->begin(), right_inf, right_inf + 2); - insert(this->end(), &r[0], right_inf); - insert(this->end(), right_inf + 2, right_end + 1); - } - else - { - insert(this->end(), &r[0], right_end + 1); + carry = left_inf->mark; + auto pos = left_inf - &(*this)[0]; + erase(begin() + pos, begin() + pos + 2); } + auto sz = size(); + insert(end(), &r[0], right_end + 1); + if (carry) + (*this)[sz + (right_inf - &r[0])].mark |= carry; acc_word w; w.sub.op = acc_op::And; @@ -783,6 +684,11 @@ namespace spot return *this; } + acc_code operator&(const acc_code& r) + { + return *this &= r; + } + acc_code operator&(acc_code&& r) { acc_code res = *this; @@ -790,20 +696,13 @@ namespace spot return res; } - acc_code operator&(const acc_code& r) - { - acc_code res = *this; - res &= r; - return res; - } - - acc_code& operator|=(acc_code&& r) + acc_code& operator|=(const acc_code& r) { if (is_t() || r.is_f()) return *this; if (is_f() || r.is_t()) { - *this = std::move(r); + *this = r; return *this; } unsigned s = size() - 1; @@ -817,11 +716,65 @@ namespace spot (*this)[s - 1].mark |= r[rs - 1].mark; return *this; } + + // In the more complex scenarios, left and right may both + // be disjunctions, and Fin(x) might be a member of each + // side. Find it if it exists. + // left_inf points to the left Inf mark if any. + // right_inf points to the right Inf mark if any. + acc_word* left_fin = nullptr; if ((*this)[s].sub.op == acc_op::Or) - pop_back(); - if (r.back().sub.op == acc_op::Or) - r.pop_back(); - insert(this->end(), r.begin(), r.end()); + { + auto start = &(*this)[s] - (*this)[s].sub.size; + auto pos = &(*this)[s] - 1; + pop_back(); + while (pos > start) + { + if (pos->sub.op == acc_op::Fin) + { + left_fin = pos - 1; + break; + } + pos -= pos->sub.size + 1; + } + } + else if ((*this)[s].sub.op == acc_op::Fin) + { + left_fin = &(*this)[s - 1]; + } + + const acc_word* right_fin = nullptr; + auto right_end = &r.back(); + if (right_end->sub.op == acc_op::Or) + { + auto start = &r[0]; + auto pos = --right_end; + while (pos > start) + { + if (pos->sub.op == acc_op::Fin) + { + right_fin = pos - 1; + break; + } + pos -= pos->sub.size + 1; + } + } + else if (right_end->sub.op == acc_op::Fin) + { + right_fin = right_end - 1; + } + + acc_cond::mark_t carry = 0U; + if (left_fin && right_fin) + { + carry = left_fin->mark; + auto pos = (left_fin - &(*this)[0]); + this->erase(begin() + pos, begin() + pos + 2); + } + auto sz = size(); + insert(end(), &r[0], right_end + 1); + if (carry) + (*this)[sz + (right_fin - &r[0])].mark |= carry; acc_word w; w.sub.op = acc_op::Or; w.sub.size = size(); @@ -829,11 +782,6 @@ namespace spot return *this; } - acc_code& operator|=(const acc_code& r) - { - return *this |= acc_code(r); - } - acc_code operator|(acc_code&& r) { acc_code res = *this; @@ -841,11 +789,9 @@ namespace spot return res; } - acc_code operator|(const acc_code& r) + acc_code& operator|(const acc_code& r) { - acc_code res = *this; - res |= r; - return res; + return *this |= r; } acc_code& operator<<=(unsigned sets) diff --git a/spot/twaalgos/cleanacc.cc b/spot/twaalgos/cleanacc.cc index 44018de30..2d9233a31 100644 --- a/spot/twaalgos/cleanacc.cc +++ b/spot/twaalgos/cleanacc.cc @@ -193,8 +193,7 @@ namespace spot for (auto m: seen_fin.sets()) inf.front().mark -= complement[m]; - res &= inf; - return res; + return inf & res; } case acc_cond::acc_op::Or: { @@ -225,8 +224,7 @@ namespace spot for (auto m: seen_inf.sets()) fin.front().mark -= complement[m]; - res |= fin; - return res; + return res | fin; } case acc_cond::acc_op::Fin: return acc_cond::acc_code::fin(pos[-1].mark); diff --git a/tests/core/acc.test b/tests/core/acc.test index 634244dcf..223675ba2 100755 --- a/tests/core/acc.test +++ b/tests/core/acc.test @@ -64,12 +64,12 @@ stripping #1: {2} 2 Inf(0)&Inf(1)&Inf(3) 1 5 Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1 -7 Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1 -7 Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1 -7 Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1 -10 (Fin(0)|Fin(1)) & (Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3))) 0 +5 (Fin(0)|Fin(2)) | (Inf(0)&Inf(1)&Inf(3)) 1 +5 (Fin(0)|Fin(2)) | (Inf(0)&Inf(1)&Inf(3)) 1 +5 (Fin(0)|Fin(2)) | (Inf(0)&Inf(1)&Inf(3)) 1 +8 (Fin(0)|Fin(1)) & ((Fin(0)|Fin(2)) | (Inf(0)&Inf(1)&Inf(3))) 0 2 f 1 -9 (Fin(0)|Fin(1)) | Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1 +5 (Fin(0)|Fin(1)|Fin(2)) | (Inf(0)&Inf(1)&Inf(3)) 1 5 (Fin(2)|Fin(3)) & (Inf(0)&Inf(1)) 0 (Fin(2)|Fin(3)) & (Inf(0)&Inf(1)) {0} true {1} @@ -82,9 +82,9 @@ f Fin(2) Inf(2) Fin(2) | Inf(2) -Fin(2) & Inf(2) -Fin(0) | (Fin(2) & Inf(1)) | Fin(3) -Fin(0) | (Fin(2) & Inf(1)) | Fin(3) +Inf(2) & Fin(2) +(Fin(0)|Fin(3)) | (Inf(1) & Fin(2)) +(Fin(0)|Fin(3)) | (Inf(1) & Fin(2)) EOF run 0 ../acc | tee stdout diff --git a/tests/core/acc2.test b/tests/core/acc2.test index ba5c2ae67..95116bce5 100755 --- a/tests/core/acc2.test +++ b/tests/core/acc2.test @@ -1,6 +1,6 @@ #!/bin/sh # -*- coding: utf-8 -*- -# Copyright (C) 2015 Laboratoire de Recherche et Développement +# Copyright (C) 2015, 2017 Laboratoire de Recherche et Développement # de l'Epita (LRDE). # # This file is part of Spot, a model checking library. @@ -71,13 +71,13 @@ diff acceptances output #------------- CNF ------------- -res="(Fin(2) | Inf(1)) & (Fin(1) | Inf(3)) & Inf(0)" +res="Inf(0) & (Inf(1) | Fin(2)) & (Inf(3) | Fin(1))" cat >acceptances<acceptances<acceptances<expected < 0 @@ -524,7 +524,7 @@ diff out expected cat >expected2 < out.dot cat <expected digraph G { rankdir=LR - label="Fin(2) & (Inf(0)&Inf(1))" + label="(Inf(0)&Inf(1)) & Fin(2)" labelloc="t" node [shape="circle"] I [label="", style=invis, width=0] @@ -156,7 +156,7 @@ HOA: v1 States: 8 Start: 0 AP: 2 "a" "b" -Acceptance: 3 Fin(2) & (Inf(0)&Inf(1)) +Acceptance: 3 (Inf(0)&Inf(1)) & Fin(2) properties: trans-labels explicit-labels trans-acc --BODY-- State: 0 diff --git a/tests/python/acc_cond.ipynb b/tests/python/acc_cond.ipynb index c371ba95b..759b8fa99 100644 --- a/tests/python/acc_cond.ipynb +++ b/tests/python/acc_cond.ipynb @@ -15,7 +15,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.3" + "version": "3.5.3+" }, "name": "" }, @@ -489,7 +489,7 @@ "output_type": "pyout", "prompt_number": 17, "text": [ - "(Fin(1) & Inf(0)) | Inf(2)" + "(Inf(0) & Fin(1)) | Inf(2)" ] } ], @@ -571,7 +571,7 @@ "output_type": "pyout", "prompt_number": 20, "text": [ - "(Fin(3) | Inf(1)) & (Fin(0)|Fin(2)) & Inf(4)" + "(Fin(3) | Inf(1)) & Inf(4) & (Fin(0)|Fin(2))" ] } ], @@ -619,7 +619,7 @@ "output_type": "pyout", "prompt_number": 22, "text": [ - "Fin(0) & (Fin(2) | Inf(1)) & (Fin(4) | Inf(1) | Inf(3))" + "Fin(0) & (Inf(1) | Fin(2)) & (Inf(1) | Inf(3) | Fin(4))" ] } ], @@ -720,8 +720,8 @@ "output_type": "stream", "stream": "stdout", "text": [ - "(Fin(0) & Inf(1)) | (Fin(2) & Inf(3))\n", - "(Inf(0) | Fin(1)) & (Inf(2) | Fin(3))\n" + "((Fin(4) & Inf(5)) | (Fin(6) & Inf(7))) & ((Fin(0) & Inf(1)) | (Fin(2) & Inf(3)))\n", + "((Inf(4) | Fin(5)) & (Inf(6) | Fin(7))) | ((Inf(0) | Fin(1)) & (Inf(2) | Fin(3)))\n" ] } ], diff --git a/tests/python/accparse.ipynb b/tests/python/accparse.ipynb index 3b6c6ca63..734e3e848 100644 --- a/tests/python/accparse.ipynb +++ b/tests/python/accparse.ipynb @@ -15,10 +15,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.3+" + "version": "3.5.3+" }, - "name": "", - "signature": "sha256:1ee7951bed30652ae110a14b210541829221552eb944ff01f25236179673dd5b" + "name": "" }, "nbformat": 3, "nbformat_minor": 0, @@ -51,7 +50,7 @@ "output_type": "pyout", "prompt_number": 2, "text": [ - "(Fin(1) & Inf(0)) | (Fin(3) & Inf(2))" + "(Inf(0) & Fin(1)) | (Inf(2) & Fin(3))" ] } ], @@ -91,7 +90,7 @@ "output_type": "pyout", "prompt_number": 4, "text": [ - "(Inf(0) | Inf(2)) & (Fin(3) | Inf(0)) & (Fin(1) | Inf(2)) & (Fin(1)|Fin(3))" + "(Inf(0) | Inf(2)) & (Inf(0) | Fin(3)) & (Inf(2) | Fin(1)) & (Fin(1)|Fin(3))" ] } ], @@ -174,4 +173,4 @@ "metadata": {} } ] -} \ No newline at end of file +} diff --git a/tests/python/automata.ipynb b/tests/python/automata.ipynb index d3e5cc8f0..336f0f3ee 100644 --- a/tests/python/automata.ipynb +++ b/tests/python/automata.ipynb @@ -15,7 +15,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.3" + "version": "3.5.3+" }, "name": "" }, @@ -177,7 +177,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae817a8d0> >" + " *' at 0x7f364c1ff810> >" ] } ], @@ -569,7 +569,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816aa20> >" + " *' at 0x7f364c1ff720> >" ] } ], @@ -639,7 +639,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816a4b0> >" + " *' at 0x7f364c18dbd0> >" ] } ], @@ -715,7 +715,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816a300> >" + " *' at 0x7f364c18d150> >" ] } ], @@ -1175,7 +1175,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816a9f0> >" + " *' at 0x7f364c18df00> >" ] } ], @@ -1276,7 +1276,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816a870> >" + " *' at 0x7f364c18df30> >" ] } ], @@ -1394,7 +1394,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816a690> >" + " *' at 0x7f364c18d660> >" ] } ], @@ -1493,7 +1493,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816a6f0> >" + " *' at 0x7f364c18d870> >" ] } ], @@ -1963,7 +1963,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816a3f0> >" + " *' at 0x7f364c18ddb0> >" ] } ], @@ -2056,12 +2056,12 @@ "\n", "G\n", "\n", - "(Fin(\n", - "\u2776\n", - ") & Fin(\n", - "\u2778\n", - ") & Inf(\n", - "\u24ff\n", + "(Inf(\n", + "\u24ff\n", + ") & Fin(\n", + "\u2776\n", + ") & Fin(\n", + "\u2778\n", ")) | (Inf(\n", "\u2777\n", ")&Inf(\n", @@ -2578,7 +2578,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae817a3f0> >" + " *' at 0x7f364c18de10> >" ] } ], @@ -2734,7 +2734,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816aab0> >" + " *' at 0x7f364c18d7b0> >" ] } ], @@ -2804,7 +2804,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816ae10> >" + " *' at 0x7f364c18de10> >" ] } ], @@ -3231,7 +3231,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae816af60> >" + " *' at 0x7f364c1a9450> >" ] }, { @@ -3399,7 +3399,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae81250f0> >" + " *' at 0x7f364c1a90c0> >" ] } ], @@ -3488,7 +3488,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae81250f0> >" + " *' at 0x7f364c1a90c0> >" ] } ], @@ -3577,7 +3577,7 @@ "\n" ], "text": [ - " *' at 0x7f9ae81250f0> >" + " *' at 0x7f364c1a90c0> >" ] } ], diff --git a/tests/python/product.ipynb b/tests/python/product.ipynb index 083b7212f..f3ea42b02 100644 --- a/tests/python/product.ipynb +++ b/tests/python/product.ipynb @@ -15,7 +15,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.3" + "version": "3.5.3+" }, "name": "" }, @@ -1191,60 +1191,64 @@ "outputs": [ { "html": [ - "
\n", + "
\n", "\n", "G\n", - "\n", - "Inf(\n", - "\u24ff\n", - ")\n", + "\n", + "Inf(\n", + "\u24ff\n", + ")&Inf(\n", + "\u2776\n", + ")&Inf(\n", + "\u2777\n", + ")\n", "\n", "\n", "1\n", - "\n", - "1\n", + "\n", + "1\n", "\n", "\n", "I->1\n", - "\n", - "\n", + "\n", + "\n", "\n", "\n", "0\n", - "\n", - "0\n", + "\n", + "0\n", "\n", "\n", "1->0\n", - "\n", - "\n", - "1\n", + "\n", + "\n", + "1\n", "\n", "\n", "0->0\n", - "\n", - "\n", - "a & !b\n", - "\u24ff\n", + "\n", + "\n", + "a & !b\n", + "\u24ff\n", "\n", "\n", "2\n", - "\n", - "2\n", + "\n", + "2\n", "\n", "\n", "0->2\n", - "\n", - "\n", - "b\n", - "\u24ff\n", + "\n", + "\n", + "b\n", + "\u24ff\n", "\n", "\n", "2->2\n", - "\n", - "\n", - "1\n", - "\u24ff\n", + "\n", + "\n", + "1\n", + "\u24ff\n", "\n", "\n", "\n", @@ -1698,60 +1702,64 @@ "outputs": [ { "html": [ - "
\n", + "
\n", "\n", "G\n", - "\n", - "Inf(\n", - "\u24ff\n", - ")\n", + "\n", + "Inf(\n", + "\u24ff\n", + ")&Inf(\n", + "\u2776\n", + ")&Inf(\n", + "\u2777\n", + ")\n", "\n", "\n", "1\n", - "\n", - "1\n", + "\n", + "1\n", "\n", "\n", "I->1\n", - "\n", - "\n", + "\n", + "\n", "\n", "\n", "0\n", - "\n", - "0\n", + "\n", + "0\n", "\n", "\n", "1->0\n", - "\n", - "\n", - "1\n", + "\n", + "\n", + "1\n", "\n", "\n", "0->0\n", - "\n", - "\n", - "a & !b\n", - "\u24ff\n", + "\n", + "\n", + "a & !b\n", + "\u24ff\n", "\n", "\n", "2\n", - "\n", - "2\n", + "\n", + "2\n", "\n", "\n", "0->2\n", - "\n", - "\n", - "b\n", - "\u24ff\n", + "\n", + "\n", + "b\n", + "\u24ff\n", "\n", "\n", "2->2\n", - "\n", - "\n", - "1\n", - "\u24ff\n", + "\n", + "\n", + "1\n", + "\u24ff\n", "\n", "\n", "\n", @@ -2021,7 +2029,7 @@ ] } ], - "prompt_number": 14 + "prompt_number": 9 }, { "cell_type": "markdown", @@ -2045,7 +2053,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "1000 loops, best of 3: 202 \u00b5s per loop\n" + "1000 loops, best of 3: 209 \u00b5s per loop\n" ] } ], @@ -2064,8 +2072,8 @@ "output_type": "stream", "stream": "stdout", "text": [ - "The slowest run took 5.71 times longer than the fastest. This could mean that an intermediate result is being cached.\n", - "100000 loops, best of 3: 4.39 \u00b5s per loop\n" + "The slowest run took 5.67 times longer than the fastest. This could mean that an intermediate result is being cached.\n", + "100000 loops, best of 3: 4.62 \u00b5s per loop\n" ] } ], diff --git a/tests/python/randaut.ipynb b/tests/python/randaut.ipynb index 4e24bd65b..03ef404bc 100644 --- a/tests/python/randaut.ipynb +++ b/tests/python/randaut.ipynb @@ -15,10 +15,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.3+" + "version": "3.5.3+" }, - "name": "", - "signature": "sha256:3e27359f7131b7b08ba2b01c8501a8f9c7c39c11a83133150d0a75de7bff2ef2" + "name": "" }, "nbformat": 3, "nbformat_minor": 0, @@ -38,6 +37,13 @@ "outputs": [], "prompt_number": 1 }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This shows the effect of running `cleanup_acceptance()` on 10 randomly generated automata." + ] + }, { "cell_type": "code", "collapsed": false, @@ -49,7 +55,9 @@ "HTML(txt)" ], "language": "python", - "metadata": {}, + "metadata": { + "scrolled": false + }, "outputs": [ { "html": [ @@ -462,10 +470,10 @@ "\n", "G\n", "\n", - "(Fin(\n", - "\u2776\n", - ") & Inf(\n", - "\u2777\n", + "(Inf(\n", + "\u2777\n", + ") & Fin(\n", + "\u2776\n", ")) | (Inf(\n", "\u24ff\n", ")&Inf(\n", @@ -952,15 +960,15 @@ "\n", "G\n", "\n", - "(Fin(\n", - "\u2777\n", - ") | Inf(\n", - "\u2778\n", - ") | Fin(\n", - "\u2776\n", - ")) & Inf(\n", - "\u24ff\n", - ")\n", + "((Fin(\n", + "\u2776\n", + ")|Fin(\n", + "\u2777\n", + ")) | Inf(\n", + "\u2778\n", + ")) & Inf(\n", + "\u24ff\n", + ")\n", "\n", "\n", "0\n", @@ -2081,10 +2089,10 @@ "\u2777\n", ")|Fin(\n", "\u2778\n", - ")) | (Fin(\n", - "\u2776\n", - ") & Inf(\n", - "\u24ff\n", + ")) | (Inf(\n", + "\u24ff\n", + ") & Fin(\n", + "\u2776\n", "))\n", "\n", "\n", @@ -2173,10 +2181,10 @@ "\u2777\n", ")|Fin(\n", "\u2778\n", - ")) | (Fin(\n", - "\u2776\n", - ") & Inf(\n", - "\u24ff\n", + ")) | (Inf(\n", + "\u24ff\n", + ") & Fin(\n", + "\u2776\n", "))\n", "\n", "\n", @@ -2263,7 +2271,7 @@ "output_type": "pyout", "prompt_number": 2, "text": [ - "" + "" ] } ], @@ -2282,4 +2290,4 @@ "metadata": {} } ] -} \ No newline at end of file +}