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,6 +3,9 @@
|
|||
#+DESCRIPTION: Code example for using Spot to translating formulas in monitors
|
||||
#+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
|
||||
|
||||
A monitor is a special type of automaton that is supposed to /monitor/
|
||||
a running system and move accordingly. A monitor detects an error
|
||||
|
|
@ -13,7 +16,7 @@ For instance here is a monitor that checks that *yellow* never occurs
|
|||
immediately after *red*.
|
||||
|
||||
#+NAME: tut11a
|
||||
#+BEGIN_SRC sh :results verbatim :exports none
|
||||
#+BEGIN_SRC sh :exports none
|
||||
ltl2tgba -D -M '!F(red & Xyellow)' -d
|
||||
#+END_SRC
|
||||
|
||||
|
|
@ -39,7 +42,7 @@ that case a violation should be reported.
|
|||
To build the above deterministic monitor using [[file:ltl2tgba.org][=ltl2tgba=]], we simply
|
||||
pass option =-M= (for monitor) and =-D= (for deterministic).
|
||||
|
||||
#+BEGIN_SRC sh :results verbatim :exports both
|
||||
#+BEGIN_SRC sh
|
||||
ltl2tgba -D -M '!F(red & X(yellow))'
|
||||
#+END_SRC
|
||||
|
||||
|
|
@ -69,7 +72,7 @@ The code is very similar to [[file:tut10.org][our previous example of building a
|
|||
claim]] except that we explicitly require a deterministic monitor and
|
||||
output in the [[file:hoa.org][HOA format]].
|
||||
|
||||
#+BEGIN_SRC python :results output :exports both
|
||||
#+BEGIN_SRC python
|
||||
import spot
|
||||
print(spot.translate('!F(red & X(yellow))', 'monitor', 'det').to_str('HOA'))
|
||||
#+END_SRC
|
||||
|
|
@ -97,7 +100,7 @@ State: 1
|
|||
|
||||
The code very similar to [[file:tut10.org][the never claim example]].
|
||||
|
||||
#+BEGIN_SRC C++ :results verbatim :exports both
|
||||
#+BEGIN_SRC C++
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/twaalgos/translate.hh>
|
||||
|
|
@ -154,7 +157,7 @@ In the [[file:hierarchy.org][hierarchy of temporal properties]], the properties
|
|||
monitorable correspond to the class of [[file:hierarchy.org::#safety][safety properties]]. You can
|
||||
check that an LTL formula is a safety by using:
|
||||
|
||||
#+BEGIN_SRC sh :results verbatim :exports both
|
||||
#+BEGIN_SRC sh
|
||||
ltlfilt --count --safety -f '!F(red & X(yellow))'
|
||||
#+END_SRC
|
||||
|
||||
|
|
@ -173,22 +176,16 @@ red light will be on until the green light is on, we would use the
|
|||
following formula: =G(press -> red U green)=. Unfortunately it is not
|
||||
a safety property:
|
||||
|
||||
#+BEGIN_SRC sh :results verbatim :exports code
|
||||
#+BEGIN_SRC sh :epilogue true
|
||||
ltlfilt --count --safety -f 'G(press -> red U green)'
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC sh :results verbatim :exports results
|
||||
ltlfilt --count --safety -f 'G(press -> red U green)'
|
||||
true
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
: 0
|
||||
|
||||
Nonetheless, we can still build a monitor for it:
|
||||
|
||||
#+NAME: tut11b
|
||||
#+BEGIN_SRC sh :results verbatim :exports none
|
||||
#+BEGIN_SRC sh :exports none
|
||||
ltl2tgba -D -M 'G(press -> red U green)' -d
|
||||
#+END_SRC
|
||||
#+BEGIN_SRC dot :file tut11b.svg :var txt=tut11b :exports results
|
||||
|
|
@ -233,7 +230,7 @@ The following code shows how to implement the above five steps in C++
|
|||
without using =spot::translator=. Unless you plan to customize some
|
||||
of these steps, we recommend you use =spot::translator= instead.
|
||||
|
||||
#+BEGIN_SRC C++ :results verbatim :exports both
|
||||
#+BEGIN_SRC C++
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/twaalgos/ltl2tgba_fm.hh>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue