gfguarantee: fix handling of true/false languages

Fixes #546 (again).

* spot/twaalgos/gfguarantee.cc (g_f_terminal_inplace): Detect
true/false languages early, so that we do not tag them as
non-inherently-weak.
* tests/core/ltlcross.test: Improve test case.
This commit is contained in:
Alexandre Duret-Lutz 2023-11-14 15:40:24 +01:00
parent 13f66e55af
commit 997f7ec7fb
2 changed files with 15 additions and 2 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2018, 2021 Laboratoire de Recherche et Développement
// Copyright (C) 2018, 2021, 2023 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -61,6 +61,11 @@ namespace spot
if (!is_terminal_automaton(aut, &si, true))
throw std::runtime_error("g_f_terminal() expects a terminal automaton");
// If a terminal automaton has only one SCC, it is either
// universal or empty. In both cases G(automaton)=automaton.
if (si.scc_count() == 1)
return aut;
unsigned ns = si.scc_count();
std::vector<bool> term(ns, false);
for (unsigned n = 0; n < ns; ++n)
@ -69,6 +74,9 @@ namespace spot
aut->prop_keep({ false, false, true, false, true, true });
aut->prop_state_acc(state_based);
// The case where the input automaton is universal or empty has
// already been dealt with, before do_g_f_terminal_inplace was
// called.
aut->prop_inherently_weak(false);
aut->set_buchi();
@ -477,8 +485,11 @@ namespace spot
}
twa_graph_ptr aut = ltl_to_tgba_fm(f, dict, true);
twa_graph_ptr reduced = minimize_obligation(aut, f);
// If f was not an obligation, we cannot deal with it here.
if (reduced == aut)
return nullptr;
scc_info si(reduced);
if (!is_terminal_automaton(reduced, &si, true))
return nullptr;

View file

@ -70,4 +70,6 @@ ltlcross --verbose ltl2tgba ltl2tgba \
ltlcross ltl2tgba -f '!(X(v3 | G!v5) | ((Xv5 & !(v5 & !X!v3)) U !v5))'
# Issue #546.
ltlcross 'ltl2tgba --medium -p' 'ltl2tgba -p' -f 'a | FGa | GF(!b | Gb)'
ltlcross 'ltl2tgba --medium -p' 'ltl2tgba -p' 'ltl2tgba --medium -D -p' \
-f 'a | FGa | GF(!b | Gb)' \
-f '(~ v1 U ~ v5) | G(F v9 & F G v1) | G F(~ v7 | G v7 | G v3)'