reduce_parity: fix to work on automata with deleted edges

* spot/twaalgos/parity.cc (reduce_parity): Use the
size of the edge vector to initialize piprime1 and piprime2,
not the number of edges.
* tests/python/parity.py: Add test case, based on a report
by Yann Thierry-Mieg.
This commit is contained in:
Alexandre Duret-Lutz 2022-02-13 18:37:34 +01:00
parent 58f33deeca
commit 3f9f6029e7
3 changed files with 25 additions and 5 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/python3
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018, 2019 Laboratoire de Recherche et Développement de
# Copyright (C) 2018, 2019, 2022 Laboratoire de Recherche et Développement de
# l'EPITA.
#
# This file is part of Spot, a model checking library.
@ -155,3 +155,17 @@ except RuntimeError as e:
assert "invalid state number" in str(e)
else:
report_missing_exception()
a = spot.automaton("""HOA: v1 name: "F(!p0 | X!p1)" States: 3
Start: 1 AP: 2 "p0" "p1" acc-name: Buchi Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic terminal --BODY-- State: 0 [t] 0 {0} State:
1 [!0] 0 [0] 2 State: 2 [!0 | !1] 0 [0&1] 2 --END--""")
# Erase the first edge of state 1
oi = a.out_iteraser(1)
oi.erase()
# postprocess used to call reduce_parity that did not
# work correctly on automata with deleted edges.
sm = a.postprocess("gen", "small")
assert sm.num_states() == 3