extend HOA I/O to preserve the state-player property

* spot/parseaut/parseaut.yy, spot/parseaut/scanaut.ll,
spot/twaalgos/hoa.cc: Add input and output support.
* doc/org/hoa.org: Document the HOA extension.
* bin/ltlsynt.cc: Add a --print-game-hoa option to
produce such format.
* tests/core/gamehoa.test: New file to test this.
* tests/Makefile.am: Add it.
* NEWS: Mention this new feature.
This commit is contained in:
Alexandre Duret-Lutz 2020-09-08 16:25:36 +02:00
parent 25c75c55b1
commit ea9384dd4b
8 changed files with 209 additions and 5 deletions

View file

@ -1154,3 +1154,69 @@ rm -f stvstracc.hoa sba.hoa stvstrlab.hoa decorate.hoa
# LocalWords: bitsets randaut stvstrlab aut Hv hw bigwedge mathsf
# LocalWords: genltl gf GFp Fp parser's rankdir br labelloc ffffa
# LocalWords: fillcolor fontname svg txt Xa
** Arenas for two-player games
An automaton can be seen as a two-player game by simply annotating
states with number representing the player that should play in this
state. We use an extension to the HOA format to transmit this
information: the =spot-state-player:= head (or =spot.state-player:= when
using the HOA 1.1 version) is followed by a string of =0= or
=1=, one per state of the automaton, representing the player's number
associated to each state.
For instance in the following output of =ltlsynt=, the sequence
call_player() indicates the players owning each of the
call_player(h="States")[:results raw] states.
#+NAME: exgame
#+begin_src sh :wrap SRC hoa
ltlsynt --ins=a --outs=b -f 'Ga <-> Gb' --print-game-hoa
#+end_src
#+RESULTS: exgame
#+begin_SRC hoa
HOA: v1
States: 11
Start: 3
AP: 2 "a" "b"
acc-name: Streett 1
Acceptance: 2 Fin(0) | Inf(1)
properties: trans-labels explicit-labels trans-acc colored complete
properties: deterministic
spot-state-player: 0 0 0 0 1 1 1 1 1 1 0
--BODY--
State: 0
[t] 4 {0}
State: 1
[t] 5 {0}
State: 2
[0] 6 {0}
[!0] 7 {0}
State: 3
[0] 8 {0}
[!0] 5 {0}
State: 4
[t] 0 {1}
State: 5
[!1] 0 {0}
[1] 1 {0}
State: 6
[t] 2 {0}
State: 7
[t] 0 {0}
State: 8
[!1] 2 {0}
[1] 3 {1}
State: 9
[t] 10 {0}
State: 10
[t] 9 {0}
--END--
#+end_SRC
#+NAME: player
#+BEGIN_SRC sh :exports none :var t=exgame h="spot-state-player"
sed -n "s/^$h: \(.*\)\$/\\1/p" <<EOF | tr -d '\n'
$t
EOF
#+END_SRC