autfilt: --complement accepts non-deterministic input

* bin/autfilt.cc: Fix the --help string for --complement, and also
merge edges in the resulting automaton, as suggested by František
Blahoudek.
* tests/core/complement.test: Adjust output and add František's
example.
This commit is contained in:
Alexandre Duret-Lutz 2018-05-16 14:11:32 +02:00
parent 605bcd723d
commit 4d82758726
2 changed files with 24 additions and 6 deletions

View file

@ -304,8 +304,7 @@ static const argp_option options[] =
{ "cleanup-acceptance", OPT_CLEAN_ACC, nullptr, 0, { "cleanup-acceptance", OPT_CLEAN_ACC, nullptr, 0,
"remove unused acceptance sets from the automaton", 0 }, "remove unused acceptance sets from the automaton", 0 },
{ "complement", OPT_COMPLEMENT, nullptr, 0, { "complement", OPT_COMPLEMENT, nullptr, 0,
"complement each automaton (currently support only deterministic " "complement each automaton (currently via determinization)", 0 },
"automata)", 0 },
{ "complement-acceptance", OPT_COMPLEMENT_ACC, nullptr, 0, { "complement-acceptance", OPT_COMPLEMENT_ACC, nullptr, 0,
"complement the acceptance condition (without touching the automaton)", "complement the acceptance condition (without touching the automaton)",
0 }, 0 },
@ -1423,7 +1422,10 @@ namespace
} }
if (opt_complement) if (opt_complement)
aut = spot::dualize(ensure_deterministic(aut)); {
aut = spot::dualize(ensure_deterministic(aut));
aut->merge_edges();
}
if (opt_dualize) if (opt_dualize)
aut = spot::dualize(aut); aut = spot::dualize(aut);

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2015-2017 Laboratoire de Recherche et Développement de # Copyright (C) 2015-2018 Laboratoire de Recherche et Développement de
# l'Epita (LRDE). # l'Epita (LRDE).
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
@ -50,7 +50,7 @@ EOF
diff out expected diff out expected
ltl2tgba -H 'GFa & GFb' Xa Fa | autfilt --complement -H >out ltl2tgba -H 'GFa & GFb' Xa Fa 'FGa & FGb' | autfilt --complement -H >out
cat >expected <<EOF cat >expected <<EOF
HOA: v1 HOA: v1
States: 1 States: 1
@ -63,8 +63,8 @@ properties: deterministic stutter-invariant
--BODY-- --BODY--
State: 0 State: 0
[!0&!1] 0 [!0&!1] 0
[!0&1] 0 {1}
[0&!1] 0 {0} [0&!1] 0 {0}
[!0&1] 0 {1}
[0&1] 0 {0 1} [0&1] 0 {0 1}
--END-- --END--
HOA: v1 HOA: v1
@ -101,6 +101,22 @@ State: 1
[0] 0 [0] 0
[!0] 1 [!0] 1
--END-- --END--
HOA: v1
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: parity min even 2
Acceptance: 2 Inf(0) | Fin(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[!0 | !1] 0
[0&1] 1 {1}
State: 1
[!0 | !1] 0 {0}
[0&1] 1 {1}
--END--
EOF EOF
diff out expected diff out expected