Research Notebook. Linear-time temporal properties [ltp-0001]
DefinitionTraces and behaviours [ltp-0002]
Let the set of all possible states be \Sigma . Note that we do not require that \Sigma is finite. Then, \Sigma ^\ast is the set of finite sequences of states. We denote the empty sequence as \varepsilon . The concatenation of two sequences t and u is written tu.
The set of all behaviours — infinite sequences of states — is \Sigma ^\omega . We define \sigma {}t = \sigma when the sequence \sigma is infinite. We say that t is a prefix of u (or u is an extension of t) iff there exists some w such that tw = u.
We shall model terminating systems, which have finite behaviours, as behaviours that infinitely repeat their final state.
DefinitionProperties [ltp-0003]
A property, being a specification of a system, can be thought of as simply a set of behaviours, i.e. a subset of the space \Sigma ^\omega {}. A property is satisfied by a system if all behaviours exhibited by the system are contained within the set. It is violated by a system if there exists a behaviour exhibited by the system that is not contained within the set.
The complement of a property, written P^\complement , is the set of all behaviours that violate the property P, i.e. \Sigma ^\omega \setminus P.
Concerning safety properties
DefinitionSafety properties [ltp-0004]
A safety property says that a bad thing does not happen. The "bad thing" in this case is some finite, observable event. In other words, safety properties are those properties whose violation can be established by examining only a finite prefix of the behaviour.
For example, the safety property "The state \mathtt {a} is never reached" is violated by any finite prefix containing the state \mathtt {a}.
DefinitionBad prefixes [ltp-000B]
For a property P, the bad prefixes of P are those finite prefixes t \in \Sigma ^\ast from which the violation of P can be established, i.e. \forall \sigma \in \Sigma ^\omega .\ t\sigma \notin P.
A property P is a safety property iff all violating behaviours are extensions of bad prefixes.
TheoremTrivial properties are safety properties [ltp-000A]
The empty property \emptyset and the property \Sigma ^\omega are both safety properties.
Proof.
The property \Sigma ^\omega has no violating behaviours, so vacuously all violations can be established by finite prefixes.
For the property \emptyset , all behaviours are violating, so the empty prefix \varepsilon is a bad prefix.
TheoremSafety properties are closed under finite union [ltp-0009]
The union of any two safety properties is a safety property.
Proof.
Let P and Q be safety properties. Take any violating behaviour \sigma \notin P \cup Q. Then, \sigma \notin P and \sigma \notin Q. Since P and Q are safety properties, there exist finite prefixes t and u of \sigma such that no extension of t is in P and no extension of u is in Q. Let v be the longer of t and u; then v is still a prefix of \sigma . Any extension of v is also an extension of both bad prefixes t and u, so it is in neither in P nor Q, and hence not in P \cup Q. Thus the violation of P can be established just by examining the bad prefix v, so P \cup Q is a safety property.
CounterexampleSafety properties are not closed under infinite union [ltp-000E]
Consider the family of properties P_{i \in \mathbb {N}} = \{ \sigma \in \Sigma ^\omega \mid \sigma _i = \texttt {a}\}, i.e. the property where the ith state is \texttt {a}. Each P_i is a safety property, as all violating behaviours are extensions of bad prefixes of length i. Their union \bigcup _{i \in \mathbb {N}} P_i, however, is not a safety property, as any finite prefix can be extended to a good prefix by appending an \texttt {a}-state, and therefore cannot be a bad prefix.
TheoremSafety properties are closed under intersection [ltp-0008]
For a (possibly infinite) collection of properties P_{i \in I}, if every P_i is a safety property then \bigcap _{i \in I} P_i is a safety property.
Proof.
Concerning guarantee properties
DefinitionGuarantee properties [ltp-0005]
A guarantee (or cosafety) property is the complement of a safety property. A guarantee property says that a good thing happens eventually. As with safety properties, the "good thing" is some finite, observable event. In other words, guarantee properties are those properties whose satisfaction can be established by examining only a finite prefix of the behaviour.
For example, the guarantee property "The state \mathtt {a} is eventually reached" is satisfied by any finite prefix containing the state \mathtt {a}.
Leslie Lamport originally called these liveness properties, but we use the more popular definition of that term from Alpern and Schneider.
DefinitionGood prefixes [ltp-000D]
For a property P, the good prefixes of P are those finite prefixes t \in \Sigma ^\ast from which the satisfaction of P can be established, i.e. \forall \sigma \in \Sigma ^\omega .\ t\sigma \in P.
A property P is a guarantee property iff all satisfying behaviours are extensions of good prefixes.
TheoremTrivial properties are guarantee properties [ltp-000C]
The empty property \emptyset and the property \Sigma ^\omega are both guarantee properties.
Proof.
Follows from Theorem [ltp-000A] as the complement of any safety property is a guarantee property.
TheoremGuarantee properties are closed under finite intersection [ltp-000G]
The intersection of any two guarantee properties is a guarantee property.
Proof.
Let P and Q be guarantee properties. Then P^\complement and Q^\complement are safety properties. By Theorem [ltp-0009] their union P^\complement \cup Q^\complement is a safety property and thus its complement (P^\complement \cup Q^\complement )^\complement = P \cap Q is a guarantee property.
CounterexampleGuarantee properties are not closed under infinite intersection [ltp-000H]
Consider the family of properties P_{i \in \mathbb {N}} = \{ \sigma \in \Sigma ^\omega \mid \sigma _i \neq \texttt {a}\}, i.e. the property where the ith state is not \texttt {a}. Each P_i is a guarantee property, as all satisfying behaviours are extensions of good prefixes ending in a non-\mathtt {a} state of length i. Their intersection \bigcap _{i \in \mathbb {N}} P_i, however, is not a guarantee property, as any finite prefix can be extended to a bad prefix by appending an \texttt {a}-state, and therefore cannot be a good prefix.
TheoremGuarantee properties are closed under union [ltp-000F]
For a (possibly infinite) collection of properties P_{i \in I}, if every P_i is a guarantee property then \bigcup _{i \in I} P_i is a guarantee property.
Proof.
Let P_{i \in I} be a (possibly infinite) family of guarantee properties. Then each P_i^\complement is a safety property and therefore \bigcap _{i \in I} P_i^\complement is a safety property by Theorem [ltp-0008]. Its complement (\bigcap _{i \in I} P_i^\complement )^\complement = \bigcup _{i \in I} P_i is therefore a guarantee property.
Properties as a topological space
ConstructionBehaviours as topology [ltp-0007]
- (from Defining Liveness)
The space \Sigma ^\omega {} forms a topology where safety properties are the closed sets and guarantee properties are the open sets. This follows from Theorem [ltp-000C], Theorem [ltp-000G], and Theorem [ltp-000F] (or, equivalently, from Theorem [ltp-000A], Theorem [ltp-0009] and Theorem [ltp-0008]).
DefinitionGuarantee kernel [ltp-000I]
- (from The Infinite, in Finite Time)
Given a property P \subseteq \Sigma ^\omega , the guarantee kernel of P, written \underline {P}, is the largest subset of P which is a guarantee property. That is, \underline {P} is the set of all infinite extensions of the good prefixes of P.
It follows that P is a guarantee property iff \underline {P} = P.
This is a kernel operator, so it is co-extensive (\underline {P} \subseteq P), idempotent (\underline {\underline {P}} = \underline {P}), and monotonic (P \subseteq R implies \underline {P} \subseteq \underline {R}).
Topologically speaking, the guarantee kernel is the interior operator.
Intuitively, the guarantee kernel of P is all behaviours for which some finite prefix extended in any way will get into P.
TheoremGuarantee kernel distributes over finite intersection [ltp-000N]
- (from The Infinite, in Finite Time)
The guarantee kernel distributes over binary intersection, i.e. \underline {P} \cap \underline {R} = \underline {P \cap R}
Proof.
Showing each direction separately:
- \underline {P} \cap \underline {R} \subseteq \underline {P \cap R}: Let \sigma be a behaviour in \underline {P} \cap \underline {R}. There must exist a prefix t of \sigma which is a good prefix for P, and a prefix u of \sigma which is a good prefix for R. Because both t and u are prefixes of \sigma , either t is a prefix of u or u is a prefix of t. If t is a prefix of u, then u must also be a good prefix for P \cap R and thus \sigma \in \underline {P \cap R}. Likewise for t when u is a prefix of t.
- \underline {P} \cap \underline {R} \supseteq \underline {P \cap R}: Follows from monotonicity of guarantee kernel.
CounterexampleGuarantee kernel does not distribute over infinite intersection [ltp-000P]
Follows from Counterexample [ltp-000H]. As each P_i is a guarantee property, the guarantee kernel of each P_i is just P_i. But the guarantee kernel of their infinite intersection \bigcap _{i \in \mathbb {N}} P_i is \empty .
CounterexampleGuarantee kernel does not distribute over union [ltp-000O]
- (from The Infinite, in Finite Time)
Take the properties P = \{ \sigma \mid \texttt {a}\ \text {occurs infinitely often in}\ \sigma \} and R = \{ \sigma \mid \texttt {a}\ \text {occurs finitely many times in}\ \sigma \}. Both have an empty guarantee kernel, i.e. \underline {P} = \underline {R} = \emptyset , however P \cup R = \Sigma ^\omega so the guarantee kernel of the union is \Sigma ^\omega , not \emptyset .
DefinitionSafety closure [ltp-000J]
- (from Defining Liveness)
Given a property P \subseteq \Sigma ^\omega , the safety closure of P, written \overline {P}, is the smallest superset of P which is a safety property. It is the dual of the guarantee kernel, so \underline {P^\complement } = \overline {P}^\complement . This means that the safety closure of P contains all behaviours which cannot be shown to violate P by a finite bad prefix.
It follows that P is a safety property iff \overline {P} = P.
This is a closure operator, so it is extensive (\overline {P} \supseteq P), idempotent (\overline {\overline {P}} = \overline {P}), and monotonic (P \subseteq R implies \overline {P} \subseteq \overline {R}).
Topologically speaking, the safety closure is the (limit-)closure.
Intuitively, the safety closure of P is all behaviours for which any finite prefix extended in some way will get into P.
TheoremSafety closure distributes over finite union [ltp-000Q]
The safety closure distributes over binary union, i.e. \overline {P} \cup \overline {R} = \overline {P \cup R}
Proof.
CounterexampleSafety closure does not distribute over infinite union [ltp-000R]
Follows from Counterexample [ltp-000E]. As each P_i is a safety property, the safety closure of each P_i is just P_i. But the safety closure of their infinite union \bigcup _{i \in \mathbb {N}} P_i is \Sigma ^\omega .
CounterexampleSafety closure does not distribute over intersection [ltp-000S]
Take the properties P = \{ \sigma \mid \texttt {a}\ \text {occurs infinitely often in}\ \sigma \} and R = \{ \sigma \mid \texttt {a}\ \text {occurs finitely many times in}\ \sigma \}. Both have a safety closure of \Sigma ^\omega , i.e. \overline {P} = \overline {R} = \Sigma ^\omega , however P \cap R = \emptyset so the safety closure of the intersection is \emptyset , not \Sigma ^\omega .
TheoremA metric space of properties [ltp-000M]
The topological space of properties is a metric space by the following metric, standard for Cantor or Baire spaces:
d(\sigma ,\rho ) = \begin {cases} 0 & \text {if}\ \sigma = \rho \\ 2^{-\!\sup \{\ \ell \ \mid \ \forall i < \ell .\ \sigma _i = \rho _i\}} & \text {otherwise}\end {cases}The function d is a valid metric as d(\sigma ,\rho ) = 0 iff \sigma = \rho , d is symmetric, and the triangle inequality holds: d(\sigma ,\rho ) \leq d(\sigma ,\tau ) + d(\tau ,\rho )
Proof.
- \implies \!: Assume P is a guarantee property. Let \sigma \in P. Then, because P is guarantee, there must exist some finite prefix p of \sigma which is good for P, i.e. all extensions of p are in P. Set r = |p| - 1 and \varepsilon = 2^{-r}. Then the metric ball of radius \varepsilon , i.e. \{ u \mid d(t,u) < \varepsilon \}, is the set of all infinite extensions of p, because d(\sigma ,\rho ) < 2^{-r} iff \sigma and \rho agree for a prefix of length r + 1 — that is, p. Since \sigma was arbitrary, this shows that \forall \sigma \in P.\ \exists \varepsilon > 0.\ \{ \rho \mid d(\sigma ,\rho ) < \varepsilon \} \subseteq P as required.
- \impliedby \!: Assume P is open in the metric topology, i.e. that \forall \sigma \in P.\ \exists \varepsilon > 0.\ \{ \rho \mid d(\sigma ,\rho ) < \varepsilon \} \subseteq P. We shall show that P is a guarantee property, by showing that it is contained in its guarantee kernel P \subseteq \underline {P}. Assume \sigma \in P. Let \varepsilon > 0 be such that \{ \rho \mid d(\sigma ,\rho ) < \varepsilon \} \subseteq P . By the Archimedean property, there must be some natural number r such that 2^{-r} < \varepsilon . The ball of radius 2^{-r}, i.e. \{ \rho \mid d(\sigma ,\rho ) < 2^{-r} \} is therefore contained within the ball of radius \varepsilon , which, by our openness assumption, must in turn be contained within P. Because d(\sigma ,\rho ) < 2^{-r} iff \sigma and \rho agree for a prefix of length r + 1, let p be a prefix of \sigma of length r + 1. Then the ball of radius 2^{-r} is exactly all infinite extensions of p. As our openness assumption says that this ball is a subset of P, all infinite extensions of p are therefore in P and thus p is a good prefix of P. This shows, as \sigma was arbitrary, that all \sigma \in P are the extension of some good prefix, and therefore that \sigma \in \underline {P}. Therefore P \subseteq \underline {P} and {P} is a guarantee property.
Concerning liveness properties
DefinitionLiveness properties [ltp-0006]
A liveness property says that a good thing happens eventually, but unlike guarantee properties, the "good thing" need not be some finite, observable event. Rather, liveness properties are those properties whose violation cannot be established by examining only a finite prefix of the behaviour. In other words, P is a liveness property iff for any finite prefix t \in \Sigma ^\ast , there exists an infinite extension \sigma \in \Sigma ^\omega such that t\sigma is in the property P.
For example, the property "Every \mathtt {r}equest state is eventually followed by an \mathtt {a}nswer state" is a liveness property: No matter how many unanswered \mathtt {r}equests are in a finite prefix, we could always see the \mathtt {a}nswer in the future.
TheoremLiveness properties are dense [ltp-000K]
- (from Defining Liveness)
In the topology of properties, a property P is a liveness property iff P is dense. In other words, when the safety closure \overline {P} = \Sigma ^\omega .
Proof.
If \sigma \in \overline {P} that means no finite prefix of \sigma can be used to rule out P, i.e. every prefix of \sigma can be extended in some way to a behaviour in P. If \overline {P} = \Sigma ^\omega , this means that every finite prefix can be extended to a behaviour in P, which is exactly the definition of a liveness property.
TheoremLiveness properties are closed under union [ltp-000T]
For a (possibly infinite) collection of properties P_{i \in I}, if every P_i is a liveness property then \bigcup _{i \in I} P_i is a liveness property.
Proof.
Let P_{i \in I} be a family of liveness properties. Because liveness properties are dense, for any i, \overline {P_i} = \Sigma ^\omega . As safety closure is monotonic, \Sigma ^\omega \subseteq \overline {\bigcup _{i \in I} P_i }. Therefore the union is dense \overline {\bigcup _{i \in I} P_i } = \Sigma ^\omega and therefore a liveness property.
CounterexampleLiveness properties are not closed under intersection [ltp-000U]
Take the properties P = \{ \sigma \mid \texttt {a}\ \text {occurs infinitely often in}\ \sigma \} and R = \{ \sigma \mid \texttt {a}\ \text {occurs finitely many times in}\ \sigma \}. Both are liveness properties, i.e. dense (\overline {P} = \overline {R} = \Sigma ^\omega ), however P \cap R = \emptyset which is not a liveness property (as \overline {\emptyset } = \emptyset not \Sigma ^\omega ).
TheoremSafety-liveness decomposition [ltp-000L]
- (from Defining Liveness)
Every property is the intersection of a safety and a liveness property.
Proof.
Let P be a property. Then, let L = (\overline {P} \setminus P)^\complement . Then:
\begin {array}{lcl} L \cap \overline {P} & = & (\overline {P} \setminus P)^\complement \cap \overline {P} \\ & = & (\overline {P}^\complement \cup P) \cap \overline {P} \\ & = & (\overline {P}^\complement \cap \overline {P}) \cup (P \cap \overline {P}) \\ & = & \emptyset \cup (P \cap \overline {P}) \\ & = & P \end {array}The set \overline {P} is clearly closed and therefore a safety property. It remains to show that L is dense (and therefore a liveness property).
Assume for contradiction that A = (\overline {P}\setminus P)^\complement is not dense, so there exists \sigma \in \Sigma ^\omega such that \sigma \notin \overline {A}. By our definition of safety closure, some finite prefix u of \sigma is a bad prefix of A, meaning no extension of u lies in A. Hence every extension of u lies in \overline {P} \setminus P, i.e. every extension of u lies in \overline {P} but not in P. Because every extension of u lies in \overline {P}, u cannot finitely refute P, so every extension of u must be extendable to some trace in P, contradicting that no extension of u lies in P. Therefore no such u exists, so every behaviour \sigma is in \overline {A}, and A is dense.
Concerning LTL
DefinitionLinear-time temporal logic [ltp-000V]
Properties are commonly written using linear-time temporal logic (LTL), a modal logic defined over behaviours. Given atomic propositions \mathsf {a} : \Sigma \rightarrow \mathbb {B}, the syntax for formulae is given by:
\begin {array}{lcl} \varphi , \psi &::=& \top \mid \bot \mid \mathsf {a} \mid \varphi \land \psi \mid \varphi \lor \psi \mid \neg \varphi \\ &\mid & \mathop {\raisebox {-0.2em}{\text {\Large ○}}} \varphi \mid \mathop {\raisebox {-0.2em}{\text {\Large ◇}}} \varphi \mid \mathop {\raisebox {-0.1em}{\text {\Large □}}} \varphi \mid \varphi \mathbin {\mathcal {U}} \psi \mid \varphi \mathbin {\mathcal {R}} \psi \end {array}To assign semantics, we compositionally map each formula to a property. Here the notation f^k indicates the self-composition of f k times, i.e. f^0(x)=x and f^{k+1}(x)=f^k(f(x)). The function \mathop {\triangleright }, the prepend operator, is defined as follows:
\mathop {\triangleright } X = \{ s\sigma \mid s \in \Sigma \land \sigma \in X \}\begin {array}{lcl} \llbracket \top \rrbracket &=& \Sigma ^\omega \\ \llbracket \bot \rrbracket &=& \emptyset \\ \llbracket \mathsf {a}\rrbracket &=& \{ \sigma \mid \mathsf {a}(\sigma _0) \} \\ \llbracket \varphi \land \psi \rrbracket &=& \llbracket \varphi \rrbracket \cap \llbracket \psi \rrbracket \\ \llbracket \varphi \lor \psi \rrbracket &=& \llbracket \varphi \rrbracket \cup \llbracket \psi \rrbracket \\ \llbracket \neg \varphi \rrbracket &=& \llbracket \varphi \rrbracket ^\complement \\ \llbracket \mathop {\raisebox {-0.2em}{\text {\Large ○}}} \varphi \rrbracket &=& \mathop {\triangleright }\llbracket \varphi \rrbracket \\ \llbracket \mathop {\raisebox {-0.2em}{\text {\Large ◇}}} \varphi \rrbracket &=& \bigcup _{i \in \mathbb {N}}\mathop {\triangleright }^i\llbracket \varphi \rrbracket \\ \llbracket \mathop {\raisebox {-0.1em}{\text {\Large □}}} \varphi \rrbracket &=& \bigcap _{i \in \mathbb {N}}\mathop {\triangleright }^i\llbracket \varphi \rrbracket \\ \llbracket \varphi \mathbin {\mathcal {U}} \psi \rrbracket &=& \bigcup _{i \in \mathbb {N}}f^k(\llbracket \psi \rrbracket )\text {, where}\ f(X) = \mathop {\triangleright } X \cap \llbracket \varphi \rrbracket \\ \llbracket \varphi \mathbin {\mathcal {R}} \psi \rrbracket &=& \bigcap _{i \in \mathbb {N}}f^k(\llbracket \psi \rrbracket )\text {, where}\ f(X) = \mathop {\triangleright } X \cup \llbracket \varphi \rrbracket \\ \end {array}These semantics are sometimes written in terms of a satisfaction relation like \sigma \models \varphi . This notation is equivalent to our \sigma \in \llbracket \varphi \rrbracket .
A minimal fragment of LTL [ltp-000W]
All of the connectives linear-time temporal logic can be constructed from the following minimal fragment (among others:)
\begin {array}{lcl} \varphi , \psi &::=& \top \mid \mathsf {a} \mid \varphi \land \psi \mid \neg \varphi \mid \mathop {\raisebox {-0.2em}{\text {\Large ○}}} \varphi \mid \varphi \mathbin {\mathcal {U}} \psi \end {array}The remaining connectives can be derived by using the following identities:
- \bot \equiv \neg \top
- \varphi \lor \psi \equiv \neg (\neg \varphi \land \neg \psi )
- \mathop {\raisebox {-0.2em}{\text {\Large ◇}}} \varphi \equiv \top \mathbin {\mathcal {U}} \varphi
- \mathop {\raisebox {-0.1em}{\text {\Large □}}} \varphi \equiv \neg \mathop {\raisebox {-0.2em}{\text {\Large ◇}}} \neg \varphi
- \varphi \mathbin {\mathcal {R}} \psi \equiv \neg (\neg \varphi \mathbin {\mathcal {U}} \neg \psi )
Concerning decision properties
DefinitionDecision properties [ltp-000X]
- (from The Infinite, in Finite Time)
A decision property (called strong monitorable by Amjad et al.) is a property for which both confirmation and refutation only require a finite prefix. In other words, decision properties are the intersection of a safety and guarantee property. This makes decision properties the clopen sets in our topology. A simple characterisation from topology is that P is a decision property iff \overline {P}=\underline {P}.
TheoremDecision properties are closed under complement [ltp-000Y]
If P is a decision property then so is P^\complement .
Proof.
We know that \overline {P}=\underline {P}. Then, from the definition of safety closure, we have:: \begin {array}{lcl} \overline {P^\complement } & = & \underline {P}^\complement \\ & = & \overline {P}^\complement \\ & = & \underline {P^\complement }\end {array}
TheoremDecision properties are closed under finite union and intersection [ltp-000Z]
If P and Q are decision properties then so is P \cup Q and P \cap Q.
Proof.
We know that \overline {P}=\underline {P} and \overline {Q}=\underline {Q}. As safety closure distributes over finite union and the guarantee kernel is monotonic, we have: \begin {array}{lcl} \overline {P \cup Q} & = & \overline {P} \cup \overline {Q} \\ & = & \underline {P} \cup \underline {Q} \\ & \subseteq & \underline {P \cup Q} \\ & \subseteq & \overline {P \cup Q} \end {array}
As the inclusion ends up again at \overline {P\cup Q}, the inclusions must be equalities, and thus \overline {P \cup Q} = \underline {P \cup Q}. As decision properties are closed under complement, the proof for intersection follows from this straightforwardly.CounterexampleDecision properties are not closed under infinite union nor intersection [ltp-0010]
Follows from Counterexample [ltp-000E]. Each P_i is both a safety property and a guarantee property. Therefore, each P_i is a decision property. But the safety closure of their infinite union \bigcup _{i \in \mathbb {N}} P_i is the strictly larger set \Sigma ^\omega . Therefore, their infinite union is not even a safety property so certainly not a decision property.
Therefore, decision properties are not closed under infinite union. Because decision properties are closed under complement, they cannot be closed under infinite intersection either.
DefinitionObligation properties [ltp-0011]
An obligation property is comprised of (finite) boolean combinations of safety and guarantee properties. That is:
- Every guarantee property is an obligation property.
- If P is an obligation property, then P^\complement is an obligation property.
- If P and Q are obligation properties, then P \cap Q is an obligation property.
- If P and Q are obligation properties, then P \cup Q is an obligation property.
Topologically, this is called the constructible sets of our topology.