Computation tree logic

From HandWiki
Revision as of 16:15, 6 February 2024 by John Stpola (talk | contribs) (linkage)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Computation tree logic (CTL) is a branching-time logic, meaning that its model of time is a tree-like structure in which the future is not determined; there are different paths in the future, any one of which might be an actual path that is realized. It is used in formal verification of software or hardware artifacts, typically by software applications known as model checkers, which determine if a given artifact possesses safety or liveness properties. For example, CTL can specify that when some initial condition is satisfied (e.g., all program variables are positive or no cars on a highway straddle two lanes), then all possible executions of a program avoid some undesirable condition (e.g., dividing a number by zero or two cars colliding on a highway). In this example, the safety property could be verified by a model checker that explores all possible transitions out of program states satisfying the initial condition and ensures that all such executions satisfy the property. Computation tree logic belongs to a class of temporal logics that includes linear temporal logic (LTL). Although there are properties expressible only in CTL and properties expressible only in LTL, all properties expressible in either logic can also be expressed in CTL*.

CTL was first proposed by Edmund M. Clarke and E. Allen Emerson in 1981, who used it to synthesize so-called synchronisation skeletons, i.e abstractions of concurrent programs.

Syntax of CTL

The language of well-formed formulas for CTL is generated by the following grammar:

[math]\displaystyle{ \begin{align} \phi &::= \bot \mid \top \mid p \mid (\neg\phi) \mid (\phi\land\phi) \mid (\phi\lor\phi) \mid (\phi\Rightarrow\phi) \mid (\phi\Leftrightarrow\phi) \\ &\mid\quad \mbox{AX }\phi \mid \mbox{EX }\phi \mid \mbox{AF }\phi \mid \mbox{EF }\phi \mid \mbox{AG }\phi \mid \mbox{EG }\phi \mid \mbox{A }[\phi \mbox{ U } \phi] \mid \mbox{E }[\phi \mbox{ U } \phi] \end{align} }[/math]

where [math]\displaystyle{ p }[/math] ranges over a set of atomic formulas. It is not necessary to use all connectives – for example, [math]\displaystyle{ \{\neg, \land, \mbox{AX}, \mbox{AU}, \mbox{EU}\} }[/math] comprises a complete set of connectives, and the others can be defined using them.

  • [math]\displaystyle{ \mbox{A} }[/math] means 'along All paths' (inevitably)
  • [math]\displaystyle{ \mbox{E} }[/math] means 'along at least (there Exists) one path' (possibly)

For example, the following is a well-formed CTL formula:

[math]\displaystyle{ \mbox{EF }(\mbox{EG } p \Rightarrow \mbox{AF } r) }[/math]

The following is not a well-formed CTL formula:

[math]\displaystyle{ \mbox{EF }\big(r \mbox{ U } q\big) }[/math]

The problem with this string is that [math]\displaystyle{ \mathrm U }[/math] can occur only when paired with an [math]\displaystyle{ \mathrm A }[/math] or an [math]\displaystyle{ \mathrm E }[/math].

CTL uses atomic propositions as its building blocks to make statements about the states of a system. These propositions are then combined into formulas using logical operators and temporal operators.

Operators

Logical operators

The logical operators are the usual ones: ¬, ∨, ∧, ⇒ and ⇔. Along with these operators CTL formulas can also make use of the boolean constants true and false.

Temporal operators

The temporal operators are the following:

  • Quantifiers over paths
    • A Φ – All: Φ has to hold on all paths starting from the current state.
    • E Φ – Exists: there exists at least one path starting from the current state where Φ holds.
  • Path-specific quantifiers
    • X φ – Next: φ has to hold at the next state (this operator is sometimes noted N instead of X).
    • G φ – Globally: φ has to hold on the entire subsequent path.
    • F φ – Finally: φ eventually has to hold (somewhere on the subsequent path).
    • φ U ψ – Until: φ has to hold at least until at some position ψ holds. This implies that ψ will be verified in the future.
    • φ W ψ – Weak until: φ has to hold until ψ holds. The difference with U is that there is no guarantee that ψ will ever be verified. The W operator is sometimes called "unless".

In CTL*, the temporal operators can be freely mixed. In CTL, operators must always be grouped in pairs: one path operator followed by a state operator. See the examples below. CTL* is strictly more expressive than CTL.

Minimal set of operators

In CTL there are minimal sets of operators. All CTL formulas can be transformed to use only those operators. This is useful in model checking. One minimal set of operators is: {true, ∨, ¬, EG, EU, EX}.

Some of the transformations used for temporal operators are:

  • EFφ == E[trueU(φ)] ( because Fφ == [trueU(φ)] )
  • AXφ == ¬EXφ)
  • AGφ == ¬EFφ) == ¬ E[trueUφ)]
  • AFφ == A[trueUφ] == ¬EGφ)
  • A[φUψ] == ¬( E[(¬ψ)U¬(φψ)] ∨ EGψ) )

Semantics of CTL

Definition

CTL formulae are interpreted over transition systems. A transition system is a triple [math]\displaystyle{ \mathcal{M}=(S,{\rightarrow},L) }[/math], where [math]\displaystyle{ S }[/math] is a set of states, [math]\displaystyle{ {\rightarrow} \subseteq S \times S }[/math] is a transition relation, assumed to be serial, i.e. every state has at least one successor, and [math]\displaystyle{ L }[/math] is a labelling function, assigning propositional letters to states. Let [math]\displaystyle{ \mathcal{M}=(S,\rightarrow,L) }[/math] be such a transition model, with [math]\displaystyle{ s \in S }[/math], and [math]\displaystyle{ \phi \in F }[/math], where [math]\displaystyle{ F }[/math] is the set of well-formed formulas over the language of [math]\displaystyle{ \mathcal{M} }[/math].

Then the relation of semantic entailment [math]\displaystyle{ (\mathcal{M}, s \models \phi) }[/math] is defined recursively on [math]\displaystyle{ \phi }[/math]:

  1. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models \top \Big) \land \Big( (\mathcal{M}, s) \not\models \bot \Big) }[/math]
  2. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models p \Big) \Leftrightarrow \Big( p \in L(s) \Big) }[/math]
  3. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models \neg\phi \Big) \Leftrightarrow \Big( (\mathcal{M}, s) \not\models \phi \Big) }[/math]
  4. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models \phi_1 \land \phi_2 \Big) \Leftrightarrow \Big( \big((\mathcal{M}, s) \models \phi_1 \big) \land \big((\mathcal{M}, s) \models \phi_2 \big) \Big) }[/math]
  5. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models \phi_1 \lor \phi_2 \Big) \Leftrightarrow \Big( \big((\mathcal{M}, s) \models \phi_1 \big) \lor \big((\mathcal{M}, s) \models \phi_2 \big) \Big) }[/math]
  6. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models \phi_1 \Rightarrow \phi_2 \Big) \Leftrightarrow \Big( \big((\mathcal{M}, s) \not\models \phi_1 \big) \lor \big((\mathcal{M}, s) \models \phi_2 \big) \Big) }[/math]
  7. [math]\displaystyle{ \bigg( (\mathcal{M}, s) \models \phi_1 \Leftrightarrow \phi_2 \bigg) \Leftrightarrow \bigg( \Big( \big((\mathcal{M}, s) \models \phi_1 \big) \land \big((\mathcal{M}, s) \models \phi_2 \big) \Big) \lor \Big( \neg \big((\mathcal{M}, s) \models \phi_1 \big) \land \neg \big((\mathcal{M}, s) \models \phi_2 \big) \Big) \bigg) }[/math]
  8. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models AX\phi \Big) \Leftrightarrow \Big( \forall \langle s \rightarrow s_1 \rangle \big( (\mathcal{M}, s_1) \models \phi \big) \Big) }[/math]
  9. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models EX\phi \Big) \Leftrightarrow \Big( \exists \langle s \rightarrow s_1 \rangle \big( (\mathcal{M}, s_1) \models \phi \big) \Big) }[/math]
  10. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models AG\phi \Big) \Leftrightarrow \Big( \forall \langle s_1 \rightarrow s_2 \rightarrow \ldots \rangle (s=s_1) \forall i \big( (\mathcal{M}, s_i) \models \phi \big) \Big) }[/math]
  11. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models EG\phi \Big) \Leftrightarrow \Big( \exists \langle s_1 \rightarrow s_2 \rightarrow \ldots \rangle (s=s_1) \forall i \big( (\mathcal{M}, s_i) \models \phi \big) \Big) }[/math]
  12. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models AF\phi \Big) \Leftrightarrow \Big( \forall \langle s_1 \rightarrow s_2 \rightarrow \ldots \rangle (s=s_1) \exists i \big( (\mathcal{M}, s_i) \models \phi \big) \Big) }[/math]
  13. [math]\displaystyle{ \Big( (\mathcal{M}, s) \models EF\phi \Big) \Leftrightarrow \Big( \exists \langle s_1 \rightarrow s_2 \rightarrow \ldots \rangle (s=s_1) \exists i \big( (\mathcal{M}, s_i) \models \phi \big) \Big) }[/math]
  14. [math]\displaystyle{ \bigg( (\mathcal{M}, s) \models A[\phi_1 U \phi_2] \bigg) \Leftrightarrow \bigg( \forall \langle s_1 \rightarrow s_2 \rightarrow \ldots \rangle (s=s_1) \exists i \Big( \big( (\mathcal{M}, s_i) \models \phi_2 \big) \land \big( \forall (j \lt i) (\mathcal{M}, s_j) \models \phi_1 \big) \Big) \bigg) }[/math]
  15. [math]\displaystyle{ \bigg( (\mathcal{M}, s) \models E[\phi_1 U \phi_2] \bigg) \Leftrightarrow \bigg( \exists \langle s_1 \rightarrow s_2 \rightarrow \ldots \rangle (s=s_1) \exists i \Big( \big( (\mathcal{M}, s_i) \models \phi_2 \big) \land \big( \forall (j \lt i) (\mathcal{M}, s_j) \models \phi_1 \big) \Big) \bigg) }[/math]

Characterisation of CTL

Rules 10–15 above refer to computation paths in models and are what ultimately characterise the "Computation Tree"; they are assertions about the nature of the infinitely deep computation tree rooted at the given state [math]\displaystyle{ s }[/math].

Semantic equivalences

The formulae [math]\displaystyle{ \phi }[/math] and [math]\displaystyle{ \psi }[/math] are said to be semantically equivalent if any state in any model that satisfies one also satisfies the other. This is denoted [math]\displaystyle{ \phi \equiv \psi }[/math]

It can be seen that [math]\displaystyle{ \mathrm A }[/math] and [math]\displaystyle{ \mathrm E }[/math] are duals, being universal and existential computation path quantifiers respectively: [math]\displaystyle{ \neg \mathrm A\Phi \equiv \mathrm E \neg \Phi }[/math].

Furthermore, so are [math]\displaystyle{ \mathrm G }[/math] and [math]\displaystyle{ \mathrm F }[/math].

Hence an instance of De Morgan's laws can be formulated in CTL:

[math]\displaystyle{ \neg AF\phi \equiv EG\neg\phi }[/math]
[math]\displaystyle{ \neg EF\phi \equiv AG\neg\phi }[/math]
[math]\displaystyle{ \neg AX\phi \equiv EX\neg\phi }[/math]

It can be shown using such identities that a subset of the CTL temporal connectives is adequate if it contains [math]\displaystyle{ EU }[/math], at least one of [math]\displaystyle{ \{AX,EX\} }[/math] and at least one of [math]\displaystyle{ \{EG,AF,AU\} }[/math] and the boolean connectives.

The important equivalences below are called the expansion laws; they allow unfolding the verification of a CTL connective towards its successors in time.

