1 Introduction

Mission-time LTL (MLTL) [34] has the syntax of Linear Temporal Logic with the option of integer bounds on the temporal operators. It was created as a generalization of the variations [3, 14, 25] on finitely-bounded linear temporal logic, ideal for specification of missions carried out by aircraft, spacecraft, rovers, and other vehicular or robotic systems. MLTL provides the readability of LTL [32], while assuming, when a different duration is not specified, that all requirements must be upheld during the (a priori known) length of a given mission, such as during the half-hour battery life of an Unmanned Aerial System (UAS). Using integer bounds instead of real-number or real-time bounds leads to more generic specifications that are adaptable to model checking at different levels of abstraction, or runtime monitoring on different platforms (e.g., in software vs in hardware). Integer bounds should be read as generic time units, referring to the basic temporal resolution of the system, which can generically be resolved to units such as clock ticks or seconds depending on the mission. Integer bounds also allow generic specification with respect to different granularities of time, e.g., to allow easy updates to model-checking models, and re-usable specifications for the same requirements on different embedded systems that may have different resource limits for storing runtime monitors. MLTL has been used in many industrial case studies [18, 28, 34, 37, 42,43,44], and was the official logic of the 2018 Runtime Verification Benchmark Competition [1]. Many specifications from other case studies, in logics such as MTL [3] and STL [25], can be represented in MLTL. We intuitively relate MLTL to LTL and MTL-over-naturals as follows: (1) MLTL formulas are LTL formulas with bounded intervals over temporal operators, and interpreted over finite traces. (2) MLTL formulas are MTL-over-naturals formulas without any unbounded intervals, and interpreted over finite traces.

Despite the practical utility of MLTL, no model checker currently accepts this logic as a specification language. The model checker nuXmv encodes a related logic for use in symbolic model checking, where the \(\Box \) and \(\Diamond \) operators of an can have integer bounds [21], though bounds cannot be placed on the \(\mathcal {U}\) or \(\mathcal {V}\) (the Release operator of nuXmv) operators.

We also critically need an MLTL satisfiability checker to enable specification debugging. Specification is a major bottleneck to the formal verification of mission-based, especially autonomous, systems [35], with a key part of the problem being the availability of good tools for specification debugging. Satisfiability checking is an integral tool for specification debugging: [38, 39] argued that for every requirement \(\varphi \) we need to check \(\varphi \) and \(\lnot \varphi \) for satisfiability; we also need to check the conjunction of all requirements to ensure that they can all be true of the same system at the same time. Specification debugging is essential to model checking [39,40,41] because a positive answer may not mean there is no bug and a negative answer may not mean there is a bug if the specification is valid/unsatisfiable, respectively. Specification debugging is critical for synthesis and runtime verification (RV) since in these cases there is no model; synthesis and RV are both entirely dependent on the specification. For synthesis, satisfiability checking is the best-available specification-debugging technique, since other techniques, such as vacuity checking (cf. [6, 10]) reference a model in addition to the specification. While there are artifacts one can use in RV, specification debugging is still limited outside of satisfiability checking yet central to correct analysis. A false positive due to RV of an incorrect specification can have disastrous consequences, such as triggering an abort of an (otherwise successful) mission to Mars. Arguably, the biggest challenge to creating an RV algorithm or tool is the dearth of benchmarks for checking correctness or comparatively analyzing these [36], where a benchmark consists of some runtime trace, a temporal logic formula reasoning about that trace, and some verdict designating whether the trace at a given time satisfies the requirement formula. A MLTL satisfiability solver is useful for RV benchmark generation [22].

Despite the critical need for an MLTL satisfiability solver, no such tool currently exists. To the best of our knowledge, there is only one available solver (zot [8]) for checking the satisfiability of MTL-over-naturals formulas, interpreted over infinite traces. Since MLTL formulas are interpreted over finite traces and there is no trivial reduction from one to another, zot cannot be directly applied to MLTL satisfiability checking.

Our approach is inspired by satisfiability-checking algorithms from other logics. For LTL satisfiability solving, we observe that there are multiple efficient translations from LTL satisfiability to model checking, using nuXmv [40]; we therefore consider here translations to nuXmv model checking, both indirectly (as a translation to LTL), and directly using the new KLIVE [13] back-end and the BMC back-end, taking advantage of the bounded nature of MLTL. The bounded nature of MLTL enables us to also consider a direct encoding at the word-level, suitable as input to an SMT solver. Our contribution is both theoretic and experimental. We first consider the complexity of such translations. We prove that the MLTL satisfiability checking problem is NEXPTIME-complete and that satisfiability checking , the variant of MLTL where all intervals start at 0, is PSPACE-complete. Secondly, we introduce translation algorithms for (LTL over finite traces [14]), MLTL-to-LTL, MLTL-to-SMV, and MLTL-to-SMT, thus creating four options for MLTL satisfiability checking. Our results show that the MLTL-to-SMT transition with the Z3 SMT solver offers the most scalable performance, though the MLTL-to-SMV translation with an SMV model checker can offer the best performance when the intervals in the MLTL formulas are restricted to small ranges less than 100.

2 Preliminaries

A (closed) interval over naturals \(I = [a, b]\) (\(0\le a\le b\) are natural numbers) is a set of naturals \(\{i\ |\ a\le i\le b\}\). I is called bounded iff \(b < +\infty \); otherwise I is unbounded. MLTL is defined using bounded intervals. Unlike Metric Temporal Logic (MTL) [4], it is not necessary to introduce open or half-open intervals over the natural domain, as every open or half-open bounded interval is reducible to an equivalent closed bounded interval, e.g., (1,2) = \(\emptyset \), (1,3) = [2,2], (1,3] = [2,3], etc. Let \(\mathcal {AP}\) be a set of atomic propositions, then the syntax of a formula in MLTL is

$$\begin{aligned} \varphi \,::= \mathsf{true}\ |\ \mathsf{false}\ |\ p\ |\ \lnot \varphi \ |\ \varphi \wedge \psi \ |\ \varphi \vee \psi \ |\ \Box \varphi \ |\ \Diamond \varphi \ |\ \varphi \ \mathcal {U}_I \ \psi \ |\ \varphi \mathcal {R}_I\psi \end{aligned}$$

where I is a bounded interval, \(p\in \mathcal {AP}\) is an atom, and \(\varphi \) and \(\psi \) are subformulas.

Given two MLTL formulas \(\varphi , \psi \), we denote \(\varphi = \psi \) iff they are syntactically equivalent, and \(\varphi \equiv \psi \) iff they are semantically equivalent, i.e., \(\pi \,\models \,\varphi \) iff \(\pi \,\models \,\psi \) for a finite trace \(\pi \). In MLTL semantics, we define \(\mathsf{false}\equiv \lnot \mathsf{true}\), \(\varphi \vee \psi \equiv \lnot (\lnot \varphi \wedge \lnot \psi )\), \(\lnot (\varphi \ \mathcal {U}_I \ \psi )\equiv (\lnot \varphi \mathcal {R}_I\lnot \psi )\) and \(\lnot \Diamond _I\varphi \equiv \Box _I\lnot \varphi \). MLTL keeps the standard operator equivalences from LTL, including \((\Diamond _I \varphi ) \equiv (true \ \mathcal {U}_I \varphi )\), \((\Box _I \varphi ) \equiv (false \ \mathcal {R}_I \ \varphi )\), and \((\varphi \ \mathcal {R}_I \ \psi ) \equiv (\lnot (\lnot \varphi \ \mathcal {U}_I \ \lnot \psi ))\). Notably, MLTL discards the neXt (\(\mathcal {X}\)) operator, which is essential in LTL [32], since \(\mathcal {X}\varphi \) is semantically equivalent to \(\Box _{[1,1]}\varphi \).

The semantics of MLTL formulas is interpreted over finite traces bounded by base-10 (decimal) intervals. Let \(\pi \) be a finite trace in which every position \(\pi [i]\ (i\ge 0)\) is over \(2^{\mathcal {AP}}\), and \(|\pi |\) denotes the length of \(\pi \) (\(|\pi |<+\infty \) when \(\pi \) is a finite trace). We use \(\pi _i\ (|\pi |>i\ge 0)\) to represent the suffix of \(\pi \) starting from position i (including i). Let \(a, b \in \mathbb {I}, a \le b\); we define that \(\pi \) models (satisfies) an MLTL formula \(\varphi \), denoted as \(\pi \,\models \, \varphi \), as follows:

  • \(\pi \,\models \,p\) iff \(p\in \pi [0]\);

  • \(\pi \,\models \, \lnot \varphi \) iff ;

  • \(\pi \,\models \,\varphi \wedge \psi \) iff \(\pi \,\models \,\varphi \) and \(\pi \,\models \,\psi \);

  • \(\pi \,\models \, \varphi \ \mathcal {U}_{[a,b]} \ \psi \) iff \(|\pi |> a\) and, there exists \(i\in [a,b]\), \(i<|\pi |\) such that \(\pi _i\,\models \,\psi \) and for every \(j\in [a,b], j<i\) it holds that \(\pi _j\,\models \,\varphi \);

Compared to the traditional MTL-over-naturalsFootnote 1 [16], the Until formula in MLTL is interpreted in a slightly different way. In MTL-over-naturals, the satisfaction of \(\varphi \ \mathcal {U}_I \ \psi \) requires \(\varphi \) to hold from position 0 to the position where \(\psi \) holds (in I), while in MLTL \(\varphi \) is only required to hold within the interval I, before the time \(\psi \) holds. From the perspective of writing specifications, cf. [34, 37], this adjustment is more user-friendly. It is not hard to see that MLTL is as expressive as the standard MTL-over-naturals: the formula \(\varphi \ \mathcal {U}_{[a, b]} \ \psi \) in MTL-over-naturals can be represented as \((\Box _{[0,a-1]}\varphi )\wedge (\varphi \ \mathcal {U}_{[a, b]}\ \psi )\) in MLTL; \(\varphi \ \mathcal {U}_{[a, b]} \ \psi \) in MLTL can be represented as \(\Diamond _{[a, a]}(\varphi \ \mathcal {U}_{[0, b-a]} \ \psi )\) in MTL-over-naturals.

We say an MLTL formula is in BNF if the formula contains only \(\lnot \), \(\wedge \) and \(\mathcal {U}_I\) operators. It is trivial to see that every MLTL formula can be converted to its (semantically) equivalent BNF with a linear cost. Consider \(\varphi = (\lnot a)\vee ((\lnot b) \mathcal {R}_I (\lnot c))\) as an example. Its BNF form is \(\lnot (a\wedge (b \ \mathcal {U}_I \ c))\). Without explicit clarification, this paper assumes that every MLTL formula is in BNF.

The closure of an MLTL formula \(\varphi \), denoted as \(cl(\varphi )\), is a set of formulas such that: (1) \(\varphi \in cl(\varphi )\); (2) \(\varphi \in cl(\varphi )\) if \(\lnot \varphi \in cl(\varphi )\); (3) \(\varphi ,\psi \in cl(\varphi )\) if \(\varphi \ op\ \psi \in cl(\varphi )\), where op can be \(\wedge \) or \(\mathcal {U}_I\). Let \(|cl(\varphi )|\) be the size of \(cl(\varphi )\). Since the definition of \(cl(\varphi )\) ignores the intervals in \(\varphi \), \(|cl(\varphi )|\) is linear in the number of operators in \(\varphi \). We also define the closure(*) of an MLTL formula \(\varphi \), denoted \(cl^*(\varphi )\), as the set of formulas such that: (1) \(cl(\varphi )\subseteq cl^*(\varphi )\); (2) if \(\varphi \ \mathcal {U}_{[a, b]}\ \psi \in cl^*(\varphi )\) for \(0<a\le b\), then \(\varphi \ \mathcal {U}_{[a-1, b-1]}\ \psi \) is in \(cl^*(\varphi )\); (3) if \(\varphi \ \mathcal {U}_{[0, b]}\ \psi \in cl^*(\varphi )\) for \(0<b\), then \(\varphi \ \mathcal {U}_{[0, b-1]}\ \psi \) is in \(cl^*(\varphi )\). Let \(|cl^*(\varphi )|\) be the size of \(cl^*(\varphi )\) and K be the maximal natural number in the intervals of \(\varphi \). It is not hard to see that \(|cl^*(\varphi )|\) is at most \(K\cdot |cl(\varphi )|\).

We also consider a fragment of MLTL, namely , which is more frequently used in practice, cf. [18, 34]. Informally speaking, formulas are MLTL formulas in which all intervals start from 0. For example, \(\Diamond _{[0,4]}a\wedge (a \ \mathcal {U}_{[0,1]} \ b)\) is a formula, while \(\Diamond _{[2,4]}a\) is not.

Given an MLTL formula \(\varphi \), the satisfiability problem asks whether there is a finite trace \(\pi \) such that \(\pi \,\models \,\varphi \) holds. To solve this problem, we can reduce it to the satisfiability problem of the related logics LTL and (LTL over finite traces [14]), and leverage the off-the-shelf satisfiability checking solvers for these well-explored logics. We abbreviate MLTL, LTL, and satisfiability checking as MLTL-SAT, LTL-SAT, and respectively.

: Linear Temporal Logic over Finite Traces [14]. We assume readers are familiar with LTL (over infinite traces). is a variant of LTL that has the same syntax, except that for , the dual operator of \(\mathcal {X}\) is \(\mathcal {N}\) (weak Next), which differs \(\mathcal {X}\) in the last state of the finite trace. In the last state of a finite trace, \(\mathcal {X}\psi \) can never be satisfied, while \(\mathcal {N}\psi \) is satisfiable. Given an formula \(\varphi \), there is an LTL formula \(\psi \) such that \(\varphi \) is satisfiable iff \(\psi \) is satisfiable. In detail, \(\psi = \Diamond Tail\wedge t(\varphi )\) where Tail is a new atom identifying the end of the satisfying trace and \(t(\varphi )\) is constructed as follows:

  • \(t(p) = p\) where p is an atom;

  • \(t(\lnot \psi ) = \lnot t(\psi )\);

  • \(t(\mathcal {X}\psi ) = \lnot Tail\wedge \mathcal {X}t(\psi )\);

  • \(t(\psi _1\wedge \psi _2) = t(\psi _1)\wedge t(\psi _2)\);

  • \(t(\psi _1 U\psi _2) = t(\lnot Tail\wedge \psi _1) U t(\psi _2)\).

In the above reduction, \(\varphi \) is in BNF. Since the reduction is linear in the size of the original formula and LTL-SAT is PSPACE-complete [45], is also a PSPACE-complete problem [14].

3 Complexity of MLTL-SAT

It is known that the complexity of MITL (Metric Interval Temporal Logic) satisfiability is EXPSPACE-complete, and the satisfiability complexity of the fragment of MITL named is PSPACE-complete [2]. MLTL (resp. ) can be viewed as a variant of MITL (resp. ) that is interpreted over the naturals. We show that MLTL satisfiability checking is NEXPTIME-complete, via a reduction from MLTL to .

Lemma 1

Let \(\varphi \) be an MLTL formula, and K be the maximal natural appearing in the intervals of \(\varphi \) (K is set to 1 if there are no intervals in \(\varphi \)). There is an formula \(\theta \) that recognizes the same language as \(\varphi \). Moreover, the size of \(\theta \) is in \(O(K\cdot |cl(\varphi )|)\).

Proof

(Sketch). For an MLTL formula \(\varphi \), we define the formula \(f(\varphi )\) recursively as follows:

  • If \(\varphi = \mathsf{true}, \mathsf{false}\), or an atom p, \(f(\varphi ) = \varphi \);

  • If \(\varphi = \lnot \psi \), \(f(\varphi ) = \lnot f(\psi )\);

  • If \(\varphi = \xi \wedge \psi \), \(f(\varphi ) = f(\xi )\wedge f(\psi )\);

  • If \(\varphi = \xi \ \mathcal {U}_{[a,b]} \ \psi \),

$$ f(\varphi ) = {\left\{ \begin{array}{ll} \mathcal {X}(f(\xi \ \mathcal {U}_{[a-1, b-1]} \ \psi )), \ \ \text {if } 0< a\le b;\\ f(\psi )\vee (f(\xi )\wedge \mathcal {X}(f(\xi U_{[a,b-1]}\psi ))), \text {if } a = 0 \text { and } 0 < b;\\ f(\psi ), \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \text {if } a = 0 \text { and } b = 0;\\ \end{array}\right. } $$

\(\mathcal {X}\) represents the neXt operator in . Let \(\theta = f(\varphi )\); we can prove by induction that \(\varphi \) and \(\theta \) accept the same language. Moreover, the size of \(\theta \) is at most linear to \(K\cdot |cl(\varphi )|\), i.e., in \(O(K\cdot |cl(\varphi )|)\), based on the aforementioned construction.   \(\square \)

We use the construction shown in Lemma 1 to explore several useful properties of MLTL. For instance, the formula translated from an MLTL formula contains only the \(\mathcal {X}\) temporal operator or its dual \(\mathcal {N}\), which represents weak Next [19, 23], and the number of these operators is strictly smaller than \(K\cdot |cl(\varphi )|\). Every \(\mathcal {X}\) or \(\mathcal {N}\) subformula in the formula corresponds to some temporal formula in \(cl^*(\varphi )\). Notably, because the natural-number intervals in \(\varphi \) are written in base 10 (decimal) notation, the blow-up in the translation of Lemma 1 is exponential.

The next lower bound is reminiscent of the NEXPTIME-lower bound shown in [31] for a fragment of Metric Interval Temporal Logic (MITL), but is different in the details of the proof as the two logics are quite different.

Theorem 1

The complexity of \(\mathsf{MLTL} \) satisfiability checking is NEXPTIME-complete.

Proof

(Sketch). By Lemma 1, there is an formula \(\theta \) that accepts the same traces as MLTL formula \(\varphi \), and the size of \(\theta \) is in \(O(K\cdot |cl(\varphi )|)\). The only temporal connectives used in \(\theta \) are \(\mathcal {X}\) and \(\mathcal {N}\), since the translation to reduces all MLTL temporal connectives in \(\varphi \) to nested \(\mathcal {X}\)’s or \(\mathcal {N}\)’s (produced by simplifying \(\lnot \mathcal {X}\)). Thus, if \(\theta \) is satisfiable, then it is satisfiable by a trace whose length is bounded by the length of \(\theta \). Thus, we can just guess a trace \(\pi \) of exponential length of \(\theta \) and check that it satisfies \(\varphi \). As a result, the upper bound for MLTL-SAT is NEXPTIME.

Before proving the NEXPTIME lower bound, recall the PSPACE-lower bound proof in [45] for LTL satisfiability. The proof reduces the acceptance problem for a linear-space bounded Turing machine M to LTL satisfiability. Given a Turing machine M and an integer k, we construct a formula \(\varphi _M\) such that \(\varphi _M\) is satisfiable iff M accepts the empty tape using k tape cells. The argument is that we can encode such a space-bounded computation of M by a trace \(\pi \) of length \(c^k\) for some constant c, and then use \(\varphi _M\) to force \(\pi \) to encode an accepting computation of M. The formula \(\varphi _M\) has to match corresponding points in successive configurations of M, which can be expressed using a O(k)-nested \(\mathcal {X}\)’s, since such points are O(k) points apart.

To prove a NEXPTIME-lower bound for MLTL, we reduce the acceptance problem for exponentially bounded non-deterministic Turing machines to MLTL satisfiability. Given a non-deterministic Turing machine M and an integer k, we construct an MLTL formula \(\varphi _M\) of length O(k) such that \(\varphi _M\) is satisfiable iff M accepts the empty tape in time \(2^k\). Note that such a computation of a \(2^k\)-time bounded Turing machines consists of \(2^k\) many configurations of length \(2^k\) each, so the whole computation is of exponential length – \(4^k\), and can be encoded by a trace \(\pi \) of length \(4^k\), where every point of \(\pi \) encodes one cell in the computation of M. Unlike the reduction in [45], in the encoding here corresponding points in successive configurations are exponentially far (\(2^k\)) from each other, because each configuration has \(2^k\) cells, so the relationship between such successive points cannot be expressed in LTL. Because, however, the constants in the intervals of MLTL are written in base-10 (decimal) notation, we can write formulas of size O(k), e.g., formulas of the form \(p \ \mathcal {U}_{[0,{2^k}]} \ q\), that relate points that are \(2^k\) apart.

The key is to express the fact that one Turing machine configuration is a proper successor of another configuration using a formula of size O(k). In the PSPACE-lower-bound proof of [45], LTL formulas of size O(k) relate successive configurations of k-space-bounded machines. Here MLTL formulas of size O(k) relate successive configurations of \(2^k\)-time-bounded machines. Thus, we can write a formula \(\varphi _M\) of length O(k) that forces trace \(\pi \) to encode a computation of M of length \(2^k\).    \(\square \)

Now we consider formulas, and prove that the complexity of checking the satisfiability of formulas is PSPACE-complete. We first introduce the following lemma to show an inherent feature of formulas.

Lemma 2

The conjunction of identical \(\mathcal {U}\)-rooted formulas is equivalent to the conjunct with the smallest interval range: \((\xi \ \mathcal {U}_{[0, a]} \ \psi ) \wedge (\xi \ \mathcal {U}_{[0, b]} \ \psi ) \equiv (\xi \ \mathcal {U}_{[0, a]} \ \psi ) \), where \(b > a\).

Proof

We first prove that for \(i\ge 0\), the equation \((\xi \ \mathcal {U}_{[0, i]} \ \psi ) \wedge (\xi \ \mathcal {U}_{[0, i+1]} \ \psi ) \equiv (\xi \ \mathcal {U}_{[0, i]} \ \psi ) \) holds. When \(i = 0\), we have \((\xi \ \mathcal {U}_{[0, 0]} \ \psi ) \equiv f(\psi )\) and \((\xi \ \mathcal {U}_{[0, 1]} \ \psi )\equiv (f(\psi )\vee f(\xi )\wedge \mathcal {X}(f(\psi )))\). So \((\xi \ \mathcal {U}_{[0, 0]} \ \psi ) \wedge (\xi \ \mathcal {U}_{[0, 1]} \ \psi ) \equiv f(\psi )\equiv (\xi \ \mathcal {U}_{[0, 0]} \ \psi )\) is true. Inductively, assume that \((\xi \ \mathcal {U}_{[0, k]} \ \psi ) \wedge (\xi \ \mathcal {U}_{[0, k+1]} \ \psi ) \equiv (\xi \ \mathcal {U}_{[0, k]} \ \psi ) \) is true for \(k\ge 0\). When \(i = k+1\), we have \((\xi \ \mathcal {U}_{[0, k+1]} \ \psi ) \equiv (f(\psi )\vee f(\xi )\wedge \mathcal {X}(\xi \ \mathcal {U}_{[0, k]} \ \psi ))\) and \((\xi \ \mathcal {U}_{[0, k+2]} \ \psi ) \equiv (f(\psi )\vee f(\xi )\wedge \mathcal {X}(\xi \ \mathcal {U}_{[0, k+1]} \ \psi ))\). By hypothesis assumption, \((\xi \ \mathcal {U}_{[0, k]}\ \psi ) \wedge (\xi \ \mathcal {U}_{[0, k+1]} \ \psi ) \equiv (\xi \ \mathcal {U}_{[0, k]} \ \psi ) \) implies that the following equivalence is true:

$$\begin{aligned}&(\xi \ \mathcal {U}_{[0, k+1]} \ \psi ) \wedge (\xi \ \mathcal {U}_{[0, k+2]} \ \psi )\\&\equiv \ \ (f(\psi )\vee (f(\xi )\wedge \mathcal {X}(\xi \ \mathcal {U}_{[0, k]} \ \psi ))) \wedge (f(\psi )\vee (f(\xi )\wedge \mathcal {X}(\xi \ \mathcal {U}_{[0, k+1]} \ \psi )))\\&\equiv \ \ f(\psi ) \vee (f(\xi )\wedge \mathcal {X}(\xi \ \mathcal {U}_{[0, k]} \ \psi \wedge \xi \ \mathcal {U}_{[0, k+1]} \ \psi ))\\&\equiv \ \ f(\psi ) \vee (f(\xi )\wedge \mathcal {X}(\xi \ \mathcal {U}_{[0, k]} \ \psi ))\\&\equiv \ \ (\xi \ \mathcal {U}_{[0, k+1]} \ \psi ). \end{aligned}$$

Since \((\xi \ \mathcal {U}_{[0, i]} \ \psi ) \wedge (\xi \ \mathcal {U}_{[0, i+1]} \ \psi )\equiv (\xi \ \mathcal {U}_{[0, i]} \ \psi ) \) is true, we can prove by induction that \((\xi \ \mathcal {U}_{[0, i]} \ \psi ) \wedge (\xi \ \mathcal {U}_{[0, j]} \ \psi )\equiv (\xi \ \mathcal {U}_{[0, i]} \ \psi ) \) is true, where \(j>i\). Because \(b > a\) is true, it directly implies that \((\xi \ \mathcal {U}_{[0, a]} \ \psi ) \wedge (\xi \ \mathcal {U}_{[0, b]} \ \psi ) \equiv (\xi \ \mathcal {U}_{[0, a]} \ \psi ) \) is true.   \(\square \)

Lemma 3

\(\mathcal {X}\)-free is reducible to at a linear cost.

Proof

According to [45], the satisfiability checking of \(\mathcal {X}\)-free LTL formulas is still PSPACE-complete. This also applies to the satisfiability checking of \(\mathcal {X}\)-free formulas. Given an \(\mathcal {X}\)-free formula \(\varphi \), we construct the corresponding MLTL formula \(m(\varphi )\) recursively as follows:

  • \(m (p) = p\) where p is an atom;

  • \(m(\lnot \xi ) = \lnot m(\xi )\);

  • \(m(\xi \wedge \psi ) = m(\xi ) \wedge m(\psi )\);

  • \(m(\xi \ \mathcal {U}\ \psi ) = m (\xi ) \ \mathcal {U}_{[0,2^{|\varphi |}]} \ m(\psi )\).

Notably for the Until formula, we bound it with the interval \([0, 2^{|\varphi |}]\), where \(\varphi \) is the original \(\mathcal {X}\)-free formula, in the corresponding MLTL formula, which is motivated by the fact that every satisfiable formula has a finite model whose length is less than \(2^{|\varphi |}\) [14]. The above translation has linear blow-up, because the integers in intervals use the decimal notation. Now we prove by induction over the type of \(\varphi \) that \(\varphi \) is satisfiable iff \(m(\varphi )\) is satisfiable. That is, we prove that (\(\Rightarrow \)) \(\pi \,\models \,\varphi \) implies \(\pi \,\models \, m(\varphi )\) and (\(\Leftarrow \)) \(\pi \,\models \, m(\varphi )\) implies \(\pi \,\models \,\varphi \), for some finite trace \(\pi \).

We consider the Until formula \(\eta =\xi \ \mathcal {U}\ \psi \) (noting that \(\varphi \) is fixed to the original formula), and the proofs are trivial for other types. (\(\Rightarrow \)) \(\eta \) is satisfiable implies there is a finite trace \(\pi \) such that \(\pi \,\models \,\eta \) and \(|\pi |\le 2^{|\varphi |}\) [14]. Moreover, \(\pi \,\models \,\eta \) holds iff there is \(0\le i\) such that \(\pi _i\,\models \,\psi \) and for every \(0\le j<i\), \(\pi _j\,\models \,\xi \) is true (from semantics). By the induction hypothesis, \(\pi _i \,\models \,\psi \) implies \(\pi _i\,\models \, m(\psi )\) and \(\pi _j\,\models \,\xi \) implies \(\pi _j\,\models \, m(\xi )\). Also, \(i\le 2^{|\varphi |}\) is true because of \(|\pi |\le 2^{|\varphi |}\). As a result, \(\pi \,\models \,\eta \) implies that there is \(0\le i\le 2^{|\varphi |}\) such that \(\pi _i\,\models \, m(\psi )\) and for every \(0\le j<i\), \(\pi _j\,\models \, m(\xi )\) is true. According to the MLTL semantics, \(\pi \,\models \, m(\eta )\) is true. (\(\Leftarrow \)) \(m (\eta )\) is satisfiable implies there is a finite trace \(\pi \) such that \(\pi \,\models \, m(\eta )\). According to MLTL semantics, there is \(0\le i\le 2^{|\varphi |}\) such that \(\pi _i\,\models \, m(\psi )\) and for every \(0\le j < i\) it holds that \(\pi _j\,\models \, m(\xi )\). By hypothesis assumption, \(\pi _i\,\models \, m(\psi )\) implies \(\pi _i\,\models \,\psi \) and \(\pi _j\,\models \, m(\xi )\) implies \(\pi _j\,\models \, \xi \). Also, \(0\le i\le 2^{|\varphi |}\) implies \(0\le i\). As a result, \(\pi \,\models \, m(\eta )\) implies that there is \(0\le i\) such that \(\pi _i\,\models \, \psi \) and for every \(0\le j < i\) it holds that \(\pi _j\,\models \, \xi \). From semantics, it is true that \(\pi \,\models \,\eta \).    \(\square \)

Theorem 2

The complexity of checking the satisfiability of is PSPACE-complete.

Proof

Since Lemma 3 shows a linear reduction from \(\mathcal {X}\)-free to and \(\mathcal {X}\)-free is PSPACE-complete [14], it directly implies that the lower bound of is PSPACE-hard.

For the upper bound, recall from the proof of Theorem 1 that an \(\mathsf{MLTL} \) formula \(\varphi \) is translated to an formula \(\theta \) of length \(K\cdot |cl(\varphi )|\), which, as we commented, involved an exponential blow-up in the notation for K. Following the automata-theoretic approach for satisfiability, one would translate \(\theta \) to an NFA and check its non-emptiness [14]. Normally, such a translation would involve another exponential blow-up. We show that this is not the case for . Recalling from the automaton construction in [14] that every state of the automaton is a set of subformulas of \(\theta \), the size of a state is at most \(K\cdot |cl(\varphi )|\). In the general case, if \(\psi _1,\psi _2\) are two subformulas of \(\theta \) corresponding to the MLTL formulas \(\xi \ \mathcal {U}_{I_1} \ \psi \) and \(\xi \ \mathcal {U}_{I_2} \ \psi \), \(\psi _1\) and \(\psi _2\) can be in the same state of the automaton, which implies that the size of the state can be at most \(K\cdot |cl(\varphi )|\). When the formula \(\varphi \) is restricted to , we show that the exponential blow-up can be avoided. Lemma 2 shows that either \(\psi _1\) or \(\psi _2\) in the state is enough, since assuming \(I_1\subseteq I_2\), then \((\psi _1\wedge \psi _2)\equiv \psi _1\), by Lemma 2. So the size of the state in the automaton for a formula \(\varphi \) is at most \(|cl(\varphi )|\). For each subformula in the state, there can be K possible values (e.g., for \(\Diamond _I \xi \) in the state, we can have \(\Diamond _{[0, 1]}\xi \), \(\Diamond _{[0,2]}\xi \), etc.). Therefore the size of the automaton is in \(O(2^{|cl(\varphi )|}\cdot K^{|cl(\varphi )|})\approx 2^{O(|cl(\varphi )|)}\). Therefore, satisfiability checking is a PSPACE-complete problem.    \(\square \)

4 Implementation of MLTL-SAT

We first show how to reduce MLTL-SAT to the well-explored and LTL-SAT. Then we introduce two new satisfiability-checking strategies based on the inherent properties of MLTL formulas, which are able to leverage the state-of-art model-checking and SMT-solving techniques.

4.1 MLTL-SAT via Logic Translation

For a formula \(\varphi \) from one logic, and \(\psi \) from another logic, we say \(\varphi \) and \(\psi \) are equi-satisfiable when \(\varphi \) is satisfiable under its semantics iff \(\psi \) is satisfiable under its semantics. Based on Lemma 1 and Theorem 1, we have the following corollary,

Corollary 1

(MLTL-SAT to ). MLTL-SAT can be reduced to with an exponential blow-up.

From Corollary 1, MLTL-SAT is reducible to , enabling use of the off-the-shelf satisfiability solvers, cf. aaltaf [23]. It is also straightforward to consider MLTL-SAT via LTL-SAT; LTL-SAT has been studied for more than a decade, and there many off-the-shelf LTL solvers are available, cf. [24, 38, 40].

Theorem 3

(MLTL to LTL). For an MLTL formula \(\varphi \), there is an LTL formula \(\theta \) such that \(\varphi \) and \(\theta \) are equi-satisfiable, and the size of \(\theta \) is in \(O(K\cdot |cl(\varphi )|)\), where K is the maximal integer in \(\varphi \).

Proof

Lemma 1 provides a translation from the MLTL formula \(\varphi \) to the equivalent formula \(\varphi '\), with a blow-up of \(O(K\cdot |cl(\varphi )|)\). As shown in Sect. 2, there is a linear translation from the formula \(\varphi '\) to its equi-satisfiable LTL formula \(\theta \) [14]. Therefore, the blow-up from \(\varphi \) to \(\theta \) is in \(O(K\cdot |cl(\varphi )|)\).    \(\square \)

Corollary 2

(MLTL-SAT to LTL-SAT). MLTL-SAT can be reduced to LTL-SAT with an exponential blow-up.

Since MLTL-SAT is reducible to LTL-SAT, MLTL-SAT can also benefit from the power of LTL satisfiability solvers. Moreover, the reduction from MLTL-SAT to LTL-SAT enables leveraging modern model-checking techniques to solve the MLTL-SAT problem, due to the fact that LTL-SAT has been shown to be reducible to model checking with a linear blow-up [38, 39].

Corollary 3

(MLTL-SAT to MLTL-SAT can be reduced to LTL model checking with an exponential blow-up.

In our implementation, we choose the model checker nuXmv [12] for LTL satisfiability checking, as it allows an LTL formula to be directly input as the temporal specification together with a universal model as described in [38, 39].

4.2 Model Generation

Using the LTL formula as the temporal specification in nuXmv has been shown, however, to not be the most efficient way to use model checking for satisfiability checking [40]. Consider the MLTL formula \(\Diamond _{[0,10]}a \wedge \Diamond _{[1,11]}a\). The translated formula is \(f(\Diamond _{[0,10]}a) \wedge \mathcal {X}(f(\Diamond _{[0,10]}a))\), where \(f(\Diamond _{[0,10]}a)\) has to be constructed twice. To avoid such redundant construction, we follow [40] and encode directly the input MLTL formula as an SMV model (the input model of nuXmv) rather than treating the LTL formula, which is obtained from the input MLTL formula, as a specification.

An SMV [27] model consists of a Boolean transition system \(Sys=(V, I, T)\), where V is a set of Boolean variables, I is a Boolean formula representing the initial states of Sys, and T is the Boolean transition formula. Moreover, a specification to be verified against the system is also contained in the SMV model (here we focus on the LTL specification). Given the input MLTL formula \(\varphi \), we construct the corresponding SMV model \(M_{\varphi }\) as follows.

  • Introduce a Boolean variable for each atom in \(\varphi \) as well as for “Tail” (new variable identifying the end of a finite trace).

  • Introduce a Boolean variable \(\mathcal {X}\_\psi \) for each \(\mathcal {U}\) formula \(\psi \) in \(cl^*(\varphi )\), which represents the intermediate temporal formula \(\mathcal {X}\psi \).

  • Introduce a temporary Boolean variableFootnote 2 \(T\_\psi \) for each \(\mathcal {U}\) formula in \(cl^*(\varphi )\).

  • A Boolean formula \(e(\psi )\) is used to represent the formula \(\psi \) in \(cl^*(\varphi )\) in the SMV model, which is defined recursively as follows.

    1. 1.

      \(e(\psi ) = \psi \), if \(\psi \) is an Boolean atom;

    2. 2.

      \(e (\psi ) = \lnot e (\psi _1)\), if \(\psi =\lnot \psi _1\);

    3. 3.

      \(e (\psi ) = e (\psi _1)\wedge e (\psi _2)\), if \(\psi = \psi _1\wedge \psi _2\);

    4. 4.

      \(e (\psi ) = T\_\psi \), if \(\psi \) is an \(\mathcal {U}\) formula.

  • Let the initial Boolean formula of the system Sys be \(e(\varphi )\).

  • For each temporary variable \(T\_\psi \), create a DEFINE statement according to the type and interval of \(\psi \), as follows.

    $$ T_{\psi _1 \mathcal {U}_{[a, b]}\psi _2} = {\left\{ \begin{array}{ll} \mathcal {X}\_(\psi _1 \mathcal {U}_{[a-1, b-1]}\psi _2), \ \ \text {if } 0< a\le b;\\ e(\psi _2) \vee (e(\psi _1)\wedge \mathcal {X}\_(\psi _1 \mathcal {U}_{[0, b-1]}\psi _2)), \text {if } a = 0 \text { and } 0 < b;\\ e(\psi _2), \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \text {if } a = 0 \text { and } b = 0.\\ \end{array}\right. } $$
  • Create the Boolean formula \((\mathcal {X}\_\psi \leftrightarrow (\lnot Tail\wedge next(e(\psi ))))\) for each \(\mathcal {X}\_\psi \) in the VAR list (the set V in Sys) of the SMV model.

  • Finally, designate the LTL formula \(\Box \lnot Tail\) as the temporal specification of the SMV model \(M_{\varphi }\) (which implies that a counterexample trace satisfies \(\Diamond Tail\)).

Encoding Heuristics for Formulas. We also encode the rules shown in Lemma 2 to prune the state space for checking the satisfiability of formulas. These rules are encoded using the INVAR constraint in the SMV model. Taking the \(\mathcal {U}\) formula as an example, we encode \(T\_(\psi _1 \mathcal {U}_{[0, a]}\psi _2) \wedge T\_(\psi _1 \mathcal {U}_{[0, a-1]}\psi _2) \leftrightarrow T\_(\psi _1 \mathcal {U}_{[0, a-1]}\psi _2)\) (\(a>0\)) for each \(\psi _1 \mathcal {U}_{[0, a]}\psi _2\) in \(cl^*(\varphi )\). Similar encodings also apply to the \(\mathcal {R}\) formulas in \(cl^*(\varphi )\). Theorem 4 below guarantees the correctness of the translation, and it can be proved by induction over the type of \(\varphi \) and the construction of the SMV model.

Theorem 4

The MLTL formula \(\varphi \) is satisfiable iff the corresponding SMV model \(M_{\varphi }\) violates the LTL property \(\Box \lnot Tail\).

There are different techniques that can be used for LTL model checking. Based on the latest evaluation of LTL satisfiability checking [24], the KLIVE [13] back-end implemented in the SMV model checker nuXmv [12] produces the best performance. We thus choose KLIVE as our model-checking technique for MLTL-SAT.

Bounded MLTL-SAT. Although MLTL-SAT is reducible to the satisfiability problem of other well-explored logics, with established off-the-shelf satisfiability solvers, a dedicated solution based on inherent properties of MLTL may be superior. One intuition is, since all intervals in MLTL formulas are bounded, the satisfiability of the formula can be reduced to Bounded Model Checking (BMC) [9].

Theorem 5

Given an MLTL formula \(\varphi \) with K as the largest natural in the intervals of \(\varphi \), \(\varphi \) is satisfiable iff there is a finite trace \(\pi \) with \(|\pi | \le K\cdot |cl(\varphi )|\) such that \(\pi \,\models \,\varphi \).

Theorem 5 states that the satisfiability of a given MLTL formula can be reduced to checking for the existence of a satisfying trace. To apply the BMC technique in nuXmv, we compute and set the maximal depth of BMC to be the value of \(K\cdot |cl(\varphi )|\) for a given MLTL formula \(\varphi \). The input SMV model for BMC is still \(M_{\varphi }\), as described in Sect. 4.2. However to ensure correct BMC checking in nuXmv, the constraint “FAIRNESS TRUE” has to be added into the SMV model.Footnote 3 The remains \(\Box \lnot Tail\). According to Theorem 5, \(\varphi \) is satisfiable iff the model checker returns a counterexample by using the BMC technique within the maximal depth of \(K\cdot |cl(\varphi )|\).

4.3 MLTL-SAT via SMT Solving

Another approach to solve MLTL-SAT is via SMT solving, considering that using SMT solvers to handle intervals in MLTL formulas is straightforward. Since the input logic of SMT solvers is First-Order Logic, we must first translate the MLTL formula to its equi-satisfiable formula in First-Order Logic over the natural domain N. We assume that readers are familiar with First-Order Logic and only focus on the translation. Given an MLTL formula \(\varphi \) and the alphabet \(\varSigma \), we construct the corresponding formula in First-Order Logic over N in the following way.

  1. 1.

    For each \(p\in \varSigma \), define a corresponding function \(f_p: Int\rightarrow Bool\) such that \(f_p(k)\) is true (\(k\in N\)) iff there is a satisfying (finite) trace \(\pi \) of \(\varphi \) and p is in \(\pi [k]\).

  2. 2.

    The First-Order Logic formula \(\textsf {fol} (\varphi , k, len)\) for \(\varphi \) (\(k, len\in N\)) is constructed recursively as below:

    • \(\textsf {fol} (\mathsf{true}, k, len) = (len > k)\) and \(\textsf {fol} (\mathsf{false}, k, len) = false\);

    • \(\textsf {fol} (p, k, len) = (len > k)\wedge f_p(k)\) for \(p\in \varSigma \);

    • \(\textsf {fol} (\lnot \xi , k, len) = (len > k)\wedge \lnot \textsf {fol} (\xi , k, len)\);

    • \(\textsf {fol} (\xi \wedge \psi , k, len)\) \(= (len >k) \wedge \textsf {fol} (\xi , k, len) \wedge \textsf {fol} (\psi , k, len)\);

    • \(\textsf {fol} (\xi \ \mathcal {U}_{[a,b]} \ \psi , k, len)\) \(= (len > a+k)\wedge \) \(\exists i.(\) \((a+k \le i\le b+k) \wedge \) \(\textsf {fol} (\psi , i, len-i) \wedge \) \(\forall j. (\) \((a+k \le j< i)\rightarrow \) \(\textsf {fol} (\xi ,j, len-j)))\);

In the formula \(\textsf {fol} (\varphi , k, len)\), k represents the index of the (finite) trace from which \(\varphi \) is evaluated, and len indicates the length of the suffix of the trace starting from the index k. Since the formula is constructed recursively, we need to introduce k to record the index. Meanwhile, len is necessary because the \(\mathsf{MLTL} \) semantics, which is interpreted over finite traces, constrains the lengths of the satisfying traces of the Until formulas. The following theorem guarantees that MLTL-SAT is reducible to the satisfiability of First-Order Logic.

Theorem 6

For an MLTL formula \(\varphi \), \(\varphi \) is satisfiable iff the corresponding First-Order Logic formula \(\exists len.\textsf {fol} (\varphi , 0, len)\) is satisfiable.

Proof

Let the alphabet of \(\varphi \) be \(\varSigma \), and \(\pi \in (2^{\varSigma })^*\) be a finite trace. For each \(p\in \varSigma \), we define the function \(f_p : Int \rightarrow Bool\) as follows: \(f_p (k) = \mathsf{true}\) iff \(p\in \pi [k]\) if \(0\le k< |\pi |\). We now prove by induction over the type of \(\varphi \) and the construction of \(\textsf {fol} (\varphi , k, len)\) with respect to \(\varphi \) that \(\pi _k\,\models \,\varphi \) holds iff \(\{f_p | p\in \varSigma \}\) is a model of \(\textsf {fol} (\varphi , k, |\pi |)\): here \(|\pi |\) is the length of \(\pi \). The cases when \(\varphi \) is \(\mathsf{true}\) or \(\mathsf{false}\) are trivial.

  • If \(\varphi = p\) is an atom, \(\pi _k\,\models \,\varphi \) holds iff \(p\in \pi [k]\) (i.e., \(\pi _k[0]\)) is true, which means \(f_p (k)=\mathsf{true}\). As a result, \(\{f_p\}\) is a model of \(\textsf {fol} (\varphi , k, |\pi |)\), which implies that \(\pi _k\,\models \,\varphi \) holds iff \(\{f_p | p\in \varSigma \}\) is a model of \(\textsf {fol} (\varphi , k, |\pi |)\).

  • If \(\varphi = \lnot \xi \), \(\pi _k\,\models \,\varphi \) holds iff holds. By hypothesis assumption, \(\pi _k\,\models \,\xi \) holds iff \(\{f_p | p\in \varSigma \}\) is a model of \(\textsf {fol} (\xi , k, |\pi |)\), which is equivalent to saying holds iff \(\{f_p | p\in \varSigma \}\) is not a model of \(\textsf {fol} (\xi , k, |\pi |)\). As a result, \(\pi _k\,\models \,\lnot \xi \) holds iff \(\{f_p | p\in \varSigma \}\) is a model of \(\lnot \textsf {fol} (\xi , k, |\pi |)\).

  • If \(\varphi = \xi \wedge \psi \), \(\pi _k\,\models \,\varphi \) holds iff \(\pi _k\,\models \,\xi \) and \(\pi _k\,\models \,\psi \). By hypothesis assumption, \(\pi _k\,\models \,\xi \) (resp. \(\pi _k\,\models \,\psi \)) holds iff \(\{f_p|p\in \varSigma \}\) is a model of \(\textsf {fol} (\xi , k, |\pi |)\) (resp. \(\textsf {fol} (\psi , k, |\pi |)\)). According to the construction of the \(\textsf {fol} \) function, \(\{f_p|p\in \varSigma \}\) is a model of \(\textsf {fol} (\xi \wedge \psi , k, |\pi |)\). As a result, \(\pi _k\,\models \,\xi \wedge \psi \) holds iff \(\{f_p|p\in \varSigma \}\) is a model of \(\textsf {fol} (\xi \wedge \psi , k, |\pi |)\).

  • If \(\varphi = \xi \ \mathcal {U}_{[a,b]} \ \psi \), \(\pi _k\,\models \,\varphi \) holds iff there is \(a+k\le i\le b+k\) such that \(\pi _i\,\models \,\psi \) and \(\pi _j\,\models \,\xi \) holds for every \(a+k\le j < i\). By hypothesis assumption, \(\pi _i\,\models \,\psi \) holds iff \(\{f_p|p\in \varSigma \}\) is a model of \(\textsf {fol} (\psi , i, len-i)\) (the length of \(\pi _i\) is \(len-i\)), and \(\pi ,j\,\models \,\xi \) holds iff \(\{f_p|p\in \varSigma \}\) is a model of \(\textsf {fol} (\xi , j, |\pi |-j)\) (the length of \(\pi _j\) is \(|\pi |-j\)). Moreover, \(|\pi | > a+k\) must be true according to the MLTL semantics. As a result, \(\{f_p|p\in \varSigma \}\) is a model of \(\textsf {fol} (\varphi , k, |\pi |)\), which implies that \(\pi _k\,\models \,\xi \ \mathcal {U}_{[a,b]}\psi \) holds iff \(\{f_p|p\in \varSigma \}\) is a model of \(\textsf {fol} (\xi \ \mathcal {U}_{[a,b]} \ \psi , k, |\pi |)\).

This proof holds for all values of k, including the special case where \(k = 0\).    \(\square \)

We then encode \(\exists len.\textsf {fol} (\varphi , 0, len)\) into the SMT-LIB v2 format [7], which is the input of most modern SMT solvers; we call the full SMT-LIB v2 encoding \(\mathsf{SMT} (\varphi )\). We first use the “declare-fun” command to declare a function \(f_a : Int\rightarrow Bool\) for each \(p\in \varSigma \). We also define the function \(f_{\varphi }: Int\times Int\rightarrow Bool\) for the First-Order Logic formula \(\textsf {fol} (\varphi , k, len)\). The corresponding SMT-LIB v2 command is “define-fun \(f_{\varphi }\ ((k\ Int)\ (len\ Int))\ Bool\ S (\textsf {fol} (\varphi , k, len))\)”, where \(S (\textsf {fol} (\varphi , k, len))\) is the SMT-LIB v2 implementation of \(\textsf {fol} (\varphi , k, len)\). In detail, \(S (\textsf {fol} (\varphi , k, len))\) is acquired recursively as follows.

  • \(S (\textsf {fol} (p, k, len)) \longrightarrow \) (and (\(> len\ k\)) (\(f_p\ k\)))

  • \(S(\lnot \textsf {fol} (\varphi , k, len)) \longrightarrow \) (and (\(> len\ k\)) (not \(S (\textsf {fol} (\varphi , k)\))))

  • \(S (\textsf {fol} (\varphi _1\wedge \psi , k, len) \longrightarrow \) (and (\(>\ len\ k\)) (and \(S (\textsf {fol} (\varphi _1, k, len))\) \(S(\textsf {fol} (\psi , k, len))\)))

  • \(S (\textsf {fol} (\varphi _1\ \mathcal {U}_{[a,b]} \ \psi , k, len)) \longrightarrow \) (and (\(>\ len\ a+k\)) (exists (\(i\ Int\)) (and (\(\le \ (+\ a\ k)\ i\)) (\(\ge \ i\ (+\ b\ k)\)) \(S(\textsf {fol} (\psi , i, len-i))\) (forall (\(j\ Int\)) (\(\Rightarrow \) (and \((\le \ (+\ a\ k)\ j)\ (<\ j\ i)\)) \(S(\textsf {fol} (\varphi _1, j, len-j))\))))))

Table 1. The SMT-LIB v2 template for \(\mathsf{SMT} (\varphi )\).

Finally, we use the “assert” command “(assert (exists ((\(len\ Int\))) \((f_{\varphi }\ 0\ len)\)))” together with the “(check-sat)” command to request SMT solvers for the satisfiability of \(\exists len.\textsf {fol} (\varphi , 0, len)\). In a nutshell, the general framework of the SMT-LIB v2 format for \(\mathsf{SMT} (\varphi )\) (i.e., \(\exists len.\textsf {fol} (\varphi , 0, len)\)) is shown in Table 1, and the correctness is guaranteed by Theorem 7 below.

Theorem 7

The First-Order Logic formula \(\exists len.fol(\varphi , 0, len)\) is satisfiable iff the SMT solver returns SAT with the input \(\mathsf{SMT} (\varphi )\).

An inductive proof for the theorem can be conducted according to the construction of \(\mathsf{SMT} (\varphi )\). Notably, there is no difference between the SMT encoding for MLTL formulas and that for formulas, as the SMT-based encoding does not require unrolling the temporal operators in the formula.

5 Experimental Evaluations

Tools and Platform. We implemented the translator MLTLconverter in C++, including encodings for an MLTL formula as equi-satisfiable LTL and formulas, and corresponding SMV and SMT-LIB v2 models. We leverage the extant LTL solver aalta [24], solver aaltaf [23], SMV model checker nuXmv [12], and the SMT solver Z3 [29] to check the satisfiability of the input MLTL formula in their respective encodings from MLTLconverter. The solvers, including the runtime flags we used, are summarized in Table 2. We evaluated both BMC and KLIVE [13] model-checking back-ends in nuXmv, and the corresponding commands are shown in Fig. 1. Notably in the figure, the maximal length “MAX” to run BMC is computed dynamically for each MLTL formula, based on Theorem 5.

Table 2. List of solvers and their runtime flags.
Fig. 1.
figure 1

nuXmv commands for BMC (left) and KLIVE (right).

All experiments were executed on Rice University’s NOTS cluster,Footnote 4 running RedHat 5, with 226 dual socket compute blades housed within HPE s6500, HPE Apollo 2000, and Dell PowerEdge C6400 chassis. All the nodes are interconnected with 10 GigE network. Each satisfiability check over one MLTL formula and one solver was executed with exclusive access to one CPU and 8 GB RAM with a timeout of one hour, as measured by the Linux command. We assigned a time penalty of one hour to benchmarks that segmentation fault or timeout.

Experimental Goals. We evaluate performance along three metrics. (1) Each satisfiability check has two parts: the encoding time (consumed by MLTLconverter) and the solving time (consumed by solvers). We evaluate how each encoding affects the performance of both stages of MLTL-SAT. (2) We comparatively analyze the performance and scalability of end-to-end MLTL-SAT via LTL-SAT, , LTL model checking, and our new SMT-based approach. (3) We evaluate the performance and scalability for satisfiability checking using encoding heuristics (Lemma 2).

Benchmarks. There are few MLTL (or even MTL-over-naturals) benchmarks available for evaluation. Previous works on MTL-over-naturals [2,3,4] mainly focus on the theoretic exploration of the logic. To enable rigorous experimental evaluation, we develop three types of benchmarks, motivated by the generation of LTL benchmarks [38].Footnote 5

(1) Random MLTL Formulas (R): We generated 10,000 R formulas, varying the formula length L (20, 40, 60, 80, 100), the number of variables N (1, 2, 3, 4, 5), and the probability of the appearance of the \(\mathcal {U}\) operator P (0.33, 0,5, 0.7, 0.95); for each (LNP) we generated 100 formulas. For every \(\mathcal {U}\) operator, we randomly chose an interval [ij] where \(i\ge 0\) and \(j\le 100\).

(2) NASA-Boeing MLTL Formulas (NB): We use challenging benchmarks [15] created from projects at NASA [17, 26] and Boeing [11]. We extract 63 real-life LTL requirements from the SMV models of the benchmarks, and then randomly generate an interval for each temporal operator. (We replace each \(\mathcal {X}\) with \(\Box _{[1,1]}\).) We create 3 groups of such formulas (63 in each) to test the scalability of different approaches, by restricting the maximal number of the intervals to be 1,000, 10,000, and 100,000 respectively.

(3) Random Formulas (R0): We generated 500 R0 formulas in the same way as the R formulas, except that every generated interval was restricted to start from 0; we generated sets of five for each (LNP). This small set of R benchmarks serve to compare the performance on formulas whose SMV encodings were created with/without heuristics.

Fig. 2.
figure 2

Cactus plot for different MLTL encodings on R formulas: LTL-SAT and lines overlap; SMV and SMT lines overlap.

Fig. 3.
figure 3

Cactus plot for different MLTL solving approaches on R formulas: LTL-SAT and lines overlap.

Correctness Checking. We compared the verdicts from all solvers for every test instance and found no inconsistencies, excluding segmentation faults. This exercise aided with verification of our implementations of the translators, including diagnosing the need for including FAIRNESS TRUE in BMC models.

Experimental Results. Figure 2 compares encoding times for the R benchmark formulas. We find that (1) Encoding MLTL as either LTL and is not scalable even when the intervals in the formula are small; (2) The cost of MLTL-to-SMV encoding is comparable to that from MLTL to SMT-LIB v2. Although the cost of encoding MLTL as and SMV are in \(O(K\cdot |cl(\varphi )|)\), where K is the maximal interval length in \(\varphi \), the practical gap between the encodings and SMV encoding affirms our conjecture that the SMV model is more compact in general than the corresponding formulas. Also because K is kept small in the R formulas, the encoding cost between SMV and SMT-LIB v2 becomes comparable.

Figure 3 shows total satisfiability checking times for R benchmarks. Recall that the inputs of both BMC and KLIVE approaches are SMV models. The MLTL-SAT via KLIVE is the fastest solving strategy for MLTL formulas with interval ranges of less than 100. The portion of satisfiable/unsatisfiable formulas of this benchmark is approximate 4/1. Although BMC is known to be good at detecting counterexamples with short lengths, it does not perform as well as the KLIVE and SMT approaches on checking satisfiable formulas since only longer counterexamples (with length greater than 1000) exist for most of these formulas. While nuXmv successfully checked all such models, Fig. 4 shows that increasing the interval range constraint results in segmentation faults; more than half of our benchmarks produced this outcome for formulas with allowed interval ranges of up to 600. Meanwhile, the solving solutions via are definitely not competitive for any interval range.

Fig. 4.
figure 4

Proportion of segmentation faults for sets of 200 R formulas with maximal interval ranges varying from 100 to 1000.

The SMT-based approach dominates the model-checking-approaches when considering scalable NB benchmarks, as shown in Fig. 5. Here, e.g., “BMC-1000” means using BMC to check the group of benchmarks with a maximal interval range of 1,000. Due to segmentation faults, “BMC-1000” and “KLIVE-1000” have almost the same performance because the SMV models generated from our translator MLTLconverter are too large for nuXmv to handle. The performance of the model-checking approaches is constrained by the scalability of the model checker (nuXmv). However, the SMT encoding does not face such a bottleneck; see “Z3-1000,” “Z3-10000,” and “Z3-100000” in Fig. 5. We conclude that the SMT approach is the best available strategy for MLTL satisfiability checking.

Fig. 5.
figure 5

Cactus plot for BMC,KLIVE and SMT-solving approaches on the NB benchmarks; BMC and KLIVE overlap.

Fig. 6.
figure 6

Scatter plot for both the BMC and KLIVE approaches to checking formulas ith/without encoding heuristics.

Finally, we evaluated the performance of model-checking-based approaches on the R0 formulas, observing that there is an exponential complexity gap between MLTL-SAT and . Figure 6 compares the performance of satisfiability solving via the BMC and KLIVE approaches. There is no significant improvement when the SMV encoding heuristics for are applied. For the BMC solving approach, performance is largely unaffected by encoding heuristics. For the KLIVE solving approach, encoding heuristics decrease solving performance. The results support the well-known phenomenon that the theoretic analysis and the practical evaluations do not always match.

We summarize with three conclusions. (1) For satisfiability checking of MLTL formulas, the new SMT-based approach is best. (2) For satisfiability checking of MLTL formulas with interval ranges less than 100, the MLTL-SAT via KLIVE approach is fastest. (3) The dedicated encoding heuristics for do not significantly improve the satisfiability checking time of over MLTL-SAT. They do not solve the nuXmv scalability problem.

6 Discussion and Conclusion

Metric Temporal Logic (MTL) was first introduced in [3], for describing continuous behaviors interpreted over infinite real-time traces. The later variants Metric Interval Temporal Logic (MITL) [5], and Bounded Metric Temporal Logic (BMTL) [30] are also interpreted over infinite traces. Intuitively, MLTL is a combination of MITL and BMTL that allows only bounded, discrete (over natural domain) intervals that are interpreted over finite traces. There are several previous works on the satisfiability of MITL, though their tools only support the infinite semantics. Bounded satisfiability checking for MITL formulas is proposed in [33], and the reduction from MITL to LTL is presented in [20]. Since previous works focus on MITL over infinite traces and there is no trivial way to reduce MLTL over finite traces to MITL over infinite traces, the previous methodologies are not comparable to those presented in this paper. This includes the SMT-based solution of reducing MITL formulas to equi-satisfiable Constraint LTL formulas [8]. Compared to that, our new SMT-based approach more directly encodes MLTL formulas into the SMT language without translation through an intermediate language.

The contribution of a complete, correct, and open-source MLTL satisfiability checking algorithm and tool opens up avenues for a myriad of future directions, as we have now made possible specification debugging MLTL formulas in design-time verification and benchmark generation for runtime verification. We plan to explore alternative encodings for improving the performance of MLTL satisfiability checking and work toward developing an optimized multi-encoding approach, following the style of the previous study for LTL [40]; the current SMT model generated from the MLTL formula uses a relatively simple theory (uninterpreted functions). We also plan to explore lazy encodings from MLTL formulas to SMT models. For example, instead of encoding the whole MLTL formula into a monolithic SMT model, we may be able to decrease overall satisfiability-solving time by encoding the MLTL formula in parts with dynamic ordering similar to [15]. To make the output of SMT-based MLTL satisfiability checking more usable, we plan to investigate translations from the functions returned from Z3 for satisfiable instances into more easily parsable satisfying assignments.