-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmtTranslation.tex
2484 lines (2245 loc) · 154 KB
/
smtTranslation.tex
1
2
3
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
58
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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
189
190
191
192
193
194
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
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
724
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
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
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
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
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
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
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
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
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
997
998
999
1000
% Created 2020-08-20 gio 13:13
% Intended LaTeX compiler: pdflatex
\documentclass[a4paper,11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\graphicspath{{./images/}}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[margin=1in]{geometry}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{setspace}
\usepackage{bbding}
\newcommand*\BitAnd{\mathbin{\&}}
\newcommand*\BitOr{\mathbin{|}}
\newcommand{\BitNeg}{!}
\newcommand*\ShiftLeft{\ll}
\newcommand*\ShiftRight{\gg}
\newcommand*\cmark{\small\Checkmark}
\newcommand*{\xmark}{\small\XSolidBrush}
\renewcommand{\arraystretch}{1.0}
\mathchardef\mhyphen="2D % Define a "math hyphen"
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\setlength{\parskip}{1em}
\setlength{\abovetopsep}{0.5em}
\setstretch{1.2}
\newcommand{\cltloc}{CLTLoc}
\newcommand{\aez}{ae2sbvzot}
\begin{document}
\title{Improved Verification of Networks of Timed Automata}
\input{./frontpage/frontpage.tex}
%\section*{Acknowledgments}
\newpage
\thispagestyle{empty}
\vspace{1.0cm}
\begin{center}
\mbox{\parbox{10cm}{\centering Many thanks to my supervisors for their
guidance and insightful comments, and a special thank you to my family for
all of their love and support.
\vspace{1cm}
And to my friends, thank you for keeping me company online during the long
months of quarantine. }}
\end{center}
\clearpage
\tableofcontents
\listoffigures
\newpage
\listoftables
\newpage
\clearpage
\section*{Abstract}\label{abstract}
\addcontentsline{toc}{section}{Abstract}
Timed Automata (TA) are a de facto modeling standard for systems with
time-sensitive properties. A common task is to verify if a given network of TA
satisfy a given property for every possible execution of the network. These
questions lend themselves to being expressed in Linear Temporal Logics (LTLs),
which allows for expressions over atomic propositions that are defined over time
positions in $\mathbb{N}$. We build upon the TA solver TACK, which supports
properties expressed in the rich Metric Interval Temporal Logic (MITL), and
encodes both the TA network and property to be verified into a variant of Linear
Temporal Logic, Constraint LTL over clocks (\cltloc). The produced \cltloc\
formula can then be solved by tools such as Zot, which transform \cltloc\
properties into SMT-LIB, a standardized SMT solver language with support for
BitVector and real-valued logics.
We present a novel method that preserves TACK's encoding of MITL properties
while encoding the Timed Automata network directly into SMT-LIB, making use of
both the BitVector logic and the logic of real-valued functions. Our primary
targeted SMT solver is Microsoft's Z3, which supports many standardized formats,
including SMT-LIB and has strong support for several SMT logics. We introduce
several optimizations that allow us to significantly outperform the \cltloc\
encoding, and correct deficiencies in the original encoding.
\section*{Sommario}\label{sommario}
\addcontentsline{toc}{section}{Sommario}
Gli Automi temporizzati (TA) sono de facto lo standard di modellazione per
sistemi con proprietà dipendenti dal tempo. Un'importante attivit\`{a} \`{e}
quella di verificare se una data rete di TA soddisfa una data propriet\`{a}, per
ogni possibile esecuzione della rete. Molte propriet\`{a} interassanti si
possono esprimere in modo sintetico e efficace in Logica Temporale Lineare
(LTL), che permette di predicare su proposizioni atomiche variabili nel tempo.
In questa tesi ci basiamo sul TA solver TACK, che supporta propriet\`{a}
espresse nella logica temporale Metric Interval Temporal Logic (MITL), pi\`{u}
espressiva di LTL, e codifica sia la rete TA che la propriet\`{a} da verificare
in una variante di LTL, Constraint LTL over clocks (CLTLoc). La formula CLTLoc
risultante pu\`{o} quindi essere risolta con strumenti di verifica come Zot, che
trasformano CLTLoc in SMT-LIB, un linguaggio standardizzato per solutori SMT
con supporto per BitVector e logiche reali.
In questa tesi presentiamo un nuovo metodo di verifica che conserva la codifica
TACK delle propriet\`{a} MITL ma che codifica la rete di TA direttamente in
SMT-LIB, utilizzando sia la logica BitVector che la logica delle funzioni a
valore reale. Il nostro principale risolutore SMT mirato \`{e} lo Z3 di
Microsoft, che supporta molti formati standardizzati, compreso SMT-LIB e ha un
forte supporto per diverse logiche SMT\@. Abbiamo introdotto varie
ottimizzazioni che ci hanno permesso di migliorare in modo significativo le
prestazioni di verifica rispetto alla codifica CLTLoc e di correggere alcune
carenze nella codifica originale.
\chapter{Introduction}\label{introduction}
Timed Automata~\cite{alur94} (TA) are a popular tool for modeling time-sensitive
systems. By combining the transition semantics of finite automata with
real-valued clocks, they are of great theoretical and practical interest for
representing time-bound processes and applications. They have found common use
in the domain of model checking, where system representations are evaluated
against a given property of interest. Various tools and encoding languages exist
for a variety of applications and use cases. These include the current de facto
standard Uppaal~\cite{larsen97}, as well as NuSMV~\cite{cimatti02} and
$\text{MITL}_{0,\infty}$BMC~\cite{kindermann13}.
Model Checking refers to a verification technique for solving properties of
state transition systems. A wide variety of industrial applications, including
circuit design, control systems, and program verification lend themselves to
this representation. In the model checking process, the system is exhaustively
searched to see if the given property is valid. For \emph{invariant} properties,
the property holds if every reachable state in the system satisfies the
property, and thus the model checker attempts to find a counterexample to
falsify the property. Conversely, a \emph{reachability} property asserts that
there exists at least one reachable state in which the given property holds, and
the model checker proves the property by finding that such a reachable state
exists. A reachability property can be solved by asserting its negation as an
invariant property (and vice versa).
TACK is a bounded model checker for networks of timed automata developed by
Menghi et al~\cite{tack20}. Properties to be verified are specified in Metric
Interval Temporal Logic (MITL), and are converted along with the TA network into
\cltloc, a variant of Constraint Linear Temporal Logic supporting real-valued
clocks. MITL and \cltloc\ are rich logics that allow for continuous-time
semantics using traces, a form of timed words, to represent the execution of the
networks of TA.
Our contribution is a novel encoding of the TA network which does not use
\cltloc\ as an intermediate step, instead directly transforming the network
semantics into a hybrid BitVector representation. This approach has the
advantage of being tailor-made for TA networks, while the previous approach
relied on the general-purpose \cltloc\ converter \aez. However rather than just
re-create the existing encoding in a new language, we have corrected several
deficiencies in the original TACK encoding, and have added additional features
to make TACK more useful for users. In addition we have exploited opportunities
to more efficiently encode TA constructs, noticeably eliminating the need for
BitVectors to track the active state of the TA, instead relying on the active
transition to carry this information.
In this paper, we will first present the current state-of-the-art for bounded
model checking, followed by an in-depth description of both the required
preliminary knowledge and the specific implementation of the TACK bounded model
checker (Chapter 2). We will then present our novel contribution to the problem
of encoding the TA network into a form suitable for an SMT bounded model checker
(Chapter 3). Afterwords we will present our experimental results (Chapter 4) as
well as summary remarks (Chapter 5).
\chapter{Preliminaries}\label{prelims}
In this chapter we present the current TACK bounded model checking procedure,
along with the required prerequisite knowledge. We begin with a discussion on
the current state-of-the-art in model checking, followed by a discussion on
Timed Automata, giving an intuitive introduction to the topic before formally
defining the TA used in the rest of the paper. We then discuss Bounded Model
Checking, formally defining a \emph{trace} of a TA network and presenting an
illustrative example trace. We then discuss the two temporal logics used in the
TACK encoding, \cltloc\ and MITL\@. With the theoretical background complete, we
move on to discussing the TACK encoding itself, followed by an summary of
BitVector logic and \aez, the tool used by TACK to convert \cltloc\ formulas
into BitVector form.
\section{State of the Art}\label{stateoftheart}
For many years, model checking was performed using Binary Decision Diagrams
(BDDs)~\cite{bryant86}, which offer many time- and space-complexity advantages
over explicit state enumeration~\cite{burch92}. BDDs are symbolic
representations of functions over boolean variables that exploit symmetries to
avoid explicitly representing the entire state space. However to
efficiently handle larger state spaces, BDDs have been largely abandoned in
favor of bounded model checking techniques. A representative example is
NuSMV~\cite{cimatti02}, which was originally designed to use BDDs but has since
been rewritten to use SAT-based bounded model checking. Using the strength of
modern-day SAT and SMT solvers, bounded model checking encodes the semantics of
the state transition system into SAT or SMT form, and then tasks the solver with
finding a valid assignment of states to time positions starting from a given
initial state such that the desired reachability property is true (resp.\ false
for invariant properties). Because such solvers require finite state spaces, the
number of time positions considered is limited by a bound $k$, hence the name
bounded model checking.
In addition to finding finite traces, bounded model checking has also been
applied to finding traces of infinite length that can be represented in finite
space. This is accomplished by limiting the search to so-called ``lasso-shaped''
traces. These traces begin with an initial finite sequence of states before
entering an infinite loop of states. Thus only a finite number of states need to
be explicitly represented by the bounded model checker, which can search for
lassos of length up to the given bound.
To represent state systems with real-time properties, Timed Automata have
emerged as a de facto standard~\cite{alur94}. At their core, timed automata are
finite state machines that are enriched with real-valued clocks that track the
passage of time. These clocks can then be incorporated into transition guards
and state invariants to control and synchronize automata. Unfortunately while
Timed Automata have had great success at modeling real-time systems, they have
not been useful for representing the properties to be verified, and in fact it
has been shown that verification using TA to represent properties is
undecidable~\cite{alur94}. As a result various temporal logics have been
developed by different solvers to represent the properties to be evaluated.
Uppaal~\cite{larsen97} is a de facto standard for model checking systems of timed
automata. Uppaal supports a subset of Timed Computation Tree Logic (TCTL), an
extension of the widely known Computation Tree Logic (CTL) with real-time
properties. The CTL family of logics uses the expressive tree-view of future
positions, and as such can represent a wide range of universality and existence
statements not possible in Linear Temporal Logics. However due to the difficulty
of encoding the full semantics of this logic, Uppaal and similar implementations
often restrict themselves to a subset of TCTL.
In addition to the work done with branching-time logics, there has been interest
in the expressive power of Metric Temporal Logic (MTL), a form of Linear
Temporal Logic (LTL) with Interval constraints on the `until' operator. While
powerful, standard MTL properties are undecidable in general for infinite
traces~\cite{bouyer09}. To make MTL tractable, the subset MITL was proposed in
1991~\cite{Alur91thebenefits}, which offers decidable continuous semantics for
TAs. MITL is valuable both for its \emph{continuous} time semantics, where the
value of a property can be known at every position $p \in \mathbb{R^{+}}$, and
for its ability to capture expressive and complex properties. Examples of MITL
solvers include a tool developed by Kindermann et al.~\cite{kindermann13}, which
relies on a further subset $\text{MITL}_{0,\infty}$ for property validation, and
currently supports both finite and lasso-shaped bounded traces. Another is TACK,
which was developed by Menghi et al.~\cite{tack20} and has implemented a bounded
model checker for lasso-shaped infinite traces over the full MITL logic. To
improve the speed of the verification process, TACK encodes the TA and property
to be verified into BitVector logic~\cite{baresi15,baresi16}, which is supported
by the standardized SMT-LIB language~\cite{BarFT-SMTLIB}. To avoid the
incompleteness of the naive lasso encoding shown by
Kindermann~\cite{kindermann12}, both tools use a region-based encoding of the
clock values. This is paired with a ``non-Zeno'' requirement, so that the
infinite traces span an infinite amount of time. In the following chapter we
will summarize the background and work accomplished in the TACK solver, before
then presenting our contribution to the TACK verification tool.
\section{Timed Automata}\label{timed-automata}
Timed Automata are a useful model for many interactions that require precise
timing mechanisms~\cite{alur94}. Each Timed Automaton has a set of states, one
of which is active at any given moment, much like a Finite State Machine (FSM).
Also like a FSM, a Timed Automaton has a set of transitions that allow it to
move between different states. However these transitions come with powerful
timing properties that allow for finer control over the progression of the
automata. Included with our automata is a network of clocks and integer
variables. Clocks progress as time passes, and can be used alongside variables
as prerequisites for taking transitions and remaining in states. Transitions can
also reset these clocks (and assign new values to variables), allowing for
communication and shared state between different Timed Automata. For explicit
synchronization, we define a set of synchronization primitives that can be used
to coordinate transitions between different automata. Finally, states can be
labeled with atomic propositions, to aid in defining model properties that we
will then verify over the network. To help concretize this concept, we will
introduce a simple Timed Automaton, which will be used throughout this paper to
help visualize important concepts.
%\begin{figure}[h]
% \centering
% \def\svgwidth{0.50\columnwidth}
% \input{images/example-min.pdf_tex}
% \caption{Simple TA example}
% \label{fig:example-min}
%\end{figure}
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{minTA-blank}
\caption{A basic Timed Automaton}
\label{fig:example-blank}
\end{figure}
As we can see in Figure~\ref{fig:example-blank}, Timed Automata have many
similarities with Finite State Machines and other automata. This example timed
automaton consists of a finite set of states $Q_{i} = \{q_{1},q_{2},q_{3}\}$,
and a finite set of transitions $T_{i} = \{t_{1},t_{2},t_{3},t_{4}\}$. Like a
finite state machine, at a given moment in time there is one state that is
``active''. The TA can take transitions that may change its state, with the
condition that the source of the transition must be the currently active state.
We denote the source state of a transition $t$ as $t_{-}$, and the destination
state as $t_{+}$. As an example, if the current active state is $q_{1}$, then
either $t_{1}$ or $t_{2}$ can be taken. Although not shown in this example, the
source and destination state of a transition may be the same state, and there
may be multiple transitions with identical source states and identical
destination states.
In addition to states and transitions, TA are enriched with clocks and bounded
integer variables. Clocks are variables over $\mathbb{R}_{\geq 0}$ that
increment with the passage of time. Their ability to continuously change value
is fundamental to the ability of timed automata to model time-sensitive and
real-time systems. Meanwhile the bounded integer variables do not change value
on their own, and have to be explicitly modified by the TA.
\begin{figure}[h]
\centering
\includegraphics[width=0.6\textwidth]{minTA-big}
\caption{A Timed Automaton with clock $x$ and variable $n$.}
\label{fig:example-big}
\end{figure}
We can now show how these values are used and manipulated by a timed automaton.
Figure~\ref{fig:example-big} shows the same example TA modified with transition
guards, transition assignments, and state invariants. Transition guards are
conditions over either clocks or variables that prevent the associated
transition from being taken when they are not satisfied. As an example,
transition $t_{2}$ can only be taken when the value of clock $x$ is greater than
$5$. Assignments on the other hand modify the value of a clock or variable
\emph{after} the transition has been taken. For example, it is perfectly valid
for transition $t_{2}$ to be taken when $x=6$, even though the assignment $x=0$
resets the value of $x$ to $0$, which is smaller than the value accepted by the
transition guard $x>5$. To be clear, the value is updated in the same instant as
the transition, however the guards only consider the pre-transition value of the
clock when determining if the transition is valid. Variables can be assigned to
any value, while clocks can only be reset to $0$. The third feature to mention
are the state invariants. In our example there is only one, $x<2$ which is
associated with state $q_{2}$. When a state is active, its invariant (if any) is
required to be true. The invariant attached to $q_{2}$ requires the TA to depart
state $q_{2}$ before clock $x$ reaches a value of $2$. In this example the only
transition that leads to state $q_{2}$ resets the value of clock $x$, but in
general it is illegal to transition into a state if the invariant would be
violated upon entry.
In addition to clocks and variables, TA also offer a powerful synchronization
mechanism for different automata in the same network to coordinate. Any
transition may contain a synchronization event of the form
$\{channel \times sync\}$, where $channel$ can be any symbol and
$sync \in \{!,?,\#,@\}$. Two different timed automata can synchronize their
transitions by labeling them with the same synchronization channel, and using
the actions to describe the type of synchronization desired.
\begin{table}
\centering
\begin{tabular}{l p{0.7\textwidth}}
\textbf{Type} & \textbf{Synchronization Semantics} \\
\midrule
One-to-one & Whenever a TA $\mathcal{A}_{i}$ takes a transition with a
synchronization event $\alpha{!}$, there exists exactly one
$\mathcal{A}_{j}$, $i\neq j$, such that in the same instant
$\mathcal{A}_{j}$ has an active transition $t'$ with the
synchronization event $\alpha{?}$, and vice versa. \\
\midrule
Broadcast & Whenever a TA $\mathcal{A}_{i}$ takes a transition with a
synchronization event $\alpha\#$, every other TA
$\mathcal{A}_{j}$ must not simultaneously take a transition with
the same event, and must either simultaneously take a transition
labeled with $\alpha @$, or there must not exist a transition
$t' \in \mathcal{A}_{j}$ such that $t_{-}$ is the currently
active state, $\alpha @$ is the synchronization event, and the
clock and variable guards of $t'$ are satisfied.
\\
\midrule
\end{tabular}
\caption{Supported Synchronization Events}
\label{table:sync-def}
\end{table}
As shown in Table~\ref{table:sync-def}, two types of synchronization are
defined. The first type is one-to-one synchronization, which has two associated
operators, one signifying one-to-one sending (${!}$), and the second for
one-to-one receiving (${?}$). A transition labeled with $\alpha{!}$, for some
channel $\alpha$, can only be fired if at the same moment in time, another TA
takes a transition labeled with the $\alpha{?}$ event. The second type of
synchronization available is termed `broadcast' synchronization, and again we
have two operators, broadcast-send ($\#$) and broadcast-receive (${@}$). Like
one-to-one synchronization, for a given channel $\alpha$ there can only be one
active transition with the event $\alpha\#$, however the difference is that
there can be 0, 1, or multiple automata that sync using broadcast-receive at
once. In addition, each automaton is \emph{required} to perform a broadcast-sync
if it is able to, meaning that there exists a transition $t$ such that $t_{-}$
is the currently active state, and all guards of the transition are satisfied.
With the basic concepts introduced, we will formally define the Timed Automata
discussed in this paper. Let \(AP\) be a set of atomic propositions, and let \(Act\) be a set of
synchronization events of the form $Act \subset \{channel \times sync\}$,
where channel is a set of symbols and $sync \in \{!,?,\#,@\}$. In addition we
define a null event \(\tau\). \(Act_{\tau}\) is the set \(Act \cup \{\tau\}\).
Let \(X\) be a finite set of clocks, and \(Int\) a finite set of integer-valued
variables. \(\Gamma(X)\) is the set of clock constraints, where a clock
constraint \(\gamma\) is a relation
\(x \sim c \BitOr \gamma \land \gamma\), where \(x \in X\),
\(\sim \in \{<,>,\leq,\geq\}\), and \(c \in \mathbb{N}\). \(Assign(X)\) is the set of
clock assignments, where each assignment has the form \(x := 0\), where
\(x \in X\iffalse{,\ c {\in} \mathbb{Z}^+}\fi\). \(Assign(Int)\) is a set of
variable assignments of the form \(y := exp\), where
\(exp := exp + exp\BitOr exp - exp\BitOr n\BitOr c\),
\(n \in Int\) and \(c \in \mathbb{Z}\). \(\Gamma(Int)\) is the set of integer
variable constraints, where a variable constraint \(\gamma\) is defined as
\(\gamma := n \sim c\BitOr n \sim n'\BitOr \neg \gamma\BitOr \gamma \land \gamma\),
where \(n\) and \(n'\) are integer variables, \(c \in \mathbb{Z}\), and
\(\sim \in \{<,=\}\). A Timed Automaton with variables is defined as the tuple
\(\mathcal{A} = \big \langle AP,X, Act_{\tau}, Int, Q, q^0, v_{var}^0, Inv, L, T \big \rangle\).
In this tuple \(Q\) is the finite set of states of the timed automaton,
\(q^0 \in Q\) is the initial state of the TA,
\(v_{var}^{0} : Int \rightarrow \mathbb{Z}\) is a function providing initial
values for each of the variables, and \(Inv : Q \rightarrow \Gamma(X)\) is a
function assigning each state to a (possibly empty) set of clock constraints.
The labeling function \(L: Q \rightarrow \mathcal{P}(AP)\) assigns each state to
a subset of the atomic propositions. Each transition \(t \in T\) has the form
\(t = \big \langle Q \times Q \times Act_{\tau} \times \Gamma(X) \times \Gamma(Int) \times \mathcal{P}(Assign(X)) \times \mathcal{P}(Assign(Int)) \big \rangle \),
consisting of a source and destination state, an action, a set of clock and
variable guards, a set of clocks to be reset when the transition fires, and a
set of variables to assign values to. To refer to the components of a transition
we will use \(t_-\) and \(t_+\) to refer to the source and destination states
respectively, as well as
\(t_\epsilon, t_{\gamma_c}, t_{\gamma_v}, t_{a_c}, t_{a_v}\) to refer to the
event, clock constraints, variable constraints, clock assignments, and variable
assignments respectively.
A network of Timed Automata is a finite list of timed automata \(\mathcal{A} =
[\mathcal{A}_1, \mathcal{A}_2, \ldots \mathcal{A}_N]\). Timed Automata in the
same network can refer to common clocks, variables, and synchronization channels
to coordinate their actions. To simplify the notation we will use the symbols
\(T\), \(X\), \(Int\), and \(Act/Act_{\tau}\) to refer to the union of the respective
sets of each individual timed automaton in the network. When necessary to refer
to the properties of one timed automaton in particular, we will append a
numerical subscript to the set in question, for example \(X_i\) to refer to the
clocks used by the specific timed automaton \(\mathcal{A}_{i} \in \mathcal{A}\).
\section{Bounded Model Checking}\label{bounded-sat}
Bounded Model Checking~\cite{bouyer09} refers to the problem of evaluating if a
given network of timed automata satisfies a given model, or property. To perform
this evaluation, the TA network along with the property to be evaluated are
transformed into a form acceptable by a Satisfiability Modulo Theories, or SMT
solver. The solver then searches all possible executions of the system to
determine if the property is satisfied. Before we can discuss this process, we
must describe what we mean by an execution of a network of timed automata.
At a given position in time, the TA network can be described by the currently
active states, as well as the values of the clocks and integer variables.
To describe the values of the clocks and variables at different positions in
time, we introduce `valuations', which accept a clock or variable argument and
return a value.
\begin{align*}
v : &\ \mathcal{X} \rightarrow \mathbb{R}_{\geq 0} \\
v_{var} : &\ Int \rightarrow \mathbb{Z} \\
\end{align*}
Each time position has an associated clock and variable valuation.
Because the execution of a TA is a series of instantaneous state transitions,
interspersed throughout time, we can represent a TA execution as a series of
`snapshots' showing these moments of transitions. In order to achieve this
representation, we use the concept of a trace.
For the time being let us consider a trace $\eta$ to be an infinite sequence
\[\eta = (l_{0},v_{0},v_{var,0}),\delta_{0},t_{0},(l_{1},v_{1},v_{var,1}),\delta_{1},t_{1}, \ldots\]
Where $l_{l}[i]$ returns the active state $q \in Q_{i}$ for $i \in [1,N]$, and
$t_{l}[i]$ returns a transition $t \in T_{i} \cup \sharp$, where $\sharp$ is the
\emph{null transition}, which signifies that the TA does not perform a discrete
transition. We can see that the trace is made up of snapshots of the TA in a
given moment of time $(l,v,v_{var})$, which are connected with a combined
temporal $\delta$ and discrete $t$ transition step. We can safely require that
all transitions follow this pattern because two consecutive temporal transitions
$\delta$ can simply be combined into one whose length is the sum of the two
original transitions, and two consecutive discrete transitions can be combined
\textbf{iff} no TA in the network performs a non-null transition in both
positions, in which case the trace would be illegal, as TA cannot perform
multiple simultaneous transitions in our model.
\begin{figure}[h]
\centering
\includegraphics[width=0.6\textwidth]{trace-shift-min}
\caption{An example trace through 4 positions.}
\label{fig:trace-min}
\end{figure}
In Figure~\ref{fig:trace-min} we can see a trace of the Timed Automaton defined
in Figure~\ref{fig:example-big}, which has been given an index of 1. To prevent
the value of $t[i]$ being undefined at position $0$, the value of $t[i]$
corresponds to the transition taken in the following time position. However for
clarity in the traces shown here, the values of $t[1]$ and $\delta$ have been
shifted to the right by half of one position, so that the active transition is
placed in between its source and destination states. At the top of the trace
$l[1]$ tracks the currently active state of the timed automaton. In this simple
trace the automaton begins in state $q_{1}$, then after $6$ time units in
$q_{1}$ the TA transitions to $q_{2}$, remains in
$q_{2}$ using a null transition, and then transitions to $q_{3}$. Below the active
state we show the active values of both the variable $n$ and the clock $x$ at
the given positions. The value $\delta$ shows the amount of time that passes
between the current state, and the immediately following state.
One surprising observation is that the value of the clock $x$ does not seem to
change between positions $0$ and $1$, despite $\delta$ indicating that $6$ units
of time has passed. Recall that transition $t_{2}$ resets the value of the clock
$x$ to zero, and that the trace captures the values of clocks and variables
\emph{after} any assignments have been applied.
\begin{figure}[h]
\centering
\includegraphics[width=0.6\textwidth]{trace-shift-delta}
\caption{A trace highlighting the evaluation of a clock guard.}
\label{fig:trace-delta}
\end{figure}
Figure~\ref{fig:trace-delta} shows how we can compute the value of clock $x$ at
the moment of the transition, before the reset is applied. By combining the
values of $x$ and $\delta$, we obtain the value of $x$ that is used to determine
if the clock guard of transition $t_{2}$ is satisfied. We see that $x$ has a
value of 6, which satisfies the guard $x>5$.
Notice in the above trace the value of clock $x$ during the transition from
state $q_{2}$ to state $q_{3}$. State $q_{2}$ has an invariant requiring that
the value of clock $x$ be strictly less than $2$, however at the moment of
transition $x(2) + \delta(2) = 2$. Is this trace therefore illegal? This raises
an interesting question: at the moment of transition, what is the active state?
Possible answers could include the source state, the destination, both, or
neither. Different models of Timed Automata implement this differently. Some,
like Uppaal~\cite{larsen97} implement so called ``super-dense'' time semantics,
in which the TA may be in multiple states and perform multiple transitions in
the same instant of time. In our model, the TA is always in exactly one state at
every instant in time. If at the moment of transition the TA remains in the
source state, the transition is said to be ``right-closed'' or equivalently
``left-open'', because the interval of time that the TA spends in \(t_{-}\) ends
in a closed interval, while the interval of time that the TA spends in \(t_{+}\)
begins in an open interval. Conversely if the TA is located in the destination
state at the moment of transition, we say that it is ``left-closed'', which also
implies that it is right-open. Returning to our example trace, if the timed
automaton is not in state $q_{2}$ in the instance of transition, then the strict
inequality in the state invariant can be satisfied with equality at the instance
of transition, since the automaton is not actually in that state at that final
moment. To formalize this notion we introduce the weak clock relation
$\sim_{w}$, which is defined as follows:
\begin{align*}
x \sim_{w} c \iff & (x \sim c\ \lor\ x = c) \ \ \sim \in \{<,>,\leq,\geq\} \\
x =_{w} c \iff & false
\end{align*}
To make our trace more precise, we add for each TA $\mathcal{A}_{i}$ the term
$edge^{RC}[i]$, which is true at a given time position iff the currently active
edge is right-closed.
\begin{figure}[h]
\centering
\includegraphics[width=0.6\textwidth]{trace-shift-full}
\caption{An example trace with edge variable.}
\label{fig:trace-full}
\end{figure}
Figure~\ref{fig:trace-full} shows the same example trace as before, but with the
addition of the edge variable. Like the transitions, it is shifted to the right
by half of one position for ease of viewing. Notice that when transition $t_{3}$
is taken, the edge is left-closed, as is required by the invariant. The value of
the edge variable is not shown during the null transition, however during a null
transition either value is equivalent. We now revise the notion of a trace to
include this term.
\begin{defn} A trace $\eta$ is an infinite sequence
\[\eta = (l_{0},v_{0},v_{var,0}),\delta_{0},t_{0},edge_{0},(l_{1},v_{1},v_{var,1}),\delta_{1},t_{1},edge_{1}, \ldots\]
\end{defn}
When using Timed Automata to model real-time systems, a common desire is to
verify that every valid trace of the system obeys a given constraint, or
property. Problems of feasibility quickly arise however, due to the infinite
length of these traces. Bounded Model Checking is a process in which timed
automata traces of infinite length can be efficiently verified against a
property. Since TA traces are infinite in length, we restrict ourselves to
traces of the form
\(s_0 s_1\ldots s_{l-1}{(s_l s_{l+1}\ldots s_{k-1}s_k)}^\omega\), where every
$s = (l,v,v_{var},\delta,t,edge)$. These ``lasso-shaped'' traces consist of an
initial sequence of states up until \(s_{l-1}\), followed by a loop that can be
repeated an infinite amount of times to form the full trace. Since the beginning
of the loop is allowed to occur anywhere within the sequence, the only variable
is the number of distinct states \(k\). Bounded Model Checking refers to
checking if a given property is satisfied over lasso-shaped traces of up to
length \(k\). The TA system along with the desired property are converted into a
format suitable for parsing by a SAT or SMT solver, which is then tasked with
finding a counterexample to the property. If a counterexample is found, then
there exists at least one trace that does not satisfy the provided property.
Otherwise, the property is said to have been verified over the TA network up to
the bound \(k\), as the solver has shown that no lasso-shaped traces of length
\(k\) exist that contradict the property. Although restricting ourselves to only
lasso-shaped traces may seem to be a severe limitation, it has been shown that
for a given TA network $\mathcal{A}$, there exists a limit $K$ such that if a
counterexample for a given property exists, there exists a counterexample of
length no more than $K$~\cite{biere99}.
\section{Constraint LTL Over Clocks}\label{cltloc}
Constraint LTL is an extension of linear temporal logic allowing formulas over a
given constraint system~\cite{demri07}. \cltloc\ is a constraint LTL where the
constraint system consists of clocks defined over the positive real numbers.
This allows for the construction of formulas defined over atomic propositions
and clocks. A clock is a variable over \(\mathbb{R}_{\geq 0}\) whose value
changes between LTL positions to model the passage of time. Like clocks in timed
automata, clocks can be reset back to zero. In addition \cltloc\ has been
extended to support expressions over arithmetical variables~\cite{marconi16}.
A formula in \cltloc\ consists of atomic propositions, clock formulas, and
formulas over integer variables, which are combined using the standard LTL
operators of \(\mathcal{X}\) (next) and \(\mathcal{U}\) (until), as well as the
derived operators \(\mathcal{G}\) (globally), \(\mathcal{F}\) (future), and
\(\mathcal{R}\) (release). A clock formula compares the value of the clock to a
given natural number, for instance \(x > 7\). A variable formula, on the other
hand, can compare not only individual variables but also arithmetic combinations
of variables. An example would be the expression \(b + c = 7\); \(b,c \in Int\).
Let \(X\) be a finite set of clocks and \(Int\) be a finite set of integer
variables. \cltloc\ formulas are defined as follows:
\[\phi := p \BitOr x \sim c \BitOr \exp_{1} \sim \exp_{2} \BitOr \mathcal{X}(n) \sim \exp \BitOr \phi \land \phi \BitOr \neg \phi \BitOr \mathcal{X}\phi \BitOr \phi \mathcal{U} \phi \]
Where \(p \in AP\), \(x \in X\), \(c \in \mathbb{N}\), \(n \in Int\),
$\sim \in \{<,=\} $ and \(exp\) are arithmetic formulas over integer variables
and integers (defined in Section~\ref{timed-automata}).
As mentioned before, clocks are special dense variables over
\(\mathbb{R}_{\geq 0}\) that `progress' between different LTL positions. To be
more specific, each clock must either increment between two adjacent time
positions, or it must be reset. To maintain a consistent view of time, we
introduce \(\delta: \mathbb{N} \rightarrow \mathbb{R}_{>0}\), which measures the
amount of time that elapses between two adjacent time positions. For a given
clock valuation \(\sigma: \mathbb{N} \times X \rightarrow \mathbb{R}_{\geq 0}\),
each clock \(x \in X\) must either obey the equivalence
\(\sigma(l,x) + \delta(l) = \sigma(l+1,x)\), or is reset, i.e.\
\(\sigma(l+1,x) = 0\). This ensures that all clocks progress at the same rate,
and we can use \(\delta(t)\) to calculate the amount of time elapsed between any
two positions.
We also define variables via the assignment function
$\iota : \mathbb{N} \times Int \rightarrow \mathbb{Z}$ that assigns a value to
each variable $n \in Int$ at every time position in $\mathbb{N}$. The
arithmetical expressions $\exp$ can now be evaluated at a time position $l$ by
replacing every occurrence of an integer variable $n$ with $\iota(l,n)$.
A \cltloc\ interpretation is the triple $(\pi, \sigma, \iota)$, where
$\pi: \mathbb{N} \rightarrow \wp(AP)$ maps time positions to the set of atomic
propositions that evaluate to true, and $\sigma$ and $\iota$ are the clock and
variable valuations. A \cltloc\ formula $\phi$ evaluated at time position $l$ is
defined as follows:
\begin{align*}
&(\pi,\sigma,\iota),l \vDash x \sim c && \Leftrightarrow && \sigma(l,x) \sim c \\
&(\pi,\sigma,\iota),l \vDash \exp_{1} \sim \exp_{2} && \Leftrightarrow && \exp_{1}(\iota,l) \sim \exp_{2}(\iota,l) \\
&(\pi,\sigma,\iota),l \vDash \mathcal{X}(n) \sim \exp && \Leftrightarrow && \iota(l{+}1,n) \sim \exp(\iota,l) \\
&(\pi,\sigma,\iota),l \vDash p && \Leftrightarrow && p \in \pi(l) \\
&(\pi,\sigma,\iota),l \vDash \neg \phi && \Leftrightarrow && \neg ((\pi,\sigma,\iota),l \vDash \phi) \\
&(\pi,\sigma,\iota),l \vDash \phi_{1} \land \phi_{2} && \Leftrightarrow &&((\pi,\sigma,\iota),l \vDash \phi_{1}) \land ((\pi,\sigma,\iota),l \vDash \phi_{2}) \\
&(\pi,\sigma,\iota),l \vDash \mathcal{X}(\phi) && \Leftrightarrow && (\pi,\sigma,\iota),l{+}1 \vDash \phi \\
&(\pi,\sigma,\iota),l \vDash \phi_{1} \mathcal{U} \phi_{2} && \Leftrightarrow &&((\pi,\sigma,\iota),l \vDash \phi_{2}) \lor \\
&&&&& \bigg(((\pi,\sigma,\iota),l \vDash \phi_{1}) \land ((\pi,\sigma,\iota),l{+}1 \vDash \phi_{1} \mathcal{U} \phi_{2}) \bigg) \\
\end{align*}
A \cltloc\ formula $\phi$ is said to be \emph{satisfiable} if an interpretation
$(\pi,\sigma,\iota)$ exists such that $(\pi,\sigma,\iota),0 \vDash \phi$. This
is often shortened to simply $(\pi,\sigma,\iota) \vDash \phi$.
\section{MITL}\label{mitl}
Metric Interval Temporal Logic is a restriction of Metric Temporal Logic (MTL)
such that subscripts must be intervals~\cite{Alur91thebenefits} of non-zero
length. An interval $I$ is a convex region of $\mathbb{R}_{\geq 0}$. The bounds
of this region must be in the set $\{\mathbb{N} \cup \infty\}$. We will
represent an interval as $\langle a,b \rangle$ or $\langle a,\infty )$, where
$a,b \in \mathbb{N}$, $\langle\ \in \{\ (,[\ \}$ and $\rangle \in \{\ ),]\ \}$.
The following grammar describes the set of MITL formulas:
\[\phi := \alpha\ |\ \phi \lor \phi\ |\ \neg \phi\ |\ \phi\ \mathcal{U}_{I} \phi\]
Where $\alpha$ represents the set of atomic propositions. The set of
propositions currently supported by TACK consists of the set $AP$ (atomic
propositions of the network of TA) and propositions of the form $n = c$, where
$n$ is an integer variable and $c$ is a constant value.
The semantics of MITL are defined as follows. An MITL signal is a function
$M : \mathbb{R}_{\geq 0} \rightarrow \mathcal{P}(AP) \times \mathbb{Z}^{Int}$.
At a given time $t$, $M(t) = P, v_{var}$ gives us the set of $AP$ that evaluate
to true $P$, as well as a valuation for the integer variables $v_{var}$. For a
given signal $M$, $M,t \vDash \phi$ is defined as follows:
\begin{align*}
&M,t \vDash \alpha && \Leftrightarrow && M(t) = (\psi,v_{var}) \land \alpha \in \psi \\
&M,t \vDash n = c && \Leftrightarrow && M(t) = (\psi,v_{var}) \land v_{var}(v) = c \\
&M,t \vDash \phi_{1} \land \phi_{2} && \Leftrightarrow && (M,t \vDash \phi_{1}) \land (M,t \vDash \phi_{2}) \\
&M,t \vDash \neg \phi && \Leftrightarrow && \neg (M,t \vDash \phi) \\
&M,t \vDash \phi_{1} \mathcal{U}_{I} \phi_{2} && \Leftrightarrow && \exists t' > t, t' - t \in I, (M,t \vDash \phi_{2}) \land \forall t'' \in (t,t'), (M,t'' \vDash \phi_{1}) \\
\end{align*}
An MITL formula $\phi$ is said to be \emph{satisfiable} if an interpretation
$M$ exists such that $M,0 \vDash \phi$. We then say that $M$ models $\phi$.
\section{TACK \cltloc\ Translation}\label{prelim-tack}
The TACK~\cite{tack20} tool developed by Menghi et al.\ converts Bounded
Satisfiability Checking problems into the CLTLoc language. TACK uses Metric
Interval Temporal Logic to specify the property to be checked for satisfiability,
which allows for more compact and powerful specifications of the desired
properties to be checked. Once the Timed Automata network and the MITL property
have been converted into CLTLoc, TACK then uses the tool Zot to convert this
intermediate representation of the problem into the SMT-LIB language, which is
supported by many modern SMT solvers. Zot was designed with a modular
architecture to allow for several different strategies and algorithms that can
be used to convert its input. Currently the most successful Zot plugin for
CLTLoc Bounded Model Checking is \aez. We will provide an overview of both
the TACK encoding of Timed Automata in CLTLoc and the ae2sbvzot translation of
CLTLoc into BitVector form.
Each time position in an infinite trace of a network of timed automata is
represented as a position in the mono-infinite temporal space of \cltloc. At
every time position $l[i]$ and $t[i]$ return the active state and active
transition at the current time position. Each function is syntactic sugar for a
set of atomic propositions, one for each possible value of the function, that
are constrained so that only one may evaluate to true in each time position.
Each $edge_{i}^{RC},\ i \in [1,N]$ is encoded as an atomic proposition. TA
clocks and variables can be represented directly as \cltloc\ clocks and
variables.
\begin{table}
\centering
% \setlength{\tabcolsep}{4pt}
\aboverulesep=0ex
\belowrulesep=0ex
\renewcommand{\arraystretch}{1.2}
\caption{TACK Encoding of an Automaton in CLTLoc}
\label{tack-encoding}
\begin{tabular}{c|c|c}
\toprule
\(\varphi_{1} := \underset{i \in [1,N]}{\bigwedge} (l[i] = 0)\) &
\(\varphi_{2} := \underset{n \in Int}{\bigwedge} n = v_{var}^0 (n) \) &
\(\varphi_{3} := \underset{i \in [1,N]}{\bigwedge} Inv(l[i])\) \\
\midrule
\(\varphi_{4} {:=} \underset{x \in X}{\bigwedge} (x_{0} {=} 0 \land x_{1} {>} 0 \land x_{v} {=} 0)\) & \multicolumn{2}{c}{\( \varphi_{5}(j) {:=} \underset{x \in X}{\bigwedge} (x_{j} {=} 0) {\rightarrow} \mathcal{X}\left( (x_{(j{+}1){\mod 2}} = 0) \mathcal{R}\big( (x_{v}{=}j){\land}(x_{j}{>}0) \big) \right) \)} \\
\midrule
\multicolumn{3}{c}{\(\varphi_{6} := \underset{q \in \mathcal{Q}_{i}}{\underset{i \in [1,N]}{\bigwedge}} \bigg( \Big( l[i] = q \land t[i] = \sharp \Big) \rightarrow \mathcal{X} \Big( Inv(q) \land r_{1}(Inv(q)) \Big) \bigg) \)} \\
\midrule
\multicolumn{3}{c}{\( \varphi_{7} := \underset{t \in T_{i}}{\underset{i \in [1,N]}{\bigwedge}} t[i] = t \rightarrow \Big( l[i] = t_{-} \land \mathcal{X}(l[i] = t_{+}) \land \varphi_{\gamma_{c}} \land \varphi_{\gamma_{v}} \land \varphi_{\alpha_{c}} \land \varphi_{\alpha_{v}} \land \varphi_{edge}(t_{-}, t_{+}, i) \Big) \)} \\
\multicolumn{3}{c}{\( \varphi_{edge}(a,b,i) := \varphi_{\alpha RC}(a,b,i) \lor \varphi_{\alpha LC}(a,b,i) \)}
\\
\multicolumn{3}{c}{\( \varphi_{\alpha RC}(a,b,i) := Inv(a) \land r_{2}(Inv_{w}(b)) \land edge^{RC}[i] \)} \\
\multicolumn{3}{c}{\( \varphi_{\alpha LC}(a,b,i) := Inv_{w}(a) \land r_{2}(Inv(b)) \land \neg edge^{RC}[i] \)} \\
\midrule
\multicolumn{3}{c}{\( \varphi_{8} := \underset{i \in [1,N]; q,q' \in \mathcal{Q}_{i} | q \neq q'}{\bigwedge} \bigg( \Big( (l[i] = q) \land \mathcal{X}(l[i] = q') \Big) \rightarrow \underset{t \in T_{i} | t_{-} = q, t_{+} = q'}{\bigvee} (t[i] = t) \bigg) \)} \\
\midrule
\multicolumn{3}{c}{\( \varphi_{9} := \underset{x \in X}{\bigwedge} \bigg( \mathcal{X}(x_{0} = 0 \lor x_{1} = 0) \rightarrow \underset{t \in T_{i} | x \in t_{a_{c}}}{\underset{i \in [1,N]} {\bigvee}} t[i] = t \bigg) \)} \\
\midrule
\multicolumn{3}{c}{\( \varphi_{10} := \underset{n \in Int}{\bigwedge} \bigg( (\neg(n = \mathcal{X}(n))) \rightarrow \underset{t \in T_{i} | n \in t_{a_{v}}}{\underset{i \in [1,N]}{\bigvee}} t[i] = t \bigg) \)}
\end{tabular}
\end{table}
Table~\ref{tack-encoding} contains the formulas used to encode the Timed
Automata into CLTLoc. To accomplish this encoding, several auxiliary formulas
are used. \(l[i], i \in [1,N]\) represents the \emph{location} of the TA \(i\)
at the current time position. Likewise, \(t[i], i \in [1,N]\) represents the
currently active transition for TA \(i\) at the current time position. Because
not every TA will transition at each time position, we introduce a \emph{null
transition} symbol \(\sharp\). Therefore the function \(t[i]\) may return
either a transition or the symbol \(\sharp\). If transition \(t\) is active in a
given position \(i\), then the TA is in state \(t_{-}\) at position \(i\) and
state \(t_{+}\) at position \(i+1\).
The first formula constrains each TA to be in the initial state at time 0. For
each Timed Automaton, the states are represented as natural numbers, with the
initial state as \(0\). The second formula initializes each variable
\(n \in Int\) to its initial value, and the third ensures that the invariants of
each initial state hold in the initial position.
Formulas 4 and 5 are the clock constraints, and describe how the active value of
the clock evolves throughout the trace. To both test the value of a clock and
simultaneously reset the value during a transition, TACK has used two clock
variables to encode a single clock value. There is currently a work in progress
to extent \cltloc\ to support simultaneous test and reset, however at the time
of writing this is not published. For a clock $x$, $x_{v}$ holds the index of
the active clock value, and references to the clock value elsewhere are
syntactic sugar for evaluating this variable and then choosing the appropriate
clock value. The active value is never zero, and a clock reset at position $i$
is not reflected in the formula until position $i{+}1$.
Formula $\varphi_{6}$ defines the semantics for the null transition. If a Timed
Automaton performs a null transition then at the moment of transition, the state
invariant must hold both before and after clock resets are applied. The function
$r_{1}$ replaces the value of any reset clock with $0$, thus capturing the
post-reset value of any clock used in the invariant.
Formula $\varphi_{7}$ encodes the discrete transitions. Each must respect the guards
and assignments of the transitions, the TA must currently be in the source state
of the transition, and must be in the destination state in the following
position. $\varphi_{edge}$ encodes the two possible edge states, right and
left-closed, and ensures that the invariants are satisfied, either weakly or
strongly depending on the edge type. Function $r_{2}$ again ensures that in the
event of a clock reset, the the invariants of the destination state are
evaluated against the correct clock values.
The final three formulas capture the sufficient conditions for a discrete
transition. The active state of a TA my not change, nor may a clock be reset,
nor may a variable value change without a transition explicitly causing the
change.
\begin{table}[ht]
\centering
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{l c c}
\toprule
\textbf{Type} && \textbf{Synchronization Encoding} \\
\midrule
\multirow{2}{5em}{One-to-one}
& $v_{1} :=$ &
$\underset{t \in T_{i}| t_{\epsilon} = \alpha!}{\underset{i \in [1,N]}{\land}} \Bigg( t[i] = t \rightarrow \underset{j \neq i}{\underset{j \in [1,N],}{\lor}} \Bigg( \genfrac{}{}{0pt}{0}{\genfrac{}{}{0pt}{0}{\varphi_{sync{\mhyphen}on}(j,\alpha?) \land \neg \varphi_{sync{\mhyphen}on{\mhyphen}but}(\{i,j\},\alpha?)}{\land}}{\varphi_{same{\mhyphen}edge}(i,j)} \Bigg) \Bigg)$
\\
& $v_{2} :=$ &
$\underset{t \in T_{i}| t_{\epsilon} = \alpha?}{\underset{i \in [1,N]}{\land}} \Bigg( t[i] = t \rightarrow \underset{j \neq i}{ \underset{j \in [1,N],}{\lor}}( \varphi_{sync{\mhyphen}on}(j,\alpha!) \land \neg \varphi_{sync{\mhyphen}on{\mhyphen}but}(\{i,j\}, \alpha!) ) \Bigg)$
\\
\midrule
\multirow{2}{5em}{Broadcast}
& $v_{1} :=$ & $\genfrac{}{}{0pt}{0}{\genfrac{}{}{0pt}{0}{\underset{t \in T_{i}|t_{\epsilon} = \alpha \#}{\underset{i \in [1,N]}{\bigwedge}} (t[i] = t \rightarrow (\neg \varphi_{sync{\mhyphen}on{\mhyphen}but}(\{i\},\alpha \#)))}{\land}}{\underset{t \in T_{i}|t_{\epsilon}=\alpha \#}{\underset{i \in [1,N]}{\bigwedge}} \bigg( t[i]=t \rightarrow \bigg( \underset{j \neq i}{\underset{h \in [1,N]}{\bigwedge}} \bigg( \genfrac{}{}{0pt}{0}{\genfrac{}{}{0pt}{0}{\varphi_{sync{\mhyphen}on}(j,\alpha @) \land \varphi_{same{\mhyphen}edge}(i,j)}{\lor}}{\big( \underset{t_{\epsilon}' = \alpha @}{\underset{t' \in T_{i'},}{\bigwedge}} (\mathcal{X}(\neg \phi_{t_{\gamma_{c}}'}) \lor \neg \phi_{t_{\gamma_{v}}'} \lor l[j] \neq {t'}_{-}) \big)} \bigg) \bigg) \bigg)}$
\\
& $v_{2} :=$ & $\underset{t \in T_{i}|t_{\epsilon} = \alpha @}{\underset{i \in [1,N]}{\land}} (t[i] = t \rightarrow \varphi_{sync{\mhyphen}on{\mhyphen}but}(\{i\},\alpha\#))$\\
\midrule
$\varphi_{sync{\mhyphen}on}$&$(j,\alpha):=$ &$\underset{t \in T_{i} | t_{\epsilon} = \alpha}{\bigvee} (t[i] = t)$\\
$\varphi_{sync{\mhyphen}on{\mhyphen}but}$&$(S,\alpha):=$ & $\underset{g \in \{i|i \in [1,N]\}\backslash S}{\bigvee} \varphi_{sync{\mhyphen}on}(h,\alpha)$\\
$\varphi_{same{\mhyphen}edge}$&$(i,j):=$ & $\mathcal{X}(edge^{RC}[i] \leftrightarrow edge^{RC}[j])$\\
\bottomrule
\end{tabular}
\caption{Encoding of Different Synchronization Types}
\label{table:cltloc-sync}
\end{table}
Table~\ref{table:cltloc-sync} contains the encodings for the two supported
synchronization types. These synchronization semantics are defined in
Table~\ref{table:sync-def}. The formula \emph{sync-on} is true if the automaton
$i$ performs a transition with the event $\alpha$. \emph{Sync-on-but} is true if
an automaton not included in the set $S$ performs a sync on $\alpha$.
\emph{Same-edge} is true if the two automatons have the same edge type.
\emph{Liveness Constraints} When we introduced the concept of traces, we gave
examples in which at least one Timed Automata performed a non-null (or discrete)
transition at every position in the trace. It seems natural to require at least
one discrete transition in each position, because otherwise the state of the
network would not change, and we could simply remove the unnecessary duplicate
position from the trace. Unfortunately the addition of MITL properties makes
this a bit more complex. Consider the MITL property
$\mathcal{G}_{[0,\infty)} \neg(\mathcal{G}_{[0,10]}\ \alpha)$, where $\alpha$ is
an atomic proposition which only evaluates to true in state $q$. This property
states that a TA is never in state $q$ for 10 or more time units before leaving.
Now let us consider a hypothetical counterexample. In trace $\eta$, the TA
transitions into state $q$ at position $i$, and then transitions to another
state in position $i{+}i$, with $\delta(i)=20$. This clearly violates the
property, as the TA remained in state $q$ for 20 seconds. However in order to
detect this violation, the MITL encoding requires there to be a specific
position in which the property is violated. Unfortunately position $i{+}1$ does
not suffice, as the TA is no longer in the critical state $q$. This
counterexample can only be detected if the solver has the ability to add another
time position in-between $i$ and $i{+}1$, where at least 10 units of time has
passed \textbf{and} the TA is still located in state $q$. Thus we must tolerate
positions in which every TA performs a null transition. That being said, we
often do not wish to accept traces in which discrete transitions \textbf{never}
occur. These requirements are termed \emph{liveness constraints}.
\begin{table}[h]
\centering
\begin{tabular}{p{0.2\textwidth} p{0.1\textwidth} c}
\toprule
\textbf{Type} && \textbf{Liveness Semantics} \\
\midrule
Strong transition liveness &&
$\underset{i \in [1,N]}{\land} \mathcal{G}(\mathcal{F}(t[i] \neq \sharp))$
\\
\midrule
Weak transition liveness && $\mathcal{G}(\mathcal{F}(\underset{i \in [1,N]}{\lor} t[i] \neq \sharp))$ \\
\midrule
Unrestricted && $\top$ \\
\bottomrule
\end{tabular}
\caption{Possible Liveness Constraints}
\label{table:liveness-def}
\end{table}
In addition to the TA and synchronization constraints, TACK includes support for
optional liveness constraints. The first is termed Strong Transition Liveness,
which is shown in Table~\ref{table:liveness-def}. This guarantees that every
time position, eventually in the future all timed automaton in the network will
take a discrete transition. Although a weaker version termed Weak Transition
Liveness is defined in the TACK paper, it is not implemented in the TACK tool.
It requires that at every position \emph{at least one} timed automaton will
eventually perform a discrete transition. Finally the Unrestricted Liveness
option places no restrictions on TA liveness.
\begin{table}[h]
\centering
\begin{tabular}{l c c}
\toprule
\textbf{Type} &\quad\quad\quad\quad & \textbf{Edge Semantics} \\
\midrule
Right-closed & & $\underset{i \in [1,N]}{\land} \mathcal{G} (edge^{RC}[i])$ \\
\midrule
Open & & $\top$ \\
\bottomrule
\end{tabular}
\caption{Possible Edge Constraints}
\label{table:edge-def}
\end{table}
\emph{Edge Constraints} In addition to liveness, TACK also allows for
customization of its edge constraints. As we have seen in
Section~\ref{bounded-sat}, the edge variables are necessary for defining which
state an automaton is located in during the instant of transition. However the
freedom to choose between two possible edge types is often not needed, and adds
additional overhead to the solver. To speed up problems that do not have
invariant edge cases, TACK provides the option to set all edge variables to
right-closed in every time position. As seen in Table~\ref{table:edge-def}, this
is contrasted with the `open' edge semantics, which do not place any additional
restrictions on the edge variables.
\section{Bit-Vector Logic}\label{bvlogic}
A BitVector is an array of binary values, or bits. BitVectors are interpreted
using two's complement arithmetic to produce integer values, and their length
can be any positive integer (\(\mathbb{Z}^+\)). We use the notation
\(\overleftarrow{x}_{[n]}\) to represent a BitVector \(x\) of length \(n\), but
this can be simplified to \(\overleftarrow{x}\) if the length is clear. Bits are
numbered from right to left, with the rightmost, least significant bit labeled
as 0, and the leftmost, most significant bit labeled as \(n-1\). As an example,
the constant vector \(-4\) of length 5 would be written as
\(\overleftarrow{-4}_{[5]}\), which would expand to \(11100\). We can also
reference individual bits in the vector using the notation
\(\overleftarrow{x}_{[n]}^{[i]}\) to \(extract\) the \(i\)th bit from the
BitVector \(x\). It is also possible to extract a sub-vector with the notation
\(\overleftarrow{x}_{[n]}^{[j:i]}\), where \(n>j\geq i\geq 0\). This extracts a
vector of length \(j-i+1\) whose rightmost bit corresponds to the \(i\)th bit of
\(x\) and whose leftmost bit corresponds to the \(j\)th. Similarly,
\(concatenation\) operates on two BitVectors by combining their bit arrays.
\(\overleftarrow{x}_{[n]} :: \overleftarrow{y}_{[m]}\) returns a new BitVector
\(\overleftarrow{z}_{[n+m]}\) where \(\overleftarrow{z}^{[m-1:0]} =
\overleftarrow{y}\), and \(\overleftarrow{z}^{[m+n-1:m]} = \overleftarrow{x}\).
The usual arithmetic operations of addition (\(+\)) and subtraction (\(-\)) are
defined over two BitVectors of the same length. BitVectors also support the
bit-wise operators not (\(\BitNeg\)), disjuction (\(\BitOr\)), conjunction (\(\BitAnd\)),
equivalence (\(\iff\)), and implication (\(\Rightarrow\)). These binary operators return a
new BitVector where each bit \(i\) is the result of applying the logical
operator to the \(i\)th bit of each of the input vectors, following the usual
convention where \(1\) is true and \(0\) is false. For example, the expression
\(\big( \overleftarrow{1100} \Rightarrow \overleftarrow{1010} \big) \) would
evaluate to \(\overleftarrow{1101}\), since \(a \rightarrow b\) is equivalent to
\(a \lor \neg b\).
\section{AE2SBVZOT}\label{zot-encoding}
The final program to mention is \aez, which is a BitVector-based plugin for Zot.
It accepts CLTL formulas and converts them to BitVector logic, which it then
sends to Microsoft's Z3 to solve.
\begin{table}[hb]
\centering
\caption{An example \aez\ trace showing loop variables.}
\begin{tabular}{l|c c c c c}
BitVector & \textbf{4} & 3 & \textbf{2} & 1 & 0 \\
\midrule
\(\overleftarrow{foo}\) & \textbf{1} & 0 & \textbf{1} & 1 & 0 \\
\(\overleftarrow{\neg foo}\) & \textbf{0} & 1 & \textbf{0} & 0 & 1 \\
\(\overleftarrow{\mathcal{X}foo}\) & \textbf{0} & 1 & \textbf{0} & 1 & 1 \\
\midrule
\(\overleftarrow{lpos}\) & 0 & 0 & 0 & 1 & 0 \\
\(\overleftarrow{inloop}\) & 1 & 1 & 1 & 0 & 0
\end{tabular}
\label{table:zotloop}
\end{table}
To model the lasso shape of runs, \aez\ adds an additional position to the
BitVector that represents the `loopback' position, or the first position of the
next iteration of the loop. This position becomes the left-most, most
significant bit of the vector. To separate the lasso from the initial portion of
the trace, \aez\ defines two special BitVectors, \(\overleftarrow{lpos}\) and
\(\overleftarrow{inloop}\). In Table~\ref{table:zotloop} we can see an example formula,
\(foo\), along with the corresponding vectors \(\overleftarrow{lpos}\) and
\(\overleftarrow{inloop}\). We can see that \(\overleftarrow{lpos}\) has a value
of 2, meaning that bit 2 is the first position in the loop. Looking at the table
we can see that the columns for bits 2 and 4 are in bold, to represent that 4,
being the `loopback' position, is a copy of position 2, and therefore all
formulas are constrained to have identical values in these positions. Meanwhile
\(\overleftarrow{inloop}\) highlights that bits 0 and 1 are \textbf{not} in the
loop portion of the trace, while the rest of the positions are. The infinite
trace therefore would begin in position 0, move to position 1, and then repeat
the infinite sequence of positions \([232323\ldots]\).
\begin{table}[ht]
\centering
%\setstretch{0.7}
\caption{\aez\ definition of a proposition \(\varphi\)}