Preliminirary support for generic acceptance.

* src/tgba/acc.hh: Add creation and printing of generic acceptance
code.
* src/tgba/acc.cc: New file.
* src/tgba/Makefile.am: Add it.
* src/tgbatest/acc.cc: More tests.
* src/tgbatest/acc.test: Update.
* src/tgba/tgba.hh (set_acceptance, get_acceptance): New methods.
* src/tgba/tgbagraph.hh: Store acceptance code.
* src/hoaparse/hoaparse.yy: Read any acceptance.
* src/dstarparse/nsa2tgba.cc, src/ta/taexplicit.cc,
src/tgba/tgbaproduct.cc, src/tgba/tgbasafracomplement.cc,
src/tgbaalgos/degen.cc, src/tgbaalgos/hoa.cc,
src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/product.cc, src/tgbaalgos/stutter.cc,
src/tgbatest/hoaparse.test: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2015-02-18 11:28:03 +01:00
parent c61f053e2d
commit fd1f6c4d61
19 changed files with 778 additions and 176 deletions

View file

@ -37,6 +37,8 @@ void check(spot::acc_cond& ac, spot::acc_cond::mark_t m)
int main()
{
spot::acc_cond ac(4);
ac.set_generalized_buchi();
std::cout << ac.get_acceptance() << '\n';
auto m1 = ac.marks({0, 2});
auto m2 = ac.marks({0, 3});
@ -50,6 +52,7 @@ int main()
check(ac, m1 | m2 | m3);
ac.add_set();
ac.set_generalized_buchi();
check(ac, m1);
check(ac, m2);
@ -62,9 +65,11 @@ int main()
check(ac, ac.comp(m2 & m3));
spot::acc_cond ac2(ac.num_sets());
ac2.set_generalized_buchi();
check(ac2, m3);
spot::acc_cond ac3(ac.num_sets() + ac2.num_sets());
ac3.set_generalized_buchi();
std::cout << ac.num_sets() << " + "
<< ac2.num_sets() << " = " << ac3.num_sets() << '\n';
auto m5 = ac3.join(ac, m2, ac2, m3);
@ -74,10 +79,8 @@ int main()
auto m7 = ac3.join(ac, ac.comp(m2 & m3), ac2, ac2.all_sets());
check(ac3, m7);
std::vector<unsigned> v;
ac3.fill_from(m7, std::back_inserter(v));
const char* comma = "";
for (auto i: v)
for (auto i: m7.sets())
{
std::cout << comma << i;
comma = ",";
@ -85,6 +88,7 @@ int main()
std::cout << '\n';
spot::acc_cond ac4;
ac4.set_generalized_buchi();
check(ac4, ac4.all_sets());
check(ac4, ac4.comp(ac4.all_sets()));
@ -102,4 +106,17 @@ int main()
check(ac, ac.strip(v, u));
}
auto code1 = ac.inf({0, 1, 3});
std::cout << code1.size() << ' ' << code1 << '\n';
code1.append_or(ac.fin({2}));
std::cout << code1.size() << ' ' << code1 << '\n';
code1.append_or(ac.fin({0}));
std::cout << code1.size() << ' ' << code1 << '\n';
code1.append_or(ac.fin({}));
std::cout << code1.size() << ' ' << code1 << '\n';
code1.append_and(ac.inf({}));
std::cout << code1.size() << ' ' << code1 << '\n';
code1.append_and(ac.fin({}));
std::cout << code1.size() << ' ' << code1 << '\n';
}

View file

@ -24,6 +24,7 @@
set -e
cat >expect <<EOF
Inf(0)&Inf(1)&Inf(2)&Inf(3)
#2: {0,2}
#2: {0,3}
#2: {1,2}
@ -58,6 +59,12 @@ stripping
#1: {0}
#1: {4}
#1: {2}
2 Inf(0)&Inf(1)&Inf(3)
5 (Fin(2)) | (Inf(0)&Inf(1)&Inf(3))
7 (Fin(0)) | (Fin(2)) | (Inf(0)&Inf(1)&Inf(3))
7 (Fin(0)) | (Fin(2)) | (Inf(0)&Inf(1)&Inf(3))
7 (Fin(0)) | (Fin(2)) | (Inf(0)&Inf(1)&Inf(3))
2 f
EOF
run 0 ../acc | tee stdout

View file

@ -1321,9 +1321,6 @@ EOF
# Acceptance: 1 Inf(0)
# and a development version of our parser would
# incorrectly interpret the former as the latter.
#
# Make sure we ignore all {0} if the acceptance is "1 t".
# See https://github.com/adl/hoaf/issues/36
cat >input <<EOF
HOA: v1
@ -1362,46 +1359,83 @@ State: 0
--END--
EOF
# The mapping of acceptance sets for the second automaton is
# input -> output
# 0 -> 0
# 1 -> removed
# 2 -> 1
# 3 -> removed
# 4 -> 2
# !2 -> 3
expectok input <<EOF
expectok input -v --is-empty <<EOF
HOA: v1
name: "TGBA for Fa"
States: 2
Start: 0
AP: 1 "a"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete deterministic
Acceptance: 1 t
properties: trans-labels explicit-labels trans-acc complete deterministic
--BODY--
State: 0 "F(a)"
[0] 1
[0] 1 {0}
[!0] 0
State: 1 "t"
[t] 1
[t] 1 {0}
--END--
HOA: v1
States: 1
Start: 0
AP: 3 "a" "b" "c"
acc-name: generalized-Buchi 4
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
Acceptance: 6 Inf(0)&Inf(2)&Inf(4)&Inf(5)
properties: trans-labels explicit-labels trans-acc complete deterministic
--BODY--
State: 0
[0&1&2] 0 {0 1 2}
[!0&1&2] 0 {1 2}
[0&!1&2] 0 {0 1}
[!0&!1&2] 0 {1}
[0&1&!2] 0 {0 2 3}
[!0&1&!2] 0 {2 3}
[0&!1&!2] 0 {0 3}
[!0&!1&!2] 0 {3}
[0&1&2] 0 {0 2 4}
[!0&1&2] 0 {2 4}
[0&!1&2] 0 {0 2}
[!0&!1&2] 0 {2}
[0&1&!2] 0 {0 4 5}
[!0&1&!2] 0 {4 5}
[0&!1&!2] 0 {0 5}
[!0&!1&!2] 0 {5}
--END--
EOF
# FIXME: Test removal of useless acceptance sets
#
# # The mapping of acceptance sets for the second automaton is
# # input -> output
# # 0 -> 0
# # 1 -> removed
# # 2 -> 1
# # 3 -> removed
# # 4 -> 2
# # !2 -> 3
# expectok input <<EOF
# HOA: v1
# name: "TGBA for Fa"
# States: 2
# Start: 0
# AP: 1 "a"
# acc-name: all
# Acceptance: 0 t
# properties: trans-labels explicit-labels state-acc complete deterministic
# --BODY--
# State: 0 "F(a)"
# [0] 1
# [!0] 0
# State: 1 "t"
# [t] 1
# --END--
# HOA: v1
# States: 1
# Start: 0
# AP: 3 "a" "b" "c"
# acc-name: generalized-Buchi 4
# Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
# properties: trans-labels explicit-labels trans-acc complete deterministic
# --BODY--
# State: 0
# [0&1&2] 0 {0 1 2}
# [!0&1&2] 0 {1 2}
# [0&!1&2] 0 {0 1}
# [!0&!1&2] 0 {1}
# [0&1&!2] 0 {0 2 3}
# [!0&1&!2] 0 {2 3}
# [0&!1&!2] 0 {0 3}
# [!0&!1&!2] 0 {3}
# --END--
# EOF