concepts.org 44.5 KB
 Alexandre Duret-Lutz committed Jan 23, 2016 1 2 # -*- coding: utf-8 -*- #+TITLE: Concepts  Alexandre Duret-Lutz committed May 10, 2016 3 #+DESCRIPTION: Informal explanation of various concepts used in Spot.  Alexandre Duret-Lutz committed Jan 23, 2016 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 #+SETUPFILE: setup.org #+HTML_LINK_UP: index.html This page documents some of the concepts used in Spot, and whose knowledge is usually assumed throughout the documentation. The presentation is informal on purpose. * Atomic proposition (AP) :PROPERTIES: :CUSTOM_ID: ap :END: An /atomic proposition/ is a named Boolean variable that represents a simple property that must be true or false. It usually represents some property of a system. For instance =light_on= and =door_open= could be the names of two atomic propositions that are respectively true if the light is on and the door open, and false otherwise. Atomic propositions are used to construct temporal logic formulas (see below) to specify properties of the system: for instance we might want to state that /whenever the the door is open, the light should be on/. We could write that as the [[#ltl][LTL formula]] =G(door_open -> light_on)= in which =G= is a temporal operator that means /always/. Atomic propositions are also used to form the [[#boolean][Boolean formulas]] that label the edges of automata. * Boolean formula :PROPERTIES: :CUSTOM_ID: boolean :END: A /Boolean formula/ is formed from [[#ap][atomic propositions]], the Boolean constants true and false, and standard Boolean operators like /and/, /or/, /implies/, /xor/, etc. * Binary Decision Diagrams (BDD) :PROPERTIES: :CUSTOM_ID: bdd :END: A Binary Decision Diagram is a data structure for efficient manipulation of [[#boolean][Boolean formulas]]. BDDs correspond to a kind of /if-then-else normal form/ for Boolean formulas. If we fix the order in which the atomic propositions will be tested, that normal form is unique. BDDs are stored as directed acyclic graphs with sharing of subformulas. For further information about BDDs, read for instance [[http://configit.com/configit_wordpress/wp-content/uploads/2013/07/bdd-eap.pdf][Henrik Reif Andersen's lecture notes]]. In Spot, BDDs are one way to represent Boolean formulas, and in particular, they are used to labels the edges of [[#buchi][automata]]. Spot uses a  Alexandre Duret-Lutz committed Apr 10, 2016 58 customized version of [[https://sourceforge.net/projects/buddy/][the BuDDy library]] for manipulating BDDs.  Alexandre Duret-Lutz committed Jan 23, 2016 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107  * ω-word :PROPERTIES: :CUSTOM_ID: word :END: An ω-word (omega-word) is a word of infinite length. In our context, each letter is used to describe the state of a system at a given time, and the sequence of letters shows the evolution of the system as the (discrete) time is incremented. If the set $AP$ of [[#ap][atomic propositions]] is fixed, an ω-word over $AP$ is an infinite sequence of subsets of $AP$. In other words, there are $2^{|AP|}$ possible letters to choose from, and these letters denote the set of atomic propositions that are true at a given instant. For instance if $AP=\{a,b,c\}$, the infinite sequence $\{a,b\};\{a\};\{a,b\};\{a\};\{a,b\};\{a\};\ldots$ is an example of ω-word over $AP$. This particular ω-word can be interpreted as the following scenario: atomic proposition $a$ is always true, $b$ is true at each other instant, and $c$ is always false. Note that instead of using sets of atomic propositions, it is equivalent to write that word using [[https://en.wikipedia.org/wiki/Canonical_normal_form#Minterms][minterms]] over $AP$: $(a\land b\land \bar c);(a\land \bar b\land \bar c); (a\land b\land \bar c);(a\land \bar b\land \bar c); (a\land b\land \bar c);(a\land \bar b\land \bar c);\ldots$ * ω-Automaton :PROPERTIES: :CUSTOM_ID: automaton :END: An ω-automaton is used to represent sets of ω-word. Those look like the classical [[https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton][Nondeterministic Finite Automata]] in the sense that they also have states and transitions. However ω-automata recognize [[#word][ω-words]] instead of finite words. In this context, the notion of /final state/ makes no sense, and is replaced by the notion of [[#acceptance-condition][acceptance condition]]: a run of the automaton (i.e., an infinite sequence alternating states and edges in a way that is compatible with the structure of the automaton) is /accepting/ if it satisfies the constraint given by the acceptance condition. In Spot, ω-automata have their edges labeled by [[#boolean][Boolean formulas]] represented using [[#bdd][BDDs]]. An ω-word is accepted by an ω-automaton if there exists an accepting run whose labels (those Boolean formulas) are compatible with the minterms used as letters in the word.  Alexandre GBAGUIDI AISSE committed Jan 16, 2017 108 The /language/ of an ω-automaton is the set of ω-words it accepts.  Alexandre Duret-Lutz committed Jan 23, 2016 109 110 111  There are many kinds of ω-Automata and they mostly differ by their [[#acceptance-condition][acceptance condition]]. The different types of acceptance condition,  Alexandre GBAGUIDI AISSE committed Jan 16, 2017 112 and whether the automata are deterministic or not can affect their  Alexandre Duret-Lutz committed Jan 23, 2016 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 expressive power. One of the simplest and most common type of ω-Automata is the [[#buchi][Büchi automaton]] described next. * Büchi automaton :PROPERTIES: :CUSTOM_ID: buchi :END: A Büchi automaton is a simple kind of [[#automaton][ω-Automaton]] in which a run is accepting iff it visits some /accepting state/ infinitely often. Those accepting states are often denoted using a double circle. For instance here is a Büchi automaton that accepts only words in which $a$ is always true, and $b$ is true infinitely often. #+NAME: buchi-example1 #+BEGIN_SRC sh :results verbatim :exports none ltl2tgba 'G(a) & GF(b)' -B -d #+END_SRC  Alexandre Duret-Lutz committed Nov 22, 2017 135 #+BEGIN_SRC dot :file concept-buchi1.svg :var txt=buchi-example1 :exports results  Alexandre Duret-Lutz committed Jan 23, 2016 136 137 138 139 $txt #+END_SRC #+RESULTS:  Alexandre Duret-Lutz committed Nov 22, 2017 140 [[file:concept-buchi1.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155  The above automaton would accept the [[#word][ω-word we used previously as an example]]. As a more concrete example, here is a (complete) Büchi automaton for the [[#ltl][LTL formula]] =G(door_open -> light_on)= that specifies that =light_on= should be true whenever =door_open= is true. #+NAME: buchi-example2 #+BEGIN_SRC sh :results verbatim :exports none ltl2tgba 'G(door_open -> light_on)' -d -C #+END_SRC  Alexandre Duret-Lutz committed Nov 22, 2017 156 #+BEGIN_SRC dot :file concept-buchi2.svg :var txt=buchi-example2 :exports results  Alexandre Duret-Lutz committed Jan 23, 2016 157 158 159 160 $txt #+END_SRC #+RESULTS:  Alexandre Duret-Lutz committed Nov 22, 2017 161 [[file:concept-buchi.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188  The =1= displayed on the edge that loops on state =1= should be read as /true/, i.e., the Boolean formula that accepts any valuation of the atomic propositions. The above automaton is complete: any possible ω-word over $AP=\{\mathit{door\_open}, \mathit{light\_on}\}$ is recognized by some run. But not all those runs are accepting. In fact, there is only one run that is accepting: the one that loops continuously on state 0. All the remaining runs eventually reach state 1 and stay there. Those runs recognize scenarios where at some point the door is open and the light is off. There is an infinite number of those runs: they differ by the number of times they loop on state 0. But since those runs reach state 1, it means they visited state 0 only a finite number of times, so they do not validate the acceptance condition. There can be multiple accepting states, but it is enough to visit one infinitely often. For instance the following Büchi automaton accept all runs in which at all point $a$ is true iff $b$ is true at the next instant. #+NAME: buchi-example3 #+BEGIN_SRC sh :results verbatim :exports none ltl2tgba 'G(a <-> Xb)' -B -d #+END_SRC  Alexandre Duret-Lutz committed Nov 22, 2017 189 #+BEGIN_SRC dot :file concept-buchi3.svg :var txt=buchi-example3 :exports results  Alexandre Duret-Lutz committed Jan 23, 2016 190 191 192 193 $txt #+END_SRC #+RESULTS:  Alexandre Duret-Lutz committed Nov 22, 2017 194 [[file:concept-buchi3.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226  * Transitions vs. Edges :PROPERTIES: :CUSTOM_ID: trans-edge :END: Since automata are labeled by Boolean formulas instead of letters it is sometimes useful to think of the formula-labeled *edges* of an automaton as a way to aggregate several letter-labeled *transitions*. Whenever the distinction is important, for instance when giving the size of an automaton, we use the terms *edge* and *transition* to distinguish whether we are looking at the automaton as a graph, or whether we are actually considering all possible letters that may have been aggregated in an edge. Here is a simple example: #+NAME: te1 #+BEGIN_SRC sh :results verbatim :exports none cat >concept-te.hoa < Xb)=. #+NAME: concepts-alt #+BEGIN_SRC sh :results verbatim :exports none autfilt -d.ba < Xb)" [(!0)] 3&0 [(0)] 2&0 [t] 1&0 State: 1 "F(a <-> Xb)" {0} [(!0)] 3 [(0)] 2 [t] 1 State: 2 "b" [(1)] 4 State: 3 "!b" [(!1)] 4 State: 4 "t" [t] 4 --END-- EOF #+END_SRC  Alexandre Duret-Lutz committed Nov 22, 2017 603 #+BEGIN_SRC dot :file concepts-alt.svg :var txt=concepts-alt :exports results  Alexandre Duret-Lutz committed Dec 29, 2016 604 605 606 607 $txt #+END_SRC #+RESULTS:  Alexandre Duret-Lutz committed Nov 22, 2017 608 [[file:concepts-alt.svg]]  Alexandre Duret-Lutz committed Dec 29, 2016 609 610  In this picture, the universal edges appear as arrows with a white  Alexandre Duret-Lutz committed Feb 01, 2017 611 tip going to a small dot, from which additional arrows connect to the  Alexandre Duret-Lutz committed Dec 29, 2016 612 613 614 615 616 617 618 619 620 621 622 623 624 universal destinations. Here the three universal edges all leave the initial state, and connect to two universal destinations. Note that non-determinism is allowed between universal edges, for instance upon reading a word starting with "=a=", this automaton should non-deterministically decide to read the rest of the word from states =GF(a<->Xb)= and =F(a<->Xb)= (when taking the universal transition labeled by =1=) or from states =GF(a<->Xb)= and =b= (when taking the universal transition labeled by =a=). Alternation support in Spot is currently experimental, please report any issue. The only supported file format able to represent alternating automata is the [[#hoa][HOA format, introduced below]].  Alexandre Duret-Lutz committed Jan 23, 2016 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 * Never claims :PROPERTIES: :CUSTOM_ID: neverclaim :END: Never claims are used by [[http://spinroot.com/][Spin]] to represent Büchi automata; they are part of the Promela language. Here are two never claims using different syntaxes to represent a Büchi automaton for the LTL formula =p0 | GFp1= (that is: $p_0$ or infinitely often $p_1$). The graphical representation of that automaton follows. #+BEGIN_SRC sh :results verbatim :exports results ltl2tgba -s 'p0 | GFp1' > tmp.$$ Alexandre Duret-Lutz committed May 17, 2016 640 ltl2tgba -s6 'p0 | GFp1' | pr -w80 -m -t tmp.$$ -  Alexandre Duret-Lutz committed Oct 03, 2016 641 rm tmp.  Alexandre Duret-Lutz committed Jan 23, 2016 642 643 644 645 #+END_SRC #+RESULTS: #+begin_example  Alexandre Duret-Lutz committed May 17, 2016 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 never { /* p0 | GFp1 */ never { /* p0 | GFp1 */ T0_init: T0_init: if do :: (p0) -> goto accept_all :: atomic { (p0) -> assert(!(p0)) } :: (!(p0)) -> goto accept_S2 :: (!(p0)) -> goto accept_S2 fi; od; accept_S2: accept_S2: if do :: (p1) -> goto accept_S2 :: (p1) -> goto accept_S2 :: (!(p1)) -> goto T0_S3 :: (!(p1)) -> goto T0_S3 fi; od; T0_S3: T0_S3: if do :: (p1) -> goto accept_S2 :: (p1) -> goto accept_S2 :: (!(p1)) -> goto T0_S3 :: (!(p1)) -> goto T0_S3 fi; od; accept_all: accept_all: skip skip } }  Alexandre Duret-Lutz committed Jan 23, 2016 665 666 667 668 669 670 #+end_example #+NAME: never-ex1 #+BEGIN_SRC sh :results verbatim :exports none ltl2tgba -Bd 'p0 | GFp1' #+END_SRC  Alexandre Duret-Lutz committed Nov 22, 2017 671 #+BEGIN_SRC dot :file concept-never1.svg :var txt=never-ex1 :exports results  Alexandre Duret-Lutz committed Jan 23, 2016 672 673 674 675 $txt #+END_SRC #+RESULTS:  Alexandre Duret-Lutz committed Nov 22, 2017 676 [[file:concept-never1.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723  The two different types of never claims differ only in a few syntactic elements: =do..od= instead of =if..fi=, =assert= instead of =goto accept_all=, etc. Older Spin releases used to output the first one, while newer Spin releases (starting with Spin 6.2.4) use the second syntax as they help Spin to produce more precise counterexamples. Spot can read and write never claims in both syntaxes, but it cannot parse never claim that use other features (such as variables) of the Promela language. * LBTT's format :PROPERTIES: :CUSTOM_ID: lbtt :END: This format was originally introduced by [[http://www.tcs.hut.fi/Software/maria/tools/lbt/][LBT]], a tool for translating LTL to (state-based) generalized Büchi automata, and then used by [[http://www.tcs.hut.fi/Software/lbtt/][LBTT]], a tool for testing LTL-to-Büchi translators. For instance the Büchi automaton we used as an example for never claims can be encoded as follows: #+BEGIN_SRC sh :results verbatim :exports results ltl2tgba --ba --lbtt 'p0 | GFp1' #+END_SRC #+RESULTS: #+begin_example 4 1 0 1 -1 1 p0 2 ! p0 -1 1 0 0 -1 1 t -1 2 0 0 -1 2 p1 3 ! p1 -1 3 0 -1 2 p1 3 ! p1 -1 #+end_example  Alexandre Duret-Lutz committed Nov 22, 2017 724 [[file:concept-never1.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753  The format has been extended in two ways. First, LBTT extended it to support transition-based acceptance. This is indicated by a =t= on the first line: #+BEGIN_SRC sh :results verbatim :exports results ltl2tgba --lbtt 'p0 | GFp1' #+END_SRC #+RESULTS: #+begin_example 3 1t 0 1 1 -1 p0 2 -1 ! p0 -1 1 0 1 0 -1 t -1 2 0 2 0 -1 p1 2 -1 ! p1 -1 #+end_example #+NAME: lbtt-ex2 #+BEGIN_SRC sh :results verbatim :exports none ltl2tgba -d 'p0 | GFp1' #+END_SRC  Alexandre Duret-Lutz committed Nov 22, 2017 754 #+BEGIN_SRC dot :file concept-lbtt2.svg :var txt=lbtt-ex2 :exports results  Alexandre Duret-Lutz committed Jan 23, 2016 755 756 757 758 $txt #+END_SRC #+RESULTS:  Alexandre Duret-Lutz committed Nov 22, 2017 759 [[file:concept-lbtt2.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 760 761 762 763 764 765 766 767 768 769 770 771 772 773  We call this format the LBTT format because of this extension. A second, but independent extension, was done in [[http://ltl2dstar.de/][=ltl2dstar=]], allowing atomic propositions that are different from =p0=, =p1=, =p2=, etc. Both extensions are supported by Spot. * DSTAR format :PROPERTIES: :CUSTOM_ID: dstar :END: The DSTAR format is the native format of [[http://ltl2dstar.de/][=ltl2dstar=]]. It allows  Maximilien Colange committed Aug 28, 2017 774 representing Deterministic Streett And Rabin automata, hence the  Alexandre Duret-Lutz committed Jan 23, 2016 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 name. Spot can read the DSTAR format, but it does not output it. Adding output for this format would not be difficult, but it would also not be very useful: for all intents and purposes, the [[#hoa][HOA]] format should be preferred. =ltl2dstar= can now also output HOA directly. Here is one Rabin automaton in the DSTAR format: #+BEGIN_SRC sh :results verbatim :exports results echo '| F G p0 G F p1' | ltl2dstar --output-format=native - - #+END_SRC #+RESULTS: #+begin_example DRA v2 explicit Comment: "Union{Safra[NBA=2],Safra[NBA=2]}" States: 4 Acceptance-Pairs: 2 Start: 0 AP: 2 "p0" "p1" --- State: 0 Acc-Sig: -0 0 1 2 3 State: 1 Acc-Sig: +0 0 1 2 3 State: 2 Acc-Sig: -0 +1 0 1 2 3 State: 3 Acc-Sig: +0 +1 0 1 2 3 #+end_example #+NAME: dstar-example1 #+BEGIN_SRC sh :results verbatim :exports none echo '| F G p0 G F p1' | ltl2dstar --output-format=native - - | autfilt -d.a #+END_SRC  Alexandre Duret-Lutz committed Nov 22, 2017 827 #+BEGIN_SRC dot :file concept-dstar.svg :var txt=dstar-example1 :exports results  Alexandre Duret-Lutz committed Jan 23, 2016 828 829 830 831 $txt #+END_SRC #+RESULTS:  Alexandre Duret-Lutz committed Nov 22, 2017 832 [[file:concept-dstar.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 833 834 835 836 837 838 839 840  * Hanoi Omega-Automaton format (HOA) :PROPERTIES: :CUSTOM_ID: hoa :END: The [[http://adl.github.io/hoaf/][HOA format]] inherits several features from the [[:dstar][DSTAR format]], but extends it in many ways, including support for non-deterministic  Alexandre Duret-Lutz committed Dec 29, 2016 841 automata, alternating automata, and for arbitrary acceptance conditions.  Alexandre Duret-Lutz committed Jan 23, 2016 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885  #+BEGIN_SRC sh :results verbatim :exports results ltldo ltl2dstar -f 'FGp0 | GFp1' --name=%f #+END_SRC #+RESULTS: #+begin_example HOA: v1 name: "FGp0 | GFp1" States: 4 Start: 0 AP: 2 "p0" "p1" acc-name: Rabin 2 Acceptance: 4 (Fin(0) & Inf(1)) | (Fin(2) & Inf(3)) properties: trans-labels explicit-labels state-acc complete properties: deterministic --BODY-- State: 0 {0} [!0&!1] 0 [0&!1] 1 [!0&1] 2 [0&1] 3 State: 1 {1} [!0&!1] 0 [0&!1] 1 [!0&1] 2 [0&1] 3 State: 2 {0 3} [!0&!1] 0 [0&!1] 1 [!0&1] 2 [0&1] 3 State: 3 {1 3} [!0&!1] 0 [0&!1] 1 [!0&1] 2 [0&1] 3 --END-- #+end_example #+NAME: hoa1 #+BEGIN_SRC sh :results verbatim :exports none ltldo ltl2dstar -f 'FGp0 | GFp1' -d.a #+END_SRC  Alexandre Duret-Lutz committed Nov 22, 2017 886 #+BEGIN_SRC dot :file concept-hoa.svg :var txt=hoa1 :exports results  Alexandre Duret-Lutz committed Jan 23, 2016 887 888 889 890 $txt #+END_SRC #+RESULTS:  Alexandre Duret-Lutz committed Nov 22, 2017 891 [[file:concept-hoa.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 892 893 894 895 896  Since this file format is the only one able to represent the range of ω-automata supported by Spot, and it its default output format.  Alexandre Duret-Lutz committed Dec 29, 2016 897 898 899 900 However note that Spot does not support all automata that can be expressed using the HOA format. The present support for the HOA format in Spot, is discussed on [[file:hoa.org][a separate page]], with a section dedicated to the [[file:hoa.org::#restrictions][restrictions]].  Alexandre Duret-Lutz committed Jan 23, 2016 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948  * Linear-time Temporal Logic (LTL) :PROPERTIES: :CUSTOM_ID: ltl :END: The Linear-time Temporal Logic (LTL) extends propositional logic with operators that refer to the future. Some definitions of LTL also include past operators, but Spot only supports future operators. The view of the time is discrete: a scenario can be seen as a succession of steps in which each [[#ap][atomic proposition]] can have a different value. The following basic operators are supported: | LTL formula | meaning | |-------------+------------------------------------------------------------------------------------------------| | =f= | the formula =f= is true immediately | | =X f= | =f= will be true in the next step | | =F f= | =f= will become true eventually (it could be true immediately, or on the future) | | =G f= | =f= is always true from now on | | =f U g= | =f= has to be true until =g= becomes true (and =g= /will/ become true) | | =f W g= | =f= has to be true until =g= becomes true (=f= should stay true if =g= never becomes true) | | =f R g= | =g= has to be true until =f&g= becomes true (=g= should stay true if =f&g= never becomes true) | | =f M g= | =g= has to be true until =f&g= becomes true (and =f&g= /will/ become true) | For instance the LTL formula =G(request -> F(response))= specifies that whenever =request= atomic proposition is true, there exists a later instant (possibly the same) where =response= is true. Spot supports [[file:ioltl.org][several syntaxes for writing LTL formulas]]. For example some people prefer to write =<>= and =[]= instead of =F= and =G=, =R= is written =V= in some tools, etc. For more discussion about the temporal operators and their semantics, see the [[https://spot.lrde.epita.fr/tl.pdf][tl.pdf]] document. * Property Specification Language (PSL) :PROPERTIES: :CUSTOM_ID: psl :END: Spot supports the linear fragment of PSL, this basically extends LTL with semi-extended regular expressions. Those regular expressions can express finite languages and PSL introduces operators to use these finite languages as a prefix of a PSL formula. | PSL formula | meaning | |--------------+-------------------------------------------------------------------------|  Alexandre Duret-Lutz committed Jan 23, 2016 949 950 | ={e}<>->f= | =f= should hold on the last instant of some one prefix that matches =e= | | ={e}[]->f= | =f= should hold on the last instant of all prefixes that match =e= |  Alexandre Duret-Lutz committed Jan 23, 2016 951 952 953 954 955 956 957  In the above table =e= is a semi-extended expression, and =f= is a PSL (or LTL) formula. Semi-extended regular expressions can be formed using Boolean expressions over [[#ap][atomic propositions]] and the following operators:  Alexandre Duret-Lutz committed Jan 23, 2016 958 959 960 961 962 963 964 965 966 967 | SERE | meaning | |----------------------+-----------------------------------------------------------------------------------| | =e1;e2= | =e1= followed by =e2= (concatenation) | | =e1:e2= | =e1= fused with =e2=: =e2= has to start matching on the last letter matching =e1= | | =e1= \vert\vert =e2= | =e1= or =e2= have to match (union) | | =e1 && e2= | =e1= and =e2= have to match (intersection) | | =e1 & e2= | =e2= should match a prefix of what =e1= matches, or vice-versa | | =e[*]= | =e= should be matched a finite number of times (Kleene star) | | =e[*2..3]= | same as =(e;e)= \vert\vert =(e;e;e)= | | =e[+]= | =e= should be matched a finite number of times, and at least once |  Alexandre Duret-Lutz committed Jan 23, 2016 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996  For example the formula ={(1;1)[*]}[]->a= can be interpreted as follows: - the SERE =(1;1)[*]= matches all prefixes of even length (here =1= stands for the true formula, so it matches anything) - the part =...[]->a= requests that =a= should be true at the end of each matched prefix. Therefore this formula ensures that =a= is true at every even instant (if we consider the first instant to be odd). This is the canonical example of formula that can be expressed in PSL but not in LTL. A few other operators and syntactic sugar are supported. For more discussion about the temporal operators and their semantics, see the [[https://spot.lrde.epita.fr/tl.pdf][tl.pdf]] document. * Translation of temporal logic to automata :PROPERTIES: :CUSTOM_ID: ltl2tgba :END: Spot can translate any LTL or PSL formula into Büchi automata, or generalized Büchi automata. Internally the translator produces [[#trans-acc][Transition-based Generalized Büchi Automata (TGBA)]] but that automaton can then be simplified using several algorithms depending on what options were given. Here is for instance a translation of ={(1;1)[*]}[]->a= discussed [[#psl][above]]. #+NAME: ltl2tgba1  Alexandre Duret-Lutz committed Jan 23, 2016 997 #+BEGIN_SRC sh :results verbatim :exports code  Alexandre Duret-Lutz committed Jan 23, 2016 998 999 ltl2tgba '{(1;1)[*]}[]->a' -d #+END_SRC  Alexandre Duret-Lutz committed Nov 22, 2017 1000 #+BEGIN_SRC dot :file concept-ltl2tgba.svg :var txt=ltl2tgba1 :exports results  Alexandre Duret-Lutz committed Jan 23, 2016 1001 1002 1003 1004 \$txt #+END_SRC #+RESULTS:  Alexandre Duret-Lutz committed Nov 22, 2017 1005 [[file:concept-ltl2tgba.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015  [[file:tut10.org][Another page shows how to translate an LTL formula into a never claim]] from the command-line, Python, or C++. * Architecture of Spot :PROPERTIES: :CUSTOM_ID: architecture :END:  Alexandre Duret-Lutz committed Nov 22, 2017 1016 [[file:arch.svg]]  Alexandre Duret-Lutz committed Jan 23, 2016 1017   Alexandre Duret-Lutz committed Apr 10, 2016 1018 1019 The Spot project can be broken down into several parts, as shown above. Orange boxes are C/C++ libraries. Red boxes are command-line  Alexandre Duret-Lutz committed Apr 23, 2017 1020 1021 programs. Blue boxes are Python-related. The gray outline shows the components that are distributed and installed by Spot.  Alexandre Duret-Lutz committed Apr 10, 2016 1022   Alexandre Duret-Lutz committed Apr 10, 2016 1023 1024  - =libbddx= is a customized version of [[https://sourceforge.net/projects/buddy/][the BuDDy library]], for manipulating [[#bdd][BDDs]].  Alexandre Duret-Lutz committed Aug 22, 2017 1025  - =libspot= is the main library, containing a C++14 implementation of all the  Alexandre Duret-Lutz committed Jan 23, 2016 1026  data structures and algorithms. This depends on =libddx=.  Alexandre Duret-Lutz committed Apr 23, 2017 1027 1028 1029 1030 1031  - =libspotgen= is an auxiliary library that contains functions to generate families of automata, useful for benchmarking and testing - all the supplied [[file:tools.org][command-line tools]] distributed with Spot are built upon the =libspot= or =libspotgen= libraries - =libspotltsmin= is a library that helps interfacing Spot with  Alexandre Duret-Lutz committed Apr 10, 2016 1032 1033 1034 1035 1036  dynamic libraries that [[http://fmt.cs.utwente.nl/tools/ltsmin/][LTSmin]] uses to represent state-spaces. It currently supports libraries generated from promela models using SpinS or a patched version of DiVinE, but you have to install those third-party tools first. See [[https://gitlab.lrde.epita.fr/spot/spot/blob/next/tests/ltsmin/README][=tests/ltsmin/README=]] for details.  Alexandre Duret-Lutz committed Aug 22, 2017 1037  - In addition to the C++14 API, we also provide Python bindings for  Alexandre Duret-Lutz committed Apr 23, 2017 1038 1039 1040 1041 1042 1043  =libspotgen=, =libspotltsmin=, =libbddx=, and most of =libspot=. These are available by importing =spot.gen=, =spot.ltsmin=, =bdd=, and =spot=. Those Python bindings also includes some additional code to make them more usable in interactive environments such as the [[http://juptter.org][IPython/Jupyter]] notebook.  Alexandre Duret-Lutz committed Apr 10, 2016 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 * Automaton property flags :PROPERTIES: :CUSTOM_ID: property-flags :END: The automaton class used by Spot to represent ω-Automata is called =twa= (because we use TωA as a short for Transition-based ω-Automaton). As its names implies, the =twa= class supports only transition-based acceptance, but as [[#trans-acc][discussed previously]] we can emulate state-based acceptance using transition-based acceptance by ensuring that all transitions leaving a state have the same acceptance set membership. In addition, there is a bit in the =twa= class that we can set to indicate that the automaton is meant to be considered with state-based acceptance: this allows some algorithms to make better choices. There are actually several property flags that are stored into each automaton, and that can be queried or set by algorithms:  Alexandre Duret-Lutz committed Dec 29, 2016 1063 1064 | flag name | meaning when =true= | |----------------------+----------------------------------------------------------------------------------------------|  Alexandre Duret-Lutz committed May 11, 2017 1065 | =state_acc= | automaton should be considered as having state-based acceptance |  Alexandre Duret-Lutz committed Dec 29, 2016 1066 1067 | =inherently_weak= | accepting and rejecting cycles cannot be mixed in the same SCC | | =weak= | transitions of an SCC all belong to the same acceptance sets |  Alexandre Duret-Lutz committed Apr 26, 2017 1068 | =very_weak= | weak automaton where all SCCs have size 1 |  Alexandre Duret-Lutz committed Dec 29, 2016 1069 1070 | =terminal= | automaton is weak, accepting SCCs are complete, accepting edges may not go to rejecting SCCs | | =deterministic= | there is at most one run *recognizing* a word, but not necessarily accepting it |  Alexandre Duret-Lutz committed Apr 26, 2017 1071 | =semi_deterministic= | any nondeterminism occurs before entering an accepting SCC |  Alexandre Duret-Lutz committed Dec 29, 2016 1072 1073 | =unambiguous= | there is at most one run *accepting* a word (but it might be recognized several time) | | =stutter_invariant= | the property recognized by the automaton is [[https://www.lrde.epita.fr/~adl/dl/adl/michaud.15.spin.pdf][stutter-invariant]] |  Alexandre Duret-Lutz committed Apr 10, 2016 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090  For each flag =flagname=, the =twa= class has a method =prop_flagname()= that returns the value of the flag as an instance of =trival=, and there is a method =prop_flagname(trival newval)= that sets that value. =trival= instances can take three values: =false=, =true=, or =trival::maybe=. The idea is that algorithms should update flags as a side effect of their execution, but only if that does not induce some extra cost. For instance when translating an LTL formula into an automaton, we can set the =stutter_invariant= properties to =true= if the input formula does not use the =X= operator, but we would leave the flag to =trival::maybe= if =X= is used: the presence of such an operator =X= does not prevent the formula from being stutter-invariant, but it would require additional work to check. As another example, if you write an algorithm that must check whether  Alexandre Duret-Lutz committed Mar 27, 2017 1091 1092 1093 1094 1095 1096 1097 1098 an automaton is universal, do not call the =twa::prop_universal()= method, because that might return =trival::maybe=. Instead, call =spot::is_universal(...)=: that will respond in constant time if the =universal= property flag was either =true= or =false=, otherwise it will actually explore the automaton to decide its determinism. Note that there is also a =spot::is_deterministic(...)= function, which is equivalent to testing that the automaton is both universal and existential.  Alexandre Duret-Lutz committed Apr 10, 2016 1099 1100 1101 1102 1103  These automata properties are encoded into the [[file:hoa.org::#property-bits][HOA format]], so they can be preserved when building a processing pipeline using the shell. However the HOA format has support for more properties that do not correspond to any =twa= flag.  Alexandre Duret-Lutz committed Jul 15, 2016 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121  * Named properties for automata :PROPERTIES: :CUSTOM_ID: named-properties :END: In addition to [[#proeprty-flags][property flags]], automata in Spot can be tied to an arbitrary number of objects via a system of named properties that is implemented mostly as an =std::map= between =std::string= and =void*=. A property can be used to store additional information about the automaton, that is not usually available via the automaton interface. The property can be set via the =twa::set_named_prop(key, value)= method, and queried with the =twa::get_named_prop(key)= template method. Here is a list of named properties currently used inside Spot:  Alexandre Duret-Lutz committed Aug 06, 2016 1122 1123 1124 1125 | key name | (pointed) value type | description | |---------------------+--------------------------------+---------------------------------------------------------------------------------------------------------------------------------| | ~automaton-name~ | ~std::string~ | name for the automaton, for instance to display in the HOA format | | ~product-states~ | ~const spot::product_states~ | vector of pairs of states giving the left and right operands of each state in a product automaton |  Alexandre Duret-Lutz committed Apr 20, 2017 1126 | ~original-states~ | ~std::vector~ | original state number before transformation (used by some algorithms like =degeneralize()=) |  Alexandre Duret-Lutz committed Aug 06, 2016 1127 1128 1129 1130 | ~state-names~ | ~std::vector~ | vector naming each state of the automaton, for display purpose | | ~highlight-edges~ | ~std::map~ | map of (edge number, color number) for highlighting the output | | ~highlight-states~ | ~std::map~ | map of (state number, color number) for highlighting the output | | ~incomplete-states~ | ~std::set~ | set of states numbers that should be displayed as incomplete (used internally by ~print_dot()~ when truncating large automata) |  Maximilien Colange committed Jun 05, 2017 1131 | ~degen-levels~ | ~std::vector~ | level associated to each state by the degeneralization algorithm |  Alexandre Duret-Lutz committed May 31, 2017 1132 | ~simulated-states~ | ~std::vector~ | map states of the original automaton to states if the current automaton in the result of simulation-based reductions |  Maximilien Colange committed Nov 23, 2017 1133 | ~synthesis-outputs~ | ~bdd~ | conjunction of controllable atomic propositions (used by ~print_aiger()~ to determine which propositions should be encoded as outputs of the circuit)  Alexandre Duret-Lutz committed Jul 15, 2016 1134 1135 1136 1137 1138 1139 Objects referenced via named properties are automatically destroyed when the automaton is destroyed, but this can be altered by passing a custom destructor as a third parameter to =twa::set_named_prop()=. These properties should be considered short-lived. They are usually not propagated to new automata that are created via transformation,  Alexandre Duret-Lutz committed Apr 20, 2017 1140 1141 unless the algorithm has been explicitly implemented to preserve that property. Algorithms that update the automaton in place should  Alexandre Duret-Lutz committed Jul 15, 2016 1142 1143 1144 1145 1146 1147 1148 1149 1150 probably call =release_named_properties()= to ensure they do not inadvertently keep a stale property. Most of the above properties are related to the graphical display of automata, or to their output in the [[file:hoa.org::#named-properties][HOA format]]. So they are usually set right before the automaton is output. The notable exception is =product-states=, which is a property present in automata returned by =spot::product()= function in case it is necessary to know the origins of each state.