In [1]:
import spot
spot.setup()

This notebook demonstrates the implementation of Zielonka Tree and ACD (Alternating Cycle Decomposition) in Spot.

These two structures are used to decompose an acceptance condition (or automaton) into trees that alternate accepting and rejecting elements in order to help converting an automaton to parity acceptance. Spot implements those structures, includes some display code to better explore them iteractively, and finally use them to implement a transformation to parity acceptance.

For a formal tratement of these, in a slightly different formalism, see Optimal Transformations of Games and Automata Using Muller Conditions by Casares, Colcombet, and Fijalkow. In Spot those definitions have been adapted to use Emerson-Lei acceptance, and support transitions labeled by multiple colors (the main differences are for the Zielonka Tree, the ACD is almost identical).

Zielonka Tree

The Zielonka tree is built from an acceptance formula and is labeled by sets of colors. The root contains all colors used in the formula. If seing infinitely all colors of one node would satisfy the acceptance condition, we say that the node is accepting and draw it with an ellipse, otherwise is is rejecting and drawn with a rectangle. The children of an accepting (resp. rejecting) node, are the largest subsets of colors that are rejecting (resp. accepting).

Here is an example:

In [2]:
c = spot.acc_cond('Fin(0)&Inf(1)&(Inf(2)|Fin(3)) | (Inf(0)|Fin(1))&Fin(2)&Inf(3)')
t = spot.zielonka_tree(c)
t
Out[2]:
zielonka_tree 0 {0,1,2,3} 1 {1,2,3} 0->1 2 {0,1,3} 0->2 3 {2,3} 1->3 4 {1,3} 1->4 5 {1,3} 2->5 6 {0,1} 2->6 7 {3} <7> 3->7 8 {1} <8> 4->8 9 {3} <9> 4->9 10 {1} <10> 5->10 11 {3} <11> 5->11 12 {1} <12> 6->12

Above we can see that {0,1,2,3} is a rejecting root, but it has two accepting maximal subsets: {1,2,3} and {0,1,3}. Similarly, {1,2,3} has two rejecting maximal subsets: {2,3} and {1,3}.

The leaves of this tree have some additional numbers in angle brackets: those are the node numbers. Each node has a number (it can be seen by hovering over it with the mouse), but those leaf numbers play a particular role when the tree is used to paritize an automaton.

This tree is also layered: all nodes in each layers are alternatively rejecting and accepting. Layers are numbered incrementally from 0 at the root. In this example, leaves are in layer 3. Since it is conventional to put the root at the top, we will say that a node is high in the tree when it has a small level.

In this example, odd levels are accepting: we say the tree is odd. On another example, it could be the other way arround. The is_even() method tells us which way it is.

In [3]:
t.is_even()
Out[3]:
False

The number of leaves, and the number of the left-most leaf can be found with the following functions:

In [4]:
t.num_branches(), t.first_branch()
Out[4]:
(6, 7)

The step() methods takes one leaf L, one set of colors S, and returns a pair: (leaf, level). It works as follows: starting from node L, it walks up the tree until it has seen all colors in S, and then return the left-most leaf of the next branch of the node it has seen (assuming branches are ordered circularly from left to right). The level returned is that of the highest node seen.

We refer to the process performed by step(L,S) as reading S from L.

For instance reading [3] from 7 does not change the leaf, since that leaf is already labeled by {3}. The level emitted is 3, since that's the level of 7.

In [5]:
t.step(7, [3])
Out[5]:
(7, 3)

Reading [3] from 8, would however move to leave 9 and emit level 2. Indeed, color 3 is not recognized by 8, so we move up to node 4 (the one labelled by {1,3}), emit its level (2), and go down to the left-most leaf of the next branch.

In [6]:
t.step(8, [3])
Out[6]:
(9, 2)

If we read [0,2] from 9, we will have to go all the way up to the root (emitting 0) and then down to leaf 10:

In [7]:
t.step(9, [0,2])
Out[7]:
(10, 0)

Now, let's take this a step further, and chain multiple steps, by reading a sequence of Sᵢ and producing a sequence of levels.

In [8]:
def steps(tree, leaf, seq_of_s):
    seq_of_lvl = []
    for s in seq_of_s:
        leaf, lvl = tree.step(leaf, s)
        seq_of_lvl.append(lvl)
    return leaf, seq_of_lvl
In [9]:
print(steps(t, 7, [[1],[0],[3],[1],[0],[3],[1],[0],[3],[1],[0],[3]]))
print(steps(t, 7, [[1],[3],[1],[3],[1],[3],[1],[3]]))
(10, [1, 0, 2, 2, 1, 1, 3, 1, 1, 3, 1, 1])
(9, [1, 2, 2, 2, 2, 2, 2, 2])

If we imagine an run looping on tree transitions labeled by [1], [0], [3], we know (from the original acceptance condition) that it should be accepting. Infinite repetition of the step() procedure will emit many levels, but the smallest level we see infinitely often is 1. It corresponds to node 2, labeled by {0,1,3}: this is the highest node we visit infinitely often while steping through this tree in a loop.

Similarly, a loop of two transitions labeled by [1] and [3] should be rejecting. Stepping through the tree will emit infinitely many 2, a rejecting level.

All of this can be used to transform an automaton with arbitrary acceptance into a parity automaton, where the emitted levels will correspond to the priorities of the parity automaton.

The states of the new automaton will be pairs of states of the form (original state, leaf). If the input edge (src,dst) has colors S, then the output edge ((src,leaf),(dst,nextleaf)) will have priority L where L and nextleaf are computed as (nextleaf,L)=t.step(leaf, S). The leaf used for the initial state does not really matter, we use the left-most one.

Let's create a random automaton with this example acceptance condition, and paritize it:

In [10]:
a1 = spot.automaton("randaut -Q4 --colored -e.7 -A '{}' 2 |".format(c.get_acceptance()))
a1
Out[10]:
(Fin( ) & Inf( ) & (Inf( ) | Fin( ))) | ((Inf( ) | Fin( )) & Fin( ) & Inf( )) 0 0 I->0 0->0 !p0 & !p1 1 1 0->1 !p0 & !p1 3 3 0->3 !p0 & !p1 1->0 !p0 & p1 1->1 !p0 & p1 2 2 1->2 p0 & p1 3->0 p0 & !p1 3->1 !p0 & !p1 3->3 !p0 & !p1 3->2 p0 & !p1 2->0 p0 & p1 2->1 !p0 & p1 2->3 !p0 & p1 2->2 p0 & !p1
In [11]:
p1 = spot.zielonka_tree_transform(a1)
p1.copy_state_names_from(a1)
p1
Out[11]:
Fin( ) & (Inf( ) | (Fin( ) & Inf( ))) [parity min odd 4] 0 0#7 I->0 1 1#7 0->1 !p0 & !p1 2 3#7 0->2 !p0 & !p1 3 0#8 0->3 !p0 & !p1 1->0 !p0 & p1 1->1 !p0 & p1 4 2#7 1->4 p0 & p1 2->1 !p0 & !p1 2->4 p0 & !p1 5 0#10 2->5 p0 & !p1 6 3#8 2->6 !p0 & !p1 3->2 !p0 & !p1 3->3 !p0 & !p1 7 1#9 3->7 !p0 & !p1 4->1 !p0 & p1 4->2 !p0 & p1 4->5 p0 & p1 8 2#8 4->8 p0 & !p1 5->2 !p0 & !p1 5->5 !p0 & !p1 9 1#11 5->9 !p0 & !p1 6->4 p0 & !p1 6->5 p0 & !p1 6->6 !p0 & !p1 6->7 !p0 & !p1 7->0 !p0 & p1 7->4 p0 & p1 7->7 !p0 & p1 8->5 p0 & p1 8->7 !p0 & p1 8->8 p0 & !p1 10 3#9 8->10 !p0 & p1 9->0 !p0 & p1 9->4 p0 & p1 9->9 !p0 & p1 10->4 p0 & !p1 10->5 p0 & !p1 10->6 !p0 & !p1 10->7 !p0 & !p1

Here the parity automaton output has as many proprities as there are levels in the Zielonka tree.

The call to copy_state_names_from() above causes the states to be labeled by strings of the form orig#leaf when orig is the original state number, and leaf is a leaf of the Zielonka tree.

Since this notebook is part of our test-suite, let us also make sure those automata are equivalent.

In [12]:
spot.are_equivalent(p1, a1)
Out[12]:
True

Note that a1 above was generated as a so-called "colored" automaton, i.e., each edge has exactly one color. But the transformation also works when edges have arbitrary and possibly empty subsets of colors. In that case, reading a transition without color may emit a level that is not in the Zielonka tree, as if an additional imaginary layer labeled with the empty set was below the tree: we do not store this level for simplicity, but the step() function is aware of that.

In [13]:
a2 = spot.automaton("randaut -Q3 -e.8 --seed=4 -A '{}' 2 |".format(c.get_acceptance()))
a2
Out[13]:
(Fin( ) & Inf( ) & (Inf( ) | Fin( ))) | ((Inf( ) | Fin( )) & Fin( ) & Inf( )) 0 0 I->0 0->0 !p0 & !p1 2 2 0->2 !p0 & p1 1 1 0->1 !p0 & !p1 2->0 p0 & !p1 2->2 p0 & p1 2->1 p0 & p1 1->0 p0 & p1 1->2 !p0 & !p1 1->1 !p0 & p1
In [14]:
p2 = spot.zielonka_tree_transform(a2)
p2.copy_state_names_from(a2)
p2
Out[14]:
Fin( ) & (Inf( ) | (Fin( ) & (Inf( ) | Fin( )))) [parity min odd 5] 6 0#11 I->6 6->6 !p0 & !p1 1 1#10 6->1 !p0 & !p1 10 2#11 6->10 !p0 & p1 0 1#8 2 1#7 0->2 !p0 & p1 3 2#8 0->3 !p0 & !p1 4 0#9 0->4 p0 & p1 2->2 !p0 & p1 2->3 !p0 & !p1 7 0#8 2->7 p0 & p1 3->3 p0 & p1 3->4 p0 & !p1 3->1 p0 & p1 4->0 !p0 & !p1 4->4 !p0 & !p1 8 2#9 4->8 !p0 & p1 1->6 p0 & p1 1->2 !p0 & p1 5 2#10 1->5 !p0 & !p1 5->6 p0 & !p1 5->5 p0 & p1 9 1#12 5->9 p0 & p1 7->0 !p0 & !p1 7->4 !p0 & !p1 7->8 !p0 & p1 8->4 p0 & !p1 8->1 p0 & p1 8->8 p0 & p1 9->2 !p0 & p1 11 2#12 9->11 !p0 & !p1 12 0#10 9->12 p0 & p1 10->6 p0 & !p1 10->9 p0 & p1 10->10 p0 & p1 11->9 p0 & p1 11->11 p0 & p1 11->12 p0 & !p1 12->6 !p0 & !p1 12->1 !p0 & !p1 12->10 !p0 & p1

The shape of the Zielonka tree (and later of the ACD), can also tell us if the acceptance condition can be converted into Rabin/Streett/parity without changing the automaton structure. This follows from the following properties:

  • an automaton is Rabin-type iff the union of any two accepting cycle is necessarily accepting
  • an automaton is Streett-type iff the union of two rejecting cycle is necessarily rejecting
  • an automaton is parity-type iff it is Rabin-type and Streett-type

Here, X-type means that the acceptance condition of the automaton can be changed into X without changing the transition structure (just by coloring it differently). The Zielonka tree does not really look at the automaton, however its shape can still implies some typeness:

  • an automaton is Rabin-type if (not iff) accepting nodes of the Zielonka tree have at most one child
  • an automaton is Street-type if (not iff) rejecting nodes of the Zielonka tree have at most one child

The following methods provide this information:

In [15]:
t.has_rabin_shape(), t.has_streett_shape(), t.has_parity_shape()
Out[15]:
(False, False, False)

Let's look at some examples:

In [16]:
for ct in ('Rabin 3', 'Streett 3', 'parity min odd 5', 
           'Inf(0)&Fin(1) | (Inf(2)&Fin(3)&Fin(4))', 'f', 't'):
    cond = spot.acc_cond(ct)
    tcond = spot.zielonka_tree(cond)
    print(cond.get_acceptance(), ":", tcond.has_rabin_shape(), 
          tcond.has_streett_shape(), tcond.has_parity_shape());
    display(tcond)
