Real-time systems are increasingly pervasive in human activities, with systems becoming more and more complex. Monitoring real-time systems consists in deciding whether a log satisfies a specification. Often, we are rather interested in knowing for which segment of the log the specification is satisfied or violated. This problem can be related to string matching and pattern matching. The timed pattern matching problem was recently formulated in [UFAM14], with subsequent works varying the setting and improving the technique (e. g., [UFAM16, WAH16, WHS17]). In [UFAM14], the problem takes as input a timed signal (values that change over the continuous notion of time) and a timed regular expression (a real-time extension of regular expressions); and it returns the set of intervals for which the timed regular expression is matched by the log, i. e., restricted to belongs to the language of .
In [WAH16, WHS17], we introduced a solution to the timed pattern matching problem where the log is given in the form of a timed word (a sequence of events with their associated timestamps), and the specification in the form of a timed automaton (TA), an extension of finite-state automata with clocks [AD94]. In [WAH16], our technique first relied on an extension of the Boyer-Moore algorithm for string matching and its extension to (untimed) pattern matching by Watson and Watson; in [WHS17], it relied on (an automata-theoretic extension of) skip values from the Franek–Jennings–Smyth (FJS) algorithm for string matching [FJS07], so as to improve the efficiency.
As a motivating example, consider the example in Fig. 1. Here $ is a special terminal character. Consider the automaton in Fig. 0(a), and fix and —which gives a timed automaton [AD94]. For this timed automaton (say ) and the target timed word in Fig. 0(b), the output of the timed pattern matching problem is the set of matching intervals .
In this work, we consider a more abstract problem: given a (concrete) timed log and an incomplete specification where some of the timing constants may be known with limited precision or completely unknown, what are the intervals and the valuations of the parameters for which the specification holds? Coming back to Fig. 1, the question becomes to exhibit values for for which the specification holds on the log, i. e., , where denotes a valuation of and denotes the replacement of in with their respective valuation in .
We introduce an approach using as underlying formalisms timed words and parametric timed automata [AHV93], two well-known formalisms in the real-time systems community. We first show that the problem is decidable (which mainly comes from the fact that logs are finite), and we propose a practical solution based on parametric timed model checking.
We implement our method using IMITATOR [AFKS12] and we perform a set of experiments on a set of automotive benchmarks.
Several algorithms have been proposed for online monitoring of real-time temporal logic specifications. Online monitoring consists in monitoring on-the-fly at runtime, while offline monitoring can possibly be performed after the execution is completed, with less hard constraints on the monitoring algorithm performance. An online monitoring algorithm for ptMTL (a past time fragment of MTL [Koy90]) was proposed in [RFB14] and an algorithm for MTL[U,S] (a variant of MTL with both forward and backward temporal modalities) was proposed in [HOW14]. In addition, a case study on an autonomous research vehicle monitoring [KCDK15] shows such procedures can be performed in an actual vehicle.
The approaches most related to ours are [UFAM14, UFAM16, Ulu17]. In that series of works, logs are encoded by signals, i. e., values that vary over time. This can be seen as a state-based view, while our timed words are event-based. The formalism used for specification in [UFAM14, UFAM16] is timed regular expressions (TREs). An offline monitoring algorithm is presented in [UFAM14] and an online one is in [UFAM16]. These algorithms are implemented in the tool Montre [Ulu17]. The difference between different specification formalisms (TREs, timed automata, temporal logics, etc.) are subtle, but for many realistic examples the difference may not matter.
In [WHS17], we presented an efficient algorithm for online timed pattern matching that employs (an automata-theoretic extension of) skip values from the Franek–Jennings–Smyth (FJS) algorithm for string matching [FJS07]. We showed that our algorithm generally outperforms a brute-force one and our previous BM algorithm [WAH16]
: it is twice as fast for some realistic automotive examples. Through our theoretical analysis as well as experiments on memory consumption, our algorithm was shown to be suited for online usage scenarios, too. In comparison, we use here a different approach not based on FJS, but rather on parametric model checking.
Some algorithms have also been proposed for parameter identification of a temporal logic specification with uncertainty over a log. For discrete time setting, an algorithm for an extension of LTL is proposed in [FR08] and for real-time setting, algorithms for parametric signal temporal logic (PSTL) are proposed in [ADMN11, BFM18]. Although these works are related to our approach, previous approaches do not focus on segments of a log but one whole log. In contrast, we exhibit intervals together with their associated parameter valuations, in a fully symbolic fashion. We believe our matching-based setting is advantageous in many usage scenarios e. g., from hours of a log of a car, extracting timing constraints of a certain actions to cause slipping. Also, our setting allows the patterns with complex timing constraints (see the pattern in Fig. 3(c) for example).
In [BFMU17], the robust pattern matching problem is considered over signal regular expressions, consisting in computing the quantitative (robust) semantics of a signal relative to an expression. For piecewise-constant and piecewise-linear signals, the problem can be effectively solved using a finite union of zones.
Finally, in an orthogonal direction, in [CJL17], the authors propose a refinement of trace abstractions technique to perform parameter synthesis for real-time systems; they use IMITATOR, as in our work.
|log, target||specification, pattern||output|
|string matching||a word||a word|
|pattern matching (PM)||a word||an NFA|
|timed PM||a timed word||a TA|
|parametric timed PM||a timed word||a PTA|
A summary of various matching problems is given in Table I.
We first introduce the parametric timed pattern matching problem and the necessary preliminaries in Section II. We then introduce our approach based on parametric model checking in Section III. We apply it to benchmarks from [HAF14] in Section IV. We finally outline future directions of research in Section V.
Ii Preliminaries and objective
Ii-a Timed words and timed segments
For an alphabet , a timed word is a sequence of pairs satisfying for any . Given a timed word , we often denote it by , where is the sequence and is the sequence . Let be a timed word. We denote the subsequence by . For such that , the -shift of is where . For timed words and , their absorbing concatenation is where and are usual concatenations.
For a timed word on and satisfying , a timed word segment is defined by the timed word on the augmented alphabet , where are chosen so that and .111Observe that, in contrast with [WAH16, WHS17], we use here closed intervals, i. e., may be equal to the start or end time of the word. Here the fresh symbol is called the terminal character.
Ii-B Clocks, parameters and guards
We assume a set of clocks, i. e., real-valued variables that evolve at the same rate. A clock valuation is a function . We write for the clock valuation assigning to all clocks. Given , denotes the valuation s.t. , for all . Given , we define the reset of a valuation , denoted by , as follows: if , and otherwise.
We assume a set of parameters, i. e., unknown constants. A parameter valuation is a function .222We choose by consistency with most of the PTA literature, but also because, for classical PTAs, choosing leads to undecidability [Mil00]. We assume . A guard is a constraint over defined by a conjunction of inequalities of the form , or with and . Given , we write if the expression obtained by replacing each with and each with in evaluates to true.
Ii-C Parametric timed automata
Parametric timed automata (PTA) extend timed automata with parameters within guards and invariants in place of integer constants [AHV93].
Definition 1 (Pta).
A PTA is a tuple , where:
is a finite set of actions,
is a finite set of locations,
is the initial location,
is the set of accepting locations,
is a finite set of clocks,
is a finite set of parameters,
is the invariant, assigning to every a guard ,
is a finite set of edges where are the source and target locations, , is a set of clocks to be reset, and is a guard.
Given a parameter valuation , we denote by the non-parametric structure where all occurrences of a parameter have been replaced by . We denote as a timed automaton any structure , by assuming a rescaling of the constants: by multiplying all constants in by their least common denominator, we obtain an equivalent (integer-valued) TA, as defined in [AD94].
The synchronous product (using strong broadcast, i. e., synchronization on shared actions) of several PTAs gives a PTA.
Definition 2 (synchronized product of PTAs).
Let . Given a set of PTAs , , the synchronized product of , , denoted by , is the tuple , where:
for all ,
and is defined as follows. For all , let be the subset of indices such that . For all , for all , for all , if:
for all , there exist such that , , , and,
for all , .
Let us now recall the concrete semantics of TA.
Definition 3 (Semantics of a TA).
Given a PTA , and a parameter valuation , the semantics of is given by the timed transition system (TTS) , with
consists of the discrete and (continuous) delay transition relations:
discrete transitions: , if , and there exists , such that , and ).
delay transitions: , with , if .
Moreover we write for a combination of a delay and discrete transition if .
Given a TA with concrete semantics , we refer to the states of as the concrete states of . A run of is a possibly infinite alternating sequence of concrete states of and pairs of edges and delays starting from the initial state of the form with , , and . Given such a run, the associated timed word is , where is the action of edge , and , for .333The “” in indices comes from the fact that, following usual conventions in the literature, states are numbered starting from 0 while words are numbered from 1. Given a state , we say that is reachable in if appears in a run of . By extension, we say that is reachable; and by extension again, given a set of locations, we say that is reachable if there exists such that is reachable in .
A finite run is accepting if its last state is such that . The (timed) language is defined to be the set of timed words associated with all accepting runs of .
Ii-D Reachability synthesis
We will use here reachability synthesis to solve parametric timed pattern matching. This procedure, called EFsynth, takes as input a PTA and a set of target locations , and attempts to synthesize all parameter valuations for which is reachable in . EFsynth was formalized in e. g., [JLR15] and is a procedure that may not terminate, but that computes an exact result (sound and complete) if it terminates. EFsynth traverses the parametric zone graph of , which is a potentially infinite extension of the well-known zone graph of TAs (see, e. g., [ACEF09, JLR15] for a formal definition).
Ii-E Timed pattern matching
We now extend this problem to parameters by allowing a specification expressed using PTAs. The problem now requires not only the start and end dates for which the property holds, but also the associated parameter valuations.