
1 Introduction
Signal Temporal Logic (STL [16, 17]) is a temporal logic designed to specify properties of real-valued dense-time signals. It gained popularity due to the rigour and the ability to reason about analog and mixed signals; and it found use in such domains as analog circuits, systems biology, cyber-physical control systems (see [3] for a survey). A major use of STL is in monitoring: given a signal and an STL formula, an automated procedure can decide whether the formula holds at a given time point.
Monitoring of STL is reliably efficient. A monitoring procedure typically traverses the formula bottom up, and for every sub-formula computes a satisfaction signal, based on satisfaction signals of its operands. Boolean monitoring is based on the computation of conjunctions and disjunctions over a sliding window (“until” is implemented using a specialized version of running conjunction), and robustness monitoring (computing how well a signal satisfies a formula [9, 10]) is based on the computation of minimum and maximum over a sliding window. The complexity of both Boolean and robustness monitoring is linear in the length of the signal and does not depend on the width of temporal windows appearing in the formula. At the same time, for a range of applications, pure STL is either not expressive enough or difficult to use, and specifying a desired property often becomes a puzzle of its own. The existence of robustness and other real-valued semantics does not always help, since a monitor can perform a limited set of operations that the semantics assigns to Boolean operators. For example, for robustness semantics, and
are the only operations beyond the atomic proposition level.
One way to work around the expressiveness issues of STL is pre-processing: a computation that cannot be performed by an STL monitor can be performed by a pre-processor and supplied as an extra input signal. For a number of reasons, this is not always satisfactory. First, for monitoring of continuous-time signals, there is a big gap between the logical definitions of properties and the implementation of monitors. In continuous-time setting, properties are defined using quantification, upper and lower bounds, and similar mathematical tools for dense sets, while a monitor works with a finite piecewise representation of a signal and performs a computation that is based on induction and other tools for discrete sets. Leaving this gap exposed to the user, who has to implement the pre-processing step, is not very user-friendly. Second, monitoring of some properties cannot be cleanly decomposed into a pre-processing step followed by standard STL monitoring. Later, we give a concrete example using an extended “until” operator, and for now, notice that “until” instructs the monitor to compute a conjunction over the window that is not fixed in advance, but is defined by its second operand. Because of that, multiple researches have been motivated to search for a more expressive superset of STL that would allow to specify the properties they were interested in.
One direction for extension is to add to the original quantifier-free logic (MTL, STL) a form of variable binding: a freeze quantifier as in STL* [6], a clock reset as in TPTL [1], or even first order quantification [2]. Unfortunately, such extensions are detrimental to complexity of monitoring. When monitoring logics with quantifiers using standard bottom-up approach, subformulas containing free variables evaluate not to Boolean- or real-valued signals, but to maps from time to non-convex sets, and they cannot in general be efficiently manipulated (although for some classes of formulas monitoring of logics with quantifiers works well [4, 13]). Perhaps the most benign in this respect but also least expressive extension is 1-TPTL (TPTL with one active clock), which is as expressive as MITL, but is easier to use and admits a reasonably efficient monitoring procedure [11].
An alternative direction is to define a quantifier-free specification language with more flexible syntax and sliding window operations. For example, Signal Convolution Logic (SCL [20]) allows to specify properties using convolution with a set of select kernels. In particular, it can express properties of the form “statement holds on an interval for at least X% of the time”. In SCL, every formula has a Boolean satisfaction signal, but some works go further and allow a formula to produce a real-valued output signal based on the real-valued signals of its subformulas. This already happens for robustness of STL in a very limited way, and can be extended. For example, [19] presents temporal logic monitoring as filtering, which allows to derive multiple different real-valued semantics. Another work [7] focuses on the practical application of robustness in falsification and allows to choose between different possible robust semantics for “eventually” and “always”, in particular to replace
or
with integration where necessary.
This paper is our take on extending STL in the latter direction. We define a specification language that is more expressive than STL, but not less efficient to monitor offline, i.e., the complexity of monitoring is linear in the length of the signal and does not depend on the width of temporal windows in the formula (the latter property tends to be missing from the STL extensions, even when the authors can achieve linear complexity for a fixed formula). The most important features of the new language are as follows.
- 1.
We remove several syntactic constrains from STL: we allow a formula to have a real-valued output signal; we allow these signals to be combined in a point-wise way with arithmetic operations, comparisons, etc. This distinguishes us from the works that use standard MTL or STL syntax and assign them new semantics [10, 19].
- 2.
We allow to apply an efficiently computable aggregate function over a sliding window. We currently focus on
and
, which are enough to specify properties that motivated the development of more expressive and hard to monitor logics.
- 3.
We offer a version of “until” operator that performs aggregation over a sliding window of dynamic width, that depends on satisfaction of some formula. This distinguishes us from the works that focus on aggregation over a fixed window [20].
Finally, we focus our attention on continuous-time piecewise-constant and piecewise linear signals; we describe the algorithms and prepare an implementation only for piecewise-constant.
2 Motivating Examples
Before formally defining the new language, let us look at some examples of properties that we would like to express. In particular, we look at properties that motivated the development of more expressive and harder to monitor logics.
Example 1

![$$\max _{[0,200]} x - \min _{[0,200]} x \le 0.1$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq9.png)
![$$\mathop {\mathrm {On}_{[a,b]}}$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq10.png)


![$$ \mathop {\mathrm {On}_{[0,200]}} \mathop {\mathrm {Max}}x - \mathop {\mathrm {On}_{[0,200]}} \mathop {\mathrm {Min}}x \le 0.1 $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ4.png)
![$$[t, t+200]$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq13.png)


Damped oscillation x(t) and its maximum and minimum over the window . (Color figure online)

Sine wave x(t), its maximum over the window , and whether x(t) is a local maximum on the interval
. (Color figure online)
Example 2
(Local Maximum). Consider the property: “the current value of x is a minimum or maximum in some neighbourhood of current time point”. Previously, a similar property became a motivation to extend STL with freeze quantifiers [6], but we can also express it by comparing the value of a signal with some aggregate information about its neighbourhood, which we can do similarly to the previous example.
![$$ x \ge \mathop {\mathrm {On}_{[0,85]}} \mathop {\mathrm {Max}}x $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ5.png)
![$$[t, t+85]$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq18.png)
Example 3
(Stabilization Contd.). We want to be able to assert that x becomes stable around some value not for a fixed duration, but until some signal q becomes true. We will be able to do this with our version of “until” operator.





Example 4
(Linear Increase). At this point, we can assert x to follow a more complex shape, for example, to increase or decrease with a given slope. Let T denote an auxiliary signal that linearly increases with rate 1 (like a clock of a timed automaton), i.e. we define ; this example works as well for
, where c is a constant. To specify that x increases with the rate 2.5, we assert that the distance from x to
stays within some bounds.
![$$ \mathop {\mathrm {On}_{[0,100]}} \mathop {\mathrm {Max}}|x - 2.5\mathrm {T}| - \mathop {\mathrm {On}_{[0,100]}} \mathop {\mathrm {Min}}|x - 2.5\mathrm {T}| \le 0.1 $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ7.png)
3 Syntax and Semantics
From the examples above we can foresee how the new language looks like. Formally, an (input) signal is a function , where the time domain
is a closed real interval
, and the number |w| is the duration of the signal. We refer to signal components using their own letters:
. We assume that every signal component is piecewise-constant or piecewise-linear.
The semantics of a formula is a piecewise-constant or piecewise-linear function from real time (thus, has real-valued switching points) to a dual number (rather than a real). We defer the discussion of dual numbers until Sect. 3.2; for now we note that they extend reals, and a dual number can be written in the form , which, when
, denotes a point infinitely close to a. We denote the set of dual numbers as
. Our primary use of a dual number is to represent a time point strictly after an event (switching point, threshold crossing, etc.) but before any other event can happen; as a result we have to allow an output signal to have a dual value, denoting a value that is attained at this dual time point.





Point-wise Functions. Function symbol f ranges over real-valued functions that preserve the chosen shape of signals (and can be lifted to dual numbers). In this paper, we focus on piecewise-constant and piecewise-linear signals, so when f is applied point-wise to a piecewise-constant input, we want the result to be piecewise-constant; when f is applied point-wise to a piecewise-linear input, we want the result to be piecewise-linear. Examples of such functions are addition, subtraction,
and
of finitely many operands (we use lowercase
and
to denote a real-valued n-ary function), multiplication by a constant, absolute value, etc.
![$$\mathop {\mathrm {On}_{[0,85]}} \mathop {\mathrm {Max}}x$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq42.png)
![$$x \ge \mathop {\mathrm {On}_{[0,85]}} \mathop {\mathrm {Max}}x$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq43.png)







- 1.
refer to an input signal x;
- 2.
apply a real-valued function f pointwise to the outputs its
-subformulas;
- 3.
apply an aggregate function over the sliding window [a, b] (with some abuse of notation a can be
, and b can be
);
- 4.
be an “until” formula, which is described in Sect. 3.3.





![$$ \mathop {\mathrm {F}_{[a,b]}} \varphi = \mathop {\mathrm {On}_{[a,b]}} \mathop {\mathrm {Max}}\varphi \qquad \qquad \mathop {\mathrm {G}_{[a,b]}} \varphi = \mathop {\mathrm {On}_{[a,b]}} \mathop {\mathrm {Min}}\varphi $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ9.png)
3.1 Semantics of Until-Free Fragment








3.2 Dual Numbers
Dual numbers extend reals with a new element that has a property
. A dual number can be written in a form
, where
. We denote the set of dual numbers as
. Dual numbers were proposed by the English mathematician W. Clifford in 1873 and later applied in geometry by the German mathematician E. Study. One of modern applications of dual numbers and their extensions is in automatic differentiation [12]: one can exactly compute the value of the first derivative at a given point using the identity
. Intuitively,
can be understood as an infinitesimal value, and
(for
) is a point that is infinitely close to a. Polynomial functions can be extended to dual numbers, and via Taylor expansion, so can exponents, logarithms, and trigonometric functions. We work with piecewise-constant and piecewise-linear functions with real switching points, and we only make use of basic arithmetic. For example, if on the interval
the signal x is defined as
, then
and
.
Our primary use of a dual number is to represent a time point strictly after an event (a switching point, a threshold crossing, etc.) but before any other event can happen, i.e., we use to represent the time point that happens right after
. The coefficient 1 at
denotes that time advances with the rate of 1 (although another consistently used coefficient works as well). Consequently, we also allow an output signal to produce a dual value, denoting a value that is attained at this dual time point. On the other hand, we require that signals are defined over real time, switching points of piecewise signals are reals, and time constants in formulas are reals. That is, dual-valued time is only used internally by the temporal operators and cannot be directly observed.







Signals x and y for Example 8.

Example 5
Consider the signal x defined as: “”, as shown in Fig. 4. Let us find the minimum of x on the interval
. By our definition,
. This result should be understood as follows: x(t) approaches the value of 1 from the above with derivative
, but never reaches it.
Example 6
Our definition of minimum and maximum allows to correctly compare values of piecewise-linear functions around their discontinuity points. In Example 5, x never reaches the value of its lower bound, and our definition of minimum produces a dual number that reflects this fact and also specifies the rate at which x approaches its lower bound. This information would be lost if we computed the infimum of x. Again consider the signals in Fig. 4, with x defined as before, and “”. Let us evaluate at time
the formula
, which denotes the property
. From the previous example, we have that
. By a similar argument,
, which means that y approaches 1 from below with the rate of 1. Since,
, our property holds at time 0, as expected.
We want to emphasize that while an output signal can take a dual value, its domain is considered to be a subset of reals. The semantics of temporal operators are allowed to internally use dual-valued time points, but has to produce an output signal that is defined over real time. This ensures that a piecewise signal always has real-valued switching points and that no event can happen at a dual-valued time point.
Example 7
![$$\varphi = \mathop {\mathrm {F}_{[0,2]}} (x = \mathop {\mathrm {On}_{(-\inf ,\inf )}} \mathop {\mathrm {Min}}x)$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq97.png)



![$$\mathbb {T}=[0,|w|] \subseteq \mathbb {R}$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq100.png)
3.3 Semantics of Until
The -operator allowed us to compute minima and maxima over a sliding window of fixed width. In this section, we introduce a new version of “until” operator that allows the window to have variable width that depends on the output signal of some formula.
![$$ \llbracket p \mathbin {\mathrm {U}_{}^\mathrm{STL}} q \rrbracket (t) = \exists t' \ge t.\ q(t') \wedge \forall s \in [t, t'].\ p(s) $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ10.png)




Case 1: q is never true in the future.

Case 2: q there exists the earliest time point, where q becomes true.

Case 3: q becomes true, but there is no earliest time point.
- 1.
Figure 5: q is false for every
. Then the value of
at t is false.
- 2.
Figure 6: there exists the smallest
, where q is true (this includes the case, where
). Then the value of
at t is
(predicate p is not shown in the figure). The monitor needs not consider time points after
, since if “forall” produces false on a smaller interval, it will produce false on a larger one.
- 3.
Figure 7: q becomes true in the future, but there is no earliest time point. In this case, the monitor needs to take the universal quantification over an interval that ends just after
(the switching point of q), but before any other event occurs. We can formalize this reasoning using dual numbers and say that the value of
at t is
, where
can be intuitively understood as a time point that happens after
, but before any other event can occur.

Example 8
Let us consider two linear input signals: and
(see Fig. 3), and let us evaluate the formula
at time 0 using non-strict “until” semantics. We define the earliest time point where
becomes true to be
, thus we need to evaluate the expression
. At time
, we get
, thus the “until” formula does not hold. Informally, we can interpret the result as follows: when x becomes greater than 1, y becomes greater than x, while non-strict “until” requires that there exists a point, where both its left- and right-hand operands hold at the same time.
![$$\psi \mathbin {\mathrm {U}_{[a,b]}^{d}} \varphi $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq125.png)


![$$ \llbracket \psi \mathbin {\mathrm {U}_{[a,b]}^{d}} \varphi \rrbracket (t) = {\left\{ \begin{array}{ll} \llbracket \psi \rrbracket [t, t'], \text { if } \exists \text { the smallest } t'\in [t+a,t+b], \text { s.t. } \llbracket \varphi \rrbracket (t') \ne 0 \\ \begin{aligned} \llbracket \psi \rrbracket &{}[t, t'+\varepsilon ], \text { where } t' = \inf \{ t' | t' \in [t+a,t+b] \wedge \llbracket \varphi \rrbracket (t') \}, \\ &{} \text { if } \exists t' \in [t+a,t+b].\ \llbracket \varphi \rrbracket (t') \ne 0, \text{ but } \text{ there } \text{ is } \text{ no } \text{ smallest } t' \end{aligned} \\ d, \text { otherwise } \end{array}\right. } $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ11.png)
![$$\varphi _1\!\downarrow \mathbin {\mathrm {U}_{[a,b]}^{d}} \varphi _2$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq128.png)


![$$ \llbracket \varphi _1\!\downarrow \mathbin {\mathrm {U}_{[a,b]}^{d}} \varphi _2 \rrbracket (t) = {\left\{ \begin{array}{ll} \llbracket \varphi _1 \rrbracket (t'), \text { if }\exists \text { the smallest } t'\in [t+a,t+b], \text { s.t. } \llbracket \varphi _2 \rrbracket (t') \ne 0 \\ \begin{aligned} \llbracket \varphi _1 \rrbracket &{}(t'+\varepsilon ), \text { where } t' = \inf \{ t' | t' \in [t+a,t+b] \wedge \llbracket \varphi _2 \rrbracket (t') \}, \\ &{} \text { if } \exists t' \in [t+a,t+b].\ \llbracket \varphi _2 \rrbracket (t') \ne 0, \text{ but } \text{ there } \text{ is } \text{ no } \text{ smallest } t' \end{aligned} \\ d, \text { otherwise } \end{array}\right. } $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ12.png)
![$$ \varphi _1 \mathbin {\mathrm {U}_{[a,b]}^\mathrm{STL}} \varphi _2 = (\mathop {\mathrm {Min}}\varphi _1) \mathbin {\mathrm {U}_{[a,b]}^{0}} \varphi _2 $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ13.png)
![$$ \mathop {\mathrm {D}_{a}^{d}} \varphi = \varphi \!\downarrow \mathbin {\mathrm {U}_{[a,a]}^{d}} 1 $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ14.png)

Before time 2, an event p is followed by an event q.

A sequence of spikes and a Boolean signal marking the detected start times of spikes. (Color figure online)
Example 9
![$$x' > m \wedge \mathop {\mathrm {F}_{[0,d]}} (x' < -m)$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq131.png)



![$$ (\mathop {\mathrm {D}_{\delta }^{y}} x - x)/\delta \ge m \wedge \mathop {\mathrm {F}_{[0,d]}} ((\mathop {\mathrm {D}_{\delta }^{y}} x - x)/\delta \le -m) $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ15.png)
Example 10
![$$ (\mathop {\mathrm {On}_{[0,w]}} \mathop {\mathrm {Max}}x \ge x + m) \wedge \mathop {\mathrm {F}_{[0,w]}}(\mathop {\mathrm {On}_{[0,w]}} \mathop {\mathrm {Min}}x \le x - m) $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ16.png)
Example 11
(TPTL-like Assertion). The second form of “until” allows to reason explicitly about time points and durations, somewhat similarly to TPTL. Consider the property “within 2 time units, we should observe an event p followed by an event q” (Fig. 8 shows an example of a satisfying signal). With some case analysis, this property can be expressed in MTL [5], but probably the best way to express it is offered by TPTL, that allows to assert “”, meaning “reset a clock c, eventually, we should observe p and from that point, eventually we should observe q, while the clock value will be at most 2”. To express the property in our language, we introduce three auxiliary signals:
(which we use in some other examples as well),
, which denotes the duration until the next occurrence of p and similarly
, the duration until the next occurrence of q. Then, the property can be expressed as:
.
4 Monitoring
Similarly to other works on STL monitoring (e.g., [9]), we implement the algorithms for a subset of the language, and support the remaining operators via rewriting rules.

![$$ \begin{aligned}&(\mathop {\mathrm {Min}}\varphi _1) \mathbin {\mathrm {U}_{[a,b]}^{d}} \varphi _2 = \text { if } \lnot \mathop {\mathrm {F}_{[a,b]}}\varphi _2 \text { then } d \text { else } \mathop {\mathrm {On}_{[0,a]}} \mathop {\mathrm {Min}}((\mathop {\mathrm {Min}}\varphi _1) \mathbin {\mathrm {U}_{}^{}} \varphi _2) \\&(\mathop {\mathrm {Max}}\varphi _1) \mathbin {\mathrm {U}_{[a,b]}^{d}} \varphi _2 = \text { if } \lnot \mathop {\mathrm {F}_{[a,b]}}\varphi _2 \text { then } d \text { else } \mathop {\mathrm {On}_{[0,a]}} \mathop {\mathrm {Max}}((\mathop {\mathrm {Max}}\varphi _1) \mathbin {\mathrm {U}_{}^{}} \varphi _2) \\&\varphi _1\!\downarrow \mathbin {\mathrm {U}_{[a,b]}^{d}} \varphi _2 = \text { if } \lnot \mathop {\mathrm {F}_{[a,b]}}\varphi _2 \text { then } d \text { else } \mathop {\mathrm {D}_{a}^{}} (\varphi _1\!\downarrow \mathbin {\mathrm {U}_{}^{}} \varphi _2) \end{aligned} $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ17.png)
![$$(\mathop {\mathrm {Min}}\varphi _1) \mathbin {\mathrm {U}_{[a,b]}^{d}} \varphi _2$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq141.png)
![$$s \in [t+a, t+b]$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq142.png)

![$$[t+a, t+b]$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq144.png)









![$$g(t') \in [t', s]$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq154.png)

![$$\bigcup \{ [t', g(t')] \mid t' \in [t, t+a] \} = [t, s]$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq156.png)
![$$\mathop {\mathrm {On}_{[a,b]}}$$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_IEq157.png)





![$$ \begin{aligned}&\mathop {\mathrm {On}_{[a,b]}} \mathop {\mathrm {Min}}\varphi = \min \{ \mathop {\mathrm {On}_{[a,0]}} \mathop {\mathrm {Min}}\varphi ,\ \mathop {\mathrm {On}_{[0,b]}} \mathop {\mathrm {Min}}\varphi \} \\&\mathop {\mathrm {On}_{[a,b]}} \mathop {\mathrm {Max}}\varphi = \max \{ \mathop {\mathrm {On}_{[a,0]}} \mathop {\mathrm {Max}}\varphi ,\ \mathop {\mathrm {On}_{[0,b]}} \mathop {\mathrm {Max}}\varphi \} \end{aligned} $$](../images/483135_1_En_5_Chapter/483135_1_En_5_Chapter_TeX_Equ18.png)



All operators in the language of the monitor admit efficient offline monitoring. Minimum and maximum over a sliding window required by the -operator can be computed using a variation of Lemire’s algorithm [9, 15]; “lookup” operator
shifts its input signal by a constant distance; and for untimed “until” we can scan the input signal backwards and perform a special case of running minimum or maximum.
4.1 Monitoring Algorithms
In this section, we briefly describe monitoring algorithms for piecewise-constant signals.
Representation of Signals. We represent a piecewise-constant function or
as a sequence of segments:
, where every segment
maps an interval
to a real or dual value
. The intervals
form a partition the domain of the signal and are ordered in ascending time order, i.e.,
and
. The domain of the signal corresponding to the sequence
is denoted by
. For example, if the function x(t) is defined as
, if
, and
, if
, then x(t) is represented by the sequence
, and
.
Empty brackets denote an empty sequence that does not represent a valid signal, but can be used by algorithms as an intermediate value. We manipulate the sequences with two main operations. The function
adds a segment to the end of a sequence:
. The function
adds a segment to the start of a sequence:
. This may produce a sequence where the first segment does not start time at time 0. While such a sequence does not represent a valid signal, it can be used by the algorithms as an intermediate value. The function
removes the last segment of a sequence, assuming it was non-empty:
.
An output signal of a formula is scalar-valued and is represented by one such sequence. An input signal usually has multiple components, i.e., it is a function , and is represented by a set of n sequences.
On-Formulas. For and
, a monitor needs to compute the minimum or maximum of the output signal of
over the sliding window. The corresponding algorithm was developed for discrete time by Lemire [15] and later adapted for continuous time [9].




Algorithm for monitoring “until”-formulas.
Until-Formulas. Informally, monitoring the “until”-formulas, ,
, and
, works as follows. The monitor scans the output signals of
and
backwards. While
evaluates to a non-zero value, the monitor outputs the value of
. When
evaluates to 0, the monitor outputs either the default value (if the monitor did not yet encounter a non-zero value of
), or the running minimum or maximum of
, or the value that
had at the last time point where
was non-zero.
The function and
in Fig. 10 implement this idea. The inputs to the function
are: sequences
and
representing the output signals of
and
(with
), default value d, and the function f used for aggregation; it can be
,
, or the special function
which returns the value of its first argument and which we use to monitor the formula
. The function
scans the input sequences backwards and iterates over intervals where both input signals maintain a constant value (J). Each such interval is passed to the function
, which updates the state of the algorithm (
, s) and constructs the output signal (
).
5 Implementation and Experiments
We implemented the monitoring algorithm in a prototype tool that is available at https://gitlab.com/abakhirkin/StlEval. The tool has a number of limitations, notably it can only use piecewise-constant interpolation (so we cannot evaluate examples that use the auxiliary signal ) and does not support past-time operators. It is written in C++ and uses double-precision floating point numbers for time points and signal values. We evaluate the tool using a number of synthetic signals and a number of properties based on the ones described earlier in the paper.
Signals. We use the following signals discretized with time step 1.
, x always eventually becomes stable around some value for 200 time units.
: x always eventually becomes stable around 0 for 200 time units.
, where
, x always eventually becomes stable for at least 200 time units and then starts changing with derivative of at least 0.1.
, every local maximum is followed by a local minimum.
, if x is above 0.85, it should eventually become below
.
, spike of half-width 16 and height at least 0.5.
, where
, spike of width at most 25 and magnitude 0.04.
Some properties are expressed in our language using - and “until”-operators, and some are STL properties. This allows us to see how much time it takes to monitor a more complicated property in our language (e.g.,
, stabilization around an unknown value) compared to a similar but more simple STL property (e.g.,
, stabilization around a known value). In our experiments we see a constant factor between 2 and 5.
Monitoring time for different formulas and signals.

6 Conclusion and Future Work
We describe a new specification language that extends STL with the ability to produce and manipulate real-valued output signals (while in STL, every formula has a Boolean output signal). Properties in the new language are specified in terms of minima and maxima over a sliding window, which can have fixed width, when using a generalization of - and
-operators, or variable width, when using a new version “until”. We show how the new language can express properties that motivated the creation of more expressive and harder to monitor logics. Offline monitoring for the new language is almost as efficient as STL monitoring; the complexity is linear in the length of the input signal and does not depend on the constants appearing in the formula.
There are multiple directions for future work; perhaps more interesting one is adding integration over a sliding window (in addition to minimum and maximum). This is already allowed by some formalisms [7], and when added to our language will allow to assert that a signal approximates the behaviour of a system defined by a given differential equation (since we will be able to assert ). Before making integration available, we wish to investigate how to better deal in a specification language with approximation errors. Finally, we wish to make our language usable in falsification, which means that for every formula with Boolean output signal we wish to be able to compute a real-valued robustness measure.
Acknowledgements
The authors thank T. Ferrére, D. Nickovic, E. Asarin for comments on the draft of this paper, and O. Lebeltel for providing a version of AMT for the experiments.

Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.
The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.