(Fin(0) & Inf(1)) | (Fin(2) & Inf(3)) | (Fin(4) & Inf(5)) : True False False
zielonka_tree 0 {0,1,2,3,4,5} 1 {1,2,3,4,5} 0->1 2 {0,1,3,4,5} 0->2 3 {0,1,2,3,5} 0->3 4 {2,3,4,5} 1->4 5 {0,1,4,5} 2->5 6 {0,1,2,3} 3->6 7 {3,4,5} 4->7 8 {2,3,5} 4->8 9 {1,4,5} 5->9 10 {0,1,5} 5->10 11 {1,2,3} 6->11 12 {0,1,3} 6->12 13 {4,5} 7->13 14 {2,3} 8->14 15 {4,5} 9->15 16 {0,1} 10->16 17 {2,3} 11->17 18 {0,1} 12->18 19 {5} <19> 13->19 20 {3} <20> 14->20 21 {5} <21> 15->21 22 {1} <22> 16->22 23 {3} <23> 17->23 24 {1} <24> 18->24
(Fin(0) | Inf(1)) & (Fin(2) | Inf(3)) & (Fin(4) | Inf(5)) : False True False
zielonka_tree 0 {0,1,2,3,4,5} 1 {0,2,3,4,5} 0->1 2 {0,1,2,4,5} 0->2 3 {0,1,2,3,4} 0->3 4 {2,3,4,5} 1->4 5 {0,1,4,5} 2->5 6 {0,1,2,3} 3->6 7 {2,4,5} 4->7 8 {2,3,4} 4->8 9 {0,4,5} 5->9 10 {0,1,4} 5->10 11 {0,2,3} 6->11 12 {0,1,2} 6->12 13 {4,5} 7->13 14 {2,3} 8->14 15 {4,5} 9->15 16 {0,1} 10->16 17 {2,3} 11->17 18 {0,1} 12->18 19 {4} <19> 13->19 20 {2} <20> 14->20 21 {4} <21> 15->21 22 {0} <22> 16->22 23 {2} <23> 17->23 24 {0} <24> 18->24
Fin(0) & (Inf(1) | (Fin(2) & (Inf(3) | Fin(4)))) : True True True
zielonka_tree 0 {0,1,2,3,4} 1 {1,2,3,4} 0->1 2 {2,3,4} 1->2 3 {3,4} 2->3 4 {4} <4> 3->4
(Inf(0) & Fin(1)) | (Inf(2) & Fin(3) & Fin(4)) : True False False
zielonka_tree 0 {0,1,2,3,4} 1 {0,2,3,4} 0->1 2 {0,1,2} 0->2 3 {2,3,4} 1->3 4 {0,1} 2->4 5 {2} <5> 3->5 6 {0} <6> 4->6
f : True True True
zielonka_tree 0 {} <0>
t : True True True
zielonka_tree 0 {} <0>

Alternating Cycle Decomposition

We now turn to the ACD, which extends the Zielonka tree to take the automaton structure into account. Instead of storing subsets of colors, it stores SCCs (not necessarily maximal). In Spot, those SCCs are stored as bitvectors of edges. The principle is similar: instead of one tree, we are building a forest, with one root per non-trivial maximal SCC. The root of each tree is labeled by all the transitions in this maximal SCC: if such a huge cycle is accepting the node is said accepting and drawn as an ellipse, otherwise it is rejecting and drawn as a rectangle. For children, we look for maximal subsets of cycles that can be rejecting (if the parent was accepting), or accepting (if the parent was rejecting).

In other words all nodes correspond to SCCs that may not be maximal from a graph point of view, but that are maximal with respect to their accepting or rejecting status: adding more cycles to it would change that status.

In [17]:
a3 = spot.automaton("""HOA: v1 name: "(FGp0 & ((XFp0 & F!p1) | F(Gp1 &
XG!p0))) | G(F!p0 &\n(XFp0 | F!p1) & F(Gp1 | G!p0))" States: 10 Start:
0 AP: 2 "p0" "p1" Acceptance: 6 (Fin(0) & Fin(1)) | ((Fin(4)|Fin(5)) &
(Inf(2)&Inf(3))) properties: trans-labels explicit-labels trans-acc
complete properties: deterministic --BODY-- State: 0 [!0&!1] 0 {0 1 2
3 5} [!0&1] 1 [0&!1] 2 [0&1] 3 State: 1 [!0&1] 1 {1 3} [0&!1] 2
[!0&!1] 4 {0 1 2 3 5} [0&1] 5 State: 2 [!0&!1] 2 {1 2 3 5} [0&!1] 2 {2
4 5} [!0&1] 3 {1 3} [0&1] 3 {4} State: 3 [0&!1] 2 {2 4 5} [!0&1] 3 {1
3} [0&1] 5 {2 4} [!0&!1] 6 {1 2 3 5} State: 4 [!0&1] 1 {1 3} [0&!1] 2
[0&1] 3 [!0&!1] 7 State: 5 [0&!1] 2 {2 4 5} [0&1] 3 {4} [!0&1] 5 {1 3}
[!0&!1] 8 {1 3 5} State: 6 [0&!1] 2 {2 4 5} [!0&1] 3 {1 3} [0&1] 3 {4}
[!0&!1] 8 {1 3 5} State: 7 [0&!1] 2 [0&1] 5 [!0&!1] 7 {0 1 2 3 5}
[!0&1] 9 {1 2 3} State: 8 [0&!1] 2 {2 4 5} [!0&1] 5 {1 2 3} [0&1] 5 {2
4} [!0&!1] 8 {1 2 3 5} State: 9 [0&!1] 2 [0&1] 3 [!0&!1] 7 {0 1 3 5}
[!0&1] 9 {1 3} --END--""")

Here is the ACD for automaton a3, displayed below a copy of the automaton. Note that the automaton and ACD are linked interactively: you may click on nodes of the ACD to highlight the cycles it stores, and you may click on a state or an edge in the automaton to highlight to relevant ACD nodes (it is easier to click on edge labels than on edges).

In [18]:
theacd = spot.acd(a3); theacd
Out[18]:
(FGp0 & ((XFp0 & F!p1) | F(Gp1 &\nXG!p0))) | G(F!p0 &\n(XFp0 | F!p1) & F(Gp1 | G!p0)) (Fin( ) & Fin( )) | ((Fin( )|Fin( )) & (Inf( )&Inf( ))) 0 0 I->0 0->0 !p0 & !p1 1 1 0->1 !p0 & p1 2 2 0->2 p0 & !p1 3 3 0->3 p0 & p1 1->1 !p0 & p1 1->2 p0 & !p1 4 4 1->4 !p0 & !p1 5 5 1->5 p0 & p1 2->2 !p0 & !p1 2->2 p0 & !p1 2->3 !p0 & p1 2->3 p0 & p1 3->2 p0 & !p1 3->3 !p0 & p1 3->5 p0 & p1 6 6 3->6 !p0 & !p1 4->1 !p0 & p1 4->2 p0 & !p1 4->3 p0 & p1 7 7 4->7 !p0 & !p1 5->2 p0 & !p1 5->3 p0 & p1 5->5 !p0 & p1 8 8 5->8 !p0 & !p1 6->2 p0 & !p1 6->3 !p0 & p1 6->3 p0 & p1 6->8 !p0 & !p1 7->2 p0 & !p1 7->5 p0 & p1 7->7 !p0 & !p1 9 9 7->9 !p0 & p1 8->2 p0 & !p1 8->5 !p0 & p1 8->5 p0 & p1 8->8 !p0 & !p1 9->2 p0 & !p1 9->3 p0 & p1 9->7 !p0 & !p1 9->9 !p0 & p1
acd min odd 0 SCC #0 T: 9-16,21-28,33-36 {1,2,3,4,5} Q: 2,3,5,6,8 lvl: 0 4 T: 10,12,13,15,21,22 {2,4,5} Q: 2,3,5 lvl: 1 <4> 0->4 5 T: 23,24,34,36 {1,2,3,5} Q: 5,8 lvl: 1 0->5 6 T: 14,15,22,23 {1,2,3,4} Q: 3,5 lvl: 1 0->6 7 T: 14,16,26 {1,2,3,5} Q: 3,6 lvl: 1 0->7 8 T: 9 {1,2,3,5} Q: 2 lvl: 1 <8> 0->8 11 T: 23 {1,3} Q: 5 lvl: 2 <11> 5->11 12 T: 14 {1,3} Q: 3 lvl: 2 <12> 6->12 13 T: 23 {1,3} Q: 5 lvl: 2 <13> 6->13 14 T: 14 {1,3} Q: 3 lvl: 2 <14> 7->14 1 SCC #1 T: 31,32,39,40 {0,1,2,3,5} Q: 7,9 lvl: 1 9 T: 40 {1,3} Q: 9 lvl: 2 <9> 1->9 2 SCC #2 T: 5,7,17 {0,1,2,3,5} Q: 1,4 lvl: 1 10 T: 5 {1,3} Q: 1 lvl: 2 <10> 2->10 3 SCC #3 T: 1 {0,1,2,3,5} Q: 0 lvl: 1 <3>

The nodes of the ACD represent various bits of informations. First, the root of each tree shows the number of the maximal SCC (as computed by spot.scc_info). Trivial maximal SCCs (without cycles) are omitted from the construction. Children are sorted by decreasing size of the SCCs they represent (i.e., decreasing count of edges).

The numbers after T: list the edges that belong to the strongly connected component. The numbers are simply the indices of those edges in the automaton. Between braces are the colors covered by all those edges, to decide if a cycle formed by all these edges would be accepting. The numbers after Q: are the states touched by those edges. lvl: indicates the level of each node. Since some trees can have accepting roots while others have rejecting roots, the levels of some tree have been shifted down (i.e., the root start at levl 1 instead of 0) to ensure that all trees use the same parity. The parity of the decomposition (i.e., whether even levels are accepting) is indicated by the is_even() method.

In [19]:
theacd.is_even()
Out[19]:
False

Finally, the leaves have their node number indicated between angle brackets, but again, node numbers can be obtained by hovering over the node with the mouse. This construction may step in more that just those indicated leaves because it will consider subtrees of the ACD.

For each state of the original automaton, there exists a subtree in the ACD formed by all the node whose Q: contain that state. In the display of theacd above, you can click on any state of the input automaton to highlight the corresponding subtree of the ACD.

The step() method works similarly to Zielonka trees, except it uses edge number instead of colors. It is given a node of the ACD and the number of an edge whose source state touched belong to Q: in the current node. Then it walks up the tree until it finds a node that contains the given edge, emit the level of that node, and returns the left-most node of the next-branch in the sub-tree associated to the destination state.

For instance, let's consider the edges 2->3 and 3->2 in a1. There are actually two edges going from 2 to 3. Hovering above those arrows tells us the number of these edges:

  • 2->3 with {1,3} is edge 11
  • 2->3 with {4} is edge 12
  • 3->2 with {2,4,5} is edge 13

Let us assume we are in node 4 of the ACD (a node that contains state 2) and want to step through edges 12 and 13:

In [20]:
theacd.step(4, 12)
Out[20]:
(4, 1)
In [21]:
theacd.step(4, 13)
Out[21]:
(4, 1)

In both case, we stay in node 4 and emit level 1, this is the level of node 4, which contains both edges.

If we were to iterate through edges 11 and 13 instead, the story would be different:

In [22]:
theacd.step(4, 11)
Out[22]:
(12, 0)
In [23]:
theacd.step(12, 13)
Out[23]:
(8, 0)
In [24]:
theacd.step(8, 11)
Out[24]:
(4, 0)
In [25]:
theacd.step(4, 13)
Out[25]:
(4, 1)

And then it would loop again.

Let's consider the first step. Node 4 does not contains edge 11, so we move up the tree until we find node 0 that contains it, and emit level 0. Then the destination of edge 11 is 3, so we consider the subtree associated to 3 (clicking on state 3 shows us this is the tree that has nodes 4,7,13 as leaves) and return the left-most node of the next branch: 12.

When we read edge 13 from node 12, go all the way up to node 0 again, and consider the left-most node of the next branch in the tree for the destination 2: that's node 8.

Reading edges 11 and 13 will get us back to node 4. If we repeat this infinitely often, the smallest level we will see infinitely often is therefore 0, meaning that is a rejecting cycle.

The initial node we use to start this process can be any node that contains this state. The first_branch(s) method returns the left-most node containing state s.

In [26]:
theacd.first_branch(2)
Out[26]:
4

This first_branch() method is actually being used when step() is used to take an edge between two SCCs. In that case the edge does not appear in the ACD, and step() will return the first_branch() for its destination, and level 0.

An automaton can be paritized using ACD following a procedure similar to Zielonka tree, with this more complex stepping process.

