We study the policy change problem that arises in the runtime verification of long-running systems. The online monitors typically used in this context are generally treelike, in that they maintain substates that monitor subformulae of the target policy. We consider when and how the policy can be changed while the monitored system is running by only exploiting the information stored in the monitor's state. This is relevant, for example, to account for new system functionality or changes in regulatory requirements. We formally define the policy change problem in a general setting, independent of any specific (treelike) monitor implementation. We then show that policy change for past-time metric temporal logic (pMTL) is decidable but has tight non-primitive recursive lower and upper bounds, while with discrete-time semantics it is EXPSPACE-complete.
2012 ACM Subject Classification Theory of computation → Logic and verification; Security and privacy → Formal methods and theory of security
Runtime verification is a lightweight approach to formal verification. Its primary tool is the monitor, which checks individual runs of a system for compliance with a policy. Policies are typically trace properties expressed using a suitable policy language. Online monitors run simultaneously to the monitored system without requiring that all system events be stored in a log file. They are thus especially useful if the system runs indefinitely, as is common for, e.g., web servers.
Most practically used monitoring algorithms and tools [20, 22, 4, 3, 21, 14, 18] operate on a treelike data structure that maintains a monitor substate for every subformula of the target policy. At every point in time, the satisfaction of every subformula is computed bottom-up, and substates are updated to contain enough information to continue monitoring the trace in the future. These monitors, which we call treelike, are the primary focus of this paper.
Long-running systems may be reconfigured to a substantial degree at runtime. For example, consider a registry, operated by some public authority, that stores records in a database. Initially, our registry may be required by law to notify users about certain administrative actions within 30 days. If that legal deadline is shortened to 15 days, this should be reflected in the policy so that the monitor can detect if the system fails to implement the new requirement. A trivial approach to changing the policy consists in stopping the old monitor and starting a new one, initialized using the existing trace. This has two major drawbacks: first, it assumes that a sufficient history of events has been saved; second, it requires re-processing a potentially large fragment of the event trace.
Problem statement. We say that a monitor supports policy change from policy φ1 to policy φ2 if, after monitoring a trace prefix against φ1, it can continue monitoring the trace's
LIPICS Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany
XX:2 Policy Change for Treelike Monitors
remainder against φ2 using only the information in its state. This avoids the two drawbacks mentioned above. For example, the policy change corresponding to shortening the registry's notification deadline is always possible. When an administrative action has not been reported yet, the monitor must keep track of the time elapsed since the action's most recent occurrence, up to the old deadline. This information is sufficient to judge whether the new, shorter deadline is violated. However, policy change is not always possible, as an efficient monitor's state typically does not contain enough information to reconstruct all past events. As an extreme example, consider the case where φ1 is the trivially satisfied policy, i.e., φ1=true. Clearly, a monitor for φ1 need not store any information in its state, and hence this state could not be used to construct a valid monitor state for any non-trivial φ2. This leads us to the following research question: under which condition is policy change possible? In this paper, we answer this question for past-time metric temporal logic (pMTL) with both real-time and discrete-time semantics [16, 1] as the policy language.
Related work. The importance of policy change has been recognized in the context of self-adaptive systems, which use monitors to enact adaptation procedures if a violation of the system's requirements is detected [9]. Carwehl et al. [6] present a policy change approach for monitors constructed from timed automata templates, which correspond to a fragment of future-time MTL. They work with a manually crafted catalog of so-called property adaptation patterns that directly modify the monitor's automaton and current state. Yuan [24] presents a sound but incomplete algorithm that can perform changes between some pairs of first-order policies in the MonPoly tool [4]. In contrast to these works, we consider a decision procedure that determines, for every policy pair, whether adaptation is possible, independent of the specific monitoring algorithm used. Changing specifications at runtime has also been studied from the perspective of controller synthesis from modal sequence diagrams [11]. There, the main problem is to delay the change until it can be done safely, whereas monitors are expected to respond to whatever changes occur in their environment.
Contributions and outline. After reviewing runtime monitoring with treelike monitors and pMTL (Section 2), we make the following contributions:
We give a generalised definition of policy change for treelike monitors independent of any specific monitor implementation (Section 3).
We solve the decision problem associated with policy change for real-time pMTL with non-primitive recursive complexity by reducing policy change to 1-TPTL satisfiability over finite words [13]. We prove that such policy change is NPR-hard via a reduction from pMTL satisfiability on finite traces (Section 4).
We prove that policy change for discrete-time pMTL is EXPSPACE-complete and policy change for pLTL is PSPACE-complete (Section 5).
We show that if we remove the assumption that monitors are treelike, discrete-time policy change for pMTL is still decidable and in 2EXPSPACE, while policy change for pLTL is in EXPSPACE (Section 6).
The following table summarizes the results proven in Sections 4 and 5. Proofs of all lemmata and theorems are provided in Appendix A.
Discrete time
Real time
pMTL
EXPSPACE-complete (Theorems 23, 24)
NPR, NPR-hard (Theorems 21, 22)
pLTL
PSPACE-complete (Theorems 23, 24)
—
XX:3
2 Preliminaries
2.1 Past-time Metric Temporal Logic
Traces represent sequences of actions or states that occur during a system's execution. We consider discrete systems that can be described by a finite set of instantaneous actions or state changes modeled as events. In runtime verification, traces are obtained by observing the running system and are thus finite. We therefore model traces as finite timed words, using non-negative real numbers for the real time domain and natural numbers for the discrete time domain. Henceforth, we shall only consider real-time semantics unless stated otherwise.
Let P be an alphabet of predicates. A trace s of length ∣s∣ is a pair (σ,δ), where σ is a sequence of predicate sets (σi)0≤i<∣s∣∈(2P)∣σ∣, and δ is a sequence of delays (δi)0≤i<∣s∣∈R≥0∣σ∣. We call the index i the time-point, and the corresponding tuple (σi,δi) an event. Each delay measures the amount of time that has passed since the preceding event or since the start of time for the first event.1 If the sequence (δi) is clear from the context, the (absolute) timestamp τi is defined by ∑j≤iδj. We write T(T+, resp.) for the set of all (non-empty, resp.) traces and s⋅s′ for their concatenation.
A policy is a set of traces. A trace in the set satisfies the policy, otherwise it violates it. We consider policies definable using past-time metric temporal logic (pMTL). The pMTL formulae over predicates P={P,Q,…} are defined as
φ::=true∣P∣¬φ∣φ1∨φ2∣∙Iφ∣φ1SIφ2,
where P ranges over P and I ranges over intervals of N. An interval is either empty (∅), represented by its endpoints in the bounded case ([a,b] with a≤b, (a,b), [a,b] or (a,b] with a<b, a,b∈N), or by its lower bound in the unbounded case ([a,∞) or (a,∞), a∈N). An omitted interval subscript defaults to [0,∞). We define other operators as abbreviations: false≡¬true, (φ1∧φ2)≡¬(¬φ1∨¬φ2), (φ1→φ2)≡(¬φ1∨φ2), ⧫Iφ≡(trueSIφ), and ■Iφ≡¬(trueSI¬φ). We use the convention that unary operators (¬,∙,⧫,■) bind the strongest, followed by S, conjunction, disjunction, and implication. The size ∣φ∣ of a formula is its total number of symbols, using binary encoding for interval bounds.
Example 1. Consider the policy “whenever the system processes data, it must notify the user within 30 days.” Compliance with this policy can be checked by monitoring the policy φA=¬(¬notifyS(30,∞) process), which reads “it is not the case that we can say that there has been a process event more than 30 days ago, and, since then, there has not been any notify event.” If the delay is reduced to 15 days, the formula becomes φB=¬(¬notifyS(15,∞) process). To specify “whenever the system processes data, it must emit a notification every 30 days,” we can write φC=¬(¬notifyS(30,∞) notify).
Let s be a trace over P and i<∣s∣. The relation ⟨s,i⟩⊨φ, specifying the satisfaction of
1 The logics we study (pMTL and pLTL) cannot express properties relating to absolute time. Therefore, using delays simplifies policy change slightly since monitors need not store the most recent absolute timestamp.
XX:4 Policy Change for Treelike Monitors
φ on s=(σ,δ) at i, is the least relation closed under the following rules:
⟨s,i⟩⊨true
⟨s,i⟩⊨P \quad if P∈σi
⟨s,i⟩⊨¬φ \quad if ⟨s,i⟩⊨φ
⟨s,i⟩⊨φ1∨φ2 \quad if ⟨s,i⟩⊨φ1 or ⟨s,i⟩⊨φ2
⟨s,i⟩⊨∙Iφ \quad if i>0, τi−τi−1∈I, and ⟨s,i−1⟩⊨φ
⟨s,i⟩⊨φ1SIφ2 \quad if there exists j≤i such that τj−τi∈I, ⟨s,j⟩⊨φ2, and ⟨s,k⟩⊨φ1 for all k with j<k≤i
The policy [[φ]] consists of all non-empty traces s such that ⟨s,∣s∣−1⟩⊨φ.
Past-time linear temporal logic (pLTL) can be viewed as the fragment of pMTL where all intervals of ∙ and S operators are [0,∞). On this fragment, the truth value of a formula does not depend on the relative or absolute timestamps.
2.2 Online Monitors
An online monitor for a policy receives a (possibly unbounded) trace incrementally and determines whether the current prefix satisfies the policy. We formalize an online monitor Mφ for a policy φ as a deterministic transducer Mφ=⟨Qφ,q0φ,μφ,yφ⟩, where Qφ is the monitor's state space, q0φ∈Qφ is the initial state, μφ:Qφ×(2P×R≥0)→Qφ is the step function, and yφ:Qφ×(2P×R≥0)→{0,1} specifies the output. We canonically lift μφ and yφ to traces such that yφ is defined only for non-empty traces and returns the last output. In the following, we refer to "online monitors" as just "monitors". A generic monitor M is a mapping from policies φ to monitors Mφ. The generic monitor is correct iff it satisfies yφ(q0φ,s)=(if s∈[[[φ]] then 1 else 0) for all pMTL formulae φ and non-empty traces s over P. In this paper, all (generic) monitors are assumed to be correct.
2.3 Treelike Monitors
Most monitors found in existing work rely on trees of temporal testers [20] associated with the subformulae of the target policy. Temporal testers compute a sequence of truth values that indicate whether the subformula they monitor is satisfied or not at each time-point. Thati and Roşu's dynamic programming algorithm [22] is constructed in this way; when restricted to pMTL, it is an online monitor as in Section 2.2. Similarly, most state-of-the-art tools such as Aerial [3], Hydra [21], DejaVu [14], Explanator [18], and the MFOTL monitor MonPoly [4] use temporal testers internally when operating on pMTL specifications.
Next, we define substates. Let X,Y be two predicate variables. The set of all pMTL operators is Ω={true,¬X,X∨Y}∪P∪⋃I{∙IX,XSIY}, where we represent the operands of unary and binary operators by X and Y. The syntax tree of every pMTL formula can be seen as a finite, rooted tree labeled by operators in Ω. A monitor tree Tφ for φ is a tree isomorphic to φ's syntax tree, where each vertex is labeled by a temporal tester (a deterministic transducer) for the corresponding operator when viewed as a pMTL formula over P∪{X,Y}. The monitor tree Tφ gives rise to a monitor ⟨QTφ,q0Tφ,μTφ,yTφ⟩. Its states are trees of the same shape as Tφ, labeled by the current states of the transducers for the respective vertices. The transducer states are called the substates of the tree. Given a vertex v in the syntax tree of φ and a state q∈QTφ in Tφ, Tφ(v) denotes the monitor that corresponds to the subtree of temporal testers rooted at that vertex, and q(v) denotes the corresponding subtree of states in q. Each new event (σi,δi) received by the monitor is input
to all leaves, whose outputs are propagated bottom-up within the tree together with the delay δi. The monitor's output is obtained at the root. Intuitively, a transducer tree is a monitor whose state reflects the syntax of the monitored formula.
▶ Example 2. Figure 1 shows monitor trees for φA, φB, and φC. These formulae contain atoms notify and process, unary ¬ operators, and binary S(x,∞) operators. The temporal tester for ev∈{notify,process} is stateless and its output function is yev(q,τ,s)=ev∈s. Similarly, the temporal tester for ¬ is stateless and outputs the negation of the Boolean b it receives from its successor. The temporal tester for S(x,∞) is more complex. Its state contains two reals (q1,q2), where q2 can take the special value ⊥. The real q1 stores the latest timestamp in the trace. The real q2 stores the timestamp of the earliest timepoint at which the LHS was true and the RHS has been true since then. If such a timepoint does not exist, then q2 is ⊥. The step function μS(x,∞) uses the function upd to update q2 for every new timepoint. The corresponding output function is yS(x,∞)(q1,q2)=q1−q2>x.
We do not restrict our analysis to monitor trees since this would be overly restrictive, excluding, e.g., implementations that reuse state across identical subformulae. Instead, we only require that there be a homomorphism between the monitor's states and the states of some suitable monitor tree.
▶ Definition 3. A homomorphism between a monitor Mφ=⟨Qφ,q0φ,μφ,yφ⟩ and a monitor tree Tφ for φ is a function fφ:Qφ→QTφ satisfying fφ(q0φ)=q0Tφ, fφ(μφ(q,x))=μTφ(fφ(q),x), and yφ(q,x)=yTφ(fφ(q),x) for all q∈Qφ and x∈2P×R≥0. The corresponding treelike monitor is the triple ⟨Mφ,Tφ,fφ⟩.
A generic treelike monitor is a triple of mappings ⟨M,T,f⟩ such that M is a generic monitor and for all φ, the triple ⟨Mφ,Tφ,fφ⟩ is a treelike monitor.
3 Policy Change
The policy change problem for a generic monitor M consists of transforming the state of the monitor after monitoring a policy φ1 on an arbitrary trace to a state for a different policy φ2. The new state must be such that all future verdicts are the same as if the monitor had been checking φ2 since the beginning of the trace. In this section, we formally define the associated decision problem, which asks whether it is always possible to change from φ1 to φ2. We first outline the problem in a general setting (Section 3.1), and then specialize the problem statement to the case of treelike monitors (Section 3.2).
XX:6 Policy Change for Treelike Monitors
3.1 First Approach
For any monitor Mφ, define bisimilarity ( ≃Mφ) between two states of Mφ as
q≃Mφq′⟺∀s∈T+.yφ(q,s)=yφ(q′,s).
Observe that ≃Mφ is an equivalence relation. Intuitively, bisimilar states are indistinguishable under any possible future input to the monitor. We now say that an algorithm C:Qφ1→Qφ2 implements policy change from φ1 to φ2 iff
q≃Mφ1μφ1(q0φ1,s)⟹C(q)≃Mφ2μφ2(q0φ2,s)(1)
for all finite traces s and states q∈Qφ1. Suppose that we started monitoring φ1 on the trace prefix s1 using monitor Mφ1. Its state at the end of the prefix is q=μφ1(q0φ1,s1), which trivially satisfies the precondition of (1). We then compute C(q) and replace the running monitor with Mφ2, using C(q) as its initial state. Monitoring some continuation s2 of the trace yields
which is the output we would have obtained by running Mφ1 from the trace's beginning. The first equality follows from (1) and the definition of bisimilarity.
One may wonder whether the condition on C could be strengthened by requiring that q be equal, rather than just bisimilar, to μφ1(q0φ1,s1), as in our example. However, this would prevent us from performing multiple policy changes on the same trace. E.g., the state q′=μφ2(C(q),s2) obtained after monitoring the trace's continuation s2 generally only satisfies q′≃Mφ2μφ2(q0φ2,s1⋅s2), but the states are not necessarily equal. Hence, we could not perform a further policy change, say to φ3. In contrast, our definition allows us to continue with the state C′(q′) whenever C′ implements policy change from φ2 to φ3.
The above definition is still limited as it relies on the syntactic structure of the monitor rather than its semantics. For instance, let φ1≡(PSQ)∧¬⧫R and φ2≡PSQ. We can construct Mφ1 such that it enters and remains in a single unique state whenever it encounters an event satisfying R, since φ1 is necessarily violated from that point on. Yet there are two classes of traces, characterized by the truth value of φ2 at the last position, that are distinguishable by Mφ2. Hence, policy change from φ1 to φ2 is not possible according to our current definition.
3.2 Policy Change for Treelike Monitors
If it is treelike, the monitor Mφ1 from our previous example must maintain a correct substate for the subformula PSQ. Using this substate, policy change to φ2 is possible. Next, we generalize this observation by introducing a notion of deep bisimilarity between monitor trees and, by extension, between treelike monitors. Intuitively, deep bisimilarity is bisimilarity for each pair of matching substrates.
▶ Definition 4. Fix a treelike monitor ⟨Mφ,Tφ,fφ⟩. Two states q,q′∈QTφ are deeply bisimilar, denoted q≅Tφq′, iff for each vertex v in the syntax tree of φ, q(v) and q′(v) are bisimilar under ≃Tφ(v). Two states q,q′∈Qφ are deeply bisimilar under fφ, denoted q≅fφq′, iff fφ(q)≅Tφfφ(q′).
In general, vertices implementing the non-temporal operators {true,¬X,X∨Y}∪P need not be stateful. Therefore, assuming an efficient implementation of the monitors, the relation
XX:7
≅fφ essentially enforces that the substates corresponding to φ's temporal subformulae be bisimilar. We now redefine policy change in terms of deep bisimilarity. In our new definition, the policy change algorithm has access to possibly more information (from substates), but it is also required to output a deeply bisimilar state, which is a stronger requirement than in definition (1).
► Definition 5. Let ⟨M,T,f⟩ be a generic treelike monitor, where M=⟨Q,q0,μ,y⟩. A function C:Qφ1→Qφ2 implements policy change from φ1 to φ2 iff
q≅fφ1μφ1(q0φ1,s)⟹C(q)≅fφ2μφ2(q0φ2,s)
for all finite traces s and states q∈Qφ1.
► Example 6. Policy change is possible between MφA and MφB from Figure 1: the only temporal tester with non-trivial state in both MφA and MφB is tS(x,∞), whose state does not depend on x. Hence, the identity function implements policy change from φ1 to φ2 for any M with MφA and MφB as in Figure 1.
In the following, our focus will be on the associated decision problem:
► Definition 7 (POLICYCHANGE).
Input: a pair of pMTL formulae ⟨φ1,φ2⟩.
Output: 1 if, for every generic treelike monitor M, there exists a function C implementing policy change from φ1 to φ2, and 0 otherwise.
► Example 8. The output of POLICYCHANGE on the input ⟨φA,φC⟩ is 0. Consider the monitor trees MφA and MφC in Figure 1 and the trace prefixes
s1=(0,{notify}),(30,∅)s2=(0,∅),(30,∅)
The final state of the monitor tree MφA is the same when reading s1 or s2: the state of S[30,∞) is (30,⊥). Any function C implementing policy change from φA to φB would map these two states to the same state q of a treelike monitor M^φC. Extending each of s1 and s2 with (31,∅), we see that ⟨s1⋅(31,{}),2⟩⊨φC but ⟨s2⋅(31,∅),2⟩⊨φC. Denoting x=(∅,31), the former implies y^φ3(μ^φ3(q,x),x)=1 and the latter y^φ3(μ^φ3(q,x),x)=0, a contradiction.
4 Deciding Policy Change with Real-Time Semantics
In this section, we decide POLICYCHANGE in three steps. First, given the old policy φ1, we compute a formula ↓φ1, expressed in a suitable hyperlogic, that encodes the information extractable from any monitor state. Similarly, we compute a formula ↑φ2 encoding the information needed to assemble the new state. Then, policy change is possible iff ↓φ1 entails ↑φ2, i.e., iff ↓φ1→↑φ2 is valid. We use a decision procedure for the hyperlogic to decide whether ↓φ1→↑φ2 is valid.
This section is organized as follows. We first develop a general framework for reducing policy change to hyperlogic entailment (Section 4.1). Then, we specialize our framework to the case of pMTL, introducing a new hyperlogic called HyperpTPTL (Section 4.2). Then, we show how entailment in this hyperlogic can be reduced to 1-TPTL satisfiability to decide POLICYCHANGE (Section 4.3).
XX:8 Policy Change for Treelike Monitors
(a) Policy change ⟨φ1,φ2⟩ is possible
(b) Policy change ⟨φ1,φ2⟩ is impossible
Figure 2 Configurations of equivalence classes of trace prefixes under ≅φ1 and ≅φ2
4.1 Policy Change as Hyperlogic Entailment
We begin by lifting the deep bisimilarity relation to finite traces.
▶ Definition 9. Let Tφ be a monitor tree. Two traces s,s′∈T are indistinguishable by Tφ, written s≅Tφs′, iff μTφ(q0Tφ,s)≅TφμTφ(q0Tφ,s′).
This is again an equivalence relation. Moreover, it does not depend on the implementation of Tφ (i.e., the transducers' states and their transition functions), but only on the tree structure, which we have fixed for every pMTL formula.
Lemma 10. For every pair Tφ,Uφ of monitor trees for φ, s≅Tφs′ iff s≅Uφs′.
Therefore, we can simply write s≅φs′ without specifying a concrete monitor tree. Let [s]φ denote the equivalence class under ≅φ that contains s. These equivalence classes are the first step towards characterizing the possibility of policy change:
▶ Lemma 11. For every generic treelike monitor ⟨M,T,f⟩, there exists a function implementing policy change from φ1 to φ2 iff [s]φ1⊆[s]φ2 for all finite traces s.
The condition ∀s.[s]φ1⊆[s]φ2 from the above lemma and its negation ∃s.[s]φ1⊆[s]φ2 are illustrated in Figure 2, where each dot represents a trace prefix. Policy change is impossible iff, as in Example 8, one can find prefixes s1≅φ1s2 such that s1≅φ2s2.
The set of all classes of trace prefixes which are indistinguishable with respect to a given formula is a hyperproperty [8], i.e., a set of sets of traces. To model these classes, we construct information formulae ↓φ1 and ↑φ2, in Section 4.2 using an appropriate hyperlogic. For reasons that will become apparent there, we assume that the hyperlogic semantics is only defined for sets of aligned traces, i.e., the last absolute timestamp in all non-empty traces is the same. The general idea behind the information formulae is that ↓φ1 (over-)approximates the equivalence classes [s]φ1. Similarly, ↑φ2 (under-)approximates the equivalence classes [s]φ2. Now, if the formula ↓φ1→↑φ2 is valid, the condition of Lemma 11 follows, and policy change is possible. Moreover, reducing the policy change problem to validity checking in the hyperlogic is complete if ↓φ≡↑φ for all formulae.
▶ Lemma 12. Suppose that for all finite traces s, non-empty sets of aligned finite traces S, and formulae φ:
(1) S⊆[s]φ implies S⊨↓φ.
(2) s∈S and S⊨↑φ imply S⊆[s]φ.
(3) s≅φs+d for every d∈R≥0, where s+d denotes the copy of s where the first delay has been incremented by d.
Then the validity of ↓φ1→↑φ2 implies [s]φ1⊆[s]φ2 for all s. Moreover, if ↓φ≡↑φ=:↓φ for both φ∈{φ1,φ2}, the converse holds, too.
XX:9
4.2 Information Formulae for pMTL
Our construction of information formulae will require time constraints spanning across multiple temporal operators. Such bounds are difficult to express in logics like MTL, where the interval constraints are local to each operator. Therefore, we construct a hyperlogic based on TPTL [2], which introduces a freeze quantifier for time variables. Specifically, we augment the past-time variant of TPTL with trace quantification, similarly to how HyperLTL [7], HyperMTL [5], and HyperMITL [15] extend the respective logics. Our augmented logic, which we call Hyper past-Time Propositional Temporal Logic or HyperpTPTL, is intractable. However, we carve out a fragment for which satisfiability can be reduced to 1-TPTL, which is decidable over finite words with non-primitive recursive complexity [13]. We find this fragment to be expressive enough to encode information formulae for pMTL.
4.2.1 pTPTL and (1-)HyperpTPTL.
Past-time TPTL (pTPTL) uses a single sort of variables representing time (t,t′,…). HyperpTPTL adds a sort for trace variables (π,π′,…). Since we use a point-based time model, traces may not be synchronized, i.e., their timestamps may not agree at a given time-point; in particular, the equivalence classes [s]φ that we aim to capture are typically unsynchronized. Therefore, we construct HyperpTPTL using two levels. The inner level embeds pTPTL with the usual pointwise semantics, whereas the outer level follows (Hyper)MITL, defining the semantics at the level of timestamps instead of time-points. The syntax of pTPTL formulae φ and HyperpTPTL formulae χ is given by the following grammar:
where c∈Z, and t1 and t2 are time variables. For both logics, we define t1−t2≥c≡t2−t1≤−c, t1−t2∈[a,b]≡t1−t2≥a∧t1−t2≤b and similarly for other intervals, ∀π.φ≡¬(∃π.¬φ), as well as the other usual logical operators. The scope of the quantifiers t. (the quantifier for time variables), ∃, and ∀ extends to the right as far as possible.
pTPTL's semantics is defined by a relation ⟨s,i,v⟩⊨φ where v maps time variables to timestamps. We only show the cases that differ from pMTL:
⟨s,i,v⟩⊨∙φ⟨s,i,v⟩⊨φ1Sφ2⟨s,i,v⟩⊨t.φ⟨s,i,v⟩⊨t1−t2≤cif i>0 and ⟨s,i−1,v⟩⊨φif there exists j≤i such that ⟨s,j,v⟩⊨φ2 and ⟨s,k,v⟩⊨φ1 for all k with j<k≤iif ⟨s,i,v(t↦τi)⟩⊨φif v(t1)−v(t2)≤c
HyperpTPTL's semantics is defined by ⟨S,Π,u,v⟩⊨φ where S is a non-empty set of aligned traces, Π maps trace variables to traces in S, u∈R≥0 is a timestamp, v once again maps time variables to timestamps, and:
⟨S,Π,u,v⟩⊨true⟨S,Π,u,v⟩⊨{φ}π⟨S,Π,u,v⟩⊨¬χ⟨S,Π,u,v⟩⊨χ1∨χ2if there exists a greatest i such that τi=uwhere Π(π)=(σ,δ), and ⟨Π(π),i,v⟩⊨φif ⟨S,Π,u,v⟩⊨χif ⟨S,Π,u,v⟩⊨χ1 or ⟨S,Π,u,v⟩⊨χ2
If χ is a closed formula (no free trace or time variables), we write S⊨χ for ⟨S,∅,τ(S),∅⟩⊨χ, where τ(S) is the unique last timestamp of the traces in S, or 0 if all these traces are empty. This is the reason why we assumed traces to be aligned: it provides us with a unique timestamp to anchor the interpretation of hyperformulae. We say that χ is satisfiable iff there exists S such that S⊨χ. We denote by 1-pTPTL (1-HyperpTPTL, resp.) the syntactic fragment of pTPTL (HyperpTPTL, resp.) that uses at most two time variables, which we will denote by t and t′. The following, recursively defined function translates pMTL formulae to equivalent 1-pTPTL formulae:
▶ Lemma 13. For all φ, s, i, and v, ⟨s,i,v⟩⊨⟨φ⟩ iff ⟨s,i⟩⊨φ.
With this translation in place, we abuse notation and write {φ}π:={(φ)}π for pMTL formulae φ. The operator SI can be desugared in a similar fashion.
4.2.2 Information Formulae
We define the information formulae for pMTL recursively as follows, where π and π′ are two arbitrary, distinct trace variables.
Here we write I−d for {x−d∣x∈I,x≥d}, which is again an interval. Intuitively, the information formula for φ is a conjunction of formulae for each temporal operator in φ, which correspond to stateful monitor tree vertices. These formulae characterize the equivalence classes of traces that are indistinguishable by the corresponding transducer. For example, for a subformula ∙Iφ′ where I=∅, there are two classes of (non-empty) traces that are distinguished by the truth of φ′ at the last time-point. The formula ∀π,π′.{φ′}π→{φ′}π′ enforces that all traces in the set under consideration agree with respect to φ′. The approach for operators of the form φ1SIφ2 is similar, except that there are more classes to consider. We can distinguish them by hypothetically appending an event satisfying φ1. Then φ1SIφ2 is satisfied at the new time-point iff φ1SI−dφ2 was satisfied at the last time-point of the original trace, where d is the timestamp difference between the new and the previous time-point. Accordingly, the information formula asserts that all traces must agree on φ1SI−dφ2 for all
XX:11
d∈R≥0. In practice, taking d in I∪[0,infI] is enough, denoted by an infinitary conjunction,2 since other d give rise to empty shifted intervals.
Example 14. The information formulae for φA, φB, and φC are
Hence, γb,α,β→γb′,α,β is a tautology whenever b≥b′. Therefore, ↕φA→↕φB is a tautology, and thus policy change between φA and φB is possible.
Noting that ⟨αS(x,∞)β⟩π implies ⟨αS(x′,∞)β⟩π when x≤x′, the expression of γb,α,β obtained above shows that a temporal tester for αS(b,∞)β needs to store at least the following information: (i) the maximum x∈[0,b] such that αS[x,x]β holds (if any), (ii) the truth value of αSβ, and (iii) the truth value of αS(b,∞)β. This is exactly what some state-of-the-art monitors such as Hydra [21] store, and hence the ‘optimal’ equivalence classes described by the information formulae are actually realized in practice.
Lemma 15. The 1-HyperpTPTL formulae ↕φ fulfill the conditions of Lemma 12.
Observe that for any formula φ in pLTL, the information formula ↕φ is in HyperpLTL. Namely, when I=[0,∞), the formula for ↕(φ1SIφ2) simplifies to
which does not use any non-LTL constructs. We have the following lemma:
Lemma 16. Given any pLTL formula φ, the HyperpLTL formula of the form ↕φ does not use any S operators (or infinitary conjunctions), and the size of ↕φ is at most quadratic in ∣φ∣.
The information formulae associated to pMTL formulae are, in general, infinite, due to the presence of infinite conjunctions in ↕(φ1SIφ2). However, we show:
Lemma 17. For any interval I of R≥0 and pMTL formulae φ1 and φ2, there exists a 1-HyperpTPTL formula Φφ1,φ2,I such that
are semantically equivalent and ∣Φφ1,φ2,I∣=O(∣φ1∣+∣φ2∣).
In the following, we denote by ↕φ the information formulae obtained by first applying the rewriting from Lemma 17 to the information formula described above, and then converting the rewritten formulae to prenex normal form, using the fact that (χ∧∀π.ψ)↔(∀π.χ∧ψ), where π is not free in χ. By Lemma 17, these formulae are still in 1-HyperpTPTL. Moreover,
2 As an abuse of notation, the semantics of ∧ has been straightforwardly extended to (possibly infinite) families of HyperpTPTL formulae (χj)j∈J by defining that ⟨S,Π,u,v⟩⊨⋀j∈Jχj holds iff for all j∈J, ⟨S,Π,u,v⟩⊨χj holds.
XX:12 Policy Change for Treelike Monitors
they are of the form ∀π,π′.ψ where ∣ψ∣=O(∣φ∣2) and ψ does not contain trace quantifiers, and are equivalent to those in Lemma 15. The quadratic size of the rewritten information formulae follows from the original definition of ↕ and the linear size of the rewritten formulae. Namely, the original definition of ↕ generates O(∣φ∣) disjuncts encoding the information needed to monitor each of the subformulae of φ, each of size O(∣φ∣).
4.3 The Decision Procedure
Our algorithm for POLICYCHANGE is based on a reduction of satisfiability in the ∃∗∀∗ fragment of 1-HyperpTPTL to 1-pTPTL satisfiability. We first describe this reduction, and then present the full decision procedure.
4.3.1 Reducing ∃∗∀∗-HyperpTPTL to pTPTL Satisfiability
The satisfiability of general HyperLTL and HyperMITL is not decidable. However, it has been shown that these problems are decidable when formulae do not contain any ∀∃ quantifier alternation [10, 15]. In particular, for formulae in the decidable ∃∗∀∗ fragment, HyperMITL satisfiability can be reduced to MITL satisfiability with exponential blow-up [10]. More precisely, the blow-up factor is O(nm), where n (m, resp.) is the number of ∃ (∀, resp.) quantifiers. Hence, with a bounded number of trace quantifiers, the reduction will lead to a constant blow-up factor.
We adapt this reduction to HyperpTPTL. The target of the reduction is pTPTL satisfiability. In the following, let χ be a HyperpTPTL formula of the form ∃π1,…,πn.∀π1′,…,πm′.χ′, where χ′ is free of trace quantifiers. Without loss of generality, assume n,m≥1. Define
In the output of these translations, predicates with trace variable subscripts Pπ are treated symbolically as distinct propositions. Moreover, we assume that the predicates tpπ and ck are distinct from all other predicates. Intuitively, the translated formula is interpreted over a single trace that interleaves a finite set of aligned traces: those used to interpret the trace variables occurring in χ~. The predicate tpπ marks time-points that exist in the trace for π, and ck marks the last time-point in a sequence of time-points with the same timestamp.
XX:13
Finally, we characterize proper interleavings satisfying the above properties:
► Lemma 18. χ is satisfiable iff ζ∧ρ(χ~) is. The size of ζ∧ρ(χ~) is O(nm⋅∣χ′∣).
► Lemma 19. If χ is in 1-HyperpTPTL, then ζ∧ρ(χ~) is in 1-pTPTL.
We now prove an analogue of Lemma 18 for the HyperpLTL fragment. It follows from Lemma 16 that the rewriting step described in Lemma 17 is not necessary to ensure that ↕φ is of size polynomial in ∣φ∣. Hence, for this special case, we can show that ρ′(χ~) is again a pLTL formula, where ρ′(χ~) is defined like ρ(χ~) except that ρ′({φ}π)≡¬tpπS(tpπ∧ρπ(φ)). Moreover, the additional constraints ζ are not required to check satisfiability.
► Corollary 20. Suppose that χ is a HyperpLTL formula without S operators. Then χ is satisfiable iff ρ′(χ~), which is a pLTL formula of size O(nm⋅∣χ′∣), is satisfiable.
4.3.2 Deciding Policy Change
With this reduction, the non-primitive recursive algorithm by Haase et al. for deciding 1-TPTL satisfiability [13, 19] can be used to check the satisfiability of 1-HyperpTPTL formulae in the ∃∗∀∗ fragment. Assume given a routine SAT1TPTL, that when given as input a 1-pTPTL formula φ, returns true iff φ is satisfiable, and false otherwise. Our decision procedure is shown in Algorithm 1, where π1,π1′,π2,π2′ are four distinct trace variables.
Algorithm 1 Deciding policy change
function DECIDEPOLICYCHANGE(φ1,φ2)
(∀π,π′.χ1)←↕φ1;(∀π,π′.χ2)←↕φ2χ←(∃π2,π2′.∀π1,π1′.χ1[π↦π1,π′↦π1′]∧¬χ2[π↦π2,π′↦π2′])
return ¬SAT1TPTL(ζ∧ρ(χ~))
end function
Combining Lemmata 11, 12, 15, 17, 18 and 19, we now obtain:
► Theorem 21. Algorithm 1 decides POLICYCHANGE for real-time semantics with non-primitive recursive complexity.
Proof. Correctness. Combining Lemmata 11, 12, 15 and 17, we know that policy change from φ1 to φ2 is possible iff ↕φ1→↕φ2 is valid. This is true iff
¬(↕φ1→↕φ2)≡¬((∀π,π′.χ1)→(∀π,π′.χ2))
is not satisfiable. It is easy to check that χ≡¬((∀π,π′.χ1)→(∀π,π′.χ2)). Since χ is in the ∃∗∀∗ fragment of HyperpTPTL, by Lemma 18, it is satisfiable iff ζ∧ρ(χ~) is satisfiable in pTPTL. Therefore, policy change from φ1 to φ2 is possible iff ζ∧ρ(χ~) is not satisfiable.
Complexity. Since χ is in 1-HyperpTPTL, using Lemma 19 and [13, 19], satisfiability of ζ∧ρ(χ~) can be decided with non-primitive recursive complexity.
We further obtain a lower bound for the complexity of POLICYCHANGE via a reduction from pMTL satisfiability, which is known to have a non-primitive recursive lower bound [19]:
► Theorem 22. POLICYCHANGE for pMTL over real-time semantics has a non-primitive recursive lower bound.
XX:14 Policy Change for Treelike Monitors
5 Deciding Policy Change with Discrete-Time Semantics
In this section, we consider the POLICYCHANGE problem over discrete-time semantics. Consequently, we show that POLICYCHANGE for pLTL and pMTL becomes PSPACE-complete and EXPSPACE-complete. De Giacomo and Vardi [12] showed that the satisfiability problem is PSPACE-complete for LTL over finite traces (also known as LTLf). Although De Giacomo and Vardi use LTL with only future modalities, their results translate to pLTL by symmetry. Moreover, a general translation from MTL to LTL is straightforward and incurs a blow-up polynomial in the interval bounds. Hence, when these bounds are encoded in binary the translation yields an exponentially large LTL formula. Thus,
► Theorem 23. The following statements hold:
(i) POLICYCHANGE for pLTL is in PSPACE.
(ii) POLICYCHANGE for pMTL is in EXPSPACE.
Additionally, [17] showed that the satisfiability problem for the future time fragment of MTL, and hence also pMTL (by symmetry), over discrete time is EXPSPACE-complete. Similar to Theorem 22, we then obtain our lower bounds by reducing the pMTL (pLTL, resp.) satisfiability problem over discrete-time semantics to POLICYCHANGE for pMTL (pLTL, resp.), thus obtaining
► Theorem 24. The following statements hold:
(i) POLICYCHANGE for pLTL is PSPACE-hard.
(ii) POLICYCHANGE for pMTL is EXPSPACE-hard.
6 Policy Change for Non-Treelike Monitors
In this section, we report on preliminary results on the following generalization of the POLICYCHANGE problem over discrete-time semantics, which lifts the treelike assumption on monitors:
► Definition 25. Let M=⟨Q,q0,μ,y⟩ be a generic monitor. A function C:Qφ1→Qφ2 implements policy change from φ1 to φ2 iff
q≃Mφ1μφ1(q0φ1,s)⟹C(q)≃Mφ2μφ2(q0φ2,s)
for all finite traces s and states q∈Qφ1.
► Definition 26 (POLICYCHANGE*).
Input: a pair of pMTL formulae ⟨φ1,φ2⟩.
Output: 1 if, for every generic monitor M (not necessarily treelike), there exists a function C implementing policy change from φ1 to φ2, and 0 otherwise.
The POLICYCHANGE* problem for pLTL is decidable:
► Theorem 27. POLICYCHANGE* for pLTL is in EXPSPACE.
By translating pMTL to pLTL, we obtain:
► Theorem 28. POLICYCHANGE* for pMTL with discrete-time semantics is in 2EXPSPACE.
Whether this problem is decidable for real-time semantics remains open. Note that the lower bounds proven in the treelike case still hold, since our reductions to pLTL or pMTL satisfiability do not rely on the assumption that the monitor is treelike. The tight bounds we proved in the treelike case are one exponent lower than our preliminary unrestricted counterparts. The treelike decision procedure effectively takes advantage of the monitors' structure to go beyond a naïve enumeration of possible state mappings.
XX:15
7 Conclusion
In this paper, we have introduced the policy change problem that arises in the context of online monitoring of changing specifications, and studied it for treelike monitors. We have shown that over real-time semantics our problem has tight non-primitive recursive bounds, while over discrete-time semantics it is EXPSPACE-complete. While we have some preliminary results (cf. Section 6), as part of future work, we would like to identify the complexity of the more general problem, even under real-time semantics.
Lemma 10. For every pair Tφ,Uφ of monitor trees for φ, s≅Tφs′ iff s≅Uφs′.
Proof. There are four states to consider: t=μTφ(q0Tφ,s), t′=μTφ(q0Tφ,s′), u=μUφ(q0Uφ,s), and u′=μUφ(q0Uφ,s′). Since the formula is the same for Tφ and Uφ, all of them are isomorphic as rooted trees. Therefore, it suffices to fix an arbitrary vertex v in the syntax tree of φ and consider the subtrees of states t(v), t′(v), u(v), u′(v) in each of the four states, respectively. Specifically, we have to show that t(v)≅Tφ(v)t′(v) iff u(v)≅Uφ(v)u′(v), where Tφ(v) and Uφ(v) are the monitors for the subformula corresponding to v. Equivalently, we must show that for all s′′∈T+, yTφ(v)(t(v),s′′)=yTφ(v)(t′(v),s′′) iff yUφ(v)(u(v),s′′)=yUφ(v)(u′(v),s′′).
It thus suffices to show that for all s′′∈T+, we have
where the last step is justified because fφ1(μMφ1(q0Mφ1,s))=μTφ1(q0Tφ1,s) using Definition 3, and similarly for s′.
XX:16 Policy Change for Treelike Monitors
▶ Lemma 11. There exists, for every generic treelike monitor ⟨M,T,f⟩, a function implementing policy change from φ1 to φ2 if and only if [s]φ1⊆[s]φ2 for all finite traces s.
Proof. ⟹ Choose an arbitrary generic treelike monitor ⟨M,T,f⟩. (Such a monitor always exists. E.g., one can construct the monitor trees by “implementing” the transducers using trace equivalence classes for the states, and then choose fφ to be the identity function.) Let C be its policy change function. Consider arbitrary traces s and s′ such that s′∈[s]φ1, i.e., s≅φ1s′. Thus
μMφ1(q0Mφ1,s)≅fφ1μMφ1(q0Mφ1,s′)(2)
by Lemma A.2. Applying policy change (Definition 5) twice to (2), we obtain
Using Lemma A.2 again, it follows that s≅φ2s′ and hence s′∈[s]φ2.
⇐ Fix an arbitrary generic treelike monitor ⟨M,T,f⟩. We define C(q) nondeterministically as the state μMφ2(q0Mφ2,s(q)) for some finite trace s(q) such that q≅fφ1μφ1(q0φ1,s(q)). The new state can be chosen arbitrarily if there is no such s(q).
Consider an arbitrary state q∈QMφ1 and a trace s satisfying q≅fφ1μφ1(q0φ1,s). Thus
μφ1(q0φ1,s)≅fφ1q≅fφ1μφ1(q0φ1,s(q)).
Using Lemma A.2, it follows that s≅φ1s(q) and hence s≅φ2s(q) using the assumption [s]φ1⊆[s]φ2. Therefore
C(q)=μMφ2(q0Mφ2,s(q))≅fφ2μMφ2(q0Mφ2,s)
by Lemma A.2, which proves that C implements policy change correctly.
Lemma 12. Suppose that for all finite traces s, non-empty sets of aligned, finite traces S, and formulae φ:
(1) S⊆[s]φ implies S⊨↓φ.
(2) s∈S and S⊨↑φ imply S⊆[s]φ.
(3) s≅φs+d for every d∈R≥0, where s+d denotes the copy of s where the first delay has been incremented by d.
Then the validity of ↓φ1→↑φ2 implies [s]φ1⊆[s]φ2 for all s. Moreover, if ↓φ≡↑φ≡:↑φ for both φ∈{φ1,φ2}, the converse holds, too.
Proof. ⟹ Assume that the hyperformula ↓φ1→↑φ2 is valid and fix an arbitrary finite trace s. Denote the last absolute timestamp of s by τ(s). For every x≥τ(s), let [s]φ1x be the subset of [s]φ1 that contains all traces whose last absolute timestamp is x, such that [s]φ1x is aligned. By assumption (3), [s]φ1x contains s+(x−τ(s)) and is thus non-empty. We have [s]φ1x⊨↓φ1 by assumption (1), setting S=[s]φ1x. It follows that [s]φ1x⊨↑φ2 by modus ponens. Hence we obtain [s]φ1x⊆[s+(x−τ(s))]φ2=[s]φ2 by assumption (2) instantiated with s+(x−τ(s)) and [s]φ1x, and assumption (3). It remains to show that every trace u in [s]φ1 whose last timestamp τ(u) is less than τ(s) is also contained in [s]φ2:
⇐ Suppose that [s]φ1⊆[s]φ2 for all s and fix an arbitrary, non-empty set of aligned, finite traces S satisfying S⊨↓φ1≡↑φ1. Let s be some element of S. By assumption (2), we have S⊆[s]φ1. It follows that S⊆[s]φ2 and hence S⊨↓φ2≡↓φ2. Because S was arbitrary, we have shown that ↓φ1→↓φ2 is valid.
XX:17
A.2 Information Formulae for pMTL
Lemma 13. For all φ, s, i, and v, ⟨s,i,v⟩⊨(φ) iff ⟨s,i⟩⊨φ.
Proof. By induction on the structure of φ. The cases follow immediately from the definitions.
Before we prove Lemma 15, we provide an alternative characterization of the equivalence relation ≅φ. For every pMTL formula φ1, define eval(φ1;s) to be the trace derived from s∈T as follows. The number of events and their timestamps are the same as in s, whereas the event set σi contains X iff ⟨s,i⟩⊨φ1, for all i<∣s∣. The trace eval(φ1,φ2;s) is defined similarly, except that the event set σi additionally contains Y iff ⟨s,i⟩⊨φ2. We define
s≃φs′⟺(∀s′′∈T+.s⋅s′′∈[[φ]]⟺s′⋅s′′∈[[φ]]).
Finally, the relation Ind(φ;s,s′) is defined by recursion on φ.
Proof. Note that s≅φs′ is equivalent to μTφ(q0Tφ,s)≅TφμTφ(q0Tφ,s′) for all monitor trees Tφ. We proceed by structural induction on φ.
φ≡true: The monitor tree Ttrue consists of a single vertex. Since the output of the transducer labeling it does not depend on past time-points, s≅trues′ is true for all pairs s,s′ of traces. This matches the definition of Ind(true;s,s′).
φ≡P for some predicate P: Similar to the previous case.
φ≡¬φ′: The root of the monitor tree Tφ is labeled by a transducer t implementing the operator ¬X. It has a single child, namely Tφ′. Now observe that s≅φs′ iff s≅φ′s′ and μt(q0t,eval(φ′;s))≃tμt(q0t,eval(φ′;s′)). By the induction hypothesis, s≅φ′s′ iff Ind(φ′;s,s′), whereas μt(q0t,r)≃tμt(q0t,r′) holds for all pairs r,r′ of traces, as t's output does not depend on past time-points.
φ≡φ1∨φ2: The root of the monitor tree Tφ is labeled by a transducer t implementing the operator X∨Y. It has two children, namely Tφ1 and Tφ2. Now observe that s≅φs′ iff s≅φ1s′,s≅φ2s′, and μt(q0t,eval(φ1,φ2;s))≃tμt(q0t,eval(φ1,φ2;s′)). By the induction hypotheses for φ1 and φ2, we have
s≅φ1s′∧s≅φ2s′⟺Ind(φ1;s,s′)∧Ind(φ2;s,s′),
whereas μt(q0t,r)≃tμt(q0t,r′) holds again for all pairs r,r′.
φ≡∙iφ′: This case is similar to the one for negation, except that we must show that eval(φ′;s)≃∙IXeval(φ′;s′) iff
μt(q0t,eval(φ′;s))≃tμt(q0t,eval(φ′;s′)).
This follows immediately from the definition of ≃t and the fact that t implements ∙IX.
XX:18 Policy Change for Treelike Monitors
φ≡φ1SIφ2: This case is similar to the one for disjunction, except that we must show that eval(φ1,φ2;s)≃XSIYeval(φ1,φ2;s′) iff
This follows immediately from the definition of ≃t and the fact that t implements XSIY.
► Lemma A.4. For all traces s and s′,s≃∙0Xs′ and s≃XS0Ys′.
Proof. Trivial since [∙0X]=[XS0Y]=∅.
► Lemma A.5. Let I=∅. For all non-empty traces s and s′ that end with the same timestamp τ, s≃∙IXs′ iff s∈[X]⟺s′∈[X].
Proof. ⟺ Suppose that ∀s′′∈T+. s⋅s′′∈[∙IX]⟺s′⋅s′′∈[∙IX]. Choose any d∈I. Instantiate s′′ such that it consists of a single event (∅,τ+d). This ensures that the timestamp differences between the last and the second-to-last time-point in s⋅s′′ and s′⋅s′′ are both in I. Hence
s∈[X]⟺s⋅s′′∈[OIX]⟺s′⋅s′′∈[OIX]⟺s′∈[X].
⟺ Suppose that s∈[X]⟺s′∈[X] and fix an arbitrary non-empty trace s′′. If ∣s′′∣>1, note that the inclusion of s⋅s′′ and s′⋅s′′ in [∙IX] depends only on events in s′′. Hence assume that ∣s′′∣=1 and let τ′ be the timestamp of the only event in s′′. If τ′−τ∈/I, neither s⋅s′′ nor s′⋅s′′ is included in [∙IX]. If τ′−τ∈I,
s⋅s′′∈[OIX]⟺s∈[X]⟺s′∈[X]⟺s′⋅s′′∈[OIX].
Having covered all cases, we have shown the left-hand side.
► Lemma A.6. For all non-empty traces s and s′ that end with the same timestamp τ, s≃XSIYs′ iff, for all d∈R≥0, s∈[XSI−dY]⟺s′∈[XSI−dY].
Proof. ⟺ Suppose that ∀s′′∈T+. s⋅s′′∈[XSIY]⟺s′⋅s′′∈[XSIY]. Without loss of generality, fix an arbitrary d∈R≥0 such that I−d is non-empty. Instantiate s′′ such that it consists of a single event ({X},τ+d). It is not difficult to see that
⟺ Suppose that s∈[XSI−dY]⟺s′∈[XSI−dY] for all d and fix an arbitrary non-empty trace s′′. We distinguish several cases:
s′′∈[XSIY], which implies that s⋅s′′∈[XSIY] and s′⋅s′′∈[XSIY].
The previous case does not apply and there is an event in s′′ that does not satisfy X. Then s⋅s′′∈/[XSIY] and s′⋅s′′∈/[XSIY].
Neither case applies. Then s⋅s′′∈[XSIY] iff s∈[XSI−dY], where d is the difference between the last timestamp of s′′ and the last timestamp of s, and similarly for s′.
Lemma 15. The HyperpTPTL formula ↕φ fulfills the conditions of Lemma 12.
Proof. Recall the conditions:
(1) S⊆[s]φ implies S⊨↕φ.
(2) s∈S and S⊨↕φ imply S⊆[s]φ.
XX:19
(3) s≅φs+d for every d∈N, where s+d denotes the copy of s where the first delay has been incremented by d.
By Lemma A.3, the condition S⊆[s]φ is equivalent to ∀s′∈S. Ind(φ;s,s′), and the condition s≅φs+d is equivalent to Ind(φ;s,s+d). We proceed by structural induction on φ.
φ≡true or φ≡P: Trivial, as both S⊨↕φ and Ind(φ;s,s′) hold for all S,s, and s′.
φ≡¬φ′: Note that S⊨↕φ iff S⊨↕φ′ and Ind(φ;s,s′) iff Ind(φ′;s,s′), so this case follows directly from the induction hypothesis.
φ≡φ1∨φ2: Similarly, as S⊨↕φ iff both S⊨↕φ1 and S⊨↕φ2, and Ind(φ;s,s′) iff both Ind(φ1;s,s′) and Ind(φ2;s,s′).
φ≡∙Iφ′:
(1) Suppose that ∀s′∈S. Ind(φ;s,s′), i.e.,
∀s′∈S.eval(φ′;s)≃∙I,Xeval(φ′;s′)∧Ind(φ′;s,s′).
Using the induction hypothesis, it follows that S⊨↕φ′. It remains to show that S⊨∀π,π′. {φ′}π→{φ′}π′ if I=∅. To this end, fix two arbitrary, non-empty traces r,r′ in S such that r∈[[φ′]]. (As traces in S are aligned, φ′ is necessarily evaluated at the last time-point of each trace.) We have
eval(φ′;r)≃∙I,Xeval(φ′;s)≃∙I,Xeval(φ′;r′)
because it is an equivalence relation. Using Lemma A.5, this implies eval(φ′;r)∈[X]⟺eval(φ′;r′)∈[X], i.e., r∈[φ′]⟺r′∈[φ′].
(2) Suppose that s∈S and S⊨↕φ. Hence S⊨↕φ′ by construction of ↕φ, and from the induction hypothesis we get that ∀s′∈S. Ind(φ′;s,s′). It remains to show that ∀s′∈S. eval(φ′;s)≃∙IXeval(φ′;s′). Fix an arbitrary s′∈S. Using Lemma A.4, it suffices to consider the case where I=∅, in which case we know that S⊨∀π,π′. {φ′}π→{φ′}π′. We instantiate the quantifiers twice, once with s and s′, and once with s′ and s, to conclude that s∈[[φ′]]⟺s′∈[[φ′]] and hence eval(φ′;s)∈[X]⟺eval(φ′;s′)∈[X]. Now apply Lemma A.5.
(3) We obtain Ind(φ′;s,s+d) from the induction hypothesis and it remains to prove that eval(φ′;s)≃∙IXeval(φ′;s+d). Fix an arbitrary non-empty trace s′′. The difference between any pair of timestamps in eval(φ′;s)⋅s′′ is the same as in eval(φ′;s+d)⋅s′′ because concatenation is defined such that the timestamps of s′′ are interpreted as relative increments. Moreover, the events of the two concatenations are pointwise equal. Therefore, eval(φ′;s)⋅s′′∈[∙IX]⟺eval(φ′;s+d)⋅s′′∈[∙IX] because ∙I's semantics depends only on the events and timestamp differences.
Using Lemma A.6, this implies eval(φ1,φ2;r)∈[XSI−dY]⟺eval(φ1,φ2;r′)∈[XSI−dY], i.e., r∈[[φ1SI−dφ2]]⟺r′∈[[φ1SI−dφ2]].
XX:20 Policy Change for Treelike Monitors
(2) Suppose that s∈S and S⊨↕φ. Hence S⊨↕φ1∧↕φ2 by construction of ↕φ, and from the induction hypothesis we get that ∀s′∈S. Ind(φ1;s,s′)∧Ind(φ2;s,s′). It remains to show that ∀s′∈S. eval(φ1,φ2;s)≃XS,Yeval(φ1,φ2;s′). Fix an arbitrary s′∈S. Using Lemma A.4, it suffices to consider the case where I=∅, in which case we know that
S⊨∀π,π′.{φ1SI−dφ2}π→{φ1SI−dφ2}π′
for all d∈R≥0. (Strictly speaking, ↕φ guarantees this only up to some upper bound of d. However, as discussed in Section 4.2, the upper bound is chosen such that the interval I−d is either empty or the same for all larger d.) We again instantiate the quantifiers twice to conclude that s∈[φ1SI−dφ2]⟺s′∈[φ1SI−dφ2] and hence eval(φ1,φ2;s)∈[XSI−dY]⟺eval(φ1,φ2;s′)∈[XSI−dY] for all d. Now apply Lemma A.6.
(3) We obtain Ind(φ1;s,s+d) and Ind(φ2;s,s+d) from the induction hypotheses and it remains to prove that eval(φ1,φ2;s)≃XS,Yeval(φ1,φ2;s+d). Fix an arbitrary non-empty trace s′′. The difference between any pair of timestamps in eval(φ1,φ2;s)⋅s′′ is the same as in eval(φ1,φ2;s+d)⋅s′′ because concatenation is defined such that the timestamps of s′′ are interpreted as relative increments. Moreover, the events of the two concatenations are pointwise equal. Therefore, eval(φ1,φ2;s)⋅s′′∈[XSIY]⟺eval(φ1,φ2;s+d)⋅s′′∈[XSIY] because SI's semantics depends only on the events and timestamp differences.
▶ Lemma A.7. For ℓ2>ℓ1≥0, ∥∈{⋅,⋅} and ⋉∈{<,≤}, define
such that (⋉=<) iff (∥=). Then Φℓ1,ℓ2,α,β↔φℓ1,ℓ2,α,β1∨φℓ1,ℓ2,α,β2.
Proof. Φℓ1,ℓ2,α,β⇒φℓ1,ℓ2,α,β1∨φℓ1,ℓ2,α,β2. Assume that ⟨S,Π,u,v⟩⊨Φℓ1,ℓ2,α,β and let k∈(ℓ1,ℓ2] such that ⟨S,Π,u,v⟩⊨{αS[0,k∥]β}π∧¬{αS[0,k∥]β}π′. Let (σ,δ)=Π(π) and (σ′,δ′)=Π(π′). Let i′≤i such that i is the greatest index such that δi=u, u−k⋉δi′, ⟨(σ,δ),i′,v⟩⊨β, and ⟨(σ,δ),i′′′,v⟩⊨α for all i′<i′′≤i. By assumption, ⟨(σ′,δ′),j,v⟩⊨αS[0,k∥]β where j is the greatest index such that δj′=u. We distinguish between two cases:
If, for all j′ such that \delta'_j - \delta'_j' < u - \delta_{i'}, we have ⟨(σ′,δ′),j′,v⟩⊨α, then ⟨(σ′,δ′),j,v⟩⊨αS[0,k]β implies ⟨(σ′,δ′),j′,v⟩⊨β for all j′ with \delta'_j - \delta'_j' \leq u - \delta_{i'} and ⟨(σ′,δ′),j′′,v⟩⊨αS[0,0]β where j′′≤j is the greatest index such that \delta'_j - \delta'_j'' = u - \delta_{i'}, if it exists. Hence, ⟨S,Π,u′,v⟩⊨¬{Φ[0,0]¬α}π∧¬{Φ[0,0]β}π′ for all δi′<u′≤u and ⟨S,Π,δi′,v⟩⊨{αS[0,0]β}π∧¬{αS[0,0]β}π′, and therefore ⟨S,Π,u,v⟩⊨φℓ1,ℓ2,α,β1.
If there exists j′ such that \delta'_j - \delta'_j' < u - \delta_{i'} and ⟨(σ′,δ′),j′,v⟩⊨α, let j0 denote the greatest such j′. Since ⟨(σ′,δ′),j,v⟩⊨αS[0,k]β, we have ⟨S,Π,δj0′,v⟩⊨(¬β)S[0,0](¬α) and ⟨(σ′,δ′),j′′,v⟩⊨β for all j0<j′′≤j. Hence, ⟨S,Π,u′,v⟩⊨¬{Φ[0,0]¬α}π∧¬{Φ[0,0]β}π′ for all δj0′<u′≤u and ⟨S,Π,δj0′,v⟩⊨{(¬β)S[0,0](¬α)}π′∧{αS(t′⋅ℓ1<t−t′⋉ℓ2∧β)}π, and therefore ⟨S,Π,u,v⟩⊨φℓ1,ℓ2,α,β1.
XX:21
φℓ1,ℓ2,α,β1⇒Φℓ1,ℓ2,α,β. Assume that ⟨S,Π,u,v⟩⊨φℓ1,ℓ2,α,β1. Let k0∈[ℓ1,ℓ2] such that ⟨S,Π,u−k0,v⟩⊨{αS[0,0]β}π∧¬{αS[0,0]β}π′ and, for all u−k0≤u, ⟨S,Π,u′,v⟩⊨¬{◊[0,0]¬α}π∧¬{◊[0,0]β}π′. Hence, if (∥≡∥), ⟨S,Π,u,v⟩⊨{αS[0,k0]β}π∧¬{αS[0,k0]β}π′. Otherwise, k0<ℓ2 and thus there exists a sufficiently small ϵ>0 such that k0+ϵ<ℓ2 and there exists no time-point in either π or π′ with the timestamp k0+ϵ. Thus, we obtain ⟨S,Π,u,v⟩⊨{αS[0,k0+ϵ]β}π∧¬{αS[0,k0+ϵ]β}π′.
φℓ1,ℓ2,α,β2⇒Φℓ1,ℓ2,α,β. Assume that ⟨S,Π,u,v⟩⊨φℓ1,ℓ2,α,β2. Let k0 be such that ⟨S,Π,u−k0,v⟩⊨{(¬β)S[0,0](¬α)}π′∧{αS(tℓ1′<t−t′⋉ℓ2∧β)}π and, for all u−k0≤u′<u, ⟨S,Π,u′,v⟩⊨¬{◊[0,0]¬α}π∧¬{◊[0,0]β}π′. We obtain k1∈(ℓ1,ℓ2] such that ⟨Π(π),i,v⟩⊨β for some time-point i with τi=u−k1 and ⟨Π(π),j,v⟩⊨α for all j>i. Since, k1<ℓ2, ⟨S,Π,u,v⟩⊨{αS[0,ℓ2∥β}π∧¬{αS[0,ℓ2∥β}π′.
where ∥⋅∥∈{(⋅),[⋅],[⋅],[⋅]}. Then Ψa,ℓ,α,β↔ψa,ℓ,α,β1∨ψa,ℓ,α,β2.
Proof. Ψa,ℓ,α,β⇒ψa,ℓ,α,β1∨ψa,ℓ,α,β2. Assume that ⟨S,Π,u,v⟩⊨Ψa,ℓ,α,β∧¬ψa,ℓ,α,β1. It then suffices to show ⟨S,Π,u,v⟩⊨ψa,ℓ,α,β2. Let j0∈[0,a] such that ⟨S,Π,u,v⟩⊨{αS∥j0,j0+ℓ∥β}π∧¬{αS∥j0,j0+ℓ∥β}π′. Since ⟨S,Π,u,v⟩⊨{αS∥j0,j0+ℓ∥β}π, there exists i such that τi∈∥u−j0−ℓ,u−j0∥⊆∥u−a−ℓ,u∥, ⟨Π(π),i,v⟩⊨β, and for all i′>i, ⟨Π(π),i′,v⟩⊨α. Consequently, ⟨S,Π,u−j0,v⟩⊨{αS∥0,ℓ∥β}π. Since ⟨S,Π,u,v⟩⊨¬ψa,ℓ,α,β1, it also implies ⟨S,Π,u−j0,v⟩⊨{αS∥0,ℓ∥β}π′. However, since ⟨S,Π,u,v⟩⊨¬{αS∥j0,j0+ℓ∥β}π′, there must exist j0′≤j0 such that ⟨S,Π,u−j0′,v⟩⊨{¬α}π′. Therefore, ⟨S,Π,u,v⟩⊨ψa,ℓ,α,β2.
ψℓ1,ℓ2,α,β1⇒Ψℓ1,ℓ2,α,β. Assume that ⟨S,Π,u,v⟩⊨ψℓ1,ℓ2,α,β1. Let j0∈[0,a] such that ⟨S,Π,u−j0,v⟩⊨{αS∥0,ℓ∥β}π∧¬{αS∥0,ℓ∥β}π′ and, for all u−j0≤u′≤u, ⟨S,Π,u′,v⟩⊨¬{◊[0,0]¬α}π. Then ⟨S,Π,u,v⟩⊨{αS∥j0,j0+ℓ∥β}π∧¬{αS∥j0,j0+ℓ∥β}π′.
ψℓ1,ℓ2,α,β2⇒Ψℓ1,ℓ2,α,β. Assume that ⟨S,Π,u,v⟩⊨ψℓ1,ℓ2,α,β2. Let j0∈[0,a] such that ({◊[0,0]¬α}π′∧trueSt′⋅(t−t′≤a∧{αS∥0,ℓ∥β}π′∧{αS∥0,ℓ∥β}π)) and for all u−j0≤u′<u, ⟨S,Π,u′,v⟩⊨¬{◊[0,0]¬α}π. This means that ⟨S,Π,u−j0,v⟩⊨{¬α}π′ and there exists j0′∈[j0,a] such that ⟨S,Π,u−j0,v⟩⊨{αS∥0,ℓ∥β}π∧{αS∥0,ℓ∥β}π′ and for all u−j0′≤u′′≤u−j0, ⟨S,Π,u′′,v⟩⊨¬{◊[0,0]¬α}π. Therefore, ⟨S,Π,u,v⟩⊨{αS∥j0′,j0′+ℓ∥β}π∧¬{αS∥j0′,j0′+ℓ∥β}π′.
▶ Lemma 17. For ℓ2>ℓ1≥0, a>0, define (φi)i∈{1,2}, (ψi)i∈{1,2}, (vi)i∈{1,2} as above. Let I=∥ia,b∥r and I′=∥ia,∞), for ∥i∈{(⋅,[⋅] and ∥r∈{⋅,⋅]}. Then
Let χ be a HyperpTPTL formula of the form ∃π1,…,πn.∀π1′,…,πm′.χ′, where n≥1, m≥1, and χ′ does not contain any trace quantifiers. Recall that χ~ is constructed as follows.
For an assignment Π to variables X, let img(Π) denote the image of X under Π.
▶ Lemma A.10. χ is satisfiable iff there exists an assignment Π of traces to the trace variables {π1,…,πn} such that img(Π) is aligned and
⟨img(Π),Π,τ(img(Π)),∅⟩⊨χ~.
Proof. ⟹ Suppose that S⊨χ for some non-empty set S of aligned traces. Then there exists an assignment Π to π1,…,πn such that ⟨S,Π,τ(S),∅⟩⊨∀π1′,…,πm′,χ′. Note that img(Π)⊆S and hence τ(img(Π))=τ(S). It is easy to see that ⟨img(Π),Π,τ(img(Π)),∅⟩⊨∀π1′,…,πm′,χ′. Since img(Π)={Π(π1),…,Π(πn)} is a finite set, we can expand the universal quantifiers by enumerating all possible assignments of traces to the variables πj′, and each available trace is identified by one of the variables πi. This expansion results in χ~ and hence ⟨img(Π),Π,τ(img(Π)),∅⟩⊨χ~.
⟺Suppose that⟨img(Π),Π,τ(img(Π)),∅⟩⊨χ~.By the converse of the argument given above, we have⟨img(Π),Π,τ(img(Π)),∅⟩⊨∀π1′,…,πm′.χ′and hence⟨img(Π),∅,τ(img(Π)),∅⟩⊨χ,i.e.,img(Π)⊨χ.
XX:23
► Definition A.11. Let S be a finite, non-empty set of aligned traces. Let {π1,…,πn} be a set of trace variables, where n=∣S∣. We say that the non-empty trace s is an interleaving of S if the following conditions are satisfied.
(1) The first timestamp in s is 0 and the last timestamp is equal to τ(S).
(2) The difference between consecutive timestamps in s is at most 1.
(3) A pair (σi,δi) in s satisfies ck∈σi iff either i=∣s∣−1 or δi+1≥1.
(4) The set S is equal to the set of s's projections under {π1,…,πn}. The projection prπ(s) under π is defined as the trace that contains exactly those pairs (σi,δi) in s that satisfy tpπ∈σi, and where σi is replaced by {P∣Pπ∈σi,P=tp}.
▶ Lemma A.12. If the non-empty trace s satisfies ζ, it is an interleaving of the set of s′ projections under {π1,…,πn}.
Proof. We prove the conditions of Definition A.11:
(1) Because of the conjunct ⧫(t.t≤0), the first timestamp in s, which is a natural number, must be equal to zero. Because of the conjunct ⋀i∈{1,…,n}(⧫tpπi→⧫[0,0]tpπi), all non-empty projections of s (which correspond to those πi for which there is any event satisfying tpπi in s) end with the largest timestamp in s. In particular, the set of projections is aligned.
(2) ζ implies ■(t.¬∙(t′.¬(t−t′≤1))), which ensures that consecutive timestamps in s differ by at most 1.
(3) The last event in s satisfies the predicate ck because of the corresponding conjunct in ζ. Moreover, ζ implies ■(∙(t′.t−t′≥1)↔∙ck), which states precisely that for all i<∣s∣−1, the event at time-point i satisfies ck iff τi+1−τi≥1⟺δi+1≥1.
(4) Trivial.
▶ Lemma A.13. For every finite, non-empty set of aligned traces S, there exists an interleaving S∞ of S satisfying ζ.
Proof. Fix some enumeration {s1=(σi1,δi1),…,sn=(σin,δin)} of S. For every u in the interval [0,τ(S)] and every k∈{1,…,n}, define the trace
where [x,y] is the range of time-points in sk with absolute timestamp u. If there is no such time-point, we let Su,k∞ be the empty trace. Now define
Su∞:=({},δu)⋅Su,1∞⋅Su,2∞⋯Su,n∞⋅({ck},0),
where δu=0 if u=0 and δu=1 otherwise. Finally, S∞ is the concatenation of all Su∞, where u ranges from 0 to τ(S). Clearly, this is a non-empty trace.
It is not difficult to see that S∞ fulfills the conditions of Definition A.11. Moreover, every interleaving satisfies ζ.
XX:24 Policy Change for Treelike Monitors
▶ Lemma A.14. Let s be an interleaving of S. Then ⟨prjπ(s),i,v⟩⊨φ iff ⟨s,j,v⟩⊨ρπ(φ), where j is the time-point of the i-th event in s satisfying tpπ.
Proof. Let s=(σ,δ) and prjπ(s)=(σπ,δπ). By induction on the structure of φ, generalizing i and v.
φ≡ρπ(φ)≡true: Trivial.
φ≡ρπ(φ)≡t1−t2≤c: Trivial.
φ≡ρπ(φ)≡t≤c: Trivial.
φ≡P, hence ρπ(φ)≡Pπ. Observe that σiπ={Q∣Qπ∈σj,Q=tp}. Hence
⟨prjπ(s),i,v⟩⊨P⟺P∈σiπ⟺Pπ∈σj⟺⟨s,j,v⟩⊨Pπ.
φ≡¬φ′, hence ρπ(φ)≡¬ρπ(φ): Follows directly from the induction hypothesis (I.H.).
φ≡φ1∨φ2, hence ρπ(φ)≡ρπ(φ1)∨ρπ(φ2): Follows directly from the I.H.
φ≡∙φ′, hence ρπ(φ)≡∙(¬tpπS(tpπ∧ρπ(φ′))): Suppose that ⟨prjπ(s),i,v⟩⊨∙φ′. Therefore, i>0 and ⟨prjπ(s),i−1,v⟩⊨φ′. Using the I.H., we have ⟨s,j′,v⟩⊨ρπ(φ′), where j′ is the time-point of the (i−1)-th event in s satisfying tpπ. It follows that j′<j, ⟨s,j′,v⟩⊨tpπ, and ⟨s,k,v⟩⊨tpπ for all k∈{j′+1,…,j−1}. Hence ⟨s,j,v⟩⊨ρπ(φ). Now consider the converse direction. If ⟨s,j,v⟩⊨ρπ(φ), we know that there exists j′<j where ⟨s,j′,v⟩⊨tpπ∧ρπ(φ′) and, for all k∈{j′+1,…,j−1}, ⟨s,k,v⟩⊨tpπ. Clearly, j′ is the time-point of the (i−1)-th event in s satisfying tpπ. In particular, j must be positive. Using the I.H., we have ⟨s,i−1,v⟩⊨φ′, which concludes the case.
φ≡φ1Sφ2, hence ρπ(φ)≡(tpπ→ρπ(φ1))S(tpπ∧ρπ(φ2)): Let us write π(i) for the time-point in s corresponding to time-point i in prjπ(s), which is a monotone map. We reason
The step (*) is justified because the set {π(k)∣k∈{i′+1,…,i}} is equal to the set {k∈{π(i′)+1,…,π(i)}∣tpπ∈σk}, and π(i)=j. The step (**) is similarly justified because tpπ∈σπ(i′), and whenever tpπ∈σj′ for some j′≤π(i), there exists some i′≤i with j′=π(i′).
φ≡t.φ′, hence ρπ(φ)≡t.ρπ(φ): Follows from the I.H. by instantiating v with v(t↦τj), where τj=τiπ by choice of j.
▶ Lemma A.15. Let χ be a HyperpTPTL formula over trace variables {π1,…,πn} and without trace quantifiers. Let s=(σ,δ) be an interleaving of img(Π)={Π(π1),…,Π(πn)}. Moreover, assume that ⟨s,i,v⟩⊨ck. Then ⟨img(Π),Π,τi,v⟩⊨χ iff ⟨s,i,v⟩⊨ρ(χ).
Proof. We write ⟨Π,u,v⟩⊨χ instead of ⟨img(Π),Π,u,v⟩⊨χ for brevity. Proof by induction on the structure of χ, generalizing i,j, and v.
XX:25
χ≡ρ(χ)≡true: Trivial.
χ≡ρ(χ)≡t1−t2≤c: Trivial.
χ≡{φ}π, hence ρ(χ)≡(¬tpπ∧¬ck)S(tpπ∧ρπ(φ)): Suppose that ⟨Π,τi,v⟩⊨{φ}π. Thus ⟨Π(π),j,v⟩⊨φ, where j is the greatest time-point in Π(π) with τj=τi. We have Π(π)=prjπ(s) because s is an interleaving of img(Π). Using Lemma A.14, it follows that ⟨s,k,v⟩⊨ρπ(φ), where k is the j-th time-point in s satisfying tpπ. Note that τk=τj. Moreover, there cannot be any k′>k with the same absolute timestamp and satisfying tpπ or ck, because this would contradict the fact that j was maximal in prjπ(s). Since i is the greatest time-point in s with timestamp τi=τk (we assumed ⟨s,i,v⟩⊨ck), we have shown that ⟨s,i,v⟩⊨(¬tpπ∧¬ck)S(tpπ∧ρπ(φ)).
For the converse direction, suppose that ⟨s,i,v⟩⊨ρ(χ). Hence we obtain j≤i where τj=τi, ⟨s,j,v⟩⊨tpπ∧ρπ(φ), and there is no time-point k∈{j+1,…,i} satisfying tpπ or ck. Let π(j) be the time-point in prjπ(s)=Π(π) corresponding to j. By a similar argument to the one before, this is the greatest time-point in the projection with absolute timestamp τi. Moreover, Lemma A.14 implies ⟨prjπ(s),π(j),v⟩⊨φ. Hence ⟨Π,τi,v⟩⊨{φ}π.
χ≡¬χ′, hence ρ(χ)≡¬ρ(χ): Follows directly from the induction hypothesis (I.H.)
χ≡χ1∨χ2, hence ρ(χ)≡ρ(χ1)∨ρ(χ2): Follows directly from the I.H.
χ≡χ1Sχ2, hence ρ(χ)≡(ck→ρ(χ1))S(ck∧ρ(χ2)): We write j(u) for the greatest time-point in s where τj(u)=u. By the definition of interleavings, such a time-point exists for all u≤τi. Specifically, j is a monotone map, and j(τi)=i since ⟨s,i,v⟩⊨ck. Conversely, ⟨s,j(u),v⟩⊨ck for all u≤τi.
χ≡t.χ′, hence ρ(χ)≡t.ρ(χ): Follows from the I.H. by instantiating v with v(t↦τi).
▶ Lemma 18. χ is satisfiable iff ζ∧ρ(χ~) is satisfiable. The size of ζ∧ρ(χ~) is O(nm⋅∣χ′∣).
Proof. ⟹ Suppose that S⊨χ. Using Lemma A.10, obtain an assignment Π of traces to the trace variables {π1,…,πn} such that img(Π) is aligned and
⟨img(Π),Π,τ(img(Π)),∅⟩⊨χ~.
Since img(Π) is finite, we can use Lemma A.13 to obtain an interleaving img(Π)∞=(σ,δ) satisfying ζ. Let ℓ=∣img(Π)∞∣−1; note that τℓ=τ(img(Π)) and ⟨img(Π)∞,ℓ,∅⟩⊨ck by Definition A.11. Using Lemma A.15,
⟨img(Π),Π,τ(img(Π)),∅⟩⊨χ~⟺⟨img(Π)∞,ℓ,∅⟩⊨ρ(χ~),
XX:26 Policy Change for Treelike Monitors
i.e., img(Π)∞ satisfies ρ(χ~) as well.
⇐ Suppose that s is a non-empty trace such that ⟨s,∣s∣−1,∅⟩⊨ζ∧ρ(χ~). By Lemma A.12, the trace is an interleaving of its projections under {π1,…,πn}. Let Π map πi to prjπi(s) for all i∈{1,…,n}. Note that all of these traces are aligned by Definition A.11. As before, the last timestamp in s is equal to τ(img(Π)) and ⟨s,∣s∣−1,∅⟩⊨ck. Hence ⟨img(Π),Π,τ(img(Π)),∅⟩⊨χ~ and χ is satisfiable using Lemmata A.15 and A.10.
Size: The size of χ~ is O(nm⋅∣χ′∣). Observe that the translation ρ adds a bounded number of symbols for every symbol in χ~. Hence, ∣ρ(χ~)∣ is linear in ∣χ~∣ and hence also in O(nm⋅∣χ′∣). Finally, the size of ζ is O(n).
Lemma 19. If χ is in 1-HyperpTPTL, then ζ∧ρ(χ~) is in 1-pTPTL.
Proof. Assume that χ is in 1-HyperpTPTL, i.e., χ uses only the time variables t and t′. Clearly, χ~ is in 1-HyperpTPTL too, since it contains exactly the same time variables as χ. The transformation ρ does not introduce new time variables, and ζ uses only t and t′, hence the conclusion.
▶ Corollary 20. Suppose that χ is a HyperpLTL formula without S operators. Then χ is satisfiable iff ρ′(χ~), which is a pLTL formula of size O(nm⋅∣χ′∣), is satisfiable.
Proof. A straightforward induction shows that ρ′(χ~) is in pLTL. The size bound follows by the same argument as in the proof of Lemma 18.
HyperpLTL formulae without S are invariant under transformations of the traces' timestamps, as long as monotonicity per trace and the alignment of all traces are preserved. We therefore assume without loss of generality that all timestamps are 0 in the remainder of this proof. (The semantics of HyperpLTL is formally defined on timestamps, not time-points, and hence we continue to assume that traces are equipped with timestamps.) We also omit the mapping v of time variables to timestamps in the semantics as it is not used by the fragment.
It remains to show the correctness of the reduction. To this end, we introduce a simplified version of interleaving that omits all constraints related to timestamps, as these are irrelevant for non-metric formulae. Specifically, we call s a non-metric interleaving of S if it satisfies condition (4) of Definition A.11. We now justify the analogues of the preceding lemmata:
Every non-empty trace is trivially a non-metric interleaving of its projections (cf. Lemma A.12).
For every finite, non-empty set S of traces, there exists a non-metric interleaving S∞. This is a direct corollary of Lemma A.13.
Let s be a non-metric interleaving of S. Then ⟨prjπ(s),i⟩⊨φ iff ⟨s,j⟩⊨ρπ(φ), where j is the time-point of the i-th event in s satisfying tpπ. All relevant cases of Lemma A.14's proof (i.e., excluding atoms t1−t2≤c and t≤c, as well as freeze quantifiers) apply to non-metric interleavings as they only depend on the relationship between the interleaving and its projections.
Let χ be a HyperpLTL formula over trace variables {π1,…,πn} and without trace quantifiers or S. Let s be a non-metric interleaving of img(Π). Then ⟨img(Π),Π,0⟩⊨χ iff ⟨s,∣s∣−1⟩⊨ρ′(χ). The only case out of the relevant ones that is different from Lemma A.15 is the one for χ≡{φ}π.
Suppose that ⟨img(Π),Π,0⟩⊨{φ}π. Thus ⟨Π(π),j⟩⊨φ, where j is the last time-point in Π(π). We have Π(π)=prjπ(s) because s is a (non-metric) interleaving of img(Π). Using the modified Lemma A.14 from above, it follows that ⟨s,k⟩⊨ρπ(φ), where k is the j-th time-point in s satisfying tpπ. Moreover, there cannot be any k′>k satisfying
XX:27
tpπ, because this would contradict the fact that j was maximal in prjπ(s). It follows that ⟨s,∣s∣−1⟩⊨¬tpπS(tpπ∧ρπ(φ)).
For the converse direction, suppose that ⟨s,∣s∣−1⟩⊨ρ′(χ). Hence we obtain j≤∣s∣−1 where ⟨s,j⟩⊨tpπ∧ρπ(φ), and there is no time-point k∈{j+1,…,∣s∣−1} satisfying tpπ. Let π(j) be the time-point in prjπ(s)=Π(π) corresponding to j. By a similar argument as before, this is the last time-point in the projection, and ⟨prjπ(s),π(j)⟩⊨φ. Hence ⟨img(Π),Π,0⟩⊨{φ}π.
The rest of the proof is similar to Lemma 18, except that ζ and ck are not needed for non-metric interleavings.
► Theorem 22. POLICYCHANGE for pMTL over real-time semantics has a non-primitive recursive lower bound.
Proof. Assume an arbitrary pMTL formula φ as the instance for the satisfiability problem. We then consider the POLICYCHANGE instance to be (∙φ,∙(φ∧A)) where A is a fresh proposition not present in φ. As established in Theorem 21, POLICYCHANGE yields 1 iff
is valid. If φ is unsatisfiable, then the above formula would be semantically equivalent to ↕φ→true, which is valid. If φ is satisfiable, we must show that
is satisfiable. Consider the trace s0=(σ,δ) such that ⟨s0,∣s0∣−1⟩⊨φ. Without loss of generality, we may assume that s0 only contains predicates occurring in φ. We construct the trace s0′=(σ′,δ) where σ′=σ0…σ∣s∣−1(σ∣s∣∪{A}). Since A is a fresh variable not occurring in φ, it immediately follows that for any arbitrary pMTL formula φ′ which does not contain the proposition A,
s0⊨φ′iffs0′⊨φ′(3)
or equivalently, {s0,s0′}⊨∀π,π′.{φ′}π↔{φ′}π′.
It remains to show that {s0,s0′}⊨↕φ. We proceed by structural induction on φ.
φ≡true or φ≡P: It trivially holds.
φ≡¬φ1 or φ≡↕(∙0φ): Since ↕φ=↕φ1, it follows from our induction hypothesis.
φ≡φ1∨φ2 or φ≡↕(φ1S0φ2): By our hypothesis, {s0,s0′}⊨↕φ1 and {s0,s0′}⊨↕φ2. Hence, {s0,s0′}⊨↕φ1∧↕φ2.
φ≡∙Iφ1 if I=∅: Since φ1 is a subformula of φ, using Equation 3 and our hypothesis, it follows that {s0,s0′}⊨↕φ1∧∀π,π′. {φ1}π↔{φ1}π′.
φ≡↕(φ1S[a,b]φ2): Since the formula φ1S[a,b]−dφ2 does not contain A, for d∈{0,…,b}, once again using Equation 3 and our hypothesis, it follows that
► Theorem 27. POLICYCHANGE* for pLTL is in EXPSPACE.
Proof. Let M be a generic monitor. Without loss of generality, each Mφ can be constructed from a Büchi automaton Aφ=⟨Qφ,q0φ,μφ,Fφ⟩ recognizing φ by defining yφ from the set of accepting states Fφ as yφ(q,s)=if μφ(q,s)∈Fφ then 1 else 0. Still without loss of generality, such an automaton can be assumed to have O(2∣φ∣) states [23]. A straightforward induction on the length of s in Definition 25 shows that there exists C implementing policy change from φ1 to φ2 iff there exists a morphism K:Qφ1→Qφ2 such that
Functions from Qφ1 to Qφ2 can be enumerated using O(∣Qφ1∣log(∣Qφ2∣))=O(e∣φ1∣⋅∣φ2∣) space and the two properties of K checked with the same space complexity. Hence, POLICYCHANGE* is in EXPSPACE.
References
1 Rajeev Alur and Thomas A. Henzinger. Real-time logics: Complexity and expressiveness. Inf. Comput., 104(1):35–77, 1993. doi:10.1006/inco.1993.1025.
2 Rajeev Alur and Thomas A. Henzinger. A really temporal logic. J. ACM, 41(1):181–204, 1994. doi:10.1145/174644.174651.
3 David Basin, Bhargav Nagaraja Bhatt, Srdan Krstić, and Dmitriy Traytel. Almost event-rate independent monitoring. Formal Methods Syst. Des., 54(3):449–478, 2019. doi:10.1007/s10703-018-00328-3.
4 David Basin, Felix Klaedtke, Samuel Müller, and Eugen Zälinescu. Monitoring metric first-order temporal properties. J. ACM, 62(2):15:1–15:45, 2015. doi:10.1145/2699444.
5 Borzoo Bonakdarpour, Jyotirmoy V. Deshmukh, and Miroslav Pajic. Opportunities and challenges in monitoring cyber-physical systems security. In Tiziana Margaria and Bernhard Steffen, editors, 8th Int. Symp. on Leveraging Applications of Formal Methods, Verification and Validation (IsoLA 2018), Part IV, volume 11247 of LNCS, pages 9–18. Springer, 2018. doi:10.1007/978-3-030-03427-6\2.
6 Marc Carwehl, Thomas Vogel, Genaína Nunes Rodrigues, and Lars Grunske. Runtime verification of self-adaptive systems with changing requirements. In 18th IEEE/ACM Symp. on Software Engineering for Adaptive and Self-Managing Systems (SEAMS 2023), pages 104–114. IEEE, 2023. doi:10.1109/SEAMS59076.2023.00024.
7 Michael R. Clarkson, Bernd Finkbeiner, Masoud Koleini, Kristopher K. Micinski, Markus N. Rabe, and César Sánchez. Temporal logics for hyperproperties. In Martín Abadi and Steve Kremer, editors, 3rd Int. Conf. on Principles of Security and Trust (POST 2014), volume 8414 of LNCS, pages 265–284. Springer, 2014. doi:10.1007/978-3-642-54792-8\15.
8 Michael R. Clarkson and Fred B. Schneider. Hyperproperties. J. Comput. Secur., 18(6):1157–1210, 2010. doi:10.3233/JCS-2009-0393.
9 Martin S. Feather, Stephen Fickas, Axel van Lamsweerde, and Christophe Ponsard. Reconciling system requirements and runtime behavior. In 9th Int. Workshop on Software Specification and Design (IWSSD 1998), pages 50–59. IEEE Computer Society, 1998. doi:10.5555/857205.858297.
XX:29
10 Bernd Finkbeiner and Christopher Hahn. Deciding hyperproperties. In Joséée Desharnais and Radha Jagadeesan, editors, 27th Int. Conf. on Concurrency Theory (CONCUR 2016), volume 59 of LIPIcs, pages 13:1–13:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2016. doi:10.4230/LIPIcs.CONCUR.2016.13.
11 Carlo Ghezzi, Joel Greenyer, and Valerio Panzica La Manna. Synthesizing dynamically updating controllers from changes in scenario-based specifications. In Hausi A. Müller and Luciano Baresi, editors, 7th Int. Symp. on Software Engineering for Adaptive and Self-Managing Systems (SEAMS 2012), pages 145–154. IEEE Computer Society, 2012. doi:10.1109/SEAMS.2012.6224401.
12 Giuseppe De Giacomo and Moshe Y. Vardi. Linear temporal logic and linear dynamic logic on finite traces. In Francesca Rossi, editor, 23rd Int. Joint Conf. on Artificial Intelligence (IJCAI 2013), pages 854–860. IJCAI/AAAI, 2013.
13 Christoph Haase, Joël Ouaknine, and James Worrell. On Process-Algebraic Extensions of Metric Temporal Logic, pages 283–300. Springer London, London, 2010. doi:10.1007/978-1-84882-912-1_13.
14 Klaus Havelund, Doron Peled, and Dogan Ulus. First-order temporal logic monitoring with BDDs. Formal Methods Syst. Des., 56(1):1–21, 2020. doi:10.1007/s10703-018-00327-4.
15 Hsi-Ming Ho, Ruoyu Zhou, and Timothy M. Jones. Timed hyperproperties. Inf. Comput., 280:104639, 2021. doi:10.1016/j.ic.2020.104639.
16 Ron Koymans. Specifying real-time properties with metric temporal logic. Real Time Syst., 2(4):255–299, 1990. doi:10.1007/BF01995674.
17 François Laroussinie, Nicolas Markey, and Ph Schoebelen. Efficient timed model checking for discrete-time systems. Theoretical Computer Science, 353(1-3):249–271, 2006.
18 Leonardo Lima, Andrei Herasimau, Martin Raszyk, Dmitriy Traytel, and Simon Yuan. Explainable online monitoring of metric temporal logic. In Sriram Sankaranarayanan and Natasha Sharygina, editors, 29th Int. Conf. on Tools and Algorithms for the Construction and Analysis of Systems (TACAS 2023), Part II, volume 13994 of LNCS, pages 473–491. Springer, 2023. doi:10.1007/978-3-031-30820-8\28.
19 Joël Ouaknine and James Worrell. On the decidability and complexity of metric temporal logic over finite words. Logical Methods in Computer Science, 3, 2007.
20 Amir Pnueli and Aleksandr Zaks. PSL model checking and run-time verification via testers. In Jayadev Misra, Tobias Nipkow, and Emil Sekerinski, editors, 14th Int. Symp. on Formal Methods (FM 2006), volume 4085 of LNCS, pages 573–586. Springer, 2006. doi:10.1007/11813040\38.
21 Martin Raszyk, David Basin, Srdan Krstić, and Dmitriy Traytel. Multi-head monitoring of metric temporal logic. In Yu-Fang Chen, Chih-Hong Cheng, and Javier Esparza, editors, 17th Int. Symp. on Automated Technology for Verification and Analysis (ATVA 2019), volume 11781 of LNCS, pages 151–170. Springer, 2019. doi:10.1007/978-3-030-31784-3\9.
22 Prasanna Thati and Grigore Roșu. Monitoring algorithms for metric temporal logic specifications. In Klaus Havelund and Grigore Roșu, editors, 4th Workshop on Runtime Verification (RV@ETAPS 2004), volume 113 of Electronic Notes in Theoretical Computer Science, pages 145–162. Elsevier, 2004. doi:10.1016/j.entcs.2004.01.029.
23 Yih-Kuen Tsay and Moshe Y Vardi. From linear temporal logics to büchi automata: the early and simple principle. In Model Checking, Synthesis, and Learning: Essays Dedicated to Bengt Jonsson on The Occasion of His 60th Birthday, pages 8–40. Springer, 2022.
24 Simon Yuan. Policy change in MonPoly. Master's thesis, ETH Zurich, Switzerland, 2022.