Improving split and reorganizing

* spot/twaalgos/synthesis.cc, spot/twaalgos/synthesis.hh: New files
regrouping the functionnalities split and apply_strategy for synthesis
* python/spot/impl.i, spot/twaalgos/Makefile.am: Add them.
* spot/twaalgos/split.cc, spot/twaalgos/split.hh: No longer contains
the splits necessary for for synthesis, moved to
spot/twaalgos/synthesis.cc, spot/twaalgos/split.hh Split is now faster
and reduces the number of intermediate states, reducing the overall
size of the arena
* spot/misc/game.cc, spot/misc/game.hh: Renaming propagate_players to
alternate_players.
* tests/core/ltlsynt.test, tests/python/split.py: Update tests.
* bin/ltlsynt.cc: Adjust to new split. Swap order of split and
to_parity for lar.
This commit is contained in:
philipp 2020-09-24 16:25:53 +02:00 committed by Alexandre Duret-Lutz
parent ca043bd62d
commit 29055c8109
11 changed files with 641 additions and 308 deletions

View file

@ -62,12 +62,13 @@ parity 16;
14 1 1 10,16;
16 1 0 14,15;
1 1 1 3,6;
parity 4;
3 2 0 1,4 "INIT";
4 3 1 0,3;
0 1 0 1,2;
2 1 1 0,0;
1 2 1 3,3;
parity 5;
1 1 0 4,5 "INIT";
5 5 1 0,1;
0 1 0 2,3;
3 3 1 0,0;
2 5 1 1;
4 4 1 1,1;
EOF
: > out
@ -214,7 +215,6 @@ DPA has 12 states, 4 colors
simplification done
DPA has 11 states
determinization and simplification took X seconds
parity game built in X seconds
parity game solved in X seconds
EOF
ltlsynt --ins='a' --outs='b' -f 'GFa <-> GFb' --verbose --realizability 2> out
@ -228,7 +228,6 @@ simplification done in X seconds
DPA has 3 states
split inputs and outputs done in X seconds
automaton has 8 states
parity game built in X seconds
parity game solved in X seconds
EOF
ltlsynt --ins=a --outs=b -f 'GFa <-> GFb' --verbose --algo=ps 2> out
@ -238,11 +237,10 @@ diff outx exp
cat >exp <<EOF
translating formula done in X seconds
automaton has 16 states and 2 colors
LAR construction done in X seconds
DPA has 16 states, 4 colors
split inputs and outputs done in X seconds
automaton has 47 states
LAR construction done in X seconds
DPA has 47 states, 4 colors
parity game built in X seconds
parity game solved in X seconds
EOF
ltlsynt --ins='a,b,c,d' --outs='e' -f '(Fa & Fb & Fc & Fd) <-> GFe' \
@ -390,7 +388,7 @@ State: 2
[!0] 2
--END--
EOF
ltlsynt -x tls-impl=0 -f '!XXF(p0 & (p0 M Gp0))' > out
ltlsynt --outs=p0 -x tls-impl=0 -f '!XXF(p0 & (p0 M Gp0))' > out
diff out exp
cat >exp <<EOF
@ -407,10 +405,10 @@ State: 0
[!0] 0
--END--
EOF
ltlsynt -x tls-impl=1 -f '!XXF(p0 & (p0 M Gp0))' > out
ltlsynt --outs=p0 -x tls-impl=1 -f '!XXF(p0 & (p0 M Gp0))' > out
diff out exp
ltlsynt -f '!XXF(p0 & (p0 M Gp0))' > out
ltlsynt --outs=p0 -f '!XXF(p0 & (p0 M Gp0))' > out
diff out exp
f='Fp0 U XX((p0 & F!p1) | (!p0 & Gp1))'

View file

@ -1,5 +1,5 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018 Laboratoire de Recherche et
# Copyright (C) 2018-2020 Laboratoire de Recherche et
# Développement de l'Epita
#
# This file is part of Spot, a model checking library.
@ -28,21 +28,31 @@ def equiv(a, b):
return incl(a, b) and incl(b, a)
def do_split(f, in_list):
def do_split(f, in_list, out_list):
aut = spot.translate(f)
inputs = spot.buddy.bddtrue
for a in in_list:
inputs &= spot.buddy.bdd_ithvar(aut.get_dict().varnum(spot.formula(a)))
s = spot.split_2step(aut, inputs)
outputs = spot.buddy.bddtrue
for a in out_list:
outputs &= spot.buddy.bdd_ithvar(aut.get_dict().varnum(spot.formula(a)))
s = spot.split_2step(aut, inputs, outputs, False, False)
return aut, s
def str_diff(expect, obtained):
res = expect == obtained
if not res:
print("Expected:\n", expect, "\nbut obtained:\n", obtained)
return res
aut, s = do_split('(FG !a) <-> (GF b)', ['a'])
aut, s = do_split('(FG !a) <-> (GF b)', ['a'], ['b'])
assert equiv(aut, spot.unsplit_2step(s))
aut, s = do_split('GFa && GFb', ['a'])
aut, s = do_split('GFa && GFb', ['a'], ['b'])
assert equiv(aut, spot.unsplit_2step(s))
assert s.to_str() == """HOA: v1
assert str_diff("""HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
@ -50,6 +60,7 @@ acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
spot-state-player: 0 1 1
--BODY--
State: 0
[0] 1
@ -60,10 +71,10 @@ State: 1
State: 2
[!1] 0
[1] 0 {1}
--END--"""
--END--""", s.to_str() )
aut, s = do_split('! ((G (req -> (F ack))) && (G (go -> (F grant))))', ['go',
'req'])
aut, s = do_split('! ((G (req -> (F ack))) && (G (go -> (F grant))))',
['go', 'req'], ['ack'])
assert equiv(aut, spot.unsplit_2step(s))
# FIXME s.to_str() is NOT the same on Debian stable and on Debian unstable
# we should investigate this
@ -103,5 +114,6 @@ assert equiv(aut, spot.unsplit_2step(s))
# --END--"""
aut, s = do_split('((G (((! g_0) || (! g_1)) && ((r_0 && (X r_1)) -> (F (g_0 \
&& g_1))))) && (G (r_0 -> F g_0))) && (G (r_1 -> F g_1))', ['r_0', 'r_1'])
&& g_1))))) && (G (r_0 -> F g_0))) && (G (r_1 -> F g_1))',
['r_0', 'r_1'], ['g_0', 'g_1'])
assert equiv(aut, spot.unsplit_2step(s))