dot: Add option @ to support aliases

Fixes #497.

* spot/twaalgos/dot.cc: Implement this option.
* tests/core/ltl2tgba.test, tests/core/randaut.test: @ is
now a valid option for --dot, use something else.
* tests/python/aliases.ipynb: New file.
* tests/Makefile.am, doc/org/tut.org: Add it.
* doc/org/hoa.org: Mention aliases.
* NEWS: Mention this new feature.
This commit is contained in:
Alexandre Duret-Lutz 2022-02-03 17:49:11 +01:00
parent 4506643632
commit 9b0a20412b
8 changed files with 1072 additions and 28 deletions

3
NEWS
View file

@ -36,6 +36,9 @@ New in spot 2.10.4.dev (net yet released)
alphabet, in applications where using atomic propositions is
inconvenient.
- print_dot() learned option "@" to display aliases, as discussed
above.
New in spot 2.10.4 (2022-02-01)
Bug fixed:

View file

@ -694,10 +694,11 @@ named properties of any type. When attaching a property to a TωA, you
only supply a name for the property, a pointer, and an optional
destructor function.
There are currently two [[file:concepts.org::#named-properties][named properties]] related to the HOA format.
There are currently three [[file:concepts.org::#named-properties][named properties]] related to the HOA format.
- =automaton-name= :: Is a string that stores the name of the automaton (the one given after =name:= in the HOA format)
- =state-names= :: is a vector of strings that stores the name of the states (in case states are named in the HOA format)
- =state-names= :: Is a vector of strings that stores the name of the states (in case states are named in the HOA format)
- =aliases= :: Is a vector of pairs (name, BDD) that declares aliases to use in the HOA format
You can see these properties being preserved when an automaton is read and then immediately output:
@ -710,14 +711,15 @@ States: 3
Start: 0
AP: 2 "a" "b"
Acceptance: 2 Inf(0)&Inf(1)
Alias: @x 0&1
--BODY--
State: 0 {0}
[0&!1] 0
[0&1] 1
[@x] 1
[!0] 2
State: 1 "I am a state"
[0] 1 {1}
[0&1] 2 {1}
[@x] 2 {1}
State: 2 "so am I"
[!0] 1 {0 1}
[0] 2 {0 1}
@ -727,7 +729,7 @@ autfilt hw.hoa
#+END_SRC
#+RESULTS: hello-world
#+BEGIN_SRC hoa
#+begin_SRC hoa
HOA: v1
name: "hello world!"
States: 3
@ -736,27 +738,29 @@ AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels state-acc
Alias: @x 0&1
--BODY--
State: 0 {0}
[0&!1] 0
[0&1] 1
[@x] 1
[!0] 2
State: 1 "I am a state" {1}
[0] 1
[0&1] 2
[@x | 0&!1] 1
[@x] 2
State: 2 "so am I" {0 1}
[!0] 1
[0] 2
[@x | 0&!1] 2
--END--
#+END_SRC
#+end_SRC
However if =autfilt= performs some transformation, and actually has to
However when Spot performs some transformation, and actually has to
construct a new automaton, those properties will not be quarried over
to the new automaton. First because it is not obvious that the new
automaton should have the same name, and second because if a new
automaton is created, there might not be clear correspondence between
the old states and the new ones.
the old states and the new ones. =autfilt= tries to preserve aliases
by reintroducing them to the automaton before it is outputs it (unless
option =--aliases=drop= is used).
Here is for instance the result when =autfilt= is instructed to
simplify the automaton:
@ -766,7 +770,7 @@ autfilt --small hw.hoa
#+END_SRC
#+RESULTS:
#+BEGIN_SRC hoa
#+begin_SRC hoa
HOA: v1
States: 3
Start: 0
@ -774,20 +778,20 @@ AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
Alias: @x 0&1
--BODY--
State: 0
[0&!1] 0
[0&1] 1
[@x] 1
[!0] 2
State: 1
[0&!1] 1
[0&1] 2
[@x] 2
State: 2 {0}
[!0] 1
[0] 2
[@x | 0&!1] 2
--END--
#+END_SRC
#+end_SRC
Note that if the name of the automaton is important to you, it can be
fixed via the =--name= option. For instance =--name=%M= will
@ -822,9 +826,10 @@ State: 2 {0}
--END--
#+END_SRC
The page about [[file:oaut.org][common output option for automata]] has a section showing
how =--name= can be used to construct complex pipelines with automata that
preserve their equivalent LTL formula in the =name:= field.
The page about [[file:oaut.org][common output options for automata]] has a section
showing how =--name= can be used to construct complex pipelines with
automata that preserve their equivalent LTL formula in the =name:=
field.
* Streaming support

View file

@ -93,6 +93,7 @@ real notebooks instead.
- [[https://spot.lrde.epita.fr/ipynb/stutter-inv.html][=stutter-inv.ipynb=]] working with stutter-invariant formulas properties.
- [[https://spot.lrde.epita.fr/ipynb/satmin.html][=satmin.ipynb=]] Python interface for [[file:satmin.org][SAT-based minimization of deterministic ω-automata]].
- [[https://spot.lrde.epita.fr/ipynb/twagraph-internals.html][=twagraph-internals.ipynb=]] Inner workings of the =twa_graph= class.
- [[https://spot.lrde.epita.fr/ipynb/aliases.html][=aliases.ipynb=]] Support for HOA aliases.
- [[https://spot.lrde.epita.fr/ipynb/zlktree.html][=zlktree.ipynb=]] demonstration of Zielonka Trees and ACD
# LocalWords: utf html bdd IPython ipynb io randaut accparse acc

View file

@ -32,6 +32,7 @@
#include <spot/twa/formula2bdd.hh>
#include <spot/twaalgos/sccinfo.hh>
#include <spot/kripke/fairkripke.hh>
#include <spot/twaalgos/hoa.hh>
#include <cstdlib>
#include <cstring>
#include <algorithm>
@ -83,6 +84,7 @@ namespace spot
std::map<std::pair<int, int>, int> univ_done;
std::vector<bool> true_states_;
std::vector<bool>* state_player_;
std::unique_ptr<hoa_alias_formater> haf_ = nullptr;
acc_cond::mark_t inf_sets_ = {};
acc_cond::mark_t fin_sets_ = {};
@ -112,6 +114,7 @@ namespace spot
bool max_states_given_ = false; // related to max_states_
bool opt_latex_ = false;
bool opt_showlabel_ = true;
bool opt_aliases_ = false;
const char* nl_ = "\\n";
const char* label_pre_ = "label=\"";
char label_post_ = '"';
@ -225,6 +228,9 @@ namespace spot
case '1':
inline_state_names_ = false;
break;
case '@':
opt_aliases_ = true;
break;
case 'a':
opt_show_acc_ = true;
break;
@ -479,6 +485,11 @@ namespace spot
std::ostream&
format_label(std::ostream& os, bdd label) const
{
if (haf_)
{
os << haf_->encode_label(label);
return os;
}
return format_label(os, bdd_to_formula(label, aut_->get_dict()));
}
@ -970,6 +981,37 @@ namespace spot
if (opt_hide_true_states_)
find_true_states();
if (opt_aliases_ &&
aut->get_named_prop
<std::vector<std::pair<std::string, bdd>>>("aliases"))
{
const char* falsestr = "0";
const char* truestr = "1";
const char* orstr = " | ";
const char* andstr = " & ";
const char* notstr = "!";
const char* lparstr = "(";
const char* rparstr = ")";
if (opt_html_labels_)
{
andstr = " &amp; ";
}
haf_.reset(new hoa_alias_formater
(aut, falsestr, truestr, orstr, andstr,
notstr, lparstr, rparstr,
[this, d=aut->get_dict()](int var)->std::string
{
const bdd_dict::bdd_info& i = d->bdd_map[var];
if (SPOT_UNLIKELY(i.type != bdd_dict::var))
throw std::runtime_error
("print_dot(): unknown BDD variable");
std::ostringstream os;
format_label(os, i.f);
return os.str();
}));
}
sn_ = aut->get_named_prop<std::vector<std::string>>("state-names");
// We have no names. Do we have product sources?
if (!sn_)

View file

@ -351,6 +351,7 @@ if USE_PYTHON
TESTS_ipython = \
python/acc_cond.ipynb \
python/accparse.ipynb \
python/aliases.ipynb \
python/alternation.ipynb \
python/atva16-fig2a.ipynb \
python/atva16-fig2b.ipynb \

View file

@ -1,6 +1,6 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2019 Laboratoire de Recherche et Développement de
# Copyright (C) 2009-2019, 2022 Laboratoire de Recherche et Développement de
# l'Epita (LRDE).
# Copyright (C) 2003-2004 Laboratoire d'Informatique de Paris 6
# (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
@ -230,8 +230,8 @@ for a in 'a1;a2' 'a1[*];a2[*]'; do
done
# test unknown dot options
ltl2tgba --dot=@ a 2>stderr && exit 1
grep 'ltl2tgba: unknown option.*@' stderr
ltl2tgba --dot='~' a 2>stderr && exit 1
grep 'ltl2tgba: unknown option.*~' stderr
# Make sure the count of AP is correct through never claims or LBTT
ltl2tgba -f a -s | autfilt -q --ap=1 --lbtt | autfilt -q --ap=1

View file

@ -1,6 +1,6 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2018, 2020 Laboratoire de Recherche et
# Copyright (C) 2014-2018, 2020, 2022 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
#
# This file is part of Spot, a model checking library.
@ -79,8 +79,8 @@ diff out expected
randaut -n 5 --stats='name: "%F-%L-%s-%c-%e"' a >out2
diff out2 expected
randaut -n 5 --dot=@ a 2>stderr && exit 1
grep 'randaut: unknown option.*@' stderr
randaut -n 5 --dot='~' a 2>stderr && exit 1
grep 'randaut: unknown option.*~' stderr
randaut -n -1 -Q2 2 -H | autfilt -H --is-deterministic -n 3 -o out.hoa
randaut -n -1 -Q2 2 -H | autfilt -H -v --is-deterministic -n 4 -o '>>out.hoa'

992
tests/python/aliases.ipynb Normal file
View file

@ -0,0 +1,992 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "4ea4978c",
"metadata": {},
"outputs": [],
"source": [
"import spot\n",
"from spot.jupyter import display_inline\n",
"from buddy import bdd_ithvar\n",
"spot.setup()"
]
},
{
"cell_type": "markdown",
"id": "4dc12445",
"metadata": {},
"source": [
"Aliases is a feature of the HOA format that allows Boolean formulas to be named and reused to label automata. This can be helpful to reduce the size of a file, but it can also be abused to \"fake\" arbritary alphabets by using an alphabet of $n$ aliases encoded over $\\log_2(n)$ atomic propositions. \n",
"\n",
"Spot knows how to read HOA files containing aliases since version 2.0. However support for producing files with aliases was only added in version 2.11.\n",
"\n",
"When a HOA file containing aliases is read, the aliases are automatically expanded to define the automaton."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "09bc3560",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div style='vertical-align:text-top;display:inline-block;width:50%;'><?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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"115pt\" height=\"255pt\"\n",
" viewBox=\"0.00 0.00 115.00 255.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.0 1.0) rotate(0) translate(4 251)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-251 111,-251 111,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"8\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\">Inf(</text>\n",
"<text text-anchor=\"start\" x=\"29\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"45\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\">)&amp;Inf(</text>\n",
"<text text-anchor=\"start\" x=\"79\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"<text text-anchor=\"start\" x=\"95\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"11\" y=\"-218.8\" font-family=\"Lato\" font-size=\"14.00\">[gen. Büchi 2]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"67.25\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"67.25\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M12.4,-18C14.04,-18 28.4,-18 41.88,-18\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"49.19,-18 42.19,-21.15 45.69,-18 42.19,-18 42.19,-18 42.19,-18 45.69,-18 42.19,-14.85 49.19,-18 49.19,-18\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M65.62,-36.15C65.37,-45.54 65.91,-54 67.25,-54 68.23,-54 68.78,-49.44 68.91,-43.3\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"68.88,-36.15 72.06,-43.14 68.89,-39.65 68.91,-43.15 68.91,-43.15 68.91,-43.15 68.89,-39.65 65.76,-43.17 68.88,-36.15 68.88,-36.15\"/>\n",
"<text text-anchor=\"start\" x=\"38.75\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\">!p0 &amp; !p1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M64.54,-35.98C63.1,-53.2 64,-72 67.25,-72 70.04,-72 71.1,-58.12 70.43,-43.28\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"69.96,-35.98 73.55,-42.76 70.18,-39.47 70.41,-42.96 70.41,-42.96 70.41,-42.96 70.18,-39.47 67.26,-43.17 69.96,-35.98 69.96,-35.98\"/>\n",
"<text text-anchor=\"start\" x=\"40.75\" y=\"-90.8\" font-family=\"Lato\" font-size=\"14.00\">p0 &amp; !p1</text>\n",
"<text text-anchor=\"start\" x=\"59.25\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M64.02,-35.87C60.77,-63.52 61.84,-102 67.25,-102 72.21,-102 73.53,-69.58 71.19,-42.87\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"70.48,-35.87 74.32,-42.52 70.84,-39.35 71.19,-42.83 71.19,-42.83 71.19,-42.83 70.84,-39.35 68.06,-43.15 70.48,-35.87 70.48,-35.87\"/>\n",
"<text text-anchor=\"start\" x=\"40.75\" y=\"-120.8\" font-family=\"Lato\" font-size=\"14.00\">!p0 &amp; p1</text>\n",
"<text text-anchor=\"start\" x=\"59.25\" y=\"-105.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M63.65,-35.75C58.48,-72.48 59.67,-132 67.25,-132 74.35,-132 75.85,-79.68 71.74,-42.88\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"70.85,-35.75 74.84,-42.3 71.28,-39.22 71.72,-42.69 71.72,-42.69 71.72,-42.69 71.28,-39.22 68.59,-43.08 70.85,-35.75 70.85,-35.75\"/>\n",
"<text text-anchor=\"start\" x=\"42.75\" y=\"-149.8\" font-family=\"Lato\" font-size=\"14.00\">p0 &amp; p1</text>\n",
"<text text-anchor=\"start\" x=\"51.25\" y=\"-135.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"67.25\" y=\"-135.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n",
"</div><div style='vertical-align:text-top;display:inline-block;width:50%;'><?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.43.0 (0)\n",
" -->\n",
"<!-- Title: g Pages: 1 -->\n",
"<svg width=\"655pt\" height=\"376pt\"\n",
" viewBox=\"0.00 0.00 655.00 376.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.0 1.0) rotate(0) translate(4 372)\">\n",
"<title>g</title>\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-372 651,-372 651,4 -4,4\"/>\n",
"<!-- states -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>states</title>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"58,-311 58,-332 126,-332 126,-311 58,-311\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"58,-311 126,-311 \"/>\n",
"<text text-anchor=\"start\" x=\"70\" y=\"-317.8\" font-family=\"Times,serif\" font-size=\"14.00\">states</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"126,-311 126,-332 142,-332 142,-311 126,-311\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"126,-311 142,-311 \"/>\n",
"<text text-anchor=\"start\" x=\"129\" y=\"-317.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"58,-290 58,-311 126,-311 126,-290 58,-290\"/>\n",
"<text text-anchor=\"start\" x=\"76\" y=\"-296.8\" font-family=\"Times,serif\" font-size=\"14.00\">succ</text>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"126,-290 126,-311 142,-311 142,-290 126,-290\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"126,-290 126,-311 142,-311 142,-290 126,-290\"/>\n",
"<text text-anchor=\"start\" x=\"129\" y=\"-296.8\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"58,-269 58,-290 126,-290 126,-269 58,-269\"/>\n",
"<text text-anchor=\"start\" x=\"61\" y=\"-275.8\" font-family=\"Times,serif\" font-size=\"14.00\">succ_tail</text>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"126,-269 126,-290 142,-290 142,-269 126,-269\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"126,-269 126,-290 142,-290 142,-269 126,-269\"/>\n",
"<text text-anchor=\"start\" x=\"129\" y=\"-275.8\" font-family=\"Times,serif\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- edges -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>edges</title>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"283,-343 283,-364 359,-364 359,-343 283,-343\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"283,-343 359,-343 \"/>\n",
"<text text-anchor=\"start\" x=\"299.5\" y=\"-349.8\" font-family=\"Times,serif\" font-size=\"14.00\">edges</text>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"359,-343 359,-364 435,-364 435,-343 359,-343\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"359,-343 435,-343 \"/>\n",
"<text text-anchor=\"start\" x=\"392\" y=\"-349.8\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"435,-343 435,-364 505,-364 505,-343 435,-343\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"435,-343 505,-343 \"/>\n",
"<text text-anchor=\"start\" x=\"465\" y=\"-349.8\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"505,-343 505,-364 575,-364 575,-343 505,-343\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"505,-343 575,-343 \"/>\n",
"<text text-anchor=\"start\" x=\"535\" y=\"-349.8\" font-family=\"Times,serif\" font-size=\"14.00\">3</text>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"575,-343 575,-364 639,-364 639,-343 575,-343\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"575,-343 639,-343 \"/>\n",
"<text text-anchor=\"start\" x=\"602\" y=\"-349.8\" font-family=\"Times,serif\" font-size=\"14.00\">4</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"283,-322 283,-343 359,-343 359,-322 283,-322\"/>\n",
"<text text-anchor=\"start\" x=\"304\" y=\"-328.8\" font-family=\"Times,serif\" font-size=\"14.00\">cond</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"359,-322 359,-343 435,-343 435,-322 359,-322\"/>\n",
"<text text-anchor=\"start\" x=\"362\" y=\"-328.8\" font-family=\"Times,serif\" font-size=\"14.00\">!p0 &amp; !p1</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"435,-322 435,-343 505,-343 505,-322 435,-322\"/>\n",
"<text text-anchor=\"start\" x=\"438\" y=\"-328.8\" font-family=\"Times,serif\" font-size=\"14.00\">p0 &amp; !p1</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"505,-322 505,-343 575,-343 575,-322 505,-322\"/>\n",
"<text text-anchor=\"start\" x=\"508\" y=\"-328.8\" font-family=\"Times,serif\" font-size=\"14.00\">!p0 &amp; p1</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"575,-322 575,-343 639,-343 639,-322 575,-322\"/>\n",
"<text text-anchor=\"start\" x=\"578\" y=\"-328.8\" font-family=\"Times,serif\" font-size=\"14.00\">p0 &amp; p1</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"283,-301 283,-322 359,-322 359,-301 283,-301\"/>\n",
"<text text-anchor=\"start\" x=\"309\" y=\"-307.8\" font-family=\"Times,serif\" font-size=\"14.00\">acc</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"359,-301 359,-322 435,-322 435,-301 359,-301\"/>\n",
"<text text-anchor=\"start\" x=\"387.5\" y=\"-307.8\" font-family=\"Times,serif\" font-size=\"14.00\">{}</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"435,-301 435,-322 505,-322 505,-301 435,-301\"/>\n",
"<text text-anchor=\"start\" x=\"456\" y=\"-307.8\" font-family=\"Times,serif\" font-size=\"14.00\">{0}</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"505,-301 505,-322 575,-322 575,-301 505,-301\"/>\n",
"<text text-anchor=\"start\" x=\"526\" y=\"-307.8\" font-family=\"Times,serif\" font-size=\"14.00\">{1}</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"575,-301 575,-322 639,-322 639,-301 575,-301\"/>\n",
"<text text-anchor=\"start\" x=\"586.5\" y=\"-307.8\" font-family=\"Times,serif\" font-size=\"14.00\">{0,1}</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"283,-280 283,-301 359,-301 359,-280 283,-280\"/>\n",
"<text text-anchor=\"start\" x=\"309.5\" y=\"-286.8\" font-family=\"Times,serif\" font-size=\"14.00\">dst</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"359,-280 359,-301 435,-301 435,-280 359,-280\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"359,-280 359,-301 435,-301 435,-280 359,-280\"/>\n",
"<text text-anchor=\"start\" x=\"392\" y=\"-286.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"435,-280 435,-301 505,-301 505,-280 435,-280\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"435,-280 435,-301 505,-301 505,-280 435,-280\"/>\n",
"<text text-anchor=\"start\" x=\"465\" y=\"-286.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"505,-280 505,-301 575,-301 575,-280 505,-280\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"505,-280 505,-301 575,-301 575,-280 505,-280\"/>\n",
"<text text-anchor=\"start\" x=\"535\" y=\"-286.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"575,-280 575,-301 639,-301 639,-280 575,-280\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"575,-280 575,-301 639,-301 639,-280 575,-280\"/>\n",
"<text text-anchor=\"start\" x=\"602\" y=\"-286.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"283,-259 283,-280 359,-280 359,-259 283,-259\"/>\n",
"<text text-anchor=\"start\" x=\"286\" y=\"-265.8\" font-family=\"Times,serif\" font-size=\"14.00\">next_succ</text>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"359,-259 359,-280 435,-280 435,-259 359,-259\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"359,-259 359,-280 435,-280 435,-259 359,-259\"/>\n",
"<text text-anchor=\"start\" x=\"392\" y=\"-265.8\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"435,-259 435,-280 505,-280 505,-259 435,-259\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"435,-259 435,-280 505,-280 505,-259 435,-259\"/>\n",
"<text text-anchor=\"start\" x=\"465\" y=\"-265.8\" font-family=\"Times,serif\" font-size=\"14.00\">3</text>\n",
"<polygon fill=\"cyan\" stroke=\"transparent\" points=\"505,-259 505,-280 575,-280 575,-259 505,-259\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"505,-259 505,-280 575,-280 575,-259 505,-259\"/>\n",
"<text text-anchor=\"start\" x=\"535\" y=\"-265.8\" font-family=\"Times,serif\" font-size=\"14.00\">4</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"575,-259 575,-280 639,-280 639,-259 575,-259\"/>\n",
"<text text-anchor=\"start\" x=\"602\" y=\"-265.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"283,-238 283,-259 359,-259 359,-238 283,-238\"/>\n",
"<text text-anchor=\"start\" x=\"310\" y=\"-244.8\" font-family=\"Times,serif\" font-size=\"14.00\">src</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"359,-238 359,-259 435,-259 435,-238 359,-238\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"359,-238 359,-259 435,-259 435,-238 359,-238\"/>\n",
"<text text-anchor=\"start\" x=\"392\" y=\"-244.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"435,-238 435,-259 505,-259 505,-238 435,-238\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"435,-238 435,-259 505,-259 505,-238 435,-238\"/>\n",
"<text text-anchor=\"start\" x=\"465\" y=\"-244.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"505,-238 505,-259 575,-259 575,-238 505,-238\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"505,-238 505,-259 575,-259 575,-238 505,-238\"/>\n",
"<text text-anchor=\"start\" x=\"535\" y=\"-244.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"575,-238 575,-259 639,-259 639,-238 575,-238\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"575,-238 575,-259 639,-259 639,-238 575,-238\"/>\n",
"<text text-anchor=\"start\" x=\"602\" y=\"-244.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- meta -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>meta</title>\n",
"<text text-anchor=\"start\" x=\"10\" y=\"-123.8\" font-family=\"Times,serif\" font-size=\"14.00\">init_state:</text>\n",
"<polygon fill=\"yellow\" stroke=\"transparent\" points=\"97,-118 97,-137 192,-137 192,-118 97,-118\"/>\n",
"<text text-anchor=\"start\" x=\"99\" y=\"-123.8\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"<text text-anchor=\"start\" x=\"10\" y=\"-104.8\" font-family=\"Times,serif\" font-size=\"14.00\">num_sets:</text>\n",
"<text text-anchor=\"start\" x=\"99\" y=\"-104.8\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n",
"<text text-anchor=\"start\" x=\"10\" y=\"-85.8\" font-family=\"Times,serif\" font-size=\"14.00\">acceptance:</text>\n",
"<text text-anchor=\"start\" x=\"99\" y=\"-85.8\" font-family=\"Times,serif\" font-size=\"14.00\">Inf(0)&amp;Inf(1)</text>\n",
"<text text-anchor=\"start\" x=\"10\" y=\"-66.8\" font-family=\"Times,serif\" font-size=\"14.00\">ap_vars:</text>\n",
"<text text-anchor=\"start\" x=\"99\" y=\"-66.8\" font-family=\"Times,serif\" font-size=\"14.00\">p0 p1</text>\n",
"</g>\n",
"<!-- meta&#45;&gt;states -->\n",
"<!-- props -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>props</title>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-180.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_state_acc:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-180.8\" font-family=\"Times,serif\" font-size=\"14.00\">maybe</text>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-161.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_inherently_weak:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-161.8\" font-family=\"Times,serif\" font-size=\"14.00\">maybe</text>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-142.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_terminal:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-142.8\" font-family=\"Times,serif\" font-size=\"14.00\">maybe</text>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-123.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_weak:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-123.8\" font-family=\"Times,serif\" font-size=\"14.00\">maybe</text>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-104.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_very_weak:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-104.8\" font-family=\"Times,serif\" font-size=\"14.00\">maybe</text>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-85.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_complete:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-85.8\" font-family=\"Times,serif\" font-size=\"14.00\">yes</text>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-66.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_universal:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-66.8\" font-family=\"Times,serif\" font-size=\"14.00\">yes</text>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-47.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_unambiguous:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-47.8\" font-family=\"Times,serif\" font-size=\"14.00\">yes</text>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-28.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_semi_deterministic:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-28.8\" font-family=\"Times,serif\" font-size=\"14.00\">yes</text>\n",
"<text text-anchor=\"start\" x=\"233\" y=\"-9.8\" font-family=\"Times,serif\" font-size=\"14.00\">prop_stutter_invariant:</text>\n",
"<text text-anchor=\"start\" x=\"418\" y=\"-9.8\" font-family=\"Times,serif\" font-size=\"14.00\">maybe</text>\n",
"</g>\n",
"<!-- props&#45;&gt;edges -->\n",
"<!-- namedprops -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>namedprops</title>\n",
"<text text-anchor=\"middle\" x=\"568\" y=\"-102.8\" font-family=\"Times,serif\" font-size=\"14.00\">named properties:</text>\n",
"<text text-anchor=\"middle\" x=\"568\" y=\"-87.8\" font-family=\"Times,serif\" font-size=\"14.00\">aliases</text>\n",
"</g>\n",
"<!-- namedprops&#45;&gt;edges -->\n",
"</g>\n",
"</svg>\n",
"</div>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"a = spot.automaton(\"\"\"HOA: v1\n",
"States: 1\n",
"Start: 0\n",
"AP: 2 \"p0\" \"p1\"\n",
"Acceptance: 2 Inf(0)&Inf(1)\n",
"Alias: @a !0&!1\n",
"Alias: @b 0&!1\n",
"Alias: @c !0&1\n",
"Alias: @d 0&1\n",
"--BODY--\n",
"State: 0\n",
"[@a] 0\n",
"[@b] 0 {0}\n",
"[@c] 0 {1}\n",
"[@d] 0 {0 1}\n",
"--END--\n",
"\"\"\")\n",
"display_inline(a, a.show_storage(), per_row=2)"
]
},
{
"cell_type": "markdown",
"id": "593d8b93",
"metadata": {},
"source": [
"For more information about how to interpret the output of `show_storage()`, please see the `twagraph-internals.ipynb` notebook.\n",
"\n",
"Here, observe that the edges, labeled with aliases `@a`, `@b`, `@c`, and `@d` in the input file, actually store the expanded values of the aliases. Algorithms in Spot know nothing about the aliases, and only work with edges labeled by Boolean formulas of atomic propositions.\n",
"\n",
"However since Spot 2.11, the automaton now stores an `aliases` named-property. This property is used by the HOA printer to *attempt* to recreate edge labels using those aliases."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "49b2efcb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"HOA: v1\n",
"States: 1\n",
"Start: 0\n",
"AP: 2 \"p0\" \"p1\"\n",
"acc-name: generalized-Buchi 2\n",
"Acceptance: 2 Inf(0)&Inf(1)\n",
"properties: trans-labels explicit-labels trans-acc complete\n",
"properties: deterministic\n",
"Alias: @a !0&!1\n",
"Alias: @b 0&!1\n",
"Alias: @c !0&1\n",
"Alias: @d !@c&!@b&!@a\n",
"--BODY--\n",
"State: 0\n",
"[@a] 0\n",
"[@b] 0 {0}\n",
"[@c] 0 {1}\n",
"[@d] 0 {0 1}\n",
"--END--\n"
]
}
],
"source": [
"print(a.to_str('hoa'))"
]
},
{
"cell_type": "markdown",
"id": "6f93a48e",
"metadata": {},
"source": [
"Additionally, passing option `@` to the Dot printer will ask it to use aliases as well."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "9802e266",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"115pt\" height=\"255pt\"\n",
" viewBox=\"0.00 0.00 115.00 255.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.0 1.0) rotate(0) translate(4 251)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-251 111,-251 111,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"8\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\">Inf(</text>\n",
"<text text-anchor=\"start\" x=\"29\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"45\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\">)&amp;Inf(</text>\n",
"<text text-anchor=\"start\" x=\"79\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"<text text-anchor=\"start\" x=\"95\" y=\"-232.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"11\" y=\"-218.8\" font-family=\"Lato\" font-size=\"14.00\">[gen. Büchi 2]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"72.5\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"72.5\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M17.65,-18C19.29,-18 33.65,-18 47.13,-18\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"54.44,-18 47.44,-21.15 50.94,-18 47.44,-18 47.44,-18 47.44,-18 50.94,-18 47.44,-14.85 54.44,-18 54.44,-18\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M70.87,-36.15C70.62,-45.54 71.16,-54 72.5,-54 73.48,-54 74.03,-49.44 74.16,-43.3\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"74.13,-36.15 77.31,-43.14 74.14,-39.65 74.16,-43.15 74.16,-43.15 74.16,-43.15 74.14,-39.65 71.01,-43.17 74.13,-36.15 74.13,-36.15\"/>\n",
"<text text-anchor=\"start\" x=\"63\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\">@a</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M69.79,-35.98C68.35,-53.2 69.25,-72 72.5,-72 75.29,-72 76.35,-58.12 75.68,-43.28\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"75.21,-35.98 78.8,-42.76 75.43,-39.47 75.66,-42.96 75.66,-42.96 75.66,-42.96 75.43,-39.47 72.51,-43.17 75.21,-35.98 75.21,-35.98\"/>\n",
"<text text-anchor=\"start\" x=\"62.5\" y=\"-90.8\" font-family=\"Lato\" font-size=\"14.00\">@b</text>\n",
"<text text-anchor=\"start\" x=\"64.5\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M69.27,-35.87C66.02,-63.52 67.09,-102 72.5,-102 77.46,-102 78.78,-69.58 76.44,-42.87\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"75.73,-35.87 79.57,-42.52 76.09,-39.35 76.44,-42.83 76.44,-42.83 76.44,-42.83 76.09,-39.35 73.31,-43.15 75.73,-35.87 75.73,-35.87\"/>\n",
"<text text-anchor=\"start\" x=\"63\" y=\"-120.8\" font-family=\"Lato\" font-size=\"14.00\">@c</text>\n",
"<text text-anchor=\"start\" x=\"64.5\" y=\"-105.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M68.9,-35.75C63.73,-72.48 64.92,-132 72.5,-132 79.6,-132 81.1,-79.68 76.99,-42.88\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"76.1,-35.75 80.09,-42.3 76.53,-39.22 76.97,-42.69 76.97,-42.69 76.97,-42.69 76.53,-39.22 73.84,-43.08 76.1,-35.75 76.1,-35.75\"/>\n",
"<text text-anchor=\"start\" x=\"62.5\" y=\"-149.8\" font-family=\"Lato\" font-size=\"14.00\">@d</text>\n",
"<text text-anchor=\"start\" x=\"56.5\" y=\"-135.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"72.5\" y=\"-135.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.show('.@')"
]
},
{
"cell_type": "markdown",
"id": "3b9c1b57",
"metadata": {},
"source": [
"It should be noted that aside from input and output functions, algorithm do not care about aliases. In particular, they will not preserve the `aliases` property while creating a new automaton:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "e36d1446",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"207pt\" height=\"178pt\"\n",
" viewBox=\"0.00 0.00 207.00 177.99\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1.0 1.0) rotate(0) translate(4 173.99)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-173.99 203,-173.99 203,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"79\" y=\"-155.79\" font-family=\"Lato\" font-size=\"14.00\">Inf(</text>\n",
"<text text-anchor=\"start\" x=\"100\" y=\"-155.79\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"116\" y=\"-155.79\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"78\" y=\"-141.79\" font-family=\"Lato\" font-size=\"14.00\">[Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-34.99\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-31.29\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15,-34.99C2.79,-34.99 17.15,-34.99 30.63,-34.99\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-34.99 30.94,-38.14 34.44,-34.99 30.94,-34.99 30.94,-34.99 30.94,-34.99 34.44,-34.99 30.94,-31.84 37.94,-34.99 37.94,-34.99\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M52.76,-52.77C52.21,-62.31 53.29,-70.99 56,-70.99 57.99,-70.99 59.1,-66.31 59.33,-60.04\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"59.24,-52.77 62.48,-59.73 59.28,-56.27 59.33,-59.77 59.33,-59.77 59.33,-59.77 59.28,-56.27 56.18,-59.81 59.24,-52.77 59.24,-52.77\"/>\n",
"<text text-anchor=\"start\" x=\"46\" y=\"-74.79\" font-family=\"Lato\" font-size=\"14.00\">!p1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M50.68,-52.41C47.65,-69.78 49.43,-88.99 56,-88.99 61.7,-88.99 63.79,-74.55 62.27,-59.38\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"61.32,-52.41 65.39,-58.92 61.79,-55.88 62.26,-59.35 62.26,-59.35 62.26,-59.35 61.79,-55.88 59.14,-59.77 61.32,-52.41 61.32,-52.41\"/>\n",
"<text text-anchor=\"start\" x=\"31.5\" y=\"-107.79\" font-family=\"Lato\" font-size=\"14.00\">p0 &amp; p1</text>\n",
"<text text-anchor=\"start\" x=\"48\" y=\"-92.79\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"181\" cy=\"-34.99\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"181\" y=\"-31.29\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M74.04,-37.92C79.73,-38.77 86.12,-39.57 92,-39.99 115.5,-41.66 121.5,-41.66 145,-39.99 148.49,-39.74 152.16,-39.36 155.76,-38.91\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"162.96,-37.92 156.46,-41.99 159.49,-38.4 156.03,-38.87 156.03,-38.87 156.03,-38.87 159.49,-38.4 155.6,-35.75 162.96,-37.92 162.96,-37.92\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-44.79\" font-family=\"Lato\" font-size=\"14.00\">!p0 &amp; p1</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M168.4,-21.85C162.16,-15.77 153.91,-9.2 145,-5.99 122.84,2 114.16,2 92,-5.99 85.46,-8.35 79.27,-12.52 73.97,-16.98\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"68.6,-21.85 71.67,-14.82 71.19,-19.5 73.78,-17.15 73.78,-17.15 73.78,-17.15 71.19,-19.5 75.9,-19.48 68.6,-21.85 68.6,-21.85\"/>\n",
"<text text-anchor=\"start\" x=\"110.5\" y=\"-24.79\" font-family=\"Lato\" font-size=\"14.00\">p0</text>\n",
"<text text-anchor=\"start\" x=\"110.5\" y=\"-9.79\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M170.63,-49.78C167.25,-60.41 170.71,-70.99 181,-70.99 188.88,-70.99 192.75,-64.79 192.62,-57.11\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"191.37,-49.78 195.65,-56.15 191.96,-53.23 192.55,-56.68 192.55,-56.68 192.55,-56.68 191.96,-53.23 189.44,-57.21 191.37,-49.78 191.37,-49.78\"/>\n",
"<text text-anchor=\"start\" x=\"171\" y=\"-74.79\" font-family=\"Lato\" font-size=\"14.00\">!p0</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b = spot.degeneralize_tba(a)\n",
"b.show('.@')"
]
},
{
"cell_type": "markdown",
"id": "32483b2e",
"metadata": {},
"source": [
"This situation can be fixed by copying the aliases manually from the input automaton to the output automaton. (This is something that `autfilt` does by default, unless `--aliases=drop` is passed.)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "a9c0578c",
"metadata": {},
"outputs": [],
"source": [
"spot.set_aliases(b, spot.get_aliases(a))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "d3958e30",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"212pt\" height=\"178pt\"\n",
" viewBox=\"0.00 0.00 211.50 177.76\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1.0 1.0) rotate(0) translate(4 173.76)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-173.76 207.5,-173.76 207.5,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"81.25\" y=\"-155.56\" font-family=\"Lato\" font-size=\"14.00\">Inf(</text>\n",
"<text text-anchor=\"start\" x=\"102.25\" y=\"-155.56\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"118.25\" y=\"-155.56\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"80.25\" y=\"-141.56\" font-family=\"Lato\" font-size=\"14.00\">[Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-34.76\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-31.06\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15,-34.76C2.79,-34.76 17.15,-34.76 30.63,-34.76\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-34.76 30.94,-37.91 34.44,-34.76 30.94,-34.76 30.94,-34.76 30.94,-34.76 34.44,-34.76 30.94,-31.61 37.94,-34.76 37.94,-34.76\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M52.76,-52.55C52.21,-62.08 53.29,-70.76 56,-70.76 57.99,-70.76 59.1,-66.08 59.33,-59.82\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"59.24,-52.55 62.48,-59.51 59.28,-56.05 59.33,-59.55 59.33,-59.55 59.33,-59.55 59.28,-56.05 56.18,-59.59 59.24,-52.55 59.24,-52.55\"/>\n",
"<text text-anchor=\"start\" x=\"31\" y=\"-74.56\" font-family=\"Lato\" font-size=\"14.00\">@b | @a</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M50.68,-52.18C47.65,-69.56 49.43,-88.76 56,-88.76 61.7,-88.76 63.79,-74.32 62.27,-59.15\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"61.32,-52.18 65.39,-58.69 61.79,-55.65 62.26,-59.12 62.26,-59.12 62.26,-59.12 61.79,-55.65 59.14,-59.55 61.32,-52.18 61.32,-52.18\"/>\n",
"<text text-anchor=\"start\" x=\"46\" y=\"-107.56\" font-family=\"Lato\" font-size=\"14.00\">@d</text>\n",
"<text text-anchor=\"start\" x=\"48\" y=\"-92.56\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"179\" cy=\"-34.76\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"179\" y=\"-31.06\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M74.04,-37.69C79.73,-38.54 86.12,-39.35 92,-39.76 114.61,-41.37 120.39,-41.37 143,-39.76 146.49,-39.52 150.16,-39.13 153.76,-38.68\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"160.96,-37.69 154.46,-41.77 157.49,-38.17 154.03,-38.65 154.03,-38.65 154.03,-38.65 157.49,-38.17 153.6,-35.52 160.96,-37.69 160.96,-37.69\"/>\n",
"<text text-anchor=\"start\" x=\"108\" y=\"-44.56\" font-family=\"Lato\" font-size=\"14.00\">@c</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M166.4,-21.63C160.16,-15.55 151.91,-8.98 143,-5.76 121.68,1.92 113.32,1.92 92,-5.76 85.46,-8.12 79.27,-12.29 73.97,-16.75\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"68.6,-21.63 71.67,-14.59 71.19,-19.27 73.78,-16.92 73.78,-16.92 73.78,-16.92 71.19,-19.27 75.9,-19.26 68.6,-21.63 68.6,-21.63\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-24.56\" font-family=\"Lato\" font-size=\"14.00\">@d | @b</text>\n",
"<text text-anchor=\"start\" x=\"109.5\" y=\"-9.56\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M168.85,-49.93C165.77,-60.43 169.16,-70.76 179,-70.76 186.54,-70.76 190.29,-64.71 190.25,-57.15\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"189.15,-49.93 193.32,-56.38 189.68,-53.39 190.2,-56.85 190.2,-56.85 190.2,-56.85 189.68,-53.39 187.09,-57.33 189.15,-49.93 189.15,-49.93\"/>\n",
"<text text-anchor=\"start\" x=\"154.5\" y=\"-74.56\" font-family=\"Lato\" font-size=\"14.00\">@c | @a</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b.show('.@')"
]
},
{
"cell_type": "markdown",
"id": "9a51f316",
"metadata": {},
"source": [
"Notice how `p0` and `!p0` were rewritten as disjunction of aliases because no direct aliases could be found for them. \n",
"\n",
"Generaly, the display code tries to format formulas as a sum of product. It wil recognize conjunctions and disjunctions of aliases, but if it fails, it will resort to printing the original atomic propositions (maybe mixed with aliases)."
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "f0dc410f",
"metadata": {},
"outputs": [],
"source": [
"a = spot.automaton(\"\"\"HOA: v1\n",
"States: 3\n",
"Start: 0\n",
"AP: 4 \"p0\" \"p1\" \"p2\" \"p3\"\n",
"Acceptance: 0 t\n",
"Alias: @a !0&!1\n",
"Alias: @b 0&!1\n",
"Alias: @c !0&1\n",
"Alias: @x 2&3\n",
"Alias: @y !2&!3\n",
"Alias: @z !2&3\n",
"--BODY--\n",
"State: 0\n",
"[@a&@x] 0\n",
"[@b&!@x] 1 \n",
"State: 1\n",
"[@c&@y] 0 \n",
"[!@c&!@y] 2 \n",
"State: 2\n",
"[(@a|@b)&@x] 2\n",
"[(@b|@c)&@x] 2\n",
"[@a|@b|@c] 0\n",
"--END--\n",
"\"\"\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "d5366983",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"444pt\" height=\"148pt\"\n",
" viewBox=\"0.00 0.00 443.50 148.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.0 1.0) rotate(0) translate(4 144)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-144 439.5,-144 439.5,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"214.75\" y=\"-124.8\" font-family=\"Lato\" font-size=\"14.00\">t</text>\n",
"<text text-anchor=\"start\" x=\"206.75\" y=\"-109.8\" font-family=\"Lato\" font-size=\"14.00\">[all]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-35\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-31.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15,-35C2.79,-35 17.15,-35 30.63,-35\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-35 30.94,-38.15 34.44,-35 30.94,-35 30.94,-35 30.94,-35 34.44,-35 30.94,-31.85 37.94,-35 37.94,-35\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M49.62,-52.04C48.32,-61.86 50.45,-71 56,-71 60.17,-71 62.4,-65.86 62.71,-59.14\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"62.38,-52.04 65.85,-58.88 62.54,-55.53 62.71,-59.03 62.71,-59.03 62.71,-59.03 62.54,-55.53 59.56,-59.18 62.38,-52.04 62.38,-52.04\"/>\n",
"<text text-anchor=\"start\" x=\"28.5\" y=\"-74.8\" font-family=\"Lato\" font-size=\"14.00\">@x &amp; @a</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"210\" cy=\"-53\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"210\" y=\"-49.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M72.2,-43.6C78.18,-46.54 85.22,-49.46 92,-51 123.47,-58.13 160.92,-57.19 184.82,-55.44\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"192.08,-54.85 185.36,-58.56 188.59,-55.13 185.1,-55.42 185.1,-55.42 185.1,-55.42 188.59,-55.13 184.85,-52.28 192.08,-54.85 192.08,-54.85\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-59.8\" font-family=\"Lato\" font-size=\"14.00\">@b &amp; !@x</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M193.45,-45.57C182.22,-40.63 166.54,-34.59 152,-32 125.75,-27.32 118.64,-30.86 92,-32 88.53,-32.15 84.87,-32.38 81.27,-32.65\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"74.07,-33.24 80.79,-29.53 77.56,-32.96 81.05,-32.67 81.05,-32.67 81.05,-32.67 77.56,-32.96 81.31,-35.81 74.07,-33.24 74.07,-33.24\"/>\n",
"<text text-anchor=\"start\" x=\"94.5\" y=\"-35.8\" font-family=\"Lato\" font-size=\"14.00\">@y &amp; @c</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>2</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"367\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"367\" 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\">\n",
"<title>1&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M227.88,-49.19C255.49,-42.95 310.36,-30.56 342,-23.42\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"349.14,-21.81 343,-26.42 345.72,-22.58 342.31,-23.35 342.31,-23.35 342.31,-23.35 345.72,-22.58 341.62,-20.28 349.14,-21.81 349.14,-21.81\"/>\n",
"<text text-anchor=\"start\" x=\"268\" y=\"-42.8\" font-family=\"Lato\" font-size=\"14.00\">!@y &amp; !@c</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;0 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>2&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M348.92,-15.97C314.83,-12.22 235.97,-5.13 170,-11 134.92,-14.12 126.31,-17.04 92,-25 88.15,-25.89 84.1,-26.95 80.17,-28.03\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"73.29,-29.98 79.17,-25.04 76.66,-29.02 80.03,-28.07 80.03,-28.07 80.03,-28.07 76.66,-29.02 80.89,-31.1 73.29,-29.98 73.29,-29.98\"/>\n",
"<text text-anchor=\"start\" x=\"170\" y=\"-14.8\" font-family=\"Lato\" font-size=\"14.00\">@c | @b | @a</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M361.15,-35.04C359.96,-44.86 361.91,-54 367,-54 370.82,-54 372.87,-48.86 373.15,-42.14\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"372.85,-35.04 376.3,-41.9 373,-38.53 373.15,-42.03 373.15,-42.03 373.15,-42.03 373,-38.53 370,-42.17 372.85,-35.04 372.85,-35.04\"/>\n",
"<text text-anchor=\"start\" x=\"339\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\">@x &amp; !p1</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M357.82,-33.75C351.5,-51.54 354.56,-72 367,-72 377.88,-72 381.59,-56.33 378.11,-40.5\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"376.18,-33.75 381.14,-39.62 377.15,-37.12 378.11,-40.49 378.11,-40.49 378.11,-40.49 377.15,-37.12 375.08,-41.35 376.18,-33.75 376.18,-33.75\"/>\n",
"<text text-anchor=\"start\" x=\"298.5\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\">(@x &amp; @c) | (@x &amp; @b)</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.show('.@')"
]
},
{
"cell_type": "markdown",
"id": "e1e89823",
"metadata": {},
"source": [
"The above shows that the aliasing may fail to recover some non-trivial aliases combinations. Look in particular at the loops above state 2. `(@b|@c)&@x`, was recovered as `(@x&@c)|(@x&@b)`, but for\n",
"`(@a|@b)&@x`, which is equivalent to `!p1&p2&p3`, the code failed to translate `!p1` as `@a|@b`, so it kept `!p1`.\n",
"\n",
"\n",
"When the automaton uses the `synthesis-outputs` property to distinguish in and out variables (see the `synthesis.ipnb` notebook for more details), aliasing is done on inputs and output separately."
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "0947b601",
"metadata": {},
"outputs": [],
"source": [
"spot.set_synthesis_outputs(a, bdd_ithvar(a.register_ap('p2')) & bdd_ithvar(a.register_ap('p3')))"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "4290d8ca",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"480pt\" height=\"126pt\"\n",
" viewBox=\"0.00 0.00 480.00 126.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.0 1.0) rotate(0) translate(4 122)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-122 476,-122 476,4 -4,4\"/>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-35\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-31.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15,-35C2.79,-35 17.15,-35 30.63,-35\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-35 30.94,-38.15 34.44,-35 30.94,-35 30.94,-35 30.94,-35 34.44,-35 30.94,-31.85 37.94,-35 37.94,-35\"/>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M49.62,-52.04C48.32,-61.86 50.45,-71 56,-71 60.17,-71 62.4,-65.86 62.71,-59.14\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"62.38,-52.04 65.85,-58.88 62.54,-55.53 62.71,-59.03 62.71,-59.03 62.71,-59.03 62.54,-55.53 59.56,-59.18 62.38,-52.04 62.38,-52.04\"/>\n",
"<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"26,-72.5 26,-91.5 49,-91.5 49,-72.5 26,-72.5\"/>\n",
"<text text-anchor=\"start\" x=\"28\" y=\"-78.3\" font-family=\"Lato\" font-size=\"14.00\">@a</text>\n",
"<text text-anchor=\"start\" x=\"53\" y=\"-78.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
"<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"64,-72.5 64,-91.5 87,-91.5 87,-72.5 64,-72.5\"/>\n",
"<text text-anchor=\"start\" x=\"66\" y=\"-78.3\" font-family=\"Lato\" font-size=\"14.00\">@x</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"238\" cy=\"-61\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"238\" y=\"-57.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M69.97,-46.61C76.18,-51.42 83.99,-56.46 92,-59 132.92,-71.99 183.67,-68.56 213,-64.82\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"219.97,-63.88 213.46,-67.94 216.5,-64.35 213.03,-64.82 213.03,-64.82 213.03,-64.82 216.5,-64.35 212.61,-61.7 219.97,-63.88 219.97,-63.88\"/>\n",
"<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"94,-69.5 94,-88.5 118,-88.5 118,-69.5 94,-69.5\"/>\n",
"<text text-anchor=\"start\" x=\"96\" y=\"-75.3\" font-family=\"Lato\" font-size=\"14.00\">@b</text>\n",
"<text text-anchor=\"start\" x=\"122\" y=\"-75.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
"<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"133,-69.5 133,-88.5 160,-88.5 160,-69.5 133,-69.5\"/>\n",
"<text text-anchor=\"start\" x=\"135\" y=\"-75.3\" font-family=\"Lato\" font-size=\"14.00\">!@x</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M221.69,-53.15C206.87,-46.02 183.55,-36.02 162,-32 131.42,-26.29 123.08,-30.67 92,-32 88.53,-32.15 84.87,-32.38 81.27,-32.65\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"74.07,-33.24 80.79,-29.53 77.56,-32.96 81.05,-32.67 81.05,-32.67 81.05,-32.67 77.56,-32.96 81.31,-35.81 74.07,-33.24 74.07,-33.24\"/>\n",
"<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"96,-33.5 96,-52.5 119,-52.5 119,-33.5 96,-33.5\"/>\n",
"<text text-anchor=\"start\" x=\"98\" y=\"-39.3\" font-family=\"Lato\" font-size=\"14.00\">@c</text>\n",
"<text text-anchor=\"start\" x=\"123\" y=\"-39.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
"<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"134,-33.5 134,-52.5 158,-52.5 158,-33.5 134,-33.5\"/>\n",
"<text text-anchor=\"start\" x=\"136\" y=\"-39.3\" font-family=\"Lato\" font-size=\"14.00\">@y</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>2</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"424\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"424\" 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\">\n",
"<title>1&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M255.65,-57.11C288.41,-49.45 361.33,-32.41 399.17,-23.57\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"406.25,-21.91 400.15,-26.57 402.84,-22.71 399.44,-23.51 399.44,-23.51 399.44,-23.51 402.84,-22.71 398.72,-20.44 406.25,-21.91 406.25,-21.91\"/>\n",
"<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"316,-44.5 316,-63.5 343,-63.5 343,-44.5 316,-44.5\"/>\n",
"<text text-anchor=\"start\" x=\"318\" y=\"-50.3\" font-family=\"Lato\" font-size=\"14.00\">!@c</text>\n",
"<text text-anchor=\"start\" x=\"347\" y=\"-50.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
"<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"358,-44.5 358,-63.5 386,-63.5 386,-44.5 358,-44.5\"/>\n",
"<text text-anchor=\"start\" x=\"360\" y=\"-50.3\" font-family=\"Lato\" font-size=\"14.00\">!@y</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;0 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>2&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M405.88,-16.24C366.14,-12.44 264.57,-4.32 180,-11 140.52,-14.12 130.67,-16.43 92,-25 88.14,-25.85 84.08,-26.89 80.15,-27.96\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"73.28,-29.91 79.15,-24.97 76.64,-28.95 80.01,-28 80.01,-28 80.01,-28 76.64,-28.95 80.87,-31.03 73.28,-29.91 73.28,-29.91\"/>\n",
"<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"182,-12.5 182,-31.5 266,-31.5 266,-12.5 182,-12.5\"/>\n",
"<text text-anchor=\"start\" x=\"184\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">@c | @b | @a</text>\n",
"<text text-anchor=\"start\" x=\"270\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
"<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"281,-12.5 281,-31.5 294,-31.5 294,-12.5 281,-12.5\"/>\n",
"<text text-anchor=\"start\" x=\"283\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M417.62,-35.04C416.32,-44.86 418.45,-54 424,-54 428.17,-54 430.4,-48.86 430.71,-42.14\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"430.38,-35.04 433.85,-41.88 430.54,-38.53 430.71,-42.03 430.71,-42.03 430.71,-42.03 430.54,-38.53 427.56,-42.18 430.38,-35.04 430.38,-35.04\"/>\n",
"<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"378,-55.5 378,-74.5 432,-74.5 432,-55.5 378,-55.5\"/>\n",
"<text text-anchor=\"start\" x=\"380\" y=\"-61.3\" font-family=\"Lato\" font-size=\"14.00\">@b | @a</text>\n",
"<text text-anchor=\"start\" x=\"436\" y=\"-61.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
"<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"447,-55.5 447,-74.5 470,-74.5 470,-55.5 447,-55.5\"/>\n",
"<text text-anchor=\"start\" x=\"449\" y=\"-61.3\" font-family=\"Lato\" font-size=\"14.00\">@x</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M414.42,-33.33C406.96,-52.72 410.15,-77 424,-77 436.23,-77 440.15,-58.08 435.76,-40.3\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"433.58,-33.33 438.68,-39.06 434.62,-36.67 435.67,-40.01 435.67,-40.01 435.67,-40.01 434.62,-36.67 432.67,-40.95 433.58,-33.33 433.58,-33.33\"/>\n",
"<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"378,-78.5 378,-97.5 432,-97.5 432,-78.5 378,-78.5\"/>\n",
"<text text-anchor=\"start\" x=\"380\" y=\"-84.3\" font-family=\"Lato\" font-size=\"14.00\">@c | @b</text>\n",
"<text text-anchor=\"start\" x=\"436\" y=\"-84.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
"<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"447,-78.5 447,-97.5 470,-97.5 470,-78.5 447,-78.5\"/>\n",
"<text text-anchor=\"start\" x=\"449\" y=\"-84.3\" font-family=\"Lato\" font-size=\"14.00\">@x</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.show('.@')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bcba9188",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}