org: simplify babel blocks using #+PROPERTY: header-args
This feature is in Org 9, which is already required. * doc/org/autcross.org, doc/org/autfilt.org, doc/org/compile.org, doc/org/concepts.org, doc/org/csv.org, doc/org/dstar2tgba.org, doc/org/genaut.org, doc/org/genltl.org, doc/org/hierarchy.org, doc/org/hoa.org, doc/org/ioltl.org, doc/org/ltl2tgba.org, doc/org/ltl2tgta.org, doc/org/ltlcross.org, doc/org/ltldo.org, doc/org/ltlfilt.org, doc/org/ltlgrind.org, doc/org/ltlsynt.org, doc/org/oaut.org, doc/org/randaut.org, doc/org/randltl.org, doc/org/satmin.org, doc/org/setup.org, doc/org/tools.org, doc/org/tut01.org, doc/org/tut02.org, doc/org/tut03.org, doc/org/tut04.org, doc/org/tut10.org, doc/org/tut11.org, doc/org/tut12.org, doc/org/tut20.org, doc/org/tut21.org, doc/org/tut22.org, doc/org/tut23.org, doc/org/tut24.org, doc/org/tut30.org, doc/org/tut31.org, doc/org/tut50.org, doc/org/upgrade2.org: Simplify SRC block setups for sh, python and C++. Also fix a few typos and examples along the way.
This commit is contained in:
parent
0c8e6a38a8
commit
8a96828d85
40 changed files with 2193 additions and 2281 deletions
|
|
@ -3,12 +3,15 @@
|
|||
#+DESCRIPTION: Code example for translating formulas in Spot
|
||||
#+INCLUDE: setup.org
|
||||
#+HTML_LINK_UP: tut.html
|
||||
#+PROPERTY: header-args:sh :results verbatim :exports both
|
||||
#+PROPERTY: header-args:python :results output :exports both
|
||||
#+PROPERTY: header-args:C+++ :results verbatim :exports both
|
||||
|
||||
Here is how to translate an LTL (or PSL) formula into a never claim.
|
||||
|
||||
* Shell
|
||||
|
||||
#+BEGIN_SRC sh :results verbatim :exports both
|
||||
#+BEGIN_SRC sh
|
||||
ltl2tgba --spin 'GFa -> GFb'
|
||||
#+END_SRC
|
||||
|
||||
|
|
@ -17,23 +20,23 @@ ltl2tgba --spin 'GFa -> GFb'
|
|||
never { /* F(GFb | G!a) */
|
||||
T0_init:
|
||||
if
|
||||
:: ((!(a))) -> goto accept_S0
|
||||
:: ((true)) -> goto T0_init
|
||||
:: ((b)) -> goto accept_S2
|
||||
:: (true) -> goto T0_init
|
||||
:: (b) -> goto accept_S1
|
||||
:: (!(a)) -> goto accept_S2
|
||||
fi;
|
||||
accept_S0:
|
||||
accept_S1:
|
||||
if
|
||||
:: ((!(a))) -> goto accept_S0
|
||||
:: (b) -> goto accept_S1
|
||||
:: (!(b)) -> goto T0_S3
|
||||
fi;
|
||||
accept_S2:
|
||||
if
|
||||
:: ((b)) -> goto accept_S2
|
||||
:: ((!(b))) -> goto T0_S3
|
||||
:: (!(a)) -> goto accept_S2
|
||||
fi;
|
||||
T0_S3:
|
||||
if
|
||||
:: ((b)) -> goto accept_S2
|
||||
:: ((!(b))) -> goto T0_S3
|
||||
:: (b) -> goto accept_S1
|
||||
:: (!(b)) -> goto T0_S3
|
||||
fi;
|
||||
}
|
||||
#+end_example
|
||||
|
|
@ -47,7 +50,7 @@ method that can output in one of the supported syntaxes.
|
|||
|
||||
So the translation is actually a one-liner in Python:
|
||||
|
||||
#+BEGIN_SRC python :results output :exports both
|
||||
#+BEGIN_SRC python
|
||||
import spot
|
||||
print(spot.formula('GFa -> GFb').translate('BA').to_str('spin'))
|
||||
#+END_SRC
|
||||
|
|
@ -57,23 +60,23 @@ print(spot.formula('GFa -> GFb').translate('BA').to_str('spin'))
|
|||
never {
|
||||
T0_init:
|
||||
if
|
||||
:: ((!(a))) -> goto accept_S0
|
||||
:: ((true)) -> goto T0_init
|
||||
:: ((b)) -> goto accept_S2
|
||||
:: (true) -> goto T0_init
|
||||
:: (b) -> goto accept_S1
|
||||
:: (!(a)) -> goto accept_S2
|
||||
fi;
|
||||
accept_S0:
|
||||
accept_S1:
|
||||
if
|
||||
:: ((!(a))) -> goto accept_S0
|
||||
:: (b) -> goto accept_S1
|
||||
:: (!(b)) -> goto T0_S3
|
||||
fi;
|
||||
accept_S2:
|
||||
if
|
||||
:: ((b)) -> goto accept_S2
|
||||
:: ((!(b))) -> goto T0_S3
|
||||
:: (!(a)) -> goto accept_S2
|
||||
fi;
|
||||
T0_S3:
|
||||
if
|
||||
:: ((b)) -> goto accept_S2
|
||||
:: ((!(b))) -> goto T0_S3
|
||||
:: (b) -> goto accept_S1
|
||||
:: (!(b)) -> goto T0_S3
|
||||
fi;
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +86,7 @@ The above line can actually be made a bit shorter, because
|
|||
=translate()= can also be used as a function (as opposed to a method)
|
||||
that takes a formula (possibly as a string) as first argument:
|
||||
|
||||
#+BEGIN_SRC python :results output :exports both
|
||||
#+BEGIN_SRC python
|
||||
import spot
|
||||
print(spot.translate('GFa -> GFb', 'BA').to_str('spin'))
|
||||
#+END_SRC
|
||||
|
|
@ -93,23 +96,23 @@ print(spot.translate('GFa -> GFb', 'BA').to_str('spin'))
|
|||
never {
|
||||
T0_init:
|
||||
if
|
||||
:: ((!(a))) -> goto accept_S0
|
||||
:: ((true)) -> goto T0_init
|
||||
:: ((b)) -> goto accept_S2
|
||||
:: (true) -> goto T0_init
|
||||
:: (b) -> goto accept_S1
|
||||
:: (!(a)) -> goto accept_S2
|
||||
fi;
|
||||
accept_S0:
|
||||
accept_S1:
|
||||
if
|
||||
:: ((!(a))) -> goto accept_S0
|
||||
:: (b) -> goto accept_S1
|
||||
:: (!(b)) -> goto T0_S3
|
||||
fi;
|
||||
accept_S2:
|
||||
if
|
||||
:: ((b)) -> goto accept_S2
|
||||
:: ((!(b))) -> goto T0_S3
|
||||
:: (!(a)) -> goto accept_S2
|
||||
fi;
|
||||
T0_S3:
|
||||
if
|
||||
:: ((b)) -> goto accept_S2
|
||||
:: ((!(b))) -> goto T0_S3
|
||||
:: (b) -> goto accept_S1
|
||||
:: (!(b)) -> goto T0_S3
|
||||
fi;
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +130,7 @@ various preferences (like small or deterministic) or characteristic
|
|||
(complete, unambiguous) for the resulting automaton. Finally, the
|
||||
output as a never claim is done via the =print_never_claim= function.
|
||||
|
||||
#+BEGIN_SRC C++ :results verbatim :exports both
|
||||
#+BEGIN_SRC C++
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/twaalgos/translate.hh>
|
||||
|
|
@ -151,22 +154,22 @@ output as a never claim is done via the =print_never_claim= function.
|
|||
never {
|
||||
T0_init:
|
||||
if
|
||||
:: (p1) -> goto accept_S0
|
||||
:: (true) -> goto T0_init
|
||||
:: (p0) -> goto accept_S2
|
||||
:: (p0) -> goto accept_S1
|
||||
:: (p1) -> goto accept_S2
|
||||
fi;
|
||||
accept_S0:
|
||||
accept_S1:
|
||||
if
|
||||
:: (p1) -> goto accept_S0
|
||||
:: (p0) -> goto accept_S1
|
||||
:: (!(p0)) -> goto T0_S3
|
||||
fi;
|
||||
accept_S2:
|
||||
if
|
||||
:: (p0) -> goto accept_S2
|
||||
:: (!(p0)) -> goto T0_S3
|
||||
:: (p1) -> goto accept_S2
|
||||
fi;
|
||||
T0_S3:
|
||||
if
|
||||
:: (p0) -> goto accept_S2
|
||||
:: (p0) -> goto accept_S1
|
||||
:: (!(p0)) -> goto T0_S3
|
||||
fi;
|
||||
}
|
||||
|
|
@ -176,7 +179,7 @@ T0_S3:
|
|||
|
||||
The Python version of =translate()= is documented as follows:
|
||||
|
||||
#+BEGIN_SRC python :results output :exports both
|
||||
#+BEGIN_SRC python :exports results
|
||||
import spot
|
||||
help(spot.translate)
|
||||
#+END_SRC
|
||||
|
|
@ -185,22 +188,30 @@ help(spot.translate)
|
|||
#+begin_example
|
||||
Help on function translate in module spot:
|
||||
|
||||
translate(formula, *args)
|
||||
translate(formula, *args, dict=<spot.impl.bdd_dict; proxy of <Swig Object of type 'std::shared_ptr< spot::bdd_dict > *' at 0x7f1f9541c090> >, xargs=None)
|
||||
Translate a formula into an automaton.
|
||||
|
||||
Keep in mind that pref expresses just a preference that may not be
|
||||
satisfied.
|
||||
Keep in mind that 'Deterministic' expresses just a preference that
|
||||
may not be satisfied.
|
||||
|
||||
The optional arguments should be strings among the following:
|
||||
- at most one in 'TGBA', 'BA', or 'Monitor'
|
||||
(type of automaton to build)
|
||||
- at most one in 'TGBA', 'BA', or 'Monitor', 'generic',
|
||||
'parity', 'parity min odd', 'parity min even',
|
||||
'parity max odd', 'parity max even' (type of automaton to
|
||||
build), 'coBuchi'
|
||||
- at most one in 'Small', 'Deterministic', 'Any'
|
||||
(preferred characteristics of the produced automaton)
|
||||
- at most one in 'Low', 'Medium', 'High'
|
||||
(optimization level)
|
||||
- any combination of 'Complete', 'Unambiguous', and
|
||||
'StateBasedAcceptance' (or 'SBAcc' for short)
|
||||
- any combination of 'Complete', 'Unambiguous',
|
||||
'StateBasedAcceptance' (or 'SBAcc' for short), and
|
||||
'Colored' (only for parity acceptance)
|
||||
|
||||
The default correspond to 'tgba', 'small' and 'high'.
|
||||
The default corresponds to 'tgba', 'small' and 'high'.
|
||||
|
||||
Additional options can be supplied using a `spot.option_map`, or a
|
||||
string (that will be converted to `spot.option_map`), as the `xargs`
|
||||
argument. This is similar to the `-x` option of command-line tools;
|
||||
so check out the spot-x(7) man page for details.
|
||||
|
||||
#+end_example
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue