lbtt: improve the LBTT output
Provide a way to output automata with state-based acceptance. Also print the guards using to_lbt_string() for consistency: as a consequence, atomic proposition that do not match p[0-9]+ are now double-quoted. * src/tgbaalgos/lbtt.hh (lbtt_reachable): Add a sba option. * src/tgbaalgos/lbtt.cc: Implement it, and use to_lbt_string(). * src/ltlvisit/lbt.cc (is_pnum): Reject 'p' without number. * src/bin/ltl2tgba.cc: Activate the sba option of --ba was given. Add an option --lbtt=t to get the old behavior. * src/bin/man/ltl2tgba.x: Document the LBTT format we use with some links and examples. * src/tgbatest/lbttparse.test: More tests. * src/tgbatest/ltlcross2.test: Add a check with --lbtt --ba. * NEWS: Update.
This commit is contained in:
parent
e2378b4904
commit
eed7e2df8f
8 changed files with 225 additions and 60 deletions
|
|
@ -67,7 +67,9 @@ static const argp_option options[] =
|
|||
/**************************************************/
|
||||
{ 0, 0, 0, 0, "Output format:", 3 },
|
||||
{ "dot", OPT_DOT, 0, 0, "GraphViz's format (default)", 0 },
|
||||
{ "lbtt", OPT_LBTT, 0, 0, "LBTT's format", 0 },
|
||||
{ "lbtt", OPT_LBTT, "t", OPTION_ARG_OPTIONAL,
|
||||
"LBTT's format (add =t to force transition-based acceptance even"
|
||||
" on Büchi automata)", 0 },
|
||||
{ "spin", 's', 0, 0, "Spin neverclaim (implies --ba)", 0 },
|
||||
{ "spot", OPT_SPOT, 0, 0, "SPOT's format", 0 },
|
||||
{ "utf8", '8', 0, 0, "enable UTF-8 characters in output "
|
||||
|
|
@ -106,7 +108,7 @@ const struct argp_child children[] =
|
|||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
enum output_format { Dot, Lbtt, Spin, Spot, Stats } format = Dot;
|
||||
enum output_format { Dot, Lbtt, Lbtt_t, Spin, Spot, Stats } format = Dot;
|
||||
bool utf8 = false;
|
||||
const char* stats = "";
|
||||
spot::option_map extra_options;
|
||||
|
|
@ -142,7 +144,17 @@ parse_opt(int key, char* arg, struct argp_state*)
|
|||
format = Dot;
|
||||
break;
|
||||
case OPT_LBTT:
|
||||
format = Lbtt;
|
||||
if (arg)
|
||||
{
|
||||
if (arg[0] == 't' && arg[1] == 0)
|
||||
format = Lbtt_t;
|
||||
else
|
||||
error(2, 0, "unknown argument for --lbtt: '%s'", arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
format = Lbtt;
|
||||
}
|
||||
break;
|
||||
case OPT_SPOT:
|
||||
format = Spot;
|
||||
|
|
@ -220,7 +232,10 @@ namespace
|
|||
|| (type == spot::postprocessor::Monitor));
|
||||
break;
|
||||
case Lbtt:
|
||||
spot::lbtt_reachable(std::cout, aut);
|
||||
spot::lbtt_reachable(std::cout, aut, type == spot::postprocessor::BA);
|
||||
break;
|
||||
case Lbtt_t:
|
||||
spot::lbtt_reachable(std::cout, aut, false);
|
||||
break;
|
||||
case Spot:
|
||||
spot::tgba_save_reachable(std::cout, aut);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,84 @@
|
|||
[NAME]
|
||||
ltl2tgba \- translate LTL/PSL formulas into Büchi automata
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[NOTE ON LBTT'S FORMAT]
|
||||
The format, described at
|
||||
http://www.tcs.hut.fi/Software/lbtt/doc/html/Format-for-automata.html,
|
||||
has support for both transition-based and state based generalized acceptance.
|
||||
|
||||
Because Spot uses transition-based generalized Büchi automata
|
||||
internally, it will normally use the transition-based flavor of that
|
||||
format, indicated with a 't' flag after the number of acceptance sets.
|
||||
For instance:
|
||||
|
||||
% bin/ltl2tgba --lbtt 'GFp0 & GFp1 & FGp2'
|
||||
2 2t // 2 states, 2 transition-based acceptance sets
|
||||
0 1 // state 0: initial
|
||||
0 -1 t // trans. to state 0, no acc., label: true
|
||||
1 -1 | & p0 p2 & p1 p2 // trans. to state 1, no acc., label: (p0&p2)|(p1&p2)
|
||||
-1 // end of state 0
|
||||
1 0 // state 1: not initial
|
||||
1 0 1 -1 & & p0 p1 p2 // trans. to state 1, acc. 0 and 1, label: p0&p1&p2
|
||||
1 0 -1 & & p1 p2 ! p0 // trans. to state 1, acc. 0, label: !p0&p1&p2
|
||||
1 1 -1 & & p0 p2 ! p1 // trans. to state 1, acc. 1, label: p0&!p1&p2
|
||||
1 -1 & & p2 ! p0 ! p1 // trans. to state 1, no acc., label: !p0&!p1&p2
|
||||
-1 // end if state 1
|
||||
|
||||
Here, the two acceptance sets are represented by the numbers 0 and 1,
|
||||
and they each contain two transitions (the first transition of state 1
|
||||
belongs to both sets).
|
||||
|
||||
When both --ba and --lbtt options are used, the state-based flavor of
|
||||
the format is used instead. Note that the LBTT format supports
|
||||
generalized acceptance conditions on states, but Spot only use this
|
||||
format for Büchi automata, where there is always only one acceptance
|
||||
set. Unlike in the LBTT documentation, we do not use the
|
||||
optional 's' flag to indicate the state-based acceptance, this way our
|
||||
output is also compatible with that of LBT (see
|
||||
http://www.tcs.hut.fi/Software/maria/tools/lbt/).
|
||||
|
||||
% ltl2tgba --ba --lbtt FGp0
|
||||
2 1 // 2 states, 1 (state-based) accepance set
|
||||
0 1 -1 // state 0: initial, non-accepting
|
||||
0 t // trans. to state 0, label: true
|
||||
1 p0 // trans. to state 1, label: p0
|
||||
-1 // end of state 0
|
||||
1 0 0 -1 // state 1: not initial, in acceptance set 0
|
||||
1 p0 // trans. to state 0, label: p0
|
||||
-1 // end if state 1
|
||||
|
||||
You can force ltl2tgba to use the transition-based flavor of the
|
||||
format even for Büchi automaton using --lbtt=t.
|
||||
|
||||
% ltl2tgba --ba --lbtt=t FGp0
|
||||
2 1t // 2 states, 1 transition-based accepance set.
|
||||
0 1 // state 0: initial
|
||||
0 -1 t // trans. to state 0, no acc., label: true
|
||||
1 -1 p0 // trans. to state 1, no acc., label: p0
|
||||
-1 // end of state 0
|
||||
1 0 // state 1: not initial
|
||||
1 0 -1 p0 // trans. to state 1, acc. 0, label: p0
|
||||
-1 // end if state 1
|
||||
|
||||
When representing a Büchi automaton using transition-based acceptance,
|
||||
all transitions leaving accepting states are put into the acceptance set.
|
||||
|
||||
A final note concerns the name of the atomic propositions. The
|
||||
original LBTT and LBT formats require these atomic propositions to
|
||||
have names such as 'p0', 'p32', ... We extend the format to accept
|
||||
atomic proposition with arbitrary names that do not conflict with
|
||||
LBT's operators (e.g. 'i' is the symbol of the implication operator so
|
||||
it may not be used as an atomic proposition), or as double-quoted
|
||||
strings. Spot will always output atomic-proposition that do not match
|
||||
p[0-9]+ as double-quoted strings.
|
||||
|
||||
% bin/ltl2tgba --lbtt 'GFa & GFb'
|
||||
1 2t
|
||||
0 1
|
||||
0 0 1 -1 & "a" "b"
|
||||
0 0 -1 & "b" ! "a"
|
||||
0 1 -1 & "a" ! "b"
|
||||
0 -1 & ! "b" ! "a"
|
||||
-1
|
||||
|
||||
[SEE ALSO]
|
||||
.BR spot-x (7)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue