#!/usr/bin/python3 # -*- mode: python; coding: utf-8 -*- # Copyright (C) 2020, 2022 Laboratoire de Recherche et Développement de # l'EPITA. # # This file is part of Spot, a model checking library. # # Spot is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # Spot is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public # License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . import spot g = spot.automaton("""HOA: v1 States: 9 Start: 0 AP: 2 "a" "b" acc-name: Streett 1 Acceptance: 2 Fin(0) | Inf(1) properties: trans-labels explicit-labels state-acc spot-state-player: 0 1 0 1 0 1 0 1 1 --BODY-- State: 0 {1} [1] 1 [1] 3 State: 1 {1} [1] 2 State: 2 {1} [0] 8 State: 3 {1} [1] 4 State: 4 {1} [0] 5 State: 5 {1} [0] 6 State: 6 {1} [1] 7 State: 7 State: 8 {1} [0] 2 --END--""") assert spot.solve_parity_game(g) == False s = spot.highlight_strategy(g).to_str("HOA", "1.1") assert s == """HOA: v1.1 States: 9 Start: 0 AP: 2 "a" "b" acc-name: Streett 1 Acceptance: 2 Fin(0) | Inf(1) properties: trans-labels explicit-labels state-acc !complete properties: !deterministic exist-branch spot.highlight.states: 0 5 1 4 2 4 3 5 4 5 5 5 6 5 7 5 8 4 spot.highlight.edges: 2 5 3 4 6 5 8 5 9 4 spot.state-player: 0 1 0 1 0 1 0 1 1 --BODY-- State: 0 {1} [1] 1 [1] 3 State: 1 {1} [1] 2 State: 2 {1} [0] 8 State: 3 {1} [1] 4 State: 4 {1} [0] 5 State: 5 {1} [0] 6 State: 6 {1} [1] 7 State: 7 State: 8 {1} [0] 2 --END--""" # Testing case where parity_game optimization # lead to wrong results si = spot.synthesis_info() game = spot.automaton("""HOA: v1 States: 27 Start: 7 AP: 11 "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" acc-name: parity max odd 3 Acceptance: 3 Fin(2) & (Inf(1) | Fin(0)) properties: trans-labels explicit-labels trans-acc colored properties: deterministic spot-state-player: 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 controllable-AP: 0 1 2 3 4 5 6 7 --BODY-- State: 0 [t] 8 {0} State: 1 [8&9] 8 {0} [!8&!10 | !9&!10] 9 {0} [!8&10 | !9&10] 10 {0} State: 2 [8&9] 8 {0} [!8&!10 | !9&!10] 11 {0} [!8&10 | !9&10] 12 {0} State: 3 [8&9] 8 {0} [!9&!10] 13 {0} [!8&10 | !9&10] 14 {0} [!8&9&!10] 15 {0} State: 4 [8&9] 8 {0} [!8&!10 | !9&!10] 16 {0} [!8&!9&10] 17 {0} [!8&9&10] 18 {0} [8&!9&10] 19 {0} State: 5 [8&9] 8 {0} [!9&!10] 20 {0} [!8&10 | !9&10] 21 {0} [!8&9&!10] 22 {0} State: 6 [8&9] 8 {0} [!8&!10 | !9&!10] 23 {0} [!8&!9&10] 24 {0} [!8&9&10] 25 {0} [8&!9&10] 26 {0} State: 7 [8&9] 8 {0} [!9&!10] 13 {0} [!8&9&!10] 15 {0} [!8&!9&10] 17 {0} [!8&9&10] 18 {0} [8&!9&10] 19 {0} State: 8 [!0&!1&2&!3&!4&5&!6&7 | !0&!1&2&!3&!4&5&6&!7 | !0&!1&2&!3&4&!5&!6&7 | !0&!1&2&!3&4&!5&6&!7 | !0&!1&2&3&!4&!5&!6&7 | !0&!1&2&3&!4&!5&6&!7 | !0&1&!2&!3&!4&5&!6&7 | !0&1&!2&!3&!4&5&6&!7 | !0&1&!2&!3&4&!5&!6&7 | !0&1&!2&!3&4&!5&6&!7 | !0&1&!2&3&!4&!5&!6&7 | !0&1&!2&3&!4&!5&6&!7 | 0&!1&!2&!3&!4&5&!6&7 | 0&!1&!2&!3&!4&5&6&!7 | 0&!1&!2&!3&4&!5&!6&7 | 0&!1&!2&!3&4&!5&6&!7 | 0&!1&!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!0&1&!2&!3&!4&5&!6&7] 3 {1} [!0&1&!2&!3&4&!5&!6&7 | !0&1&!2&3&!4&!5&!6&7] 5 {1} State: 26 [!0&!1&2&!3&!4&5&!6&7 | !0&!1&2&!3&!4&5&6&!7 | !0&1&!2&!3&!4&5&!6&7 | 0&!1&!2&!3&!4&5&!6&7 | 0&!1&!2&!3&!4&5&6&!7] 1 {1} [!0&!1&2&!3&4&!5&!6&7 | !0&!1&2&!3&4&!5&6&!7 | !0&!1&2&3&!4&!5&!6&7 | !0&!1&2&3&!4&!5&6&!7 | !0&1&!2&!3&4&!5&!6&7 | !0&1&!2&3&!4&!5&!6&7 | 0&!1&!2&!3&4&!5&!6&7 | 0&!1&!2&!3&4&!5&6&!7 | 0&!1&!2&3&!4&!5&!6&7 | 0&!1&!2&3&!4&!5&6&!7] 2 {1} [!0&1&!2&!3&!4&5&6&!7] 4 {1} [!0&1&!2&!3&4&!5&6&!7 | !0&1&!2&3&!4&!5&6&!7] 6 {1} --END--""") assert spot.solve_game(game, si) games = spot.split_edges(game) spot.set_state_players(games, spot.get_state_players(game)) assert spot.solve_game(games, si)