Introduction to Temporal Logic Mehdi Dastani BBL-521 - - PowerPoint PPT Presentation
Introduction to Temporal Logic Mehdi Dastani BBL-521 - - PowerPoint PPT Presentation
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 /
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 |= ϕ
iff M, q′ |= ϕ for all q′ such that (q, q′) ∈ R
◮ M, q |= ϕ
iff M, q′ |= ϕ for some q′ such that (q, q′) ∈ R
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 σ = q1q2 . . . where qi ∈ Q. ◮ We use σi = σ(i) = qi and σi is the suffix qi, qi+1, . . . ◮ For example: σ1 = q1 and σ2 = q2q3 . . ..
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, σ |= Xϕ ⇔ M, σ2 |= ϕ M, σ |= ϕ ⇔ M, σn |= ϕ for some n ≥ 1 M, σ |= ϕ ⇔ M, σn |= ϕ for all n ≥ 1 M, σ |= ϕUψ ⇔ ∃k ≥ 1 : M, σk |= ψ and ∀j : 1 ≤ j < k s.t. M, σj |= ϕ 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
q0 q1 q2
q0 q0q1 q0q2 q0q1q2 q0q2q0 q0q2q0q2 q0q2q0q1 q0q2q0q2q0
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 σ = q1q2q3 . . . where (qi, qi+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) = qi and σi is the suffix qiqi+1qi+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, σ |= ϕ
- r