python: rewrite translate() to deal with unambiguous and sbacc

and make it easier to extend and use.

* src/twaalgos/postproc.hh, src/twaalgos/translate.cc,
src/twaalgos/translate.hh: Incorporate the Unambiguous option
with the other preferences.  It's cleaner this way, and the
previous setup did not work well with Python.
* src/bin/ltl2tgba.cc: Adjust to this change.
* wrap/python/spot.py (translate): Rewrite.
* wrap/python/tests/automata.ipynb: Adjust existing cases, and
add more as well as some comments.
This commit is contained in:
Alexandre Duret-Lutz 2015-05-15 23:50:19 +02:00
parent 1ef3e5f3ff
commit 19a273929c
6 changed files with 666 additions and 190 deletions

View file

@ -83,7 +83,7 @@ const struct argp_child children[] =
};
static spot::option_map extra_options;
bool unambiguous = false;
static spot::postprocessor::output_pref unambig = 0;
static int
parse_opt(int key, char* arg, struct argp_state*)
@ -98,7 +98,7 @@ parse_opt(int key, char* arg, struct argp_state*)
type = spot::postprocessor::Monitor;
break;
case 'U':
unambiguous = true;
unambig = spot::postprocessor::Unambiguous;
break;
case 'x':
{
@ -186,11 +186,9 @@ main(int argc, char** argv)
program_name);
spot::translator trans(&extra_options);
trans.set_pref(pref | comp | sbacc);
trans.set_pref(pref | comp | sbacc | unambig);
trans.set_type(type);
trans.set_level(level);
if (unambiguous)
trans.set_pref(spot::translator::Unambiguous);
try
{

View file

@ -74,13 +74,11 @@ namespace spot
enum
{
Any = 0,
Small = 1,
Deterministic = 2,
// 3 reserved for unambiguous
// Combine Complete as 'Small | Complete' or 'Deterministic | Complete'
Small = 1, // Small and Deterministic
Deterministic = 2, // are exclusive choices.
Complete = 4,
// Likewise. State-based acceptance.
SBAcc = 8,
SBAcc = 8, // State-based acceptance.
Unambiguous = 16,
};
typedef int output_pref;

View file

@ -28,7 +28,6 @@ namespace spot
void translator::setup_opt(const option_map* opt)
{
comp_susp_ = early_susp_ = skel_wdba_ = skel_simul_ = 0;
unambiguous_ = false;
if (!opt)
return;
@ -64,12 +63,13 @@ namespace spot
twa_graph_ptr translator::run(const ltl::formula** f)
{
if (unambiguous_ && type_ == postprocessor::Monitor)
bool unambiguous = (pref_ & postprocessor::Unambiguous);
if (unambiguous && type_ == postprocessor::Monitor)
{
// Deterministic monitor are unambiguous, so the unambiguous
// option is not really relevant for monitors.
unambiguous_ = false;
set_pref(postprocessor::Deterministic);
unambiguous = false;
set_pref(pref_ | postprocessor::Deterministic);
}
const ltl::formula* r = simpl_->simplify(*f);
@ -94,9 +94,9 @@ namespace spot
}
else
{
bool exprop = unambiguous_ || level_ == postprocessor::High;
bool exprop = unambiguous || level_ == postprocessor::High;
aut = ltl_to_tgba_fm(r, simpl_->get_dict(), exprop,
true, false, false, 0, 0, unambiguous_);
true, false, false, 0, 0, unambiguous);
}
aut = this->postprocessor::run(aut, r);
return aut;

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -82,22 +82,12 @@ namespace spot
this->postprocessor::set_type(type);
}
typedef postprocessor::output_pref output_pref;
enum output_pref_extra { Unambiguous };
void
set_pref(output_pref pref)
{
this->postprocessor::set_pref(pref);
}
void
set_pref(output_pref_extra)
{
unambiguous_ = true;
}
typedef postprocessor::optimization_level optimization_level;
void
@ -130,7 +120,6 @@ namespace spot
int early_susp_;
int skel_wdba_;
int skel_simul_;
bool unambiguous_;
};
/// @}
}

View file

@ -219,65 +219,135 @@ def automaton(filename):
except StopIteration:
raise RuntimeError("Failed to read automaton from {}".format(filename))
def translate(formula, output='tgba', pref='small', level='high',
complete=False):
def translate(formula, *args):
"""Translate a formula into an automaton.
Keep in mind that pref expresses just a preference that may not be
satisfied.
Keyword arguments:
output -- the type of automaton to build ('tgba', 'ba', 'monitor')
pref -- prefered characteristic of the produced automaton
('small', 'deterministic', 'any')
level -- level of optimizations ('low', 'medium', 'high')
complete -- whether to produce a complete automaton (True, False)
The optional arguments should be strings among the following:
- at most one in 'TGBA', 'BA', or 'Monitor'
(type of automaton to build)
- at most one in 'Small', 'Deterministic', 'Any'
(perefered characteristics of the produced automaton)
- at most one in 'Low', 'Medium', 'High'
(optimization level)
- any combination of 'Complete', 'Unambiguous', and
'StateBasedAcceptance' (or 'SBAcc' for short)
The default correspond to 'tgba', 'small' and 'high'.
"""
type_ = None
pref_ = None
optm_ = None
comp_ = 0
unam_ = 0
sbac_ = 0
def type_set(val):
nonlocal type_
if type_ != None and type_ != val:
raise ValueError("type cannot be both {} and {}"
.format(type_, val))
elif val == 'tgba':
type_ = postprocessor.TGBA
elif val == 'ba':
type_ = postprocessor.BA
else:
assert(val == 'monitor')
type_ = postprocessor.Monitor
def pref_set(val):
nonlocal pref_
if pref_ != None and pref_ != val:
raise ValueError("preference cannot be both {} and {}"
.format(pref_, val))
elif val == 'small':
pref_ = postprocessor.Small
elif val == 'deterministic':
pref_ = postprocessor.Deterministic
else:
assert(val == 'any')
pref_ = postprocessor.Any
def optm_set(val):
nonlocal optm_
if optm_ != None and optm_ != val:
raise ValueError("optimization level cannot be both {} and {}"
.format(optm_, val))
if optm_ == 'high':
optm_ = postprocessor.High
elif optm_.startswith('med'):
optm_ = postprocessor.Medium
else:
assert(level_ == 'low')
optm_ = postprocessor.Low
def misc_set(val):
nonlocal comp_, unam_, sbac_
if val == 'complete':
comp_ = postprocessor.Complete
elif val == 'sbacc' or val == 'state-based-acceptance':
sbac_ = postprocessor.SBAcc
else:
assert(val == 'unambiguous')
unam_ = postprocessor.Unambiguous
options = {
'tgba': type_set,
'ba': type_set,
'monitor': type_set,
'small': pref_set,
'deterministic': pref_set,
'any': pref_set,
'high': optm_set,
'medium': optm_set,
'low': optm_set,
'complete': misc_set,
'unambiguous': misc_set,
'statebasedacceptance': misc_set,
'sbacc': misc_set,
}
for arg in args:
arg = arg.lower()
fn = options.get(arg)
if fn:
fn(arg)
else:
# arg is not an know option, but maybe it is a prefix of
# one of them
compat = []
f = None
for key, fn in options.items():
if key.startswith(arg):
compat.append(key)
f = fn
lc = len(compat)
if lc == 1:
f(compat[0])
elif lc < 1:
raise ValueError("unknown option '{}'".format(arg))
else:
raise ValueError("ambiguous option '{}' is prefix of {}"
.format(arg, str(compat)))
if type_ == None:
type_ = postprocessor.TGBA
if pref_ == None:
pref_ = postprocessor.Small
if optm_ == None:
optm_ = postprocessor.High
if type(formula) == str:
formula = parse_formula(formula)
a = translator(_bdd_dict)
if type(output) == str:
output_ = output.lower()
if output_ == 'tgba':
output = postprocessor.TGBA
elif output_ == 'ba':
output = postprocessor.BA
elif output_.startswith('mon'):
output = postprocessor.Monitor
else:
raise ValueError("unknown output type: " + output)
a.set_type(output)
if complete:
complete = postprocessor.Complete
else:
complete = 0
if type(pref) == str:
pref_ = pref.lower()
if pref_.startswith('sm'):
pref = postprocessor.Small
elif pref_.startswith('det'):
pref = postprocessor.Deterministic
elif pref_ == 'any':
pref = postprocessor.Any
else:
raise ValueError("unknown output preference: " + pref)
a.set_pref(pref | complete)
if type(level) == str:
level_ = level.lower()
if level_ == 'high':
level = postprocessor.High
elif level_.startswith('med'):
level = postprocessor.Medium
elif level_ == 'low':
level = postprocessor.Low
else:
raise ValueError("unknown optimization level: " + level)
a.set_level(level)
a.set_type(type_)
a.set_pref(pref_ | comp_ | unam_ | sbac_)
a.set_level(optm_)
return a.run(formula)

