translate: speed up some -G -D cases

When gf-guarentee works and produce a deterministic automaton, use it
right away without comparing it with the automaton produced by the
regular translation.  This used to be the case for all -D scenarios
except -G -D.

Reported by Florian Renkin.

* spot/twaalgos/translate.cc: Use the result of
gf_guarantee_to_ba_maybe() or fg_safety_to_dca_maybe() whenever -D is
used.
* spot/twaalgos/postproc.cc: Call remove_unused_ap() in finalize(), to
iron out some slight output differences.
* tests/core/ltl2tgba2.test, tests/python/toparity.py: Lower expected
results in the test cases.
* tests/python/automata.ipynb, tests/core/prodor.test: Adjust to new
order.
This commit is contained in:
Alexandre Duret-Lutz 2021-01-27 11:03:11 +01:00
parent 238a9ffc1d
commit 93d8f43285
6 changed files with 50 additions and 54 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/python3
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018-2020 Laboratoire de Recherche et Développement de
# Copyright (C) 2018-2021 Laboratoire de Recherche et Développement de
# l'EPITA.
#
# This file is part of Spot, a model checking library.
@ -112,7 +112,7 @@ def test(aut, expected_num_states=[], full=True):
spot.reduce_parity_here(p1)
assert spot.are_equivalent(aut, p1)
if expected_num is not None:
# print(p1.num_states(), expected_num)
print(p1.num_states(), expected_num)
assert p1.num_states() == expected_num
if full:
# Make sure passing opt is the same as setting
@ -391,4 +391,4 @@ for f in spot.randltl(5, 2000):
a = spot.translate('!(GFa -> (GFb & GF(!b & !Xb)))', 'gen', 'det')
b = spot.to_parity_old(a, True)
assert a.equivalent_to(b)
test(a, [7, 7, 3, 7, 8, 7, 3])
test(a, [7, 7, 3, 7, 7, 7, 3])