ArticleslgStudy

computer science

Computation tree logic

Computation tree logic is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Computation tree logic rather than just read about it. In short: 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 pos…

Computation tree logic — main illustration
Computation tree logic — illustration

Key takeaways

  • Computation tree logic belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Computation tree logic to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Computation tree logic from memory before moving on to harder problems.

Reference excerpt

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*.

History 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. Since the introduction of CTL, there has been debate about the relative merits of CTL and LTL. Because CTL is more computationally efficient to model check, it has become more common in industrial use, and many of the most successful model-checking tools use CTL as a specification language.

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

ϕ::=⊥∣⊤∣p∣(¬ϕ)∣(ϕ∧ϕ)∣(ϕ∨ϕ)∣(ϕ⇒ϕ)∣(ϕ⇔ϕ)∣AX ϕ∣EX ϕ∣AF ϕ∣EF ϕ∣AG ϕ∣EG ϕ∣A [ϕ U ϕ]∣E [ϕ U ϕ] where p ranges over a set of atomic formulas. It is not necessary to use all connectives – for example, {¬,∧,AX,AU,EU} comprises a complete set of connectives, and the others can be defined using them.

A means 'along All paths' (inevitably) E means 'along at least (there Exists) one path' (possibly) For example, the following is a well-formed CTL formula:

EF (EG p⇒AF r) The following is not a well-formed CTL formula:

EF (r U q) The problem with this string is that U can occur only when paired with an A or an E. 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 ℳ=(S,→,L), where S is a set of states, →⊆S×S is a transition relation, assumed to be serial, i.e. every state has at least one successor, and L is a labelling function, assigning propositional letters to states. Let ℳ=(S,→,L) be such a transition model, with s∈S, and ϕ∈F, where F is the set of well-formed formulas over the language of ℳ. Then the relation of semantic entailment (ℳ,s⊨ϕ) is defined recursively on ϕ:

((ℳ,s)⊨⊤)∧((ℳ,s)⊭⊥) ((ℳ,s)⊨p)⇔(p∈L(s)) ((ℳ,s)⊨¬ϕ)⇔((ℳ,s)⊭ϕ) ((ℳ,s)⊨ϕ1∧ϕ2)⇔(((ℳ,s)⊨ϕ1)∧((ℳ,s)⊨ϕ2)) ((ℳ,s)⊨ϕ1∨ϕ2)⇔(((ℳ,s)⊨ϕ1)∨((ℳ,s)⊨ϕ2)) ((ℳ,s)⊨ϕ1⇒ϕ2)⇔(((ℳ,s)⊭ϕ1)∨((ℳ,s)⊨ϕ2)) ((ℳ,s)⊨ϕ1⇔ϕ2)⇔((((ℳ,s)⊨ϕ1)∧((ℳ,s)⊨ϕ2))∨(¬((ℳ,s)⊨ϕ1)∧¬((ℳ,s)⊨ϕ2))) ((ℳ,s)⊨AXϕ)⇔(∀⟨s→s1⟩((ℳ,s1)⊨ϕ)) ((ℳ,s)⊨EXϕ)⇔(∃⟨s→s1⟩((ℳ,s1)⊨ϕ)) ((ℳ,s)⊨AGϕ)⇔(∀⟨s1→s2→…⟩(s=s1)∀i((ℳ,si)⊨ϕ)) ((ℳ,s)⊨EGϕ)⇔(∃⟨s1→s2→…⟩(s=s1)∀i((ℳ,si)⊨ϕ)) ((ℳ,s)⊨AFϕ)⇔(∀⟨s1→s2→…⟩(s=s1)∃i((ℳ,si)⊨ϕ)) ((ℳ,s)⊨EFϕ)⇔(∃⟨s1→s2→…⟩(s=s1)∃i((ℳ,si)⊨ϕ)) ((ℳ,s)⊨A[ϕ1Uϕ2])⇔(∀⟨s1→s2→…⟩(s=s1)∃i(((ℳ,si)⊨ϕ2)∧(∀(j<i)(ℳ,sj)⊨ϕ1))) ((ℳ,s)⊨E[ϕ1Uϕ2])⇔(∃⟨s1→s2→…⟩(s=s1)∃i(((ℳ,si)⊨ϕ2)∧(∀(j<i)(ℳ,sj)⊨ϕ1)))

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 s.

Semantic equivalences The formulae ϕ and ψ are said to be semantically equivalent if any state in any model that satisfies one also satisfies the other. This is denoted ϕ≡ψ It can be seen that A and E are duals, being universal and existential computation path quantifiers respectively: ¬AΦ≡E¬Φ. Furthermore, so are G and F. Hence an instance of De Morgan's laws can be formulated in CTL:

¬AFϕ≡EG¬ϕ ¬EFϕ≡AG¬ϕ ¬AXϕ≡EX¬ϕ It can be shown using such identities that a subset of the CTL temporal connectives is adequate if it contains EU, at least one of {AX,EX} and at least one of {EG,AF,AU} 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.

… excerpt ends here. Continue reading the full article.

Illustrations

Computation tree logic: CTL model example
CTL model example

Worked examples

Example 1 — a first encounter with Computation tree logic

Start with the simplest possible case. Write down what Computation tree logic claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Computation tree logic before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Computation tree logic ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Computation tree logic

In research
Computation tree logic appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Computation tree logic in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Computation tree logic is common in secondary-school and first-year university syllabi. It links to neighbouring topics Automata (computation), Logic in computer science, Temporal logic, so understanding it makes those chapters shorter.
In everyday life
Look for Computation tree logic outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Computation tree logic” →

How to study Computation tree logic in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Computation tree logic means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Computation tree logic out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Computation tree logic in simple terms?

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…

Why does Computation tree logic matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Computation tree logic?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Computation tree logic.

Tags

  • Automata (computation)
  • Logic in computer science
  • Temporal logic

Keep exploring