View file

@ -15,10 +15,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.2"
"version": "3.4.3+"
},
"name": "",
"signature": "sha256:fe7ef6b55c6362768f225bdba28a93036807ecfa50449826c1020f3a80e585f6"
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
@ -37,11 +36,18 @@
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To build an automaton, simply call `translate()` with a formula, and a list of options to characterize the automaton you want (those options have the same name as the long options name of the `ltl2tgba` tool, and they can be abbreviated)."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"a = spot.translate('(a U b) & GFc & GFd', 'BA', complete=True); a"
"a = spot.translate('(a U b) & GFc & GFd', 'BA', 'complete'); a"
],
"language": "python",
"metadata": {},
@ -170,17 +176,24 @@
"</svg>\n"
],
"text": [
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fd09041e6c0> >"
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f44bdf3f8d0> >"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The call the `spot.setup()` in the first cells has installed a default style for the graphviz output. If you want to change this style temporarily, you can call the `show(style)` method explicitely. For instance here is a vertical layout with the default font of GraphViz."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"a.show(\"\")"
"a.show(\"v\")"
],
"language": "python",
"metadata": {},
@ -190,124 +203,131 @@
"output_type": "pyout",
"prompt_number": 3,
"svg": [
"<svg height=\"186pt\" viewBox=\"0.00 0.00 488.00 186.00\" width=\"488pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 182)\">\n",
"<svg height=\"351pt\" viewBox=\"0.00 0.00 226.36 351.00\" width=\"226pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 347)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-182 484,-182 484,4 -4,4\" stroke=\"none\"/>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-347 222.356,-347 222.356,4 -4,4\" stroke=\"none\"/>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g class=\"node\" id=\"node2\"><title>0</title>\n",
"<ellipse cx=\"65\" cy=\"-69\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"65\" y=\"-65.3\">0</text>\n",
"<ellipse cx=\"120.356\" cy=\"-287\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"120.356\" y=\"-283.3\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>I-&gt;0</title>\n",
"<path d=\"M1.04566,-69C1.94863,-69 16.101,-69 30.7579,-69\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"37.9378,-69 30.9378,-72.1501 34.4378,-69 30.9378,-69.0001 30.9378,-69.0001 30.9378,-69.0001 34.4378,-69 30.9378,-65.8501 37.9378,-69 37.9378,-69\" stroke=\"black\"/>\n",
"<path d=\"M120.356,-341.845C120.356,-340.206 120.356,-325.846 120.356,-312.368\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"120.356,-305.058 123.506,-312.058 120.356,-308.558 120.356,-312.058 120.356,-312.058 120.356,-312.058 120.356,-308.558 117.206,-312.058 120.356,-305.058 120.356,-305.058\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>0-&gt;0</title>\n",
"<path d=\"M57.1448,-86.4099C55.6785,-96.0879 58.2969,-105 65,-105 69.9226,-105 72.6423,-100.194 73.1591,-93.8073\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"72.8552,-86.4099 76.2899,-93.2747 72.9989,-89.9069 73.1426,-93.404 73.1426,-93.404 73.1426,-93.404 72.9989,-89.9069 69.9953,-93.5333 72.8552,-86.4099 72.8552,-86.4099\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"65\" y=\"-108.8\">a &amp; !b</text>\n",
"<path d=\"M137.393,-293.379C147.214,-294.681 156.356,-292.555 156.356,-287 156.356,-282.834 151.214,-280.596 144.499,-280.287\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"137.393,-280.621 144.238,-277.146 140.89,-280.457 144.386,-280.292 144.386,-280.292 144.386,-280.292 140.89,-280.457 144.533,-283.439 137.393,-280.621 137.393,-280.621\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"174.856\" y=\"-283.3\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node3\"><title>1</title>\n",
"<ellipse cx=\"200\" cy=\"-109\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<ellipse cx=\"200\" cy=\"-109\" fill=\"none\" rx=\"31\" ry=\"22\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"200\" y=\"-105.3\">1</text>\n",
"<ellipse cx=\"67.3561\" cy=\"-196\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<ellipse cx=\"67.3561\" cy=\"-196\" fill=\"none\" rx=\"22\" ry=\"22\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"67.3561\" y=\"-192.3\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>0-&gt;1</title>\n",
"<path d=\"M89.7777,-76.1512C110.587,-82.4097 141.076,-91.5792 164.556,-98.6409\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"171.288,-100.666 163.678,-101.666 167.937,-99.6576 164.585,-98.6495 164.585,-98.6495 164.585,-98.6495 167.937,-99.6576 165.492,-95.633 171.288,-100.666 171.288,-100.666\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"130.5\" y=\"-96.8\">b</text>\n",
"<path d=\"M111.365,-270.902C103.283,-257.33 91.2671,-237.152 81.832,-221.309\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"78.2263,-215.254 84.5144,-219.656 80.0171,-218.261 81.808,-221.268 81.808,-221.268 81.808,-221.268 80.0171,-218.261 79.1015,-222.88 78.2263,-215.254 78.2263,-215.254\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"102.856\" y=\"-239.8\">b</text>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g class=\"node\" id=\"node4\"><title>4</title>\n",
"<ellipse cx=\"200\" cy=\"-18\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"200\" y=\"-14.3\">4</text>\n",
"<ellipse cx=\"175.356\" cy=\"-196\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"175.356\" y=\"-192.3\">4</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>0-&gt;4</title>\n",
"<path d=\"M88.8635,-60.2328C111.131,-51.6942 145.085,-38.6741 169.404,-29.3489\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"175.99,-26.8235 170.582,-32.271 172.722,-28.0766 169.454,-29.3298 169.454,-29.3298 169.454,-29.3298 172.722,-28.0766 168.326,-26.3886 175.99,-26.8235 175.99,-26.8235\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"130.5\" y=\"-54.8\">!a &amp; !b</text>\n",
"<path d=\"M129.438,-271.303C138.435,-256.746 152.298,-234.312 162.439,-217.902\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"166.26,-211.718 165.26,-219.329 164.42,-214.696 162.581,-217.673 162.581,-217.673 162.581,-217.673 164.42,-214.696 159.901,-216.017 166.26,-211.718 166.26,-211.718\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"170.856\" y=\"-239.8\">!a &amp; !b</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge5\"><title>1-&gt;1</title>\n",
"<path d=\"M188.354,-129.581C186.743,-139.845 190.625,-149 200,-149 207.031,-149 210.973,-143.85 211.824,-136.945\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"211.646,-129.581 214.964,-136.502 211.73,-133.08 211.815,-136.579 211.815,-136.579 211.815,-136.579 211.73,-133.08 208.666,-136.655 211.646,-129.581 211.646,-129.581\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"200\" y=\"-152.8\">c &amp; d</text>\n",
"<path d=\"M87.9369,-204.37C98.2008,-205.528 107.356,-202.738 107.356,-196 107.356,-190.946 102.206,-188.113 95.3012,-187.501\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"87.9369,-187.63 94.8809,-184.358 91.4364,-187.569 94.9358,-187.508 94.9358,-187.508 94.9358,-187.508 91.4364,-187.569 94.9907,-190.657 87.9369,-187.63 87.9369,-187.63\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"123.356\" y=\"-192.3\">c &amp; d</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g class=\"node\" id=\"node5\"><title>2</title>\n",
"<ellipse cx=\"453\" cy=\"-99\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"453\" y=\"-95.3\">2</text>\n",
"<ellipse cx=\"68.3561\" cy=\"-18\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"68.3561\" y=\"-14.3\">2</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge6\"><title>1-&gt;2</title>\n",
"<path d=\"M222.782,-123.932C241.9,-136.075 270.957,-152.26 299,-159 322.335,-164.609 329.885,-165.458 353,-159 381.944,-150.914 410.852,-131.803 429.891,-117.306\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"435.472,-112.972 431.875,-119.753 432.708,-115.119 429.943,-117.265 429.943,-117.265 429.943,-117.265 432.708,-115.119 428.011,-114.777 435.472,-112.972 435.472,-112.972\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"326\" y=\"-166.8\">!c &amp; d</text>\n",
"<path d=\"M50.199,-181.727C34.8703,-168.686 13.4697,-147.255 4.35608,-123 -1.27155,-108.022 -1.54226,-101.873 4.35608,-87 13.1144,-64.9152 32.818,-45.8318 48.0656,-33.5506\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"53.866,-29.0284 50.2823,-35.8166 51.1058,-31.1804 48.3455,-33.3324 48.3455,-33.3324 48.3455,-33.3324 51.1058,-31.1804 46.4087,-30.8481 53.866,-29.0284 53.866,-29.0284\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"22.8561\" y=\"-101.3\">!c &amp; d</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g class=\"node\" id=\"node6\"><title>3</title>\n",
"<ellipse cx=\"326\" cy=\"-99\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"326\" y=\"-95.3\">3</text>\n",
"<ellipse cx=\"68.3561\" cy=\"-105\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"68.3561\" y=\"-101.3\">3</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge7\"><title>1-&gt;3</title>\n",
"<path d=\"M231.069,-108.727C246.096,-108.374 264.539,-107.612 281,-106 284.659,-105.642 288.476,-105.175 292.266,-104.653\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"299.474,-103.594 293.006,-107.728 296.011,-104.102 292.548,-104.611 292.548,-104.611 292.548,-104.611 296.011,-104.102 292.09,-101.495 299.474,-103.594 299.474,-103.594\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"265\" y=\"-111.8\">!d</text>\n",
"<path d=\"M56.8135,-176.159C52.3073,-165.855 48.6383,-152.816 51.3561,-141 52.4094,-136.42 54.1455,-131.745 56.1156,-127.365\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"59.3394,-120.78 59.0906,-128.452 57.8004,-123.923 56.2615,-127.067 56.2615,-127.067 56.2615,-127.067 57.8004,-123.923 53.4323,-125.682 59.3394,-120.78 59.3394,-120.78\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"57.3561\" y=\"-144.8\">!d</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge13\"><title>4-&gt;4</title>\n",
"<path d=\"M188.75,-34.6641C186.25,-44.625 190,-54 200,-54 207.5,-54 211.484,-48.7266 211.953,-41.8876\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"211.25,-34.6641 215.063,-41.3259 211.589,-38.1476 211.928,-41.6311 211.928,-41.6311 211.928,-41.6311 211.589,-38.1476 208.793,-41.9363 211.25,-34.6641 211.25,-34.6641\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"200\" y=\"-57.8\">1</text>\n",
"<path d=\"M191.646,-204.016C201.745,-205.949 211.356,-203.277 211.356,-196 211.356,-190.542 205.95,-187.674 198.986,-187.397\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"191.646,-187.984 198.373,-184.286 195.135,-187.705 198.624,-187.426 198.624,-187.426 198.624,-187.426 195.135,-187.705 198.875,-190.566 191.646,-187.984 191.646,-187.984\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"214.856\" y=\"-192.3\">1</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge8\"><title>2-&gt;1</title>\n",
"<path d=\"M431.922,-87.6352C412.452,-77.3145 381.724,-62.8411 353,-57 329.481,-52.2175 322.402,-51.6745 299,-57 273.353,-62.8365 247.181,-77.2435 228.343,-89.4163\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"222.246,-93.4432 226.351,-86.9567 225.167,-91.5141 228.087,-89.585 228.087,-89.585 228.087,-89.585 225.167,-91.5141 229.823,-92.2134 222.246,-93.4432 222.246,-93.4432\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"326\" y=\"-60.8\">c</text>\n",
"<path d=\"M82.9697,-29.0929C91.4609,-35.4971 101.918,-44.3722 109.356,-54 128.603,-78.9113 134.158,-92.7751 125.356,-123 119.215,-144.088 103.068,-163.203 89.3663,-176.43\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"84.0682,-181.376 87.035,-174.297 86.6265,-178.988 89.1847,-176.599 89.1847,-176.599 89.1847,-176.599 86.6265,-178.988 91.3345,-178.901 84.0682,-181.376 84.0682,-181.376\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"132.856\" y=\"-101.3\">c</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge9\"><title>2-&gt;2</title>\n",
"<path d=\"M442.102,-115.664C439.68,-125.625 443.312,-135 453,-135 460.266,-135 464.125,-129.727 464.58,-122.888\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"463.898,-115.664 467.692,-122.337 464.227,-119.149 464.556,-122.633 464.556,-122.633 464.556,-122.633 464.227,-119.149 461.42,-122.929 463.898,-115.664 463.898,-115.664\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"453\" y=\"-138.8\">!c</text>\n",
"<path d=\"M85.0201,-25.3828C94.9811,-27.0234 104.356,-24.5625 104.356,-18 104.356,-13.0781 99.0826,-10.4634 92.2436,-10.1558\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"85.0201,-10.6172 91.8051,-7.02727 88.513,-10.394 92.0059,-10.1709 92.0059,-10.1709 92.0059,-10.1709 88.513,-10.394 92.2067,-13.3145 85.0201,-10.6172 85.0201,-10.6172\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"109.856\" y=\"-14.3\">!c</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge10\"><title>3-&gt;1</title>\n",
"<path d=\"M301.585,-90.8211C286.491,-86.65 266.488,-83.1832 249,-87 243.078,-88.2925 237.012,-90.3852 231.273,-92.7783\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"224.713,-95.6958 229.829,-89.9729 227.911,-94.2735 231.109,-92.8511 231.109,-92.8511 231.109,-92.8511 227.911,-94.2735 232.389,-95.7293 224.713,-95.6958 224.713,-95.6958\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"265\" y=\"-90.8\">c &amp; d</text>\n",
"<path d=\"M68.1643,-123.066C68.0258,-135.398 67.8354,-152.339 67.6743,-166.682\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"67.5931,-173.908 64.522,-166.873 67.6324,-170.408 67.6718,-166.909 67.6718,-166.909 67.6718,-166.909 67.6324,-170.408 70.8216,-166.944 67.5931,-173.908 67.5931,-173.908\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"84.3561\" y=\"-144.8\">c &amp; d</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge11\"><title>3-&gt;2</title>\n",
"<path d=\"M353.204,-99C372.288,-99 398.281,-99 418.815,-99\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"425.83,-99 418.83,-102.15 422.33,-99 418.83,-99.0001 418.83,-99.0001 418.83,-99.0001 422.33,-99 418.83,-95.8501 425.83,-99 425.83,-99\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"389.5\" y=\"-102.8\">!c &amp; d</text>\n",
"<path d=\"M68.3561,-86.799C68.3561,-74.3561 68.3561,-57.3644 68.3561,-43.5044\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"68.3561,-36.1754 71.5062,-43.1754 68.3561,-39.6754 68.3562,-43.1754 68.3562,-43.1754 68.3562,-43.1754 68.3561,-39.6754 65.2062,-43.1755 68.3561,-36.1754 68.3561,-36.1754\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"86.8561\" y=\"-57.8\">!c &amp; d</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge12\"><title>3-&gt;3</title>\n",
"<path d=\"M315.453,-115.664C313.109,-125.625 316.625,-135 326,-135 333.031,-135 336.767,-129.727 337.206,-122.888\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"336.547,-115.664 340.32,-122.349 336.865,-119.15 337.183,-122.635 337.183,-122.635 337.183,-122.635 336.865,-119.15 334.046,-122.921 336.547,-115.664 336.547,-115.664\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"326\" y=\"-138.8\">!d</text>\n",
"<path d=\"M85.0201,-112.383C94.9811,-114.023 104.356,-111.562 104.356,-105 104.356,-100.078 99.0826,-97.4634 92.2436,-97.1558\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"85.0201,-97.6172 91.8051,-94.0273 88.513,-97.394 92.0059,-97.1709 92.0059,-97.1709 92.0059,-97.1709 88.513,-97.394 92.2067,-100.314 85.0201,-97.6172 85.0201,-97.6172\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"110.356\" y=\"-101.3\">!d</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text": [
"<IPython.core.display.SVG at 0x7fd0908b9278>"
"<IPython.core.display.SVG object>"
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you want to add some style options to the existing one, pass a dot to the `show()` function in addition to your own style options:"
]
},
{
"cell_type": "code",
"collapsed": false,
@ -448,12 +468,19 @@
"</svg>"
],
"text": [
"<IPython.core.display.SVG at 0x7fd081c25748>"
"<IPython.core.display.SVG object>"
]
}
],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The `translate()` function can also be called with a formula object. Either as a function, or as a method."
]
},
{
"cell_type": "code",
"collapsed": false,
@ -541,7 +568,7 @@
"</svg>\n"
],
"text": [
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fd090415330> >"
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f44bdff74b0> >"
]
}
],
@ -611,12 +638,19 @@
"</svg>\n"
],
"text": [
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fd090415450> >"
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f44bdff7510> >"
]
}
],
"prompt_number": 7
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When used as a method, all the arguments are translation options. Here is a monitor:"
]
},
{
"cell_type": "code",
"collapsed": false,
@ -680,12 +714,19 @@
"</svg>\n"
],
"text": [
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fd090415270> >"
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f44bdff73c0> >"
]
}
],
"prompt_number": 8
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The following three cells show a formulas for which it makes a difference to select `'small'` or `'deterministic'`."
]
},
{
"cell_type": "code",
"collapsed": false,
@ -723,80 +764,80 @@
"output_type": "pyout",
"prompt_number": 10,
"svg": [
"<svg height=\"177pt\" viewBox=\"0.00 0.00 305.00 177.00\" width=\"305pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<svg height=\"177pt\" viewBox=\"0.00 0.00 251.00 177.00\" width=\"251pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 173)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-173 301,-173 301,4 -4,4\" stroke=\"none\"/>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-173 247,-173 247,4 -4,4\" stroke=\"none\"/>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g class=\"node\" id=\"node2\"><title>0</title>\n",
"<ellipse cx=\"136\" cy=\"-113\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"136\" y=\"-109.3\">0</text>\n",
"<ellipse cx=\"109\" cy=\"-113\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"109\" y=\"-109.3\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>I-&gt;0</title>\n",
"<path d=\"M136,-167.845C136,-166.206 136,-151.846 136,-138.368\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"136,-131.058 139.15,-138.058 136,-134.558 136,-138.058 136,-138.058 136,-138.058 136,-134.558 132.85,-138.058 136,-131.058 136,-131.058\" stroke=\"black\"/>\n",
"<path d=\"M109,-167.845C109,-166.206 109,-151.846 109,-138.368\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"109,-131.058 112.15,-138.058 109,-134.558 109,-138.058 109,-138.058 109,-138.058 109,-134.558 105.85,-138.058 109,-131.058 109,-131.058\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node3\"><title>1</title>\n",
"<ellipse cx=\"31\" cy=\"-22\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<ellipse cx=\"31\" cy=\"-22\" fill=\"none\" rx=\"31\" ry=\"22\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"31\" y=\"-18.3\">1</text>\n",
"<ellipse cx=\"22\" cy=\"-22\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<ellipse cx=\"22\" cy=\"-22\" fill=\"none\" rx=\"22\" ry=\"22\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"22\" y=\"-18.3\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>0-&gt;1</title>\n",
"<path d=\"M119.594,-98.0938C102.512,-83.6149 75.5496,-60.7611 55.8524,-44.0653\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"50.5036,-39.5316 57.8803,-41.6549 53.1736,-41.7947 55.8435,-44.0578 55.8435,-44.0578 55.8435,-44.0578 53.1736,-41.7947 53.8067,-46.4608 50.5036,-39.5316 50.5036,-39.5316\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"96.5\" y=\"-65.8\">a</text>\n",
"<path d=\"M96.903,-99.6249C82.686,-85.081 58.8862,-60.7342 41.9306,-43.3887\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"36.9064,-38.2491 44.0522,-41.0528 39.353,-40.7519 41.7996,-43.2548 41.7996,-43.2548 41.7996,-43.2548 39.353,-40.7519 39.547,-45.4567 36.9064,-38.2491 36.9064,-38.2491\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"77.5\" y=\"-65.8\">a</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g class=\"node\" id=\"node4\"><title>2</title>\n",
"<ellipse cx=\"136\" cy=\"-22\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<ellipse cx=\"136\" cy=\"-22\" fill=\"none\" rx=\"31\" ry=\"22\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"136\" y=\"-18.3\">2</text>\n",
"<ellipse cx=\"109\" cy=\"-22\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<ellipse cx=\"109\" cy=\"-22\" fill=\"none\" rx=\"22\" ry=\"22\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"109\" y=\"-18.3\">2</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>0-&gt;2</title>\n",
"<path d=\"M136,-94.8399C136,-82.5378 136,-65.6842 136,-51.3928\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"136,-44.1905 139.15,-51.1905 136,-47.6905 136,-51.1905 136,-51.1905 136,-51.1905 136,-47.6905 132.85,-51.1906 136,-44.1905 136,-44.1905\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"139.5\" y=\"-65.8\">b</text>\n",
"<path d=\"M109,-94.8399C109,-82.5378 109,-65.6842 109,-51.3928\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"109,-44.1905 112.15,-51.1905 109,-47.6905 109,-51.1905 109,-51.1905 109,-51.1905 109,-47.6905 105.85,-51.1906 109,-44.1905 109,-44.1905\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"112.5\" y=\"-65.8\">b</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g class=\"node\" id=\"node5\"><title>3</title>\n",
"<ellipse cx=\"241\" cy=\"-22\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<ellipse cx=\"241\" cy=\"-22\" fill=\"none\" rx=\"31\" ry=\"22\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"241\" y=\"-18.3\">3</text>\n",
"<ellipse cx=\"196\" cy=\"-22\" fill=\"#ffffaa\" rx=\"18\" ry=\"18\" stroke=\"black\"/>\n",
"<ellipse cx=\"196\" cy=\"-22\" fill=\"none\" rx=\"22\" ry=\"22\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"196\" y=\"-18.3\">3</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>0-&gt;3</title>\n",
"<path d=\"M152.406,-98.0938C169.488,-83.6149 196.45,-60.7611 216.148,-44.0653\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"221.496,-39.5316 218.193,-46.4608 218.826,-41.7947 216.157,-44.0578 216.157,-44.0578 216.157,-44.0578 218.826,-41.7947 214.12,-41.6549 221.496,-39.5316 221.496,-39.5316\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"197.5\" y=\"-65.8\">c</text>\n",
"<path d=\"M121.097,-99.6249C135.314,-85.081 159.114,-60.7342 176.069,-43.3887\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"181.094,-38.2491 178.453,-45.4567 178.647,-40.7519 176.2,-43.2548 176.2,-43.2548 176.2,-43.2548 178.647,-40.7519 173.948,-41.0528 181.094,-38.2491 181.094,-38.2491\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"160.5\" y=\"-65.8\">c</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge5\"><title>1-&gt;1</title>\n",
"<path d=\"M59.6885,-30.5913C70.7806,-30.9731 80,-28.1094 80,-22 80,-17.3225 74.5958,-14.5475 67.0844,-13.6751\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"59.6885,-13.4087 66.7974,-10.5128 63.1862,-13.5347 66.684,-13.6607 66.684,-13.6607 66.684,-13.6607 63.1862,-13.5347 66.5705,-16.8087 59.6885,-13.4087 59.6885,-13.4087\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"83.5\" y=\"-18.3\">a</text>\n",
"<path d=\"M42.5808,-30.3702C52.8447,-31.5284 62,-28.7383 62,-22 62,-16.9463 56.8502,-14.1134 49.9451,-13.5015\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"42.5808,-13.6298 49.5248,-10.3582 46.0803,-13.5688 49.5797,-13.5077 49.5797,-13.5077 49.5797,-13.5077 46.0803,-13.5688 49.6347,-16.6573 42.5808,-13.6298 42.5808,-13.6298\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"65.5\" y=\"-18.3\">a</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge6\"><title>2-&gt;2</title>\n",
"<path d=\"M164.689,-30.5913C175.781,-30.9731 185,-28.1094 185,-22 185,-17.3225 179.596,-14.5475 172.084,-13.6751\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"164.689,-13.4087 171.797,-10.5128 168.186,-13.5347 171.684,-13.6607 171.684,-13.6607 171.684,-13.6607 168.186,-13.5347 171.571,-16.8087 164.689,-13.4087 164.689,-13.4087\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"188.5\" y=\"-18.3\">b</text>\n",
"<path d=\"M129.581,-30.3702C139.845,-31.5284 149,-28.7383 149,-22 149,-16.9463 143.85,-14.1134 136.945,-13.5015\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"129.581,-13.6298 136.525,-10.3582 133.08,-13.5688 136.58,-13.5077 136.58,-13.5077 136.58,-13.5077 133.08,-13.5688 136.635,-16.6573 129.581,-13.6298 129.581,-13.6298\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"152.5\" y=\"-18.3\">b</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge7\"><title>3-&gt;3</title>\n",
"<path d=\"M269.689,-30.5913C280.781,-30.9731 290,-28.1094 290,-22 290,-17.3225 284.596,-14.5475 277.084,-13.6751\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"269.689,-13.4087 276.797,-10.5128 273.186,-13.5347 276.684,-13.6607 276.684,-13.6607 276.684,-13.6607 273.186,-13.5347 276.571,-16.8087 269.689,-13.4087 269.689,-13.4087\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"293.5\" y=\"-18.3\">c</text>\n",
"<path d=\"M216.581,-30.3702C226.845,-31.5284 236,-28.7383 236,-22 236,-16.9463 230.85,-14.1134 223.945,-13.5015\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"216.581,-13.6298 223.525,-10.3582 220.08,-13.5688 223.58,-13.5077 223.58,-13.5077 223.58,-13.5077 220.08,-13.5688 223.635,-16.6573 216.581,-13.6298 216.581,-13.6298\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"239.5\" y=\"-18.3\">c</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text": [
"<IPython.core.display.SVG at 0x7fd081bdb198>"
"<IPython.core.display.SVG object>"
]
}
],
@ -986,17 +1027,24 @@
"</svg>"
],
"text": [
"<IPython.core.display.SVG at 0x7fd081b6e9b0>"
"<IPython.core.display.SVG object>"
]
}
],
"prompt_number": 11
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here is how to build an unambiguous automaton:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"a = spot.translate('F(a & X(!a &Xb))', pref=\"any\"); a"
"spot.translate('GFa -> GFb', 'unambig')"
],
"language": "python",
"metadata": {},
@ -1005,6 +1053,372 @@
"metadata": {},
"output_type": "pyout",
"prompt_number": 12,
"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=\"302pt\" height=\"295pt\"\n",
" viewBox=\"0.00 0.00 301.50 295.16\" 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 291.16)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-291.16 297.5,-291.16 297.5,4 -4,4\"/>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\"><title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-107.16\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-103.46\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\"><title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15491,-107.16C2.79388,-107.16 17.1543,-107.16 30.6317,-107.16\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.9419,-107.16 30.9419,-110.31 34.4419,-107.16 30.9419,-107.16 30.9419,-107.16 30.9419,-107.16 34.4419,-107.16 30.9418,-104.01 37.9419,-107.16 37.9419,-107.16\"/>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\"><title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"157.5\" cy=\"-188.16\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"157.5\" y=\"-184.46\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge2\" class=\"edge\"><title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M66.5112,-121.807C72.9549,-130.98 82.0794,-142.636 92,-151.16 104.757,-162.122 121.236,-171.509 134.344,-178.086\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"140.854,-181.263 133.181,-181.024 137.708,-179.728 134.563,-178.193 134.563,-178.193 134.563,-178.193 137.708,-179.728 135.944,-175.362 140.854,-181.263 140.854,-181.263\"/>\n",
"<text text-anchor=\"middle\" x=\"105.5\" y=\"-172.96\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node4\" class=\"node\"><title>2</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"273\" cy=\"-127.16\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"273\" y=\"-123.46\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;2 -->\n",
"<g id=\"edge3\" class=\"edge\"><title>0&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M74.1079,-109.003C100.327,-111.801 152.035,-117.211 196,-121.16 213.175,-122.703 232.554,-124.23 247.444,-125.357\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"254.786,-125.908 247.57,-128.525 251.296,-125.646 247.806,-125.384 247.806,-125.384 247.806,-125.384 251.296,-125.646 248.042,-122.243 254.786,-125.908 254.786,-125.908\"/>\n",
"<text text-anchor=\"start\" x=\"137\" y=\"-122.96\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; !b</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node5\" class=\"node\"><title>3</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"157.5\" cy=\"-50.1603\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"157.5\" y=\"-46.4603\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;3 -->\n",
"<g id=\"edge4\" class=\"edge\"><title>0&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M72.1119,-98.5032C89.0117,-88.8219 116.498,-73.076 135.486,-62.1985\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"141.572,-58.7121 137.064,-64.925 138.535,-60.4519 135.498,-62.1917 135.498,-62.1917 135.498,-62.1917 138.535,-60.4519 133.932,-59.4584 141.572,-58.7121 141.572,-58.7121\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-89.9603\" font-family=\"Lato\" font-size=\"14.00\">a | b</text>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g id=\"node6\" class=\"node\"><title>4</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"273\" cy=\"-31.1603\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"273\" y=\"-27.4603\" font-family=\"Lato\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;4 -->\n",
"<g id=\"edge5\" class=\"edge\"><title>0&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M64.2827,-91.086C75.861,-67.75 100.908,-25.398 137,-8.1603 173.984,9.50377 222.376,-7.05194 250.041,-19.7503\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"256.608,-22.8724 248.934,-22.7117 253.447,-21.3696 250.286,-19.8668 250.286,-19.8668 250.286,-19.8668 253.447,-21.3696 251.639,-17.0219 256.608,-22.8724 256.608,-22.8724\"/>\n",
"<text text-anchor=\"start\" x=\"137\" y=\"-11.9603\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; !b</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge6\" class=\"edge\"><title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M152.858,-205.57C151.992,-215.248 153.539,-224.16 157.5,-224.16 160.409,-224.16 162.016,-219.354 162.321,-212.968\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"162.142,-205.57 165.461,-212.492 162.227,-209.069 162.312,-212.568 162.312,-212.568 162.312,-212.568 162.227,-209.069 159.163,-212.645 162.142,-205.57 162.142,-205.57\"/>\n",
"<text text-anchor=\"start\" x=\"153\" y=\"-242.96\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"149.5\" y=\"-227.96\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#5da5da\">\u24ff</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge7\" class=\"edge\"><title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M150.502,-204.756C145.214,-226.024 147.547,-254.16 157.5,-254.16 166.403,-254.16 169.209,-231.646 165.917,-211.673\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"164.498,-204.756 168.991,-210.981 165.202,-208.185 165.905,-211.613 165.905,-211.613 165.905,-211.613 165.202,-208.185 162.819,-212.246 164.498,-204.756 164.498,-204.756\"/>\n",
"<text text-anchor=\"start\" x=\"151\" y=\"-257.96\" font-family=\"Lato\" font-size=\"14.00\">!b</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge8\" class=\"edge\"><title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M263.425,-142.702C260.73,-153.069 263.922,-163.16 273,-163.16 279.95,-163.16 283.45,-157.245 283.499,-149.819\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"282.575,-142.702 286.6,-149.237 283.026,-146.173 283.477,-149.643 283.477,-149.643 283.477,-149.643 283.026,-146.173 280.353,-150.049 282.575,-142.702 282.575,-142.702\"/>\n",
"<text text-anchor=\"start\" x=\"252.5\" y=\"-181.96\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; !b</text>\n",
"<text text-anchor=\"start\" x=\"265\" y=\"-166.96\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#5da5da\">\u24ff</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g id=\"edge9\" class=\"edge\"><title>3&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M172.875,-59.9124C192.831,-73.4509 229.029,-98.0082 251.724,-113.405\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"257.742,-117.487 250.181,-116.164 254.845,-115.522 251.949,-113.557 251.949,-113.557 251.949,-113.557 254.845,-115.522 253.718,-110.951 257.742,-117.487 257.742,-117.487\"/>\n",
"<text text-anchor=\"start\" x=\"196\" y=\"-105.96\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; !b</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;3 -->\n",
"<g id=\"edge10\" class=\"edge\"><title>3&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M148.521,-66.0763C146.179,-76.3107 149.172,-86.1603 157.5,-86.1603 163.876,-86.1603 167.125,-80.3866 167.246,-73.0871\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"166.479,-66.0763 170.372,-72.6918 166.86,-69.5555 167.241,-73.0347 167.241,-73.0347 167.241,-73.0347 166.86,-69.5555 164.11,-73.3777 166.479,-66.0763 166.479,-66.0763\"/>\n",
"<text text-anchor=\"start\" x=\"144\" y=\"-89.9603\" font-family=\"Lato\" font-size=\"14.00\">a | b</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g id=\"edge11\" class=\"edge\"><title>3&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M175.601,-51.3981C191.679,-52.1201 216.301,-52.083 237,-47.1603 241.436,-46.1053 245.995,-44.4755 250.295,-42.6526\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"256.785,-39.6836 251.73,-45.4601 253.602,-41.1396 250.42,-42.5956 250.42,-42.5956 250.42,-42.5956 253.602,-41.1396 249.109,-39.7311 256.785,-39.6836 256.785,-39.6836\"/>\n",
"<text text-anchor=\"start\" x=\"196\" y=\"-54.9603\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; !b</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;3 -->\n",
"<g id=\"edge12\" class=\"edge\"><title>4&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M255.068,-27.6221C239.446,-25.0259 215.751,-22.7942 196,-28.1603 189.927,-29.8102 183.832,-32.719 178.374,-35.8916\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"172.298,-39.6776 176.573,-33.3021 175.268,-37.8266 178.239,-35.9756 178.239,-35.9756 178.239,-35.9756 175.268,-37.8266 179.905,-38.649 172.298,-39.6776 172.298,-39.6776\"/>\n",
"<text text-anchor=\"start\" x=\"203\" y=\"-31.9603\" font-family=\"Lato\" font-size=\"14.00\">a | b</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;4 -->\n",
"<g id=\"edge13\" class=\"edge\"><title>4&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M263.425,-46.7018C260.73,-57.069 263.922,-67.1603 273,-67.1603 279.95,-67.1603 283.45,-61.245 283.499,-53.8194\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"282.575,-46.7018 286.6,-53.2374 283.026,-50.1726 283.477,-53.6434 283.477,-53.6434 283.477,-53.6434 283.026,-50.1726 280.353,-54.0493 282.575,-46.7018 282.575,-46.7018\"/>\n",
"<text text-anchor=\"start\" x=\"252.5\" y=\"-70.9603\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; !b</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 0x7f44bdff7420> >"
]
}
],
"prompt_number": 12
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Compare with the standard translation:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.translate('GFa -> GFb')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 13,
"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=\"165pt\" height=\"227pt\"\n",
" viewBox=\"0.00 0.00 165.00 227.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 223)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-223 161,-223 161,4 -4,4\"/>\n",
"<!-- I -->\n",
"<!-- 1 -->\n",
"<g id=\"node2\" class=\"node\"><title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-97\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-93.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- I&#45;&gt;1 -->\n",
"<g id=\"edge1\" class=\"edge\"><title>I&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15491,-97C2.79388,-97 17.1543,-97 30.6317,-97\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.9419,-97 30.9419,-100.15 34.4419,-97 30.9419,-97.0001 30.9419,-97.0001 30.9419,-97.0001 34.4419,-97 30.9418,-93.8501 37.9419,-97 37.9419,-97\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge4\" class=\"edge\"><title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M49.6208,-114.037C48.3189,-123.858 50.4453,-133 56,-133 60.166,-133 62.4036,-127.858 62.7128,-121.143\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"62.3792,-114.037 65.8541,-120.882 62.5434,-117.533 62.7076,-121.03 62.7076,-121.03 62.7076,-121.03 62.5434,-117.533 59.561,-121.177 62.3792,-114.037 62.3792,-114.037\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-136.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=\"139\" cy=\"-153\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"139\" y=\"-149.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge3\" class=\"edge\"><title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M71.4812,-107.012C84.3818,-115.931 103.39,-129.072 117.788,-139.026\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"123.644,-143.075 116.095,-141.685 120.765,-141.085 117.886,-139.094 117.886,-139.094 117.886,-139.094 120.765,-141.085 119.678,-136.503 123.644,-143.075 123.644,-143.075\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-131.8\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node4\" class=\"node\"><title>2</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"139\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"139\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g id=\"edge5\" class=\"edge\"><title>1&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M69.6562,-84.6562C83.209,-71.4381 104.825,-50.3563 120.113,-35.4454\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"125.433,-30.2571 122.621,-37.3997 122.927,-32.7008 120.421,-35.1446 120.421,-35.1446 120.421,-35.1446 122.927,-32.7008 118.222,-32.8895 125.433,-30.2571 125.433,-30.2571\"/>\n",
"<text text-anchor=\"start\" x=\"93\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\"><title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M131.969,-169.664C130.406,-179.625 132.75,-189 139,-189 143.688,-189 146.178,-183.727 146.471,-176.888\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"146.031,-169.664 149.601,-176.46 146.244,-173.158 146.456,-176.651 146.456,-176.651 146.456,-176.651 146.244,-173.158 143.312,-176.842 146.031,-169.664 146.031,-169.664\"/>\n",
"<text text-anchor=\"start\" x=\"133.5\" y=\"-207.8\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"<text text-anchor=\"start\" x=\"131\" y=\"-192.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#5da5da\">\u24ff</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge6\" class=\"edge\"><title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M135.405,-35.7817C134.794,-45.3149 135.992,-54 139,-54 141.209,-54 142.442,-49.3161 142.699,-43.0521\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"142.595,-35.7817 145.845,-42.736 142.645,-39.2814 142.695,-42.781 142.695,-42.781 142.695,-42.781 142.645,-39.2814 139.546,-42.8261 142.595,-35.7817 142.595,-35.7817\"/>\n",
"<text text-anchor=\"start\" x=\"134.5\" y=\"-72.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"131\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#5da5da\">\u24ff</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge7\" class=\"edge\"><title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M133.494,-35.249C129.587,-56.4346 131.422,-84 139,-84 145.749,-84 147.943,-62.1347 145.582,-42.3851\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"144.506,-35.249 148.665,-41.7011 145.028,-38.7099 145.55,-42.1708 145.55,-42.1708 145.55,-42.1708 145.028,-38.7099 142.435,-42.6405 144.506,-35.249 144.506,-35.249\"/>\n",
"<text text-anchor=\"start\" x=\"132.5\" y=\"-87.8\" font-family=\"Lato\" font-size=\"14.00\">!b</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 0x7f44bdff72d0> >"
]
}
],
"prompt_number": 13
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"And here is the automaton above with state-based acceptance:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.translate('GFa -> GFb', 'sbacc')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 14,
"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=\"258pt\" height=\"180pt\"\n",
" viewBox=\"0.00 0.00 258.00 180.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 176)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-176 254,-176 254,4 -4,4\"/>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\"><title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-76\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-72.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\"><title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15491,-76C2.79388,-76 17.1543,-76 30.6317,-76\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.9419,-76 30.9419,-79.1501 34.4419,-76 30.9419,-76.0001 30.9419,-76.0001 30.9419,-76.0001 34.4419,-76 30.9418,-72.8501 37.9419,-76 37.9419,-76\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge3\" class=\"edge\"><title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M49.6208,-93.0373C48.3189,-102.858 50.4453,-112 56,-112 60.166,-112 62.4036,-106.858 62.7128,-100.143\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"62.3792,-93.0373 65.8541,-99.8818 62.5434,-96.5335 62.7076,-100.03 62.7076,-100.03 62.7076,-100.03 62.5434,-96.5335 59.561,-100.177 62.3792,-93.0373 62.3792,-93.0373\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-115.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\"><title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"143\" cy=\"-117\" rx=\"18\" ry=\"18\"/>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"143\" cy=\"-117\" rx=\"22\" ry=\"22\"/>\n",
"<text text-anchor=\"middle\" x=\"143\" y=\"-113.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge2\" class=\"edge\"><title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M72.5903,-83.52C84.8926,-89.4541 102.305,-97.8532 116.612,-104.754\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"122.938,-107.805 115.264,-107.601 119.785,-106.285 116.633,-104.764 116.633,-104.764 116.633,-104.764 119.785,-106.285 118.001,-101.927 122.938,-107.805 122.938,-107.805\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-100.8\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node4\" class=\"node\"><title>2</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"143\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"143\" cy=\"-22\" rx=\"22\" ry=\"22\"/>\n",
"<text text-anchor=\"middle\" x=\"143\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;2 -->\n",
"<g id=\"edge4\" class=\"edge\"><title>0&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M71.8059,-66.5939C84.5413,-58.5032 103.153,-46.6792 118.012,-37.2391\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"124.123,-33.3572 119.904,-39.7697 121.169,-35.234 118.214,-37.1109 118.214,-37.1109 118.214,-37.1109 121.169,-35.234 116.525,-34.452 124.123,-33.3572 124.123,-33.3572\"/>\n",
"<text text-anchor=\"start\" x=\"93\" y=\"-55.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge5\" class=\"edge\"><title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M134.994,-137.581C133.886,-147.845 136.555,-157 143,-157 147.834,-157 150.544,-151.85 151.129,-144.945\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"151.006,-137.581 154.273,-144.527 151.065,-141.08 151.123,-144.58 151.123,-144.58 151.123,-144.58 151.065,-141.08 147.973,-144.632 151.006,-137.581 151.006,-137.581\"/>\n",
"<text text-anchor=\"start\" x=\"137.5\" y=\"-160.8\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge6\" class=\"edge\"><title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M134.994,-42.5808C133.886,-52.8447 136.555,-62 143,-62 147.834,-62 150.544,-56.8502 151.129,-49.9451\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"151.006,-42.5808 154.273,-49.5273 151.065,-46.0803 151.123,-49.5798 151.123,-49.5798 151.123,-49.5798 151.065,-46.0803 147.973,-49.6324 151.006,-42.5808 151.006,-42.5808\"/>\n",
"<text text-anchor=\"start\" x=\"138.5\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node5\" class=\"node\"><title>3</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"232\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"232\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;3 -->\n",
"<g id=\"edge7\" class=\"edge\"><title>2&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M165.06,-22C177.588,-22 193.534,-22 206.607,-22\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"213.925,-22 206.925,-25.1501 210.425,-22 206.925,-22.0001 206.925,-22.0001 206.925,-22.0001 210.425,-22 206.925,-18.8501 213.925,-22 213.925,-22\"/>\n",
"<text text-anchor=\"start\" x=\"183\" y=\"-25.8\" font-family=\"Lato\" font-size=\"14.00\">!b</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g id=\"edge8\" class=\"edge\"><title>3&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M216.689,-12.1343C210.598,-8.50652 203.237,-4.83778 196,-3 186.646,-0.624833 176.631,-3.03558 167.911,-6.84342\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"161.529,-9.97151 166.428,-4.06232 164.671,-8.4312 167.814,-6.8909 167.814,-6.8909 167.814,-6.8909 164.671,-8.4312 169.201,-9.71947 161.529,-9.97151 161.529,-9.97151\"/>\n",
"<text text-anchor=\"start\" x=\"185\" y=\"-6.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;3 -->\n",
"<g id=\"edge9\" class=\"edge\"><title>3&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M224.617,-38.6641C222.977,-48.625 225.438,-58 232,-58 236.922,-58 239.537,-52.7266 239.844,-45.8876\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"239.383,-38.6641 242.973,-45.449 239.606,-42.1569 239.829,-45.6498 239.829,-45.6498 239.829,-45.6498 239.606,-42.1569 236.686,-45.8507 239.383,-38.6641 239.383,-38.6641\"/>\n",
"<text text-anchor=\"start\" x=\"225.5\" y=\"-61.8\" font-family=\"Lato\" font-size=\"14.00\">!b</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 0x7f44bdff7360> >"
]
}
],
"prompt_number": 14
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Some example of running the self-loopization algorithm on an automaton:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"a = spot.translate('F(a & X(!a &Xb))', \"any\"); a"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 15,
"svg": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
@ -1079,11 +1493,11 @@
"</svg>\n"
],
"text": [
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fd090415390> >"
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f44bdff7450> >"
]
}
],
"prompt_number": 12
"prompt_number": 15
},
{
"cell_type": "code",
@ -1097,7 +1511,7 @@
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 13,
"prompt_number": 16,
"svg": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
@ -1553,11 +1967,11 @@
"</svg>\n"
],
"text": [
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fd090415480> >"
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f44bdfd9ba0> >"
]
}
],
"prompt_number": 13
"prompt_number": 16
},
{
"cell_type": "code",
@ -1571,13 +1985,20 @@
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 14,
"prompt_number": 17,
"text": [
"False"
]
}
],
"prompt_number": 14
"prompt_number": 17
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Reading from file (see `automaton-io.ipynb` for more examples)."
]
},
{
"cell_type": "code",
@ -1616,7 +2037,7 @@
]
}
],
"prompt_number": 15
"prompt_number": 18
},
{
"cell_type": "code",
@ -1631,7 +2052,7 @@
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 16,
"prompt_number": 19,
"svg": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
@ -1749,11 +2170,11 @@
"</svg>\n"
],
"text": [
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fd0904153c0> >"
"<spot_impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f44c5f30cc0> >"
]
}
],
"prompt_number": 16
"prompt_number": 19
},
{
"cell_type": "code",
@ -1764,7 +2185,7 @@
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 17
"prompt_number": 20
}
],
"metadata": {}