ltlsynt implement polarity and gequiv after decomposition too

* bin/ltlsynt.cc: Also simplify subformulas using polarity and global
equivalence.  Add support for --polarity=before-decompose and
--global-equiv=before-decompose to restablish the previous behavior.
* spot/tl/apcollect.hh,
spot/tl/apcollect.cc (realizability_simplifier::merge_mapping): New
method.
* tests/core/ltlsynt.test: Add new test cases.
This commit is contained in:
Alexandre Duret-Lutz 2024-04-05 12:42:43 +02:00
parent 848d1a3901
commit 9230614f8d
4 changed files with 217 additions and 14 deletions

View file

@ -732,6 +732,7 @@ diff outx exp
cat >exp <<EOF
there are 2 subformulas
working on subformula (b & (b | y)) -> y
trying to create strategy directly for (b & (b | y)) -> y
direct strategy might exist but was not found.
translating formula done in X seconds
@ -743,6 +744,7 @@ automaton has 4 states
solving game with acceptance: all
game solved in X seconds
simplification took X seconds
working on subformula (a | x) -> x
trying to create strategy directly for (a | x) -> x
direct strategy might exist but was not found.
translating formula done in X seconds
@ -784,10 +786,12 @@ diff outx exp
# Here, G!(!x | !y) should be Gx & Gy
cat >exp <<EOF
there are 2 subformulas
working on subformula Gx
trying to create strategy directly for Gx
direct strategy was found.
direct strat has 1 states, 1 edges and 0 colors
simplification took X seconds
working on subformula Gy
trying to create strategy directly for Gy
direct strategy was found.
direct strat has 1 states, 1 edges and 0 colors
@ -802,6 +806,7 @@ diff outx exp
# Here, !F(a | b) should be G(!a) & G(!b)
cat >exp <<EOF
there are 2 subformulas
working on subformula G!a
trying to create strategy directly for G!a
no strategy exists.
EOF
@ -813,6 +818,7 @@ diff outx exp
# Here, G!(a -> b) should be G(a) & G(!b)
cat >exp <<EOF
there are 2 subformulas
working on subformula Ga
trying to create strategy directly for Ga
no strategy exists.
EOF
@ -846,6 +852,7 @@ diff outx exp
# (a => b) & (a => c) & (a => d)
cat >exp <<EOF
there are 3 subformulas
working on subformula a -> b
trying to create strategy directly for a -> b
direct strategy might exist but was not found.
translating formula done in X seconds
@ -857,6 +864,7 @@ automaton has 4 states
solving game with acceptance: all
game solved in X seconds
simplification took X seconds
working on subformula a -> c
trying to create strategy directly for a -> c
direct strategy might exist but was not found.
translating formula done in X seconds
@ -868,6 +876,7 @@ automaton has 4 states
solving game with acceptance: all
game solved in X seconds
simplification took X seconds
working on subformula a -> d
trying to create strategy directly for a -> d
direct strategy might exist but was not found.
translating formula done in X seconds
@ -889,6 +898,7 @@ diff outx exp
# Here, !(F(a | b)) should be G!a & G!b
cat >exp <<EOF
there are 2 subformulas
working on subformula G!a
trying to create strategy directly for G!a
no strategy exists.
EOF
@ -921,8 +931,10 @@ ltlsynt -f 'G(c) & (G(a) <-> GFb)' --outs=b,c --decompose=yes\
--verbose --pol=no --realizability 2> out
cat >exp <<EOF
there are 2 subformulas
working on subformula Gc
trying to create strategy directly for Gc
direct strategy was found.
working on subformula Ga <-> GFb
trying to create strategy directly for Ga <-> GFb
direct strategy was found.
EOF
@ -932,6 +944,7 @@ ltlsynt -f 'G(c) & (G(a) <-> GFb)' --outs=b,c --decompose=yes --pol=no \
--verbose --realizability --bypass=no 2> out
cat >exp <<EOF
there are 2 subformulas
working on subformula Gc
translating formula done in X seconds
automaton has 1 states and 0 colors
LAR construction done in X seconds
@ -940,6 +953,7 @@ split inputs and outputs done in X seconds
automaton has 2 states
solving game with acceptance: all
game solved in X seconds
working on subformula Ga <-> GFb
translating formula done in X seconds
automaton has 2 states and 2 colors
LAR construction done in X seconds
@ -956,6 +970,7 @@ diff outx exp
# ACD verbose
cat >exp <<EOF
there are 2 subformulas
working on subformula GFa <-> GFb
translating formula done in X seconds
automaton has 1 states and 2 colors
ACD construction done in X seconds
@ -965,6 +980,7 @@ automaton has 6 states
solving game with acceptance: generalized-Streett 1 1
game solved in X seconds
simplification took X seconds
working on subformula Gc
translating formula done in X seconds
automaton has 1 states and 0 colors
ACD construction done in X seconds
@ -1147,3 +1163,140 @@ grep 'controlenv.*matches both' err
ltlsynt --polarity=1 --global-e=1 -f 'G(i -> Xo) & G(!i -> F!o)' --real
ltlsynt --polarity=0 --global-e=0 -f 'G(i -> Xo) & G(!i -> F!o)' --real
cat >exp <<EOF
there are 2 subformulas
working on subformula G(i1 -> (o1 | !o2)) & G(i2 -> X(!o1 | o2))
the following signals can be temporarily removed:
i1 := 1
i2 := 1
new formula: G(o1 | !o2) & GX(!o1 | o2)
trying to create strategy directly for G(o1 | !o2) & GX(!o1 | o2)
direct strategy might exist but was not found.
translating formula done in X seconds
automaton has 2 states and 0 colors
LAR construction done in X seconds
DPA has 2 states, 0 colors
split inputs and outputs done in X seconds
automaton has 4 states
solving game with acceptance: all
game solved in X seconds
simplification took X seconds
working on subformula G(!i1 -> (o3 | !o4)) & G(!i2 -> X(!o3 | o4))
the following signals can be temporarily removed:
i1 := 0
i2 := 0
new formula: G(o3 | !o4) & GX(!o3 | o4)
trying to create strategy directly for G(o3 | !o4) & GX(!o3 | o4)
direct strategy might exist but was not found.
translating formula done in X seconds
automaton has 2 states and 0 colors
LAR construction done in X seconds
DPA has 2 states, 0 colors
split inputs and outputs done in X seconds
automaton has 4 states
solving game with acceptance: all
game solved in X seconds
simplification took X seconds
REALIZABLE
HOA: v1
States: 1
Start: 0
AP: 6 "o1" "o2" "o3" "o4" "i1" "i2"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
controllable-AP: 0 1 2 3
--BODY--
State: 0
[!0&!1&!2&!3 | !0&!1&2&3 | 0&1&!2&!3 | 0&1&2&3] 0
--END--
EOF
f1='G(i1->(o1|!o2)) & G(!i1->(o3|!o4)) & G(i2->X(!o1|o2)) & G(!i2->X(!o3|o4))'
ltlsynt -f "$f1" --verbose 2>out 1>&2
sed 's/ [0-9.e-]* seconds/ X seconds/g' out > outx
diff outx exp
gg='G(i2 -> (!o1 | o2)) & G(!i2 -> (!o3 | o4))'
cat >exp <<EOF
the following signals can be temporarily removed:
o5 := 1
new formula: G(i1 -> (o1 | !o2)) & G(!i1 -> (o3 | !o4)) & $gg
there are 2 subformulas
working on subformula G(i1 -> (o1 | !o2)) & G(i2 -> (!o1 | o2))
the following signals can be temporarily removed:
i1 := 1
i2 := 1
new formula: G(o1 | !o2) & G(!o1 | o2)
o2 := o1
new formula: G(o1 | !o1)
trying to create strategy directly for G(o1 | !o1)
direct strategy was found.
direct strat has 1 states, 1 edges and 0 colors
simplification took X seconds
working on subformula G(!i1 -> (o3 | !o4)) & G(!i2 -> (!o3 | o4))
the following signals can be temporarily removed:
i1 := 0
i2 := 0
new formula: G(o3 | !o4) & G(!o3 | o4)
o4 := o3
new formula: G(o3 | !o3)
trying to create strategy directly for G(o3 | !o3)
direct strategy was found.
direct strat has 1 states, 1 edges and 0 colors
simplification took X seconds
REALIZABLE
HOA: v1
States: 1
Start: 0
AP: 7 "o1" "o2" "o3" "o4" "o5" "i1" "i2"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic weak
controllable-AP: 0 1 2 3 4
--BODY--
State: 0
[!0&!1&!2&!3&4 | !0&!1&2&3&4 | 0&1&!2&!3&4 | 0&1&2&3&4] 0
--END--
EOF
f2='G(i1->(o1|!o2)) & G(!i1->(o3|!o4)) & G(i2->(!o1|o2)) & G(!i2->(!o3|o4))&Go5'
ltlsynt -f "$f2" --verbose 2>out 1>&2
sed 's/ [0-9.e-]* seconds/ X seconds/g' out > outx
diff outx exp
gg='G(i2->(!o1 | o2)) & G(!i2->(!o3 | o4))'
hh='0&1&3&!5&6 | 0&!3&!4&!5&6 | !1&2&!3&5&6 | !1&!3&!4&!5&6 | '
ii='1&!2&3&!5&6 | 1&!2&4&5&6 | !2&!3&!4&!5&6 | !2&!3&4&5&6'
cat >exp <<EOF
the following signals can be temporarily removed:
o5 := 1
new formula: G(i1->(o1 | !o2)) & G(!i1->(o3 | !o4)) & $gg
there are 2 subformulas
working on subformula G(i1->(o1 | !o2)) & G(i2->(!o1 | o2))
trying to create strategy directly for G(i1->(o1 | !o2)) & G(i2->(!o1 | o2))
direct strategy was found.
direct strat has 1 states, 1 edges and 0 colors
simplification took X seconds
working on subformula G(!i1->(o3 | !o4)) & G(!i2->(!o3 | o4))
trying to create strategy directly for G(!i1->(o3 | !o4)) & G(!i2->(!o3 | o4))
direct strategy was found.
direct strat has 1 states, 1 edges and 0 colors
simplification took X seconds
REALIZABLE
HOA: v1
States: 1
Start: 0
AP: 7 "o1" "o2" "i1" "i2" "o3" "o4" "o5"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic weak
controllable-AP: 0 1 4 5 6
--BODY--
State: 0
[!0&!1&2&5&6 | !0&!1&3&!5&6 | !0&!2&4&5&6 | 0&1&2&5&6 | $hh$ii] 0
--END--
EOF
f2='G(i1->(o1|!o2)) & G(!i1->(o3|!o4)) & G(i2->(!o1|o2)) & G(!i2->(!o3|o4))&Go5'
ltlsynt -f "$f2" --polarity=before-decom --verbose 2>out 1>&2
sed 's/ [0-9.e-]* seconds/ X seconds/g;s/ -> /->/g;' out > outx
diff outx exp