In [27]:
p3 = spot.acd_transform(a3, True)
p3.copy_state_names_from(a3)
p3
Out[27]:
Fin( ) & (Inf( ) | Fin( )) [parity min odd 3] 0 0#3 I->0 0->0 !p0 & !p1 1 1#10 0->1 !p0 & p1 2 2#4 0->2 p0 & !p1 3 3#4 0->3 p0 & p1 1->1 !p0 & p1 1->2 p0 & !p1 4 4#2 1->4 !p0 & !p1 5 5#4 1->5 p0 & p1 2->2 p0 & !p1 2->3 p0 & p1 6 2#8 2->6 !p0 & !p1 7 3#12 2->7 !p0 & p1 3->2 p0 & !p1 3->5 p0 & p1 3->7 !p0 & p1 8 6#7 3->8 !p0 & !p1 4->1 !p0 & p1 4->2 p0 & !p1 4->3 p0 & p1 9 7#1 4->9 !p0 & !p1 5->2 p0 & !p1 5->3 p0 & p1 10 5#11 5->10 !p0 & p1 11 8#5 5->11 !p0 & !p1 6->2 p0 & !p1 6->3 !p0 & p1 6->3 p0 & p1 6->6 !p0 & !p1 7->6 p0 & !p1 7->7 !p0 & p1 7->8 !p0 & !p1 12 5#13 7->12 p0 & p1 8->3 p0 & p1 8->6 p0 & !p1 8->11 !p0 & !p1 13 3#14 8->13 !p0 & p1 9->2 p0 & !p1 9->5 p0 & p1 9->9 !p0 & !p1 14 9#9 9->14 !p0 & p1 10->6 p0 & !p1 10->7 p0 & p1 10->10 !p0 & p1 10->11 !p0 & !p1 11->6 p0 & !p1 11->10 !p0 & p1 11->11 !p0 & !p1 11->12 p0 & p1 12->6 p0 & !p1 12->7 p0 & p1 12->11 !p0 & !p1 12->12 !p0 & p1 13->5 p0 & p1 13->6 p0 & !p1 13->8 !p0 & !p1 13->13 !p0 & p1 14->2 p0 & !p1 14->3 p0 & p1 14->9 !p0 & !p1 14->14 !p0 & p1

Note how the cycles 2#4 → 3#4 → 2#4 and 2#4 → 3#12 → 2#8 → 3#4 → 2#4 corresponds to the two cycles stepped though before.

In [28]:
a3.equivalent_to(p3)
Out[28]:
True

By default, the construction will try to save colors by not emitting colors between SCCs, and not emitting colors for the largest level of an SCC when the parity allows it. So this automaton can actually be paritized with two colors:

In [29]:
p3 = spot.acd_transform(a3)  # second argument defaults to False
p3.copy_state_names_from(a3)
assert a3.equivalent_to(p3)
p3
Out[29]:
Fin( ) & Inf( ) [Rabin 1] 0 0#3 I->0 0->0 !p0 & !p1 1 1#10 0->1 !p0 & p1 2 2#4 0->2 p0 & !p1 3 3#4 0->3 p0 & p1 1->1 !p0 & p1 1->2 p0 & !p1 4 4#2 1->4 !p0 & !p1 5 5#4 1->5 p0 & p1 2->2 p0 & !p1 2->3 p0 & p1 6 2#8 2->6 !p0 & !p1 7 3#12 2->7 !p0 & p1 3->2 p0 & !p1 3->5 p0 & p1 3->7 !p0 & p1 8 6#7 3->8 !p0 & !p1 4->1 !p0 & p1 4->2 p0 & !p1 4->3 p0 & p1 9 7#1 4->9 !p0 & !p1 5->2 p0 & !p1 5->3 p0 & p1 10 5#11 5->10 !p0 & p1 11 8#5 5->11 !p0 & !p1 6->2 p0 & !p1 6->3 !p0 & p1 6->3 p0 & p1 6->6 !p0 & !p1 7->6 p0 & !p1 7->7 !p0 & p1 7->8 !p0 & !p1 12 5#13 7->12 p0 & p1 8->3 p0 & p1 8->6 p0 & !p1 8->11 !p0 & !p1 13 3#14 8->13 !p0 & p1 9->2 p0 & !p1 9->5 p0 & p1 9->9 !p0 & !p1 14 9#9 9->14 !p0 & p1 10->6 p0 & !p1 10->7 p0 & p1 10->10 !p0 & p1 10->11 !p0 & !p1 11->6 p0 & !p1 11->10 !p0 & p1 11->11 !p0 & !p1 11->12 p0 & p1 12->6 p0 & !p1 12->7 p0 & p1 12->11 !p0 & !p1 12->12 !p0 & p1 13->5 p0 & p1 13->6 p0 & !p1 13->8 !p0 & !p1 13->13 !p0 & p1 14->2 p0 & !p1 14->3 p0 & p1 14->9 !p0 & !p1 14->14 !p0 & p1

This transformation can have substantiually fewer states than the one based on Zielonka tree, because the branches are actually restricted to only those that matter for a given state.

In [30]:
p3.num_states()
Out[30]:
15
In [31]:
spot.zielonka_tree_transform(a3).num_states()
Out[31]:
27

Typeness checks

The ACD can be used to decide Rabin, Streett, and parity-typeness. Testing Rabin-typeness requires making sure that round nodes have no children sharing a common state, and testing Streett-typeness needs a similar test for square node. These additional tests have a cost, so they need to be enabled by passing spot.acd_options_CHECK_RABIN, spot.acd_options_CHECK_STREETT, or spot.acd_options_CHECK_PARTIY to the ACD constructor. The latter option implies the former two.

As an example, automaton a3 is Rabin-type because nodes 12 and 13, which are the children of the only round node with more than one child, do not share any state. It it not Street-type, because for instance state 2 appears in both nodes 4 and 8, two children of a square node.

In [32]:
theacd = spot.acd(a3, spot.acd_options_CHECK_PARITY)
In [33]:
print(theacd.has_rabin_shape(), theacd.has_streett_shape(), theacd.has_parity_shape())
True False False

Calling the above methods withtout passing the relevant option will raise an exception.

Additonally, when the goal is only to check some typeness, the construction of the ACD can be aborted as soon as the typeness is found to be wrong. This can be enabled by passing the additional option spot.acd_options_ABORT_WRONG_SHAPE. In case the construction is aborted the ACD forest will be erased (to make sure it is not used), and node_count() will return 0.

In [34]:
print(theacd.node_count())
15
In [35]:
theacd = spot.acd(a3, spot.acd_options_CHECK_STREETT | spot.acd_options_ABORT_WRONG_SHAPE)
In [36]:
print(theacd.has_streett_shape(), theacd.node_count())
False 0

State-based transformation

The ACD usage can be modified slightly in order to produce a state-based automaton. The rules for stepping through the ACD are similar, except that when we detect that a cycle through all children of a node has been done, we return the current node without going to the leftmost leave of the next children. When stepping a transition from a node a child, we should act as if we were in the leftmost child of that node containing the source of tha transition. Stepping through a transition this way do not emit any color, instead the color of a state will be the level of its associated node. (This modified transformation do not claim to be optimal, unlike the transition-based version.)

The ORDER_HEURISTIC used below will be explained in the next section, it justs alters ordering of children of the ACD in a way that the state-based transformation prefers.

In [37]:
theacd = spot.acd(a3, spot.acd_options_ORDER_HEURISTIC)
In [38]:
theacd
Out[38]:
(FGp0 & ((XFp0 & F!p1) | F(Gp1 &\nXG!p0))) | G(F!p0 &\n(XFp0 | F!p1) & F(Gp1 | G!p0)) (Fin( ) & Fin( )) | ((Fin( )|Fin( )) & (Inf( )&Inf( ))) 0 0 I->0 0->0 !p0 & !p1 1 1 0->1 !p0 & p1 2 2 0->2 p0 & !p1 3 3 0->3 p0 & p1 1->1 !p0 & p1 1->2 p0 & !p1 4 4 1->4 !p0 & !p1 5 5 1->5 p0 & p1 2->2 !p0 & !p1 2->2 p0 & !p1 2->3 !p0 & p1 2->3 p0 & p1 3->2 p0 & !p1 3->3 !p0 & p1 3->5 p0 & p1 6 6 3->6 !p0 & !p1 4->1 !p0 & p1 4->2 p0 & !p1 4->3 p0 & p1 7 7 4->7 !p0 & !p1 5->2 p0 & !p1 5->3 p0 & p1 5->5 !p0 & p1 8 8 5->8 !p0 & !p1 6->2 p0 & !p1 6->3 !p0 & p1 6->3 p0 & p1 6->8 !p0 & !p1 7->2 p0 & !p1 7->5 p0 & p1 7->7 !p0 & !p1 9 9 7->9 !p0 & p1 8->2 p0 & !p1 8->5 !p0 & p1 8->5 p0 & p1 8->8 !p0 & !p1 9->2 p0 & !p1 9->3 p0 & p1 9->7 !p0 & !p1 9->9 !p0 & p1
acd min odd 0 SCC #0 T: 9-16,21-28,33-36 {1,2,3,4,5} Q: 2,3,5,6,8 lvl: 0 4 T: 10,12,13,15,21,22 {2,4,5} Q: 2,3,5 lvl: 1 <4> 0->4 5 T: 14,15,22,23 {1,2,3,4} Q: 3,5 lvl: 1 0->5 6 T: 23,24,34,36 {1,2,3,5} Q: 5,8 lvl: 1 0->6 7 T: 14,16,26 {1,2,3,5} Q: 3,6 lvl: 1 0->7 8 T: 9 {1,2,3,5} Q: 2 lvl: 1 <8> 0->8 11 T: 14 {1,3} Q: 3 lvl: 2 <11> 5->11 12 T: 23 {1,3} Q: 5 lvl: 2 <12> 5->12 13 T: 23 {1,3} Q: 5 lvl: 2 <13> 6->13 14 T: 14 {1,3} Q: 3 lvl: 2 <14> 7->14 1 SCC #1 T: 31,32,39,40 {0,1,2,3,5} Q: 7,9 lvl: 1 9 T: 40 {1,3} Q: 9 lvl: 2 <9> 1->9 2 SCC #2 T: 5,7,17 {0,1,2,3,5} Q: 1,4 lvl: 1 10 T: 5 {1,3} Q: 1 lvl: 2 <10> 2->10 3 SCC #3 T: 1 {0,1,2,3,5} Q: 0 lvl: 1 <3>

Let set what happens when we step through the two self-loops of state 2 (edges 9 and 10).

In [39]:
theacd.first_branch(2)
Out[39]:
4
In [40]:
theacd.state_step(4, 9)
Out[40]:
8
In [41]:
theacd.state_step(8, 10)
Out[41]:
0
In [42]:
# since 0 is not a leaf of the tree associated to state 2, the following acts like state_step(first_branch(2), 9)
theacd.state_step(0, 9) 
Out[42]:
8

The state-based version of the ACD transformation is acd_transform_sbacc(). In the output, the cycle between 2#8 and 2#0 corresponds to the repeatitions of edges 9 and 10 we stepped through above.

In [43]:
s3 = spot.acd_transform_sbacc(a3);
assert s3.equivalent_to(a3)
s3.copy_state_names_from(a3)
s3
Out[43]:
Fin( ) & Inf( ) [Rabin 1] 0 0#3 I->0 0->0 !p0 & !p1 1 1#10 0->1 !p0 & p1 2 2#4 0->2 p0 & !p1 3 3#4 0->3 p0 & p1 1->1 !p0 & p1 1->2 p0 & !p1 4 4#2 1->4 !p0 & !p1 5 5#4 1->5 p0 & p1 2->2 p0 & !p1 2->3 p0 & p1 6 2#8 2->6 !p0 & !p1 7 3#5 2->7 !p0 & p1 3->2 p0 & !p1 3->5 p0 & p1 3->7 !p0 & p1 8 6#7 3->8 !p0 & !p1 4->1 !p0 & p1 4->2 p0 & !p1 4->3 p0 & p1 9 7#1 4->9 !p0 & !p1 5->2 p0 & !p1 5->3 p0 & p1 10 5#5 5->10 !p0 & p1 11 8#6 5->11 !p0 & !p1 6->6 !p0 & !p1 12 2#0 6->12 p0 & !p1 13 3#0 6->13 !p0 & p1 6->13 p0 & p1 7->6 p0 & !p1 7->8 !p0 & !p1 14 3#11 7->14 !p0 & p1 15 5#12 7->15 p0 & p1 8->6 p0 & !p1 8->13 p0 & p1 16 3#14 8->16 !p0 & p1 17 8#0 8->17 !p0 & !p1 9->2 p0 & !p1 9->5 p0 & p1 9->9 !p0 & !p1 18 9#9 9->18 !p0 & p1 10->6 p0 & !p1 10->7 p0 & p1 10->11 !p0 & !p1 10->15 !p0 & p1 11->6 p0 & !p1 11->11 !p0 & !p1 19 5#13 11->19 !p0 & p1 20 5#0 11->20 p0 & p1 12->2 p0 & !p1 12->3 p0 & p1 12->6 !p0 & !p1 12->7 !p0 & p1 13->2 p0 & !p1 13->5 p0 & p1 13->7 !p0 & p1 13->8 !p0 & !p1 14->6 p0 & !p1 14->8 !p0 & !p1 14->14 !p0 & p1 14->15 p0 & p1 15->6 p0 & !p1 15->7 p0 & p1 15->11 !p0 & !p1 15->15 !p0 & p1 16->6 p0 & !p1 16->8 !p0 & !p1 16->16 !p0 & p1 16->20 p0 & p1 17->6 p0 & !p1 17->11 !p0 & !p1 17->19 !p0 & p1 17->20 p0 & p1 18->2 p0 & !p1 18->3 p0 & p1 18->9 !p0 & !p1 18->18 !p0 & p1 19->6 p0 & !p1 19->11 !p0 & !p1 19->19 !p0 & p1 21 3#7 19->21 p0 & p1 20->2 p0 & !p1 20->3 p0 & p1 20->10 !p0 & p1 20->11 !p0 & !p1 21->6 p0 & !p1 21->8 !p0 & !p1 21->16 !p0 & p1 21->20 p0 & p1

In this case, the number of states we obtain with acd_transform_sbacc() is smaller than what we would obtain by calling sbacc() on the result of acd_transform().

In [44]:
print(s3.num_states(), 
      spot.sbacc(spot.acd_transform(a3)).num_states())
22 28

An ordering heuristic for state-based transformation

We now explain the ORDER_HEURISTIC option, by first looking at an example without it.

In [45]:
a4 = spot.automaton("""HOA: v1 States: 3 Start: 
0 AP: 1 "p" acc-name: generalized-Buchi 2 Acceptance: 
2 Inf(1)&Inf(0) properties: trans-labels implicit-labels 
trans-acc complete deterministic --BODY-- State: 0 0 {0}
1 State: 1 1 {1} 2 State: 2 2 {1} 0 --END--""")
spot.acd(a4)
Out[45]:
Inf( )&Inf( ) [gen. Büchi 2] 0 0 I->0 0->0 !p 1 1 0->1 p 1->1 !p 2 2 1->2 p 2->0 p 2->2 !p
acd min even 0 SCC #0 T: 1-6 {0,1} Q: 0-2 lvl: 0 1 T: 2-6 {1} Q: 0-2 lvl: 1 <1> 0->1 2 T: 1,2,4,6 {0} Q: 0-2 lvl: 1 <2> 0->2
In [46]:
s4 = spot.acd_transform_sbacc(a4, False, False) # The third argument disables the heuristic
s4.copy_state_names_from(a4)
s4
Out[46]:
[Büchi] 0 0#1 I->0 1 0#2 0->1 !p 2 1#1 0->2 p 1->1 !p 3 1#2 1->3 p 2->2 !p 4 2#1 2->4 p 5 1#0 3->5 !p 6 2#2 3->6 p 4->0 p 4->4 !p 5->2 !p 5->4 p 6->1 p 7 2#0 6->7 !p 7->0 p 7->4 !p

One this example, we can see that whenever an edge leaves not 2, it creates a copy of the target state.

The ORDER_HEURISTIC option of the ACD construction, attemps to order the children of a node by decreasing number of number of successors that are out of the node. It is activated by default inside spot.acd_transform_sbacc().

In [47]:
spot.acd(a4, spot.acd_options_ORDER_HEURISTIC)
Out[47]:
Inf( )&Inf( ) [gen. Büchi 2] 0 0 I->0 0->0 !p 1 1 0->1 p 1->1 !p 2 2 1->2 p 2->0 p 2->2 !p
acd min even 0 SCC #0 T: 1-6 {0,1} Q: 0-2 lvl: 0 1 T: 1,2,4,6 {0} Q: 0-2 lvl: 1 <1> 0->1 2 T: 2-6 {1} Q: 0-2 lvl: 1 <2> 0->2
In [48]:
s4b = spot.acd_transform_sbacc(a4)
s4b.copy_state_names_from(a4)
s4b
Out[48]:
[Büchi] 0 0#1 I->0 0->0 !p 1 1#1 0->1 p 2 1#2 1->2 !p 3 2#1 1->3 p 2->2 !p 4 2#2 2->4 p 3->0 p 3->4 !p 4->4 !p 5 0#2 4->5 p 5->2 p 6 0#0 5->6 !p 6->0 !p 6->1 p

More examples

These additional examples also contribute to our test suite.

