A Rational Expressions and Star-Free Expressions

# Making Metric Temporal Logic Rational

## Abstract

We study an extension of in pointwise time with rational expression guarded modality where is a rational expression over subformulae. We study the decidability and expressiveness of this extension (++), called , as well as its fragment where only star-free rational expressions are allowed. Using the technique of temporal projections, we show that has decidable satisfiability by giving an equisatisfiable reduction to . We also identify a subclass of for which our equi-satisfiable reduction gives rise to formulae of , yielding elementary decidability. As our second main result, we show a tight automaton-logic connection between and partially ordered (or very weak) 1-clock alternating timed automata.

## 1 Introduction

Temporal logics provide constructs to specify qualitative ordering between events in time. Real time logics are quantitative extensions of temporal logics with the ability to specify real time constraints amongst events. Logics and are amongst the prominent real time logics [2]. Two notions of semantics have been studied in the literature : continuous and pointwise [4]. The expressiveness and decidability results vary considerably with the semantics used : while the satisfiability checking of is undecidable in the continuous semantics even for finite timed words [1], it is decidable in pointwise semantics with non-primitive recursive complexity [15]. Due to limited expressive power of , several additional modalities have been proposed : the modality [17] states that in time interval relative to current point, occurs at least times. The modality [17] states that there is a subsequence of time points inside interval where at th point the formula holds. In a recent result, Hunter [9] showed that, in continuous time semantics, enriched with modality (denoted ) is as expressive as with distance , which is as expressive as . Unfortunately, satisfiability and model checking of all these logics are undecidable. This has led us to focus on the pointwise case with only the future modality, i.e. logic , which we abbreviate as in rest of the paper. Also, means with modalities as well as .

In pointwise semantics, it can be shown that (see [11]). In this paper, we propose a generalization of threshold counting and Pnueli modalities by a modality , which specifies that the truth of the subformulae, , at the set of points within interval is in accordance with the rational expression . The resulting logic is called and is the subject of this paper. The expressive power of logic raises several points of interest. It can be shown that , and it can express several new and interesting properties: (1) Formula states that within time interval there is an even number of occurrences of . We will define a derived modulo counting modality which states this directly as the formula . (2) An exercise regime lasting between 60 to 70 seconds consists of arbitrary many repetitions of three pushup cycles which must be completed within 2 seconds. There is no restriction on delay between two cycles to accomodate weak athletes. This is given by where . The inability to specify rational expression constraints has been an important lacuna of LTL and its practically useful extensions such as PSL sugar [7], [6] (based on Dymanic Logic [8]) which extend LTL with both counting and rational expressions. This indicates that our logic is a natural and useful logic for specifying properties. However, to our knowledge, impact of rational expression constraints on metric temporal modalities have not been studied before. As we show in the paper, timing and regularity constraints interact in a fairly complex manner.

As our first main result, we show that satisfiability of is decidable by giving an equisatisfiable reduction to . The reduction makes use of the technique of oversampled temporal projections which was previously proposed [10], [11] and used for proving the decidability of . The reduction given here has several novel features such as an encoding of the run tree of an alternating automaton which restarts the DFA of a given rational expression at each time point (section 3.1). We identify two syntactic subsets of denoted with 2 hard satisfiability, and its further subset with -complete satisfiability. As our second main result, we show that the star-free fragment of characterizes exactly the class of partially ordered 1-clock alternating timed automata, thereby giving a tight logic automaton connection. The most non-trivial part of this proof is the construction of formula equivalent to a given partially ordered 1-clock alternating timed automaton (Lemma 4).

## 2 Timed Temporal Logics

This section describes the syntax and semantics of the timed temporal logics needed in this paper : and . Let be a finite set of propositions. A finite timed word over is a tuple . and are sequences and respectively, with , and for and , , where is the set of positions in the timed word. For convenience, we assume . The ’s can be thought of as labeling positions in . For example, given , is a timed word. is strictly monotonic iff for all . Otherwise, it is weakly monotonic. The set of finite timed words over is denoted . Given with , denotes the set of words . For as above, consists of and . Let be a set of open, half-open or closed time intervals. The end points of these intervals are in . For example, . For and interval , with and , stands for the interval .
Metric Temporal Logic(). Given a finite alphabet , the formulae of are built from using boolean connectives and time constrained version of the modality as follows:
, where . For a timed word , a position , and an formula , the satisfaction of at a position of is denoted , and is defined as follows: (i) , (ii) , (iii) and , (iv) , , and .

The language of a formula is . Two formulae and are said to be equivalent denoted as iff . Additional temporal connectives are defined in the standard way: we have the constrained future eventuality operator and its dual . We also define the next operator as . Non strict versions of operators are defined as , if , and if . Also, is a shorthand for . The subclass of obtained by restricting the intervals in the until modality to non-punctual intervals is denoted .
Timed Propositional Temporal Logic (). is a prominent real time extension of , where timing constraints are specified with the help of freeze clocks. The set of formulas are defined inductively as . is a set of clock variables progressing at the same rate, , and is an interval as above. For a timed word , we define the satisfiability relation, saying that the formula is true at position of the timed word with valuation of all the clock variables as follows: (1) , (2) , (3) and , (4) , (5) , (6) , , and . satisfies denoted iff . Here is the valuation obtained by setting all clock variables to 0. We denote by the fragment of using at most clock variables. {theorem}[[15]] satisfiability is decidable over finite timed words and is non-primitive recursive.

with Rational Expressions() We propose an extension of with rational expressions, that forms the core of the paper. These modalities can assert the truth of a rational expression (over subformulae) within a particular time interval with respect to the present point. For example, when evaluated at a point , asserts the existence of points , , such that evaluates to true at , and evaluates to true at , for all .

Syntax: Formulae of are built from (atomic propositions) as follows:
, where and is a finite set of formulae of interest, and is defined as a rational expression over . . Thus, is . An atomic rational expression is any well-formed formula .

Semantics: For a timed word , a position , and a formula , a finite set of formulae, we define the satisfaction of at a position as follows. For positions , let denote the untimed word over obtained by marking the positions of with iff . For a position and an interval , let denote the untimed word over obtained by marking all the positions such that of with iff .

1. , , and, , where is the language of the rational expression formed over the set . The subclass of using only the modality is denoted or and if only non-punctual intervals are used, then it is denoted or .

2. .

The language accepted by a formula is given by .
Example 1. Consider the formula . Then , and the subformulae of interest are . For , , since , and . On the other hand, for the word , we know that , since even though for , and .
Example 2. Consider the formula . For the word , to check at position 1, we check position 2 of the word, since . The formulae of interest for marking is . Position 2 is not marked, since . Then . However, for the word , , since position 2 is marked with , and .

Example 3. Consider the formula .
For , we have , since point 2 is not marked , even though point 3 is.

Generalizing Counting, Pnueli & Mod Counting Modalities The following reductions show that subsumes most of the extensions of studied in the literature.
(1) Threshold Counting constraints [17], [12], [11] specify the number of times a property holds within some time region is at least (or at most) . These can be expressed in : (i) , (ii) , where .
(2) Pnueli Modalities [17], which enhance the expressiveness of in continuous semantics preserving the complexity, can be written in : can be written as .
(3) Modulo Counting constraints [3], [13] specify the number of times a property holds modulo , in some region. We extend these to the timed setting by proposing two modalities and . checks if the number of times is true in interval is , where denotes a non-negative integer multiple of , and , while when asserted at a point , checks the existence of such that , is true at , holds between , and the number of times is true between is , . As an example, , when asserted at a point , checks the existence of a point such that or , , and the number of points between where is true is odd. Both these modalities can be rewritten equivalently in as follows: and where . The extension of () with only is denoted () while () denotes the extension using .

## 3 Satisfiability of RatMTL and Complexity

The main results of this section are as follows. {theorem} (1) Satisfiability of is decidable. (2) Satisfiability of is -complete. (3) Satisfiability of is in .
(4) Satisfiability of is -hard. Details of Theorems 3.2, 3.3, 3.4 can be found in Appendices E.2, E.3 and E.4. {theorem} , . Theorem 3 shows that the modality can capture (and likewise, captures ). Thus, . Observe that any can be decomposed into finitely many factors, i.e. . Given , we assert within interval and in the prefix of the latter part within , followed by . . The proofs can be seen in Appendix G.

### 3.1 Proof of Theorem 3.1

Equisatisfiability We will use the technique of equisatisfiability modulo oversampling [10] in the proof of Theorem 3. Using this technique, formulae in one logic (say ) can be transformed into formulae over a simpler logic (say ) such that whenever for a timed word over alphabet , one can construct a timed word over an extended set of positions and an extended alphabet such that and vice-versa [10], [11]. In oversampling, (i) is extended by adding some extra positions between the first and last point of , (ii) the labeling of a position is over the extended alphabet and can be a superset of the previous labeling over , while the new positions are labeled using only the new symbols . We can recover from by erasing the new points and the new symbols. A restricted use of oversampling, when one only extends the alphabet and not the set of positions of a timed word is called simple extension. In this case, if is a simple extension of , then , and by erasing the new symbols from , we obtain . See Figure 1 for an illustration. The formula over the larger alphabet such that iff is said to be equisatisfiable modulo temporal projections to . In particular, is equisatisfiable to modulo simple extensions or modulo oversampling, depending on how the word is constructed from the word .

The oversampling technique is used in the proofs of parts 3.1, 3.3 and 3.4.

Equisatisfiable Reduction : to Let be a formula. To obtain equisatisfiable formula , we do the following.

1. We “flatten” the reg modalities to simplify the formulae, eliminating nested reg modalities. Flattening results in extending the alphabet. Each of the modalities that appear in the formula are replaced with fresh witness propositions to obtain a flattened formula. For example, if , then flattening yields the formula , where are fresh witness propositions. Let be the set of fresh witness propositions such that . After flattening, the modalities appear only in this simplified form as . This simplified appearance of reg modalities are called temporal definitions and have the form or , where is a rational expression over , being the set of fresh witness propositions used in the flattening, and is either a unit length interval or an unbounded interval.

2. The elimination of reg modalities is achieved by obtaining equisatisfiable formulae over , possibly a larger set of propositions than corresponding to each temporal definition of . Relativizing these formulae and conjuncting them, we obtain an formula that is equisatisfiable to (see Figure 1 for relativization).

The above steps are routine [10], [11]. What remains is to handle the temporal definitions.

Embedding the Runs of the DFA For any given over , where is the set of witness propositions used in the temporal definitions of the forms or , the rational expression has a corresponding minimal DFA recognizing it. We define an LTL formula which takes a formula as a parameter with the following behaviour. iff for all , . To achieve this, we use two new sets of symbols and for this information. This results in the extended alphabet for the simple extension of . The behaviour of and are explained below.

Consider . Let be the minimal DFA for and let . Let be the indices of the states. Conceptually, we consider multiple runs of with a new run (new thread) started at each point in . records the state of each previously started run. At each step, each thread is updated from it previous value according to the transition function of and also augmented with a new run in initial state. Potentially, the number of threads would grow unboundedly in size but notice that once two runs are the same state at position they remain identical in future. Hence they can be merged into single thread (see Figure2). As a result, threads suffice. We record whether threads are merged in the current state using variables . An LTL formula records the evolution of and over any behaviour . We can define formula in LTL over and .

1. At each position, let be a proposition that denotes that the th thread is active and is in state , while be a proposition that denotes that the th thread is not active. The set consists of propositions for .

2. If at a position , we have and for , and if , then we can merge the threads at position . Let be a proposition that signifies that threads have been merged. In this case, is true at position . Let be the set of all propositions for .

We now describe the conditions to be checked in .

• Initial condition()- At the first point of the word, we start the first thread and initialize all other threads as : .

• Initiating runs at all points()- To check the rational expression within an arbitrary interval, we need to start a new run from every point.

• Disallowing Redundancy()- At any point of the word, if and and are both true, .

• Merging Runs()- If two different threads reach the same state on reading the input at the present point, then we merge thread with . We remember the merge with the proposition . We define a macro which is true at a point if and only if is true at and , where is the maximal set of propositions true at : .

Let be a formula that says that at the next position, and are true for , but for all , is not. is given by
. In this case, we merge threads , and either restart in the initial state, or deactivate the th thread at the next position. This is given by the formula . .

• Propagating runs()- If is true at a point, and if for all , is true, then at the next point, we have . Let denote the formula . The formula is given by
. If is true at the current point, then at the next point, either or . The latter condition corresponds to starting a new run on thread .

Let be the formula obtained by conjuncting all formulae explained above. Once we construct the simple extension , checking whether the rational expression holds in some interval in the timed word , is equivalent to checking that if is the first action point within , and if holds at , then after a series of merges of the form ,, , at the last point in the interval , is true, for some final state . This is encoded as . It can be seen that the number of possible sequences of merges are bounded. Figure 2 illustrates the threads and merging. We can easily write a 1- formula that will check the truth of at a point on the simple extension (see Appendix C). However, to write an formula that checks the truth of at a point , we need to oversample as shown below.

{lemma}

Let be a temporal definition built from . Then we synthesize a formula over such that is equivalent to modulo oversampling.

{proof}

Lets first consider the case when the interval is bounded of the form . Consider a point in with time stamp . To assert at