Definitions and examples for parity acceptance

In Spot a parity acceptance is defined by a kind, a style and a numsets:

Here are some examples:

Of course the case of parity automata with a single color is a bit degenerate, as the same formula correspond to two parity conditions with different kinds.

In addition the the above, an automaton is said to be colored if each of its edges (or states) has exactly one color. Automata that people usually call parity automata correspond in Spot to colored automata with parity acceptance. For this reason try to use the term automata with parity acceptance rather than parity automata for automata that are not colored.

Testing parity and colored

is_parity() is a method of spot.acc_cond that returns three Boolean values:

  1. whether the condition is a parity condition,
  2. whether it has max kind,
  3. whether it has odd style.

By default, is_parity() will match only conditions that are exactly equal to what the HOA format defines for the relevant configuration. For instance, the formula for min odd 4 should be exactly the following:

However there are many formulas that are equivalent to the above. For instance the following testacc acceptance condition is logically equivalent to parity min odd 4. Passing it through is_parity() will fail: the first Boolean returned is False, and the remaining one should be ignored.

To test logical equivalence to a Parity condition, pass a True argument to is_parity().

To test if an automaton is colored, use is_colored. Not this technically, this property is orthogonal to the fact the the automaton uses the acceptance conditions. It just states that each edge (or state) belongs to exactly one acceptance set.

Functions for altering automata with parity acceptance

Change parity

This section describes the change_parity() method, that allows switching between different kinds and styles. Its takes three arguments:

  1. the automaton to modify
  2. the desired kind (spot.parity_kind_any, spot.parity_kind_same, spot.parity_kind_max, spot.parity_kind_min)
  3. the desired style (spot.parity_style_any, spot.parity_style_same, spot.parity_style_odd, spot.parity_style_even)

Changing the style

Changing the style from odd to even or vice-versa can be done by adding a new color 0 and shifting all original colors by one, keeping the maximum or minimum color in case an edge has multiple colors.

When the acceptance is a parity max, all the transitions that do not belong to any acceptance set will have the new color.

max odd 5 → max even 6

min odd 5 → min even 6

Changing the kind

Generaly to go from parity max to parity min, it suffices to reverse the order of vertices.

max odd 5 → min odd 5:

max odd 4 → min even 4

When the number of colors is even, the style is changed too.

max odd 4 → min odd 5

In this case, to keep the same style, a new color would be introduced.

Colorize parity

People working with parity automata usually expect all states (or edges) to have exactly one color. This constraint, which comes in addition to the use of a parity acceptance, is what the HOA format calls "colored".

A parity automaton is a colored automaton with parity acceptance.

Coloring an automaton can be done with the colorize_parity() function. This function is not very smart: it will not attempt to simplify the acceptance before colorizing it.

Parity max

Transitions with multiple colors are purified by keeping only the set with the greatest index.
If there are uncolored transitions, they get assigned to color 0, and all original colors are shifted by one, toggling the style. If the style must be preserved (second argument set to True), we can shift all colors once more.

Colorize parity max odd 4

Colorize parity max even 4

Parity min

Transitions with multiple colors are simplified by keeping only the color with the lowest index.
An extra color may be introduced at the end of the range, without changing the acceptance style (so the second argument of colorize_parity() is useless in this case).

Colorize parity min odd 4

Degenerate cases

max odd 1

This is just another name for co-Büchi.

max even 1

Another name for Büchi

Here Streett 1 is just a synonym for parity max odd 2. (Spot's automaton printer cannot guess which name should be prefered.)

Cleanup parity

The cleanup_parity() function removes useless colors of an automaton with parity acceptance. This function is just looking at colors that do not occur in the automaton to perform the simplification. For a stronger simplification, see reduce_parity() below.

Here Rabin 1, co-Büchi, and Streett 1, are respectively the same as "min odd 2", "max odd 1", "max odd 2".

Reduce parity

The reduce_parity() function is a more elaborate version of cleanup_parity(). It implements an algorithm by Carton and Maceiras (Computing the Rabin index of a parity automaton, Informatique théorique et applications, 1999), to obtain the minimal parity acceptance condition for a given automaton. Why the original algorithm assume max odd parity, this version with work with the four types of parity acceptance. It will only try to preserve the kind (max/min) and may change the style if it allows saving one color. Furthermore, it can colorize (or uncolorize) automata at the same time, making it a very nice replacement for both cleanup_parity() and colorize_parity().

It takes two arguments:

  1. the automaton whose parity acceptance condition should be reduced
  2. a Boolean indicating whether the output should be colored (True), or if transition with no color can be used (False).

By default, the second argument is False, because acceptance sets is a scarse ressource in Spot.