In [49]:
c = spot.automaton("""
HOA: v1
States: 2
Start: 0
AP: 2 "p1" "p0"
Acceptance: 5 (Fin(0) & (Fin(3)|Fin(4)) & (Inf(1)&Inf(2))) | Inf(3)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[0&!1] 0 {2 3}
[!0&!1] 0 {2 3 4}
[!0&1] 1
[0&1] 1 {2 4}
State: 1
[!0&!1] 0 {0 2 3 4}
[!0&1] 1 {1}
[0&!1] 1 {2 3}
[0&1] 1 {1 2 4}
--END--
"""); c
Out[49]:
(Fin( ) & (Fin( )|Fin( )) & (Inf( )&Inf( ))) | Inf( ) 0 0 I->0 0->0 !p0 & p1 0->0 !p0 & !p1 1 1 0->1 p0 & !p1 0->1 p0 & p1 1->0 !p0 & !p1 1->1 p0 & !p1 1->1 !p0 & p1 1->1 p0 & p1
In [50]:
spot.zielonka_tree(c.acc())
Out[50]:
zielonka_tree 0 {0,1,2,3,4} 1 {0,1,2,4} 0->1 2 {1,2,4} 1->2 3 {2,4} <3> 2->3 4 {1,4} <4> 2->4
In [51]:
d = spot.zielonka_tree_transform(c); d
Out[51]:
Inf( ) | (Fin( ) & (Inf( ) | Fin( ))) [parity min even 4] 0 0 I->0 0->0 !p0 & p1 0->0 !p0 & !p1 1 1 0->1 p0 & !p1 0->1 p0 & p1 1->0 !p0 & !p1 1->1 !p0 & p1 2 2 1->2 p0 & !p1 1->2 p0 & p1 2->0 !p0 & !p1 2->1 !p0 & p1 2->1 p0 & p1 2->2 p0 & !p1
In [52]:
assert c.equivalent_to(d)
In [53]:
cacd = spot.acd(c); cacd
Out[53]:
(Fin( ) & (Fin( )|Fin( )) & (Inf( )&Inf( ))) | Inf( ) 0 0 I->0 0->0 !p0 & p1 0->0 !p0 & !p1 1 1 0->1 p0 & !p1 0->1 p0 & p1 1->0 !p0 & !p1 1->1 p0 & !p1 1->1 !p0 & p1 1->1 p0 & p1
acd min even 0 SCC #0 T: 1-8 {0,1,2,3,4} Q: 0,1 lvl: 0 1 T: 6 {1} Q: 1 lvl: 1 <1> 0->1
In [54]:
cacd.state_step(1, 7)
Out[54]:
0
In [55]:
d = spot.acd_transform(c); d
Out[55]:
Inf( ) [Büchi] 0 0 I->0 0->0 !p0 & p1 0->0 !p0 & !p1 1 1 0->1 p0 & !p1 0->1 p0 & p1 1->0 !p0 & !p1 1->1 p0 & !p1 1->1 !p0 & p1 1->1 p0 & p1
In [56]:
e = spot.acd_transform_sbacc(c); e
Out[56]:
[Büchi] 0 0 I->0 0->0 !p0 & p1 0->0 !p0 & !p1 1 1 0->1 p0 & !p1 0->1 p0 & p1 1->0 !p0 & !p1 1->1 p0 & !p1 2 2 1->2 !p0 & p1 1->2 p0 & p1 2->0 !p0 & !p1 2->1 p0 & !p1 2->2 !p0 & p1 2->2 p0 & p1
In [57]:
assert c.equivalent_to(d)
assert c.equivalent_to(e)

Paritizing a generalized-Büchi automaton with acd_transform() produces a Büchi automaton. The Zielonka-tree transformation produces a larger automaton because it ignores the transition structure, and also it uses an extra and unnecessary color (because it was not taught how to omit it).

In [58]:
g = spot.automaton("""HOA: v1 States: 4 Start: 0 AP: 2 "p0" "p1"
acc-name: generalized-Buchi 4 Acceptance: 4
Inf(0)&Inf(1)&Inf(2)&Inf(3) properties: trans-labels explicit-labels
trans-acc --BODY-- State: 0 [!0&1] 2 {0 1 2} [!0&!1] 3 {0 1 2 3}
State: 1 [!0&1] 0 {0 1 2} [!0&!1] 2 {0} State: 2 [!0&1] 1 {0} State: 3
[!0&!1] 2 {0 1 2 3} [0&!1] 3 {0} --END--""")

spot.acd(g)
Out[58]:
Inf( )&Inf( )&Inf( )&Inf( ) [gen. Büchi 4] 0 0 I->0 2 2 0->2 !p0 & p1 3 3 0->3 !p0 & !p1 1 1 2->1 !p0 & p1 3->2 !p0 & !p1 3->3 p0 & !p1 1->0 !p0 & p1 1->2 !p0 & !p1
acd min even 0 SCC #0 T: 1-7 {0,1,2,3} Q: 0-3 lvl: 0 1 T: 1,3-5 {0,1,2} Q: 0-2 lvl: 1 <1> 0->1 2 T: 7 {0} Q: 3 lvl: 1 <2> 0->2
In [59]:
spot.acd_transform(g)
Out[59]:
Inf( ) [Büchi] 0 0 I->0 1 1 0->1 !p0 & p1 2 2 0->2 !p0 & !p1 3 3 1->3 !p0 & p1 2->1 !p0 & !p1 2->2 p0 & !p1 3->0 !p0 & p1 3->1 !p0 & !p1
In [60]:
spot.acd_transform_sbacc(g)
Out[60]:
[Büchi] 0 0 I->0 1 1 0->1 !p0 & p1 2 2 0->2 !p0 & !p1 3 3 1->3 !p0 & p1 2->2 p0 & !p1 4 4 2->4 !p0 & !p1 3->0 !p0 & p1 3->1 !p0 & !p1 4->3 !p0 & p1
In [61]:
spot.zielonka_tree_transform(g)
Out[61]:
Inf( ) | Fin( ) [gen. Streett 1] 8 8 I->8 6 6 8->6 !p0 & p1 11 11 8->11 !p0 & !p1 0 0 2 2 0->2 !p0 & p1 2->0 !p0 & !p1 4 4 2->4 !p0 & p1 1 1 1->1 p0 & !p1 3 3 1->3 !p0 & !p1 5 5 3->5 !p0 & p1 4->6 !p0 & p1 7 7 4->7 !p0 & !p1 5->8 !p0 & p1 5->3 !p0 & !p1 9 9 6->9 !p0 & p1 7->7 p0 & !p1 10 10 7->10 !p0 & !p1 9->8 !p0 & p1 9->6 !p0 & !p1 10->2 !p0 & p1 11->0 !p0 & !p1 11->1 p0 & !p1

An issue in Spot is to always ensure that property bits of automata (cleaming that an automaton is weak, inherently weak, deterministic, etc.) are properly preserved or reset.

Here if the input is inherently weak, the output should be weak.

In [62]:
w = spot.automaton("""HOA: v1
States: 2
Start: 1
AP: 1 "a"
Acceptance: 2 Inf(0) | Inf(1)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic inherently-weak
--BODY--
State: 0
[t] 1 {0}
State: 1
[0] 0 {1}
[!0] 1 {0}
--END--"""); w
Out[62]:
Inf( ) | Inf( ) [Fin-less 2] 1 1 I->1 1->1 !a 0 0 1->0 a 0->1 1
In [63]:
w.prop_weak(), w.prop_inherently_weak()
Out[63]:
(spot.trival_maybe(), spot.trival(True))
In [64]:
w2 = spot.acd_transform(w); w2
Out[64]:
t [all] 0 0 I->0 0->0 !a 1 1 0->1 a 1->0 1
In [65]:
w2.prop_weak(), w2.prop_inherently_weak()
Out[65]:
(spot.trival(True), spot.trival(True))
In [ ]: