1. Home
  2. Explore
  3. Computer Science
  4. CTL Temporal Logic

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

CTL Temporal Logic

Speaker 1Speaker 2

CTL Temporal Logic

11:49
0:00-11:49
  1. Hope

    Hello everyone, and welcome back to our course on Embedded Systems Design, Verification, and Test. In the previous class, we introduced temporal logic: a logic that lets us reason about how system behavior changes over time, using operators such as next, eventually, always, and until.

  2. Anna

    Today we are focusing on one particular class called CTL, or Computational Tree Logic. CTL is a branching-time logic, which means it considers all the possible execution paths that can branch from a system state, rather than examining only one linear execution trace.

  3. Hope

    That distinction is important. In linear-time logic, we reason about one possible sequence of states. In branching-time logic, from a state we can ask questions about every possible future path or about at least one possible future path.

  4. Anna

    Before going further, remember that a temporal formula is interpreted over a model. A state formula is evaluated at a particular state, while a path formula is evaluated along an execution path. CTL combines path quantifiers with temporal operators so that its formulas are ultimately evaluated at states.

  5. Hope

    Let's picture a small state-transition system. Suppose the system starts in state s0. From s0, it can move either to s1 or to s2. State s1 has a transition back to itself, while s2 can move to s0 or to s1. If we unfold these transitions over time, the repeated visit to s0 appears as another node in a tree, representing s0 at a later time step.

  6. Anna

    So even though two nodes in that unfolded tree may both represent s0 and have the same labels, they can represent the system at different time steps. The tree captures the possible computations of the system, which is why the logic is called Computational Tree Logic.

  7. Hope

    The basic ingredients of CTL are atomic propositions, logical connectives, path quantifiers, and temporal operators. Atomic propositions might be p, q, or r, and their truth depends on the state being examined.

  8. Anna

    The two path quantifiers are A and E. A means 'for all possible paths,' while E means 'there exists at least one possible path.' This difference lets us distinguish requirements that must hold for every system behavior from behaviors that are merely possible.

  9. Hope

    CTL also uses the usual propositional connectives, including not, and, or, and implication. The temporal operators discussed here are X for next, F for eventually or in the future, G for globally or always, and U for until.

  10. Anna

    X, F, and G are unary temporal operators because each operates on one formula. U is binary because it relates two formulas. In a formula such as phi1 U phi2, phi1 must remain true until a state is reached where phi2 is true.

  11. Hope

    The formal syntax can be described recursively. True, written as top, and false, written as bottom, are CTL formulas. Every atomic proposition is also a CTL formula. If phi is a formula, then not phi is a formula, and formulas can be combined with logical connectives.

  12. Anna

    The temporal part has a special restriction: a temporal operator must be preceded by a path quantifier. Thus AX phi and EX phi are CTL formulas, as are AF phi, EF phi, AG phi, EG phi, A phi U psi, and E phi U psi.

  13. Hope

    For example, AX phi means that phi is true in every immediate next state. EX phi means that there is at least one immediate successor state in which phi is true. So AX is universal over the next transitions, while EX is existential over them.

  14. Anna

    Similarly, AF phi means that on every possible path, phi eventually becomes true. EF phi means that there is at least one path on which phi eventually becomes true. AG phi means that phi is true in every state along every path, whereas EG phi means that there is one path on which phi remains true in every state.

  15. Hope

    The until operators follow the same pattern. A phi U psi says that on every path, psi eventually becomes true and phi is true in all preceding states. E phi U psi says that there is at least one path with that behavior.

  16. Anna

    Consider a state s0 with several successors. If at least one successor satisfies p, then EX p is true at s0. But AX p is true only if every successor satisfies p. Finding one successor where p is false is enough to make AX p false.

  17. Hope

    The same universal-versus-existential distinction appears with AG and EG. If every path from s0 keeps q true in every state, then AG q holds at s0. If at least one path keeps q true forever, then EG q holds, even if another path eventually reaches a state where q is false.

  18. Anna

    The truth of a formula can also depend on the starting state. For example, AG phi might be false at s0 because one possible path reaches a state where phi is false, but true at s1 if every path from s1 continues through states satisfying phi.

  19. Hope

    A useful syntactic example is AG of the implication p implies not EG not q. Starting with the atomic propositions p and q, we can form not q, then EG not q, then its negation, then the implication, and finally AG of that implication. Each construction follows the CTL grammar, so the entire expression is a valid CTL formula.

  20. Anna

    By contrast, F r U q is a temporal expression but not a CTL formula as written. The temporal operators are not preceded by path quantifiers. Expressions such as E F of E r U q, or more simply A F of E r U q, supply the required path quantifiers and therefore fit the CTL syntax.

  21. Hope

    Now let's define the model on which CTL is interpreted. A CTL model is a triple consisting of S, the transition relation, and L, the labeling function. This model is commonly called a Kripke structure.

  22. Anna

    S is a finite set of states. The transition relation is a subset of S cross S, so each transition is an ordered pair from one state to another. The relation must be total, meaning every state has at least one outgoing transition and therefore at least one possible next state.

  23. Hope

    The labeling function L maps each state to a set of atomic propositions. If p belongs to L(s), then p is true at state s. For example, if L(s0) is the set containing a and b, then a and b are true at s0.

  24. Anna

    This structure resembles a finite-state machine, but the labeling function records which propositions are true at each state, and the requirement for an outgoing transition from every state makes the transition relation complete. A diagram with a state that has no outgoing transition is not a valid Kripke structure for this CTL model.

  25. Hope

    For a concrete example, suppose there are states s0, s1, s2, and s3. The transitions include s0 to s1, s1 to s2, s1 to s3, s2 to s3, s3 back to s2, and a self-loop from s3 to itself. If the labels are L(s0) equal to p, q, and r; L(s1) equal to p and q; L(s2) equal to r; and L(s3) equal to q and r, then those labels tell us exactly which atomic propositions hold at each state.

  26. Anna

    We write M, s models phi to mean that formula phi is true at state s in model M. The meaning is defined by structural induction: first establish the meaning of smaller subformulas, then use those meanings to determine the truth of the larger formula.

  27. Hope

    The constants behave as expected. Top is true at every state, and bottom is false at every state. An atomic proposition p is true at s exactly when p belongs to L(s). Negation is also direct: not phi is true at s exactly when phi is not true at s.

  28. Anna

    The logical connectives use their ordinary meanings. Phi1 and phi2 is true when both subformulas are true at the state. Phi1 or phi2 is true when at least one is true. Implication can be understood as not phi1 or phi2.

  29. Hope

    For the next operator, AX phi is true at s if phi is true in every state s' reachable from s in one transition. EX phi is true if there is at least one such successor state s' where phi is true.

  30. Anna

    For the global operators, AG phi is true at s when phi holds in every state on every path starting at s. EG phi is true when there is at least one path starting at s on which phi holds in every state.

  31. Hope

    For the future operators, AF phi requires that every path eventually reaches a state satisfying phi. EF phi requires only one path that eventually reaches such a state. The difference is whether we are guaranteeing the behavior for every possible execution or identifying one possible execution.

  32. Anna

    The formal meaning of A phi1 U phi2 is that every path eventually reaches some state si where phi2 is true, and phi1 is true in each earlier state on that path. E phi1 U phi2 has the same condition, but only one path needs to satisfy it.

  33. Hope

    For example, E p U q holds at s0 if one path reaches a state where q is true and p is true at every state before that point. A p U q is false if even one possible path fails to keep p true before reaching q.

  34. Anna

    CTL is also useful for describing digital systems. If a system has n Boolean state variables, there are at most 2 to the power n possible truth assignments. With p, q, and r, the eight possible assignments are the empty set, p, q, r, p and q, p and r, q and r, and p and q and r.

  35. Hope

    Those assignments can be viewed as possible system states, with true and false corresponding to on and off in a digital implementation. However, not every assignment must be a valid or reachable configuration. The set of reachable states is therefore a subset of the at most 2 to the power n possible states.

  36. Anna

    Finally, let's connect CTL to verification requirements. Suppose we want to know whether it is possible for a system to be started but not ready. The CTL expression EF of started and not ready says that there exists a path that eventually reaches a state where started is true and ready is false.

  37. Hope

    Another requirement is: whenever a resource request occurs, it will eventually be acknowledged. A CTL expression for that is AG of request implies AF acknowledged. It says that at every state, if request is true, then along every possible future path, acknowledged eventually becomes true.

  38. Anna

    That illustrates the role of CTL in embedded-system verification. We express required behavior as CTL state formulas, interpret them over a Kripke structure representing the design, and check whether the model satisfies those formulas.

  39. Hope

    So the central ideas are these: CTL is a branching-time logic, its formulas are evaluated at states, and every temporal operator is paired with either A or E. The Kripke structure supplies finite states, complete transitions, and state labels, while the semantics tells us whether a formula is true at a particular state.

  40. Anna

    And once we understand the difference between all paths and at least one path, operators such as AX, EX, AF, EF, AG, EG, and the two until forms become systematic. That gives us a precise language for stating and checking temporal properties of embedded and digital systems.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent