From b11c07b3516865ed806596e1bb1202b1186eeddb Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 28 Jan 2016 17:45:50 +0100 Subject: [PATCH] dot: add a get_dict()); out->copy_acceptance_of(aut); out->copy_ap_of(aut); out->prop_copy(aut, p); std::vector* names = nullptr; + std::set* incomplete = nullptr; if (preserve_names) { names = new std::vector; @@ -69,9 +71,27 @@ namespace spot unsigned src2; std::tie(src1, src2) = *todo.front(); todo.pop_front(); - for (auto* t: aut->succ(src1)) - out->new_edge(src2, new_state(t->dst()), t->cond(), t->acc()); + { + if (SPOT_UNLIKELY(max_states < out->num_states())) + { + // If we have reached the max number of state, never try + // to create a new one. + auto i = seen.find(t->dst()); + if (i == seen.end()) + { + if (!incomplete) + incomplete = new std::set; + incomplete->insert(src2); + continue; + } + out->new_edge(src2, i->second, t->cond(), t->acc()); + } + else + { + out->new_edge(src2, new_state(t->dst()), t->cond(), t->acc()); + } + } } @@ -84,6 +104,8 @@ namespace spot ptr->destroy(); } + if (incomplete) + out->set_named_prop("incomplete-states", incomplete); return out; } } diff --git a/spot/twaalgos/copy.hh b/spot/twaalgos/copy.hh index b4a6a0296..c718e3519 100644 --- a/spot/twaalgos/copy.hh +++ b/spot/twaalgos/copy.hh @@ -33,5 +33,6 @@ namespace spot /// /// This works for using the abstract interface for automata SPOT_API twa_graph_ptr - copy(const const_twa_ptr& aut, twa::prop_set p, bool preserve_names = false); + copy(const const_twa_ptr& aut, twa::prop_set p, + bool preserve_names = false, unsigned max_states = -1U); } diff --git a/spot/twaalgos/dot.cc b/spot/twaalgos/dot.cc index 1265cc579..daa2e62e1 100644 --- a/spot/twaalgos/dot.cc +++ b/spot/twaalgos/dot.cc @@ -57,6 +57,7 @@ namespace spot const_twa_graph_ptr aut_; std::vector* sn_ = nullptr; std::vector>* sprod_ = nullptr; + std::set* incomplete_; std::string* name_ = nullptr; acc_cond::mark_t inf_sets_ = 0U; acc_cond::mark_t fin_sets_ = 0U; @@ -83,9 +84,21 @@ namespace spot }; const char*const* palette = palette9; int palette_mod = 9; + unsigned max_states_ = -1U; + bool max_states_given_ = false; public: + unsigned max_states() + { + return max_states_; + } + + bool max_states_given() + { + return max_states_given_; + } + void parse_opts(const char* options) { @@ -95,7 +108,7 @@ namespace spot { case '.': { - // Copy the value in a string, so future calls to + // Copy the value in a string, so future calls to // parse_opts do not fail if the environment has // changed. (This matters particularly in an ipython // notebook, where it is tempting to redefine @@ -123,6 +136,25 @@ namespace spot options = end; break; } + case '<': + { + char* end; + max_states_ = strtoul(options, &end, 10); + if (options == end) + throw std::runtime_error + ("missing number after '<' in print_dot() options"); + if (max_states_ == 0) + { + max_states_ = -1U; + max_states_given_ = false; + } + else + { + max_states_given_ = true; + } + options = end; + break; + } case '1': opt_want_state_names_ = false; break; @@ -445,6 +477,9 @@ namespace spot os_ << ", peripheries=2"; os_ << "]\n"; } + if (incomplete_ && incomplete_->find(s) != incomplete_->end()) + os_ << " u" << s << " [label=\"...\", shape=none, width=0, height=0" + "]\n " << s << " -> u" << s << " [style=dashed]\n"; } void @@ -497,6 +532,8 @@ namespace spot sprod_ = nullptr; } } + incomplete_ = + aut->get_named_prop>("incomplete-states"); if (opt_name_) name_ = aut_->get_named_prop("automaton-name"); mark_states_ = (!opt_force_acc_trans_ @@ -566,8 +603,8 @@ namespace spot { dotty_output d(os, options); auto aut = std::dynamic_pointer_cast(g); - if (!aut) - aut = copy(g, twa::prop_set::all(), true); + if (!aut || (d.max_states_given() && aut->num_states() >= d.max_states())) + aut = copy(g, twa::prop_set::all(), true, d.max_states() - 1); d.print(aut); return os; } diff --git a/tests/Makefile.am b/tests/Makefile.am index a69507cb4..1e22ade06 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -316,7 +316,7 @@ TESTS_python = \ python/trival.py endif -CLEANFILES = python/finite.dve2C python/finite.dve.cpp +CLEANFILES = python/test1.dve python/test1.dve2C python/test1.dve.cpp SUFFIXES = .ipynb .html .ipynb.html: diff --git a/tests/python/ltsmin.ipynb b/tests/python/ltsmin.ipynb index de6a7d238..e96a57a35 100644 --- a/tests/python/ltsmin.ipynb +++ b/tests/python/ltsmin.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:83724638edf025d8183ef0d5193234734b94f7e3470d9034bea411e730c834c6" + "signature": "sha256:5cb288dca975d2e3b9a45bf32740468542c11fbd89d5a3df2155fe7e53ce9834" }, "nbformat": 3, "nbformat_minor": 0, @@ -12,15 +12,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This first chunk just makes sure the version of divine instaled accepts the `--LTSmin` option. If that is not the case, this notebook should be skipped by the test suite: `sys.exit(77)` does that." + "This first chunk just makes sure the version of DiVinE installed accepts the `--LTSmin` option. If that is not the case, this notebook should be skipped by the test suite: `sys.exit(77)` does that." ] }, { "cell_type": "code", "collapsed": false, "input": [ - "import os, sys\n", - "srcdir = os.environ.get('srcdir', '.')\n", + "import sys\n", "# Make sure we have divine and that it is patched to accept the --LTSmin option.\n", "import shutil\n", "if shutil.which(\"divine\") == None:\n", @@ -48,42 +47,75 @@ "input": [ "import spot\n", "import spot.ltsmin\n", - "spot.setup()" + "# This is notebook also tests the limitation of the number of states in the GraphViz output\n", + "spot.setup(max_states=10)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Write an example DiVinE model. " + ] + }, { "cell_type": "code", "collapsed": false, "input": [ - "m = spot.ltsmin.load(srcdir + '/../ltsmin/finite.dve')\n", - "m" + "%%file test1.dve\n", + "int a = 0, b = 0;\n", + "\n", + "process P {\n", + " state x;\n", + " init x;\n", + "\n", + " trans\n", + " x -> x { guard a < 3 && b < 3; effect a = a + 1; },\n", + " x -> x { guard a < 3 && b < 3; effect b = b + 1; };\n", + "}\n", + "\n", + "process Q {\n", + " state wait, work;\n", + " init wait;\n", + " trans\n", + " wait -> work { guard b > 1; },\n", + " work -> wait { guard a > 1; };\n", + "}\n", + "\n", + "system async;" ], "language": "python", "metadata": {}, "outputs": [ { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 3, + "output_type": "stream", + "stream": "stdout", "text": [ - "ltsmin model with the following variables:\n", - " P: ['x']\n", - " P.a: int\n", - " P.b: int" + "Overwriting test1.dve\n" ] } ], "prompt_number": 3 }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Compile the model using the `ltlmin` interface and load it. This should work with DiVinE models if `divine --LTSmin` works, and with Promela models if `spins` is installed.\n", + "\n", + "Printing an ltsmin model shows some information about the variables it contains and their types." + ] + }, { "cell_type": "code", "collapsed": false, "input": [ - "m.info()" + "m = spot.ltsmin.load('test1.dve')\n", + "m" ], "language": "python", "metadata": {}, @@ -93,9 +125,11 @@ "output_type": "pyout", "prompt_number": 4, "text": [ - "{'state_size': 3,\n", - " 'variables': [('P', 0), ('P.a', 1), ('P.b', 1)],\n", - " 'types': [('P', ['x']), ('int', [])]}" + "ltsmin model with the following variables:\n", + " a: int\n", + " b: int\n", + " P: ['x']\n", + " Q: ['wait', 'work']" ] } ], @@ -105,8 +139,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "k = m.kripke([\"P.a<1\", \"P.b>2\"])\n", - "k" + "sorted(m.info().items())" ], "language": "python", "metadata": {}, @@ -115,248 +148,10 @@ "metadata": {}, "output_type": "pyout", "prompt_number": 5, - "svg": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "G\n", - "\n", - "\n", - "\n", - "0\n", - "\n", - "P.a=0, P.b=0\n", - "\n", - "\n", - "I->0\n", - "\n", - "\n", - "\n", - "\n", - "1\n", - "\n", - "P.a=1, P.b=0\n", - "\n", - "\n", - "0->1\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "2\n", - "\n", - "P.a=0, P.b=1\n", - "\n", - "\n", - "0->2\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "3\n", - "\n", - "P.a=2, P.b=0\n", - "\n", - "\n", - "1->3\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "4\n", - "\n", - "P.a=1, P.b=1\n", - "\n", - "\n", - "1->4\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "2->4\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "5\n", - "\n", - "P.a=0, P.b=2\n", - "\n", - "\n", - "2->5\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "6\n", - "\n", - "P.a=3, P.b=0\n", - "\n", - "\n", - "3->6\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "7\n", - "\n", - "P.a=2, P.b=1\n", - "\n", - "\n", - "3->7\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "4->7\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "8\n", - "\n", - "P.a=1, P.b=2\n", - "\n", - "\n", - "4->8\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "5->8\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "9\n", - "\n", - "P.a=0, P.b=3\n", - "\n", - "\n", - "5->9\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "6->6\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & dead\n", - "\n", - "\n", - "10\n", - "\n", - "P.a=3, P.b=1\n", - "\n", - "\n", - "7->10\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "11\n", - "\n", - "P.a=2, P.b=2\n", - "\n", - "\n", - "7->11\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "8->11\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "12\n", - "\n", - "P.a=1, P.b=3\n", - "\n", - "\n", - "8->12\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "9->9\n", - "\n", - "\n", - ""P.a<1" & "P.b>2" & dead\n", - "\n", - "\n", - "10->10\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & dead\n", - "\n", - "\n", - "13\n", - "\n", - "P.a=3, P.b=2\n", - "\n", - "\n", - "11->13\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "14\n", - "\n", - "P.a=2, P.b=3\n", - "\n", - "\n", - "11->14\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & !dead\n", - "\n", - "\n", - "12->12\n", - "\n", - "\n", - "!"P.a<1" & "P.b>2" & dead\n", - "\n", - "\n", - "13->13\n", - "\n", - "\n", - "!"P.a<1" & !"P.b>2" & dead\n", - "\n", - "\n", - "14->14\n", - "\n", - "\n", - "!"P.a<1" & "P.b>2" & dead\n", - "\n", - "\n", - "\n" - ], "text": [ - " *' at 0x7f95344639c0> >" + "[('state_size', 4),\n", + " ('types', [('int', []), ('P', ['x']), ('Q', ['wait', 'work'])]),\n", + " ('variables', [('a', 0), ('b', 0), ('P', 1), ('Q', 2)])]" ] } ], @@ -366,7 +161,8 @@ "cell_type": "code", "collapsed": false, "input": [ - "a = spot.translate('\"P.a<1\" U \"P.b>2\"'); a" + "k = m.kripke([\"a<1\", \"b>2\"])\n", + "k" ], "language": "python", "metadata": {}, @@ -382,56 +178,922 @@ "\n", "\n", - "\n", - "\n", + "\n", + "\n", "G\n", - "\n", + "\n", "\n", - "\n", - "1\n", - "\n", - "1\n", - "\n", - "\n", - "I->1\n", - "\n", - "\n", - "\n", - "\n", - "1->1\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2"\n", - "\n", "\n", - "0\n", - "\n", - "\n", - "0\n", + "0\n", + "\n", + "a=0, b=0, Q=0\n", "\n", - "\n", - "1->0\n", - "\n", - "\n", - ""P.b>2"\n", + "\n", + "I->0\n", + "\n", + "\n", "\n", - "\n", - "0->0\n", - "\n", - "\n", - "1\n", + "\n", + "1\n", + "\n", + "a=1, b=0, Q=0\n", + "\n", + "\n", + "0->1\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "2\n", + "\n", + "a=0, b=1, Q=0\n", + "\n", + "\n", + "0->2\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "3\n", + "\n", + "a=2, b=0, Q=0\n", + "\n", + "\n", + "1->3\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "4\n", + "\n", + "a=1, b=1, Q=0\n", + "\n", + "\n", + "1->4\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "2->4\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "5\n", + "\n", + "a=0, b=2, Q=0\n", + "\n", + "\n", + "2->5\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "6\n", + "\n", + "a=3, b=0, Q=0\n", + "\n", + "\n", + "3->6\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "7\n", + "\n", + "a=2, b=1, Q=0\n", + "\n", + "\n", + "3->7\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "4->7\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "8\n", + "\n", + "a=1, b=2, Q=0\n", + "\n", + "\n", + "4->8\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "5->8\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "u5\n", + "\n", + "...\n", + "\n", + "\n", + "5->u5\n", + "\n", + "\n", + "\n", + "\n", + "9\n", + "\n", + "a=0, b=3, Q=0\n", + "\n", + "\n", + "5->9\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "6->6\n", + "\n", + "\n", + "!"a<1" & !"b>2" & dead\n", + "\n", + "\n", + "u7\n", + "\n", + "...\n", + "\n", + "\n", + "7->u7\n", + "\n", + "\n", + "\n", + "\n", + "u8\n", + "\n", + "...\n", + "\n", + "\n", + "8->u8\n", + "\n", + "\n", + "\n", + "\n", + "u9\n", + "\n", + "...\n", + "\n", + "\n", + "9->u9\n", + "\n", + "\n", "\n", "\n", "\n" ], "text": [ - " *' at 0x7f9534463de0> >" + " *' at 0x7f7f00239600> >" ] } ], "prompt_number": 6 }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "k.show('.<15')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 7, + "svg": [ + "\n", + "\n", + "G\n", + "\n", + "\n", + "\n", + "0\n", + "\n", + "a=0, b=0, Q=0\n", + "\n", + "\n", + "I->0\n", + "\n", + "\n", + "\n", + "\n", + "1\n", + "\n", + "a=1, b=0, Q=0\n", + "\n", + "\n", + "0->1\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "2\n", + "\n", + "a=0, b=1, Q=0\n", + "\n", + "\n", + "0->2\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "3\n", + "\n", + "a=2, b=0, Q=0\n", + "\n", + "\n", + "1->3\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "4\n", + "\n", + "a=1, b=1, Q=0\n", + "\n", + "\n", + "1->4\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "2->4\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "5\n", + "\n", + "a=0, b=2, Q=0\n", + "\n", + "\n", + "2->5\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "6\n", + "\n", + "a=3, b=0, Q=0\n", + "\n", + "\n", + "3->6\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "7\n", + "\n", + "a=2, b=1, Q=0\n", + "\n", + "\n", + "3->7\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "4->7\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "8\n", + "\n", + "a=1, b=2, Q=0\n", + "\n", + "\n", + "4->8\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "5->8\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "9\n", + "\n", + "a=0, b=3, Q=0\n", + "\n", + "\n", + "5->9\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "10\n", + "\n", + "a=0, b=2, Q=1\n", + "\n", + "\n", + "5->10\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "6->6\n", + "\n", + "\n", + "!"a<1" & !"b>2" & dead\n", + "\n", + "\n", + "11\n", + "\n", + "a=3, b=1, Q=0\n", + "\n", + "\n", + "7->11\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "12\n", + "\n", + "a=2, b=2, Q=0\n", + "\n", + "\n", + "7->12\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "8->12\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "13\n", + "\n", + "a=1, b=3, Q=0\n", + "\n", + "\n", + "8->13\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "14\n", + "\n", + "a=1, b=2, Q=1\n", + "\n", + "\n", + "8->14\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "u9\n", + "\n", + "...\n", + "\n", + "\n", + "9->u9\n", + "\n", + "\n", + "\n", + "\n", + "10->14\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "u10\n", + "\n", + "...\n", + "\n", + "\n", + "10->u10\n", + "\n", + "\n", + "\n", + "\n", + "11->11\n", + "\n", + "\n", + "!"a<1" & !"b>2" & dead\n", + "\n", + "\n", + "u12\n", + "\n", + "...\n", + "\n", + "\n", + "12->u12\n", + "\n", + "\n", + "\n", + "\n", + "u13\n", + "\n", + "...\n", + "\n", + "\n", + "13->u13\n", + "\n", + "\n", + "\n", + "\n", + "u14\n", + "\n", + "...\n", + "\n", + "\n", + "14->u14\n", + "\n", + "\n", + "\n", + "\n", + "" + ], + "text": [ + "" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "k.show('.<0') # unlimited output" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 8, + "svg": [ + "\n", + "\n", + "G\n", + "\n", + "\n", + "\n", + "0\n", + "\n", + "a=0, b=0, Q=0\n", + "\n", + "\n", + "I->0\n", + "\n", + "\n", + "\n", + "\n", + "1\n", + "\n", + "a=1, b=0, Q=0\n", + "\n", + "\n", + "0->1\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "2\n", + "\n", + "a=0, b=1, Q=0\n", + "\n", + "\n", + "0->2\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "3\n", + "\n", + "a=2, b=0, Q=0\n", + "\n", + "\n", + "1->3\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "4\n", + "\n", + "a=1, b=1, Q=0\n", + "\n", + "\n", + "1->4\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "2->4\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "5\n", + "\n", + "a=0, b=2, Q=0\n", + "\n", + "\n", + "2->5\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "6\n", + "\n", + "a=3, b=0, Q=0\n", + "\n", + "\n", + "3->6\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "7\n", + "\n", + "a=2, b=1, Q=0\n", + "\n", + "\n", + "3->7\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "4->7\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "8\n", + "\n", + "a=1, b=2, Q=0\n", + "\n", + "\n", + "4->8\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "5->8\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "9\n", + "\n", + "a=0, b=3, Q=0\n", + "\n", + "\n", + "5->9\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "10\n", + "\n", + "a=0, b=2, Q=1\n", + "\n", + "\n", + "5->10\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "6->6\n", + "\n", + "\n", + "!"a<1" & !"b>2" & dead\n", + "\n", + "\n", + "11\n", + "\n", + "a=3, b=1, Q=0\n", + "\n", + "\n", + "7->11\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "12\n", + "\n", + "a=2, b=2, Q=0\n", + "\n", + "\n", + "7->12\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "8->12\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "13\n", + "\n", + "a=1, b=3, Q=0\n", + "\n", + "\n", + "8->13\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "14\n", + "\n", + "a=1, b=2, Q=1\n", + "\n", + "\n", + "8->14\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "15\n", + "\n", + "a=0, b=3, Q=1\n", + "\n", + "\n", + "9->15\n", + "\n", + "\n", + ""a<1" & "b>2" & !dead\n", + "\n", + "\n", + "10->14\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "10->15\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "11->11\n", + "\n", + "\n", + "!"a<1" & !"b>2" & dead\n", + "\n", + "\n", + "16\n", + "\n", + "a=3, b=2, Q=0\n", + "\n", + "\n", + "12->16\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "17\n", + "\n", + "a=2, b=3, Q=0\n", + "\n", + "\n", + "12->17\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "18\n", + "\n", + "a=2, b=2, Q=1\n", + "\n", + "\n", + "12->18\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "19\n", + "\n", + "a=1, b=3, Q=1\n", + "\n", + "\n", + "13->19\n", + "\n", + "\n", + "!"a<1" & "b>2" & !dead\n", + "\n", + "\n", + "14->18\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "14->19\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "15->15\n", + "\n", + "\n", + ""a<1" & "b>2" & dead\n", + "\n", + "\n", + "20\n", + "\n", + "a=3, b=2, Q=1\n", + "\n", + "\n", + "16->20\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "21\n", + "\n", + "a=2, b=3, Q=1\n", + "\n", + "\n", + "17->21\n", + "\n", + "\n", + "!"a<1" & "b>2" & !dead\n", + "\n", + "\n", + "18->12\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "18->20\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "18->21\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "19->19\n", + "\n", + "\n", + "!"a<1" & "b>2" & dead\n", + "\n", + "\n", + "20->16\n", + "\n", + "\n", + "!"a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "21->17\n", + "\n", + "\n", + "!"a<1" & "b>2" & !dead\n", + "\n", + "\n", + "" + ], + "text": [ + "" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a = spot.translate('\"a<1\" U \"b>2\"'); a" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 9, + "svg": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "G\n", + "\n", + "\n", + "\n", + "0\n", + "\n", + "1\n", + "\n", + "\n", + "I->0\n", + "\n", + "\n", + "\n", + "\n", + "0->0\n", + "\n", + "\n", + ""a<1" & !"b>2"\n", + "\n", + "\n", + "1\n", + "\n", + "\n", + "0\n", + "\n", + "\n", + "0->1\n", + "\n", + "\n", + ""b>2"\n", + "\n", + "\n", + "1->1\n", + "\n", + "\n", + "1\n", + "\n", + "\n", + "\n" + ], + "text": [ + " *' at 0x7f7f00198690> >" + ] + } + ], + "prompt_number": 9 + }, { "cell_type": "code", "collapsed": false, @@ -444,7 +1106,7 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 7, + "prompt_number": 10, "svg": [ "\n", "\n", "\n", - "\n", - "\n", + "\n", + "\n", "G\n", - "\n", + "\n", "\n", "\n", "0\n", - "\n", - "P.a=0, P.b=0 * 1\n", + "\n", + "a=0, b=0, Q=0 * 1\n", "\n", "\n", "I->0\n", - "\n", - "\n", + "\n", + "\n", "\n", "\n", "1\n", - "\n", - "P.a=1, P.b=0 * 1\n", + "\n", + "a=1, b=0, Q=0 * 1\n", "\n", "\n", "0->1\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", "\n", "\n", "2\n", - "\n", - "P.a=0, P.b=1 * 1\n", + "\n", + "a=0, b=1, Q=0 * 1\n", "\n", "\n", "0->2\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", "\n", "\n", "3\n", - "\n", - "P.a=1, P.b=1 * 1\n", + "\n", + "a=1, b=1, Q=0 * 1\n", "\n", "\n", "2->3\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", "\n", "\n", "4\n", - "\n", - "P.a=0, P.b=2 * 1\n", + "\n", + "a=0, b=2, Q=0 * 1\n", "\n", "\n", "2->4\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", "\n", "\n", "5\n", - "\n", - "P.a=1, P.b=2 * 1\n", + "\n", + "a=1, b=2, Q=0 * 1\n", "\n", "\n", "4->5\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", "\n", "\n", "6\n", - "\n", - "P.a=0, P.b=3 * 1\n", + "\n", + "a=0, b=3, Q=0 * 1\n", "\n", "\n", "4->6\n", - "\n", - "\n", - ""P.a<1" & !"P.b>2" & !dead\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", "\n", "\n", "7\n", - "\n", - "P.a=0, P.b=3 * 0\n", + "\n", + "a=0, b=2, Q=1 * 1\n", "\n", - "\n", - "6->7\n", - "\n", - "\n", - ""P.a<1" & "P.b>2" & dead\n", + "\n", + "4->7\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", "\n", - "\n", - "7->7\n", - "\n", - "\n", - ""P.a<1" & "P.b>2" & dead\n", - "\u24ff\n", + "\n", + "8\n", + "\n", + "a=0, b=3, Q=1 * 0\n", + "\n", + "\n", + "6->8\n", + "\n", + "\n", + ""a<1" & "b>2" & !dead\n", + "\n", + "\n", + "u7\n", + "\n", + "...\n", + "\n", + "\n", + "7->u7\n", + "\n", + "\n", + "\n", + "\n", + "9\n", + "\n", + "a=1, b=2, Q=1 * 1\n", + "\n", + "\n", + "7->9\n", + "\n", + "\n", + ""a<1" & !"b>2" & !dead\n", + "\n", + "\n", + "8->8\n", + "\n", + "\n", + ""a<1" & "b>2" & dead\n", + "\u24ff\n", "\n", "\n", "\n" ], "text": [ - " *' at 0x7f95344637e0> >" + " *' at 0x7f7f00239cc0> >" ] } ], - "prompt_number": 7 + "prompt_number": 10 } ], "metadata": {}