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,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012-2020 Laboratoire de Recherche et Développement
// Copyright (C) 2012-2021 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -208,6 +208,8 @@ namespace spot
twa_graph_ptr
postprocessor::finalize(twa_graph_ptr tmp) const
{
if (PREF_ != Any && level_ != Low)
tmp->remove_unused_ap();
if (COMP_)
tmp = complete(tmp);
bool want_parity = type_ & Parity;
@ -364,7 +366,6 @@ namespace spot
if (m->num_states() <= a->num_states())
a = m;
}
a->remove_unused_ap();
}
return finalize(a);
}
@ -666,8 +667,6 @@ namespace spot
sim = dba ? dba : sim;
sim->remove_unused_ap();
if (type_ == CoBuchi)
{
unsigned ns = sim->num_states();

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013-2018, 2020 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2013-2018, 2020-2021 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -383,17 +383,14 @@ namespace spot
|| type_ == GeneralizedBuchi)
aut2 = gf_guarantee_to_ba_maybe(r, simpl_->get_dict(),
det, state_based_);
if (aut2 && (type_ & (Buchi | Parity))
&& (pref_ & Deterministic))
if (aut2 && (pref_ & Deterministic))
return finalize(aut2);
if (!aut2 && (type_ == Generic
|| type_ & (Parity | CoBuchi)))
{
aut2 = fg_safety_to_dca_maybe(r, simpl_->get_dict(),
state_based_);
if (aut2
&& (type_ & (CoBuchi | Parity))
&& (pref_ & Deterministic))
if (aut2 && (pref_ & Deterministic))
return finalize(aut2);
}
}