[math]\displaystyle{ AG\phi \equiv \phi \land AX AG \phi }[/math]
[math]\displaystyle{ EG\phi \equiv \phi \land EX EG \phi }[/math]
[math]\displaystyle{ AF\phi \equiv \phi \lor AX AF \phi }[/math]
[math]\displaystyle{ EF\phi \equiv \phi \lor EX EF \phi }[/math]
[math]\displaystyle{ A[\phi U \psi] \equiv \psi \lor (\phi \land AX A [\phi U \psi]) }[/math]
[math]\displaystyle{ E[\phi U \psi] \equiv \psi \lor (\phi \land EX E [\phi U \psi]) }[/math]

Examples

Let "P" mean "I like chocolate" and Q mean "It's warm outside."

  • AG.P
"I will like chocolate from now on, no matter what happens."
  • EF.P
"It's possible I may like chocolate some day, at least for one day."
  • AF.EG.P
"It's always possible (AF) that I will suddenly start liking chocolate for the rest of time." (Note: not just the rest of my life, since my life is finite, while G is infinite).
  • EG.AF.P
"Depending on what happens in the future (E), it's possible that for the rest of time (G), I'll be guaranteed at least one (AF) chocolate-liking day still ahead of me. However, if something ever goes wrong, then all bets are off and there's no guarantee about whether I'll ever like chocolate."

The two following examples show the difference between CTL and CTL*, as they allow for the until operator to not be qualified with any path operator (A or E):

  • AG(PUQ)
"From now until it's warm outside, I will like chocolate every single day. Once it's warm outside, all bets are off as to whether I'll like chocolate anymore. Oh, and it's guaranteed to be warm outside eventually, even if only for a single day."
  • EF((EX.P)U(AG.Q))
"It's possible that: there will eventually come a time when it will be warm forever (AG.Q) and that before that time there will always be some way to get me to like chocolate the next day (EX.P)."

Relations with other logics

Computation tree logic (CTL) is a subset of CTL* as well as of the modal μ calculus. CTL is also a fragment of Alur, Henzinger and Kupferman's alternating-time temporal logic (ATL).

Computation tree logic (CTL) and linear temporal logic (LTL) are both a subset of CTL*. CTL and LTL are not equivalent and they have a common subset, which is a proper subset of both CTL and LTL.

  • FG.P exists in LTL but not in CTL.
  • AG(P⇒((EX.Q)∧(EX¬Q))) and AG.EF.P exist in CTL but not in LTL.

Extensions

CTL has been extended with second-order quantification [math]\displaystyle{ \exists p }[/math] and [math]\displaystyle{ \forall p }[/math] to quantified computational tree logic (QCTL).[1] There are two semantics:

  • the tree semantics. We label nodes of the computation tree. QCTL* = QCTL = MSO over trees. Model checking and satisfiability are tower complete.
  • the structure semantics. We label states. QCTL* = QCTL = MSO over graphs. Model checking is PSPACE-complete but satisfiability is undecidable.

A reduction from the model-checking problem of QCTL with the structure semantics, to TQBF (true quantified Boolean formulae) has been proposed, in order to take advantage of the QBF solvers.[2]

See also

  • Probabilistic CTL
  • Fair computational tree logic
  • Linear temporal logic

References

  1. David, Amélie; Laroussinie, Francois; Markey, Nicolas (2016). Desharnais, Josée; Jagadeesan, Radha. eds. "On the Expressiveness of QCTL". 27th International Conference on Concurrency Theory (CONCUR 2016). Leibniz International Proceedings in Informatics (LIPIcs) (Dagstuhl, Germany: Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik) 59: 28:1–28:15. doi:10.4230/LIPIcs.CONCUR.2016.28. ISBN 978-3-95977-017-0. http://drops.dagstuhl.de/opus/volltexte/2016/6164. 
  2. Hossain, Akash; Laroussinie, François (2019). Gamper, Johann; Pinchinat, Sophie; Sciavicco, Guido. eds. "From Quantified CTL to QBF". 26th International Symposium on Temporal Representation and Reasoning (TIME 2019). Leibniz International Proceedings in Informatics (LIPIcs) (Dagstuhl, Germany: Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik) 147: 11:1–11:20. doi:10.4230/LIPIcs.TIME.2019.11. ISBN 978-3-95977-127-6. http://drops.dagstuhl.de/opus/volltexte/2019/11369. 

External links