Introduction to Temporal Logic Mehdi Dastani BBL-521 M.M.Dastani@uu.nl
Modal Logic Modal logic is developed to model various concepts and phenomena. ◮ Logic of � and � (necessity / possibility) ◮ Various flavours: ◮ epistemic / doxastic ◮ temporal / dynamic ◮ deontic ◮ basic property ( K ): ◮ � ( ϕ → ψ ) → ( � ϕ → � ψ ) , or equivalently ◮ ( � ( ϕ → ψ ) ∧ � ϕ ) → � ψ
Modal Logic: Semantics ◮ Kripke models: M = ( Q , π, R ) , where ◮ Q : set of possible worlds/states ◮ π : truth assignment function ◮ R : accessibility relation ◮ The set of worlds/states accessible from a state q is { q ′ | ( q , q ′ ) ∈ R } M , q ′ | = ϕ for all q ′ such that ( q , q ′ ) ∈ R ◮ M , q | = � ϕ iff M , q ′ | = ϕ for some q ′ such that ( q , q ′ ) ∈ R ◮ M , q | = � ϕ iff
Modal Logic: Semantics ◮ Kripke models: M = ( Q , π, R ) . ◮ Characteristics of R : R reflexive � ϕ → ϕ R serial � ϕ → � ϕ R transitive � ϕ → �� ϕ R symmetric ϕ → � � ϕ R euclidean � ϕ → � � ϕ ◮ Varieties of modal logics Doxastic logic � is Belief ( B ) operator R serial, transitive, euclidian (KD45) Epistemic logic � is Knowledge ( K ) operator R reflexive, transitive, symmetric (S5) Temporal logic � is Always operator R reflexive, transitive (S4) Exercise 1: Check which of the following four formulas are valid in epistemic logic: Kp ∨ ¬ Kp , Kp ∨ K ¬ p , K ( p ∨ ¬ p ) , Kp ∨ ¬ K ¬ p
Temporal Logic ◮ Various views on time: ◮ Discrete versus Continuous time ◮ Points versus Interval time ◮ Linear time versus Branching time ◮ Past versus Future time ◮ Finite versus Infinite future ◮ Temporal logic is a modal logic where truth values of statements changes with time. ◮ Logic of concepts sometimes and always ◮ sometimes ϕ is true iff ϕ holds at some future moment ◮ always ϕ is true iff ϕ holds at all future moments ◮ Temporal logic can be used to specify and verify (reason about) the behaviour of software systems.
Linear Temporal Logic (LTL): Syntax In LTL, time is discrete linear time. ◮ Let Π be a set of propositional atoms. The set of formula of linear time logic is defined as follows: ◮ p ∈ Π are formulas ◮ if ϕ and ψ are formulas, then ¬ ϕ , ϕ ∨ ψ, . . . are formulas ◮ if ϕ and ψ are formulas, then X ϕ , � ϕ , � ϕ , and ϕ U ψ are formulas ◮ Relation between modalities: ◮ � ϕ ≡ ⊤ U ϕ ◮ � ϕ ≡ ¬ � ¬ ϕ
Linear Temporal Logic (LTL): Semantics In LTL, time is discrete linear time. ◮ Linear time structures M = ( Q , π, σ ) where ◮ Q is a set of states ◮ π : Q → 2 Π is the valuation function ◮ σ : N → Q is an infinite sequence of states ◮ Notation: ◮ A linear time structure is denoted as σ = q 1 q 2 . . . where q i ∈ Q . ◮ We use σ i = σ ( i ) = q i and σ i is the suffix q i , q i + 1 , . . . ◮ For example: σ 1 = q 1 and σ 2 = q 2 q 3 . . . .
Linear temporal logic ◮ X ϕ : Nexttime ϕ ◮ � ϕ : Sometimes ϕ ◮ � ϕ : Always ϕ ◮ ϕ U ψ : ϕ until ψ
Linear temporal logic: Semantics Let M = ( Q , π, σ ) be a linear time structure. M , σ | = p p ∈ π ( σ 1 ) for p ∈ Π ⇔ M , σ | = ¬ ϕ M , σ �| = φ ⇔ M , σ | = ϕ ∨ ψ M , σ | = ϕ or M , σ | = ψ ⇔ M , σ 2 | = ϕ M , σ | = X ϕ ⇔ M , σ n | = ϕ for some n ≥ 1 M , σ | = � ϕ ⇔ M , σ n | = ϕ for all n ≥ 1 M , σ | = � ϕ ⇔ ∃ k ≥ 1 : M , σ k | = ψ and ∀ j : 1 ≤ j < k s.t. M , σ j | = ϕ M , σ | = ϕ U ψ ⇔ Exercise 2: Check the following equivalences: ◮ � ϕ ≡ ⊤ U ϕ ◮ � ϕ ≡ ¬ � ¬ ϕ
Satisfiability and Validity ◮ A linear temporal logic formula ϕ is satisfiable if and only if there exists a linear time structure M = ( Q , π, σ ) with M , σ | = ϕ ◮ A linear temporal logic formula ϕ is valid, denoted as | = ϕ , if and only if for all linear time structure M = ( Q , π, σ ) it holds M , σ | = ϕ ◮ Example: LTL Formula Satisfiable Valid ϕ → � ψ Yes No � ( ϕ → X ψ ) Yes No ϕ → � ϕ Yes Yes � ϕ → ϕ Yes Yes � ϕ → � ϕ Yes Yes ϕ ∧ � ( ϕ → X ϕ ) → � ϕ Yes Yes Exercise 3: Give a linear time structure that shows the invalidity of the first two LTL formulas in the above table.
Equivalence Formulas in linear temporal logic Duality law Idempotency law Absorption law ¬ X ϕ ≡ X ¬ ϕ �� ϕ ≡ � ϕ � � � ϕ ≡ � � ϕ ¬ � ϕ ≡ � ¬ ϕ �� ϕ ≡ � ϕ � � � ϕ ≡ � � ϕ ϕ U ( ϕ U ψ ) ≡ ϕ U ψ ¬ � ϕ ≡ � ¬ ϕ ( ϕ U ψ ) U ψ ≡ ϕ U ψ ¬ � ϕ ≡ � ¬ ϕ Expansion law Distributive law ϕ U ψ ≡ ψ ∨ ( ϕ ∧ X ( ϕ U ψ )) X ( ϕ U ψ ) ≡ ( X ϕ ) U ( X ψ ) � ( ϕ ∨ ψ ) ≡ � ϕ ∨ � ψ � ψ ≡ ψ ∨ X � ψ � ( ϕ ∧ ψ ) ≡ � ϕ ∧ � ψ � ψ ≡ ψ ∧ X � ψ Exercise 4: Examine some of the above equivalences.
Computational Tree Logic: CTL ∗ Time structures are branching tree-like structures. Let Π be a set atomic propositions. A transition system is a structure M = ( Q , π, R ) where ◮ Q is a set of states, ◮ R ⊆ Q × Q is a total relation, and ◮ π : Q → 2 Π is a valuation function. A transition system M is a graph structure. ◮ M is acyclic iff there exists no circles in M . ◮ M is a tree iff acyclic, each node has at most one R -predecessor, and all nodes in M are reachable from the root node.
Unravelling Transition Systems q 0 q 2 q 0 q 2 q 0 q 0 q 2 q 0 q 1 q 0 q 2 q 0 q 2 q 0 q 1 q 2 q 0 q 2 q 0 q 1 q 2 q 0 q 1 q 0 q 2 q 0 q 0
Computational Tree Logic: CTL ∗ ◮ Formulas ◮ State formulas: pertaining to states in time tree. ◮ Path formulas : pertaining to paths in time tree. ◮ Path quantifiers: ◮ A (universal path quantifier): A ϕ denotes that ϕ holds over all paths. ◮ E (existential path quantifier): E ϕ denotes that there exists a path that satisfies ϕ . E � ϕ A � ϕ E � ϕ A � ϕ
CTL ∗ Syntax State (S1-S3) and Path (P1-P3) formulas: ◮ (S1) atomic propositions in Π are state formulas. ◮ (S2) if ϕ and ψ are state formulas, then ¬ ϕ and ϕ ∨ ψ are state formulas. ◮ (S3) if ϕ is a path formula then A ϕ , E ϕ are state formulas. ◮ (P1) all state formulas are path formulas. ◮ (P2) if ϕ and ψ are path formulas, then ¬ ϕ and ϕ ∨ ψ are path formulas. ◮ (P3) if ϕ and ψ are path formulas, then X ϕ and ϕ U ψ are path formulas.
CTL ∗ Semantics Let M = ( Q , π, R ) be a transition system. Similar to LTL, a path is an infinite sequence σ = q 1 q 2 q 3 . . . where ( q i , q i + 1 ) ∈ R for i ≥ 1. The semantics of CTL ∗ formulas are defined with respect to a state q or a path σ . ◮ M , q | = ϕ : state formula ϕ is true in M at state q ◮ M , σ | = ϕ : path formula ϕ is true in M on path σ We use σ i = σ ( i ) = q i and σ i is the suffix q i q i + 1 q i + 2 . . . .
CTL ∗ Semantics Let M = ( Q , π, R ) be a transition system. The entailment | = is inductively defined as follows: ◮ (S1) M , q | = p iff p ∈ π ( q ) for atomic proposition p ◮ (S2) M , q | = ϕ ∨ ψ iff M , q | = ϕ or M , q | = ψ M , q | = ¬ ϕ iff M , q �| = ϕ ◮ (S3) M , q | = A ϕ iff for all path σ : σ 1 = q it holds M , σ | = ϕ M , q | = E ϕ iff there exists a path σ : σ 1 = q and M , σ | = ϕ ◮ (P1) M , σ | = p iff M , σ 1 | = p ◮ (P2) M , σ | = ϕ ∨ ψ iff M , σ | = ϕ or M , σ | = ψ M , σ | = ¬ ϕ iff M , σ �| = ϕ ◮ (P3) M , σ | = ϕ U ψ iff there exists i ≥ 1 : M , σ i | = ψ and ∀ j < i M , σ j | = ϕ M , σ | = X ϕ iff M , σ 2 | = ϕ
Model Checking Problems Let M be a finite structure and ϕ a propositional temporal formula. ◮ Model checking for LTL is PSPACE complete. ◮ Model checking for CTL ∗ is PSPACE complete.
Recommend
More recommend