• Aucun résultat trouvé

CTL, the branching-time temporal logic

N/A
N/A
Protected

Academic year: 2022

Partager "CTL, the branching-time temporal logic"

Copied!
34
0
0

Texte intégral

(1)

CTL, the branching-time temporal logic

C ˘at ˘alin Dima Universit ´e Paris-Est Cr ´eteil

(2)

Temporal properties

Safety, termination, mutual exclusion – LTL.

Liveness, reactiveness, responsiveness, infinitely repeated behaviors – LTL.

Available choices, strategies, adversial situations?

CNIL

Tout utilisateurpeutdemander le retrait de ses donn ´ees...

How do we interpretpeut?

p=demander le retrait...

Then formula =p??

NO!

Strategy to win a game

Black has a strategy to put the game in a situation from which White king will never get close to Black pawn.

(3)

Computational Tree Logic (CTL)

Syntax:

Φ ::=p|Φ∧Φ| ¬Φ| ∀ Φ| ∀Φ| ∀(ΦUΦ)| ∃ Φ| ∃Φ| ∃(ΦUΦ)

Grammarfor the logic: the set offormulasis the set of “words” obtained by this (context-free!) grammar, withΦviewed as nonterminal.

Syntactic treefor each formula.

∀,∃: path quantifier (will see why!).

U,,♦: temporal quantifiers.

Alternative notations (for the temporal operators):φ=Gφ,♦φ=Fφ, φ=Xφ.

Each path quantifier must be followed by a temporal quantifier in the syntactic tree of each formula.

Sample formula: p∧ ∃(¬ ∀p∨ ∀(pU(¬q∧ ∃q))).

Draw its syntactic tree!

Strictalternation:

Anon-CTLformula p∧ ∃(¬ ∀p∨(pU(¬q∧ ∃q))).

... because theUis not preceded by a path quantifier.

(4)

CTL presented

Intuitive meanings:

p : inany next statep holds.

Regardless ofthe actions of the “environment”, at the next clock tick p holds.

p: p will perpetually hold inany continuationfrom the current state.

Whatever the environment does, p will hold forever.

∀pUq: in any continuation from the current state q eventually holds, and until thenp must hold.

(5)

CTL formulas

Derived operators:

∃φ=¬ ∀φ

∀♦φ=∀(trueUφ)

∃φ=¬ ∀♦¬φ

∃♦φ=¬∀φ

∃(φUψ) =¬∀(¬φU(¬φ∧ ¬ψ))∧ ¬∀ψ Some intuitive meanings:

p: there exists a next state in which p holds.

The environment could make it possible for p to hold at the next clock tick.

p: there exists a continuation on which p holds perpetually.

∀♦p: in all continuations p eventually holds.

There is a guarantee that p must eventually hold, whatever the environment does.

(6)

Branching time

The root in the following tree satisfies∀ p:

p,q p,r p

The root in the following tree satisfies∃ p:

q p,r p

(7)

Branching time, contd.

(pUq)

q

q

q p

p p q

q

q

p p

p

(pUq)

q p

p

(8)

Transition systems

T = (Q,Π, δ, π,q0)with Q finite set of states.

Πfinite set of atomic propositions.

q0Q initial state.

δ⊆Q×Q transition relation.

π:Q→2Πstate labeling.

Example: the hunter/wolf/goat/cabbage puzzle.

Nondeterminism: given qQ, there may exist several r1,r2, . . .∈Q with (q,r1)∈δ,(q,r2)∈δ . . ..

Who chooses wich successor in each state?

CTL answer:the environment does!

(9)

CTL semantics in transition systems

Recursively interpret each CTL formula ineach state of the system

GivenT = (Q,Π, δ, π,q0)and qQ:

q|=p if p∈π(q).

q|=φ1∧φ2if....

q|=¬φif...

q|=∀φiffor all rQ with(q,r)∈δ, r|=φ. Example:

(10)

CTL semantics in transition systems

Recursively interpret each CTL formula ineach state of the system

GivenT = (Q,Π, δ, π,q0)and qQ:

q|=p if p∈π(q).

q|=φ1∧φ2if....

q|=¬φif...

q|=∀φiffor all rQ with(q,r)∈δ, r|=φ. Example:

p,q p,r p

(11)

CTL semantics in transition systems (contd.)

GivenT = (Q,Π, δ, π,q0)and qQ:

q|=∀φiffor each runρinT starting in q with

ρ=q=q0q1→. . .→qn→. . .(infinite!) we have that qn|=φfor all n.

In other words,ρ|=φ!

q|=∀(φ12)iffor each runρinT starting in q with

ρ=q=q0q1→. . .→qn→. . .there exists n0 with qn|=φ2and for all 0≤m<n, qm|=φ1.

In other words,ρ|=φ12!

(pUq)

q

q

q p

p p q

q

q

p p

p

(12)

Property specification

CNIL

Tout utilisateurpeutdemander le retrait de ses donn ´ees...

How do we interpretpeut?

p=demander le retrait... :∀∃♦p.

Strategy to win a game

Black has a strategy to put the game in a situation from which White king will never get close to Black pawn.

q=White king never gets close to Black pawn :∃♦∀q.

Other properties related with choices, like noninterference.

(13)

CTL properties on transition systems

Hunter/wolf/goat/cabbage puzzle.

Does the initial state satisfy∀♦(h=1∧w=1∧g=1∧c=1)?

What is the right property that says that the puzzle has a solution?

Deadlock freedom:

Suppose the states of each process are p1,p2,p3, resp. q1,q2,q3.

Deadlock freedom, i.e. all computations mayprogress:

∀ _

1≤i≤3

(PC1=pi∧ ∃PC16=pi)∨ _

1≤i≤3

(PC2=qi∧ ∃PC26=qi)

(14)

CTL properties on transition systems

Hunter/wolf/goat/cabbage puzzle.

Does the initial state satisfy∀♦(h=1∧w=1∧g=1∧c=1)?

What is the right property that says that the puzzle has a solution?

∃♦(h=1∧w=1∧g=1∧c=1) Deadlock freedom:

Suppose the states of each process are p1,p2,p3, resp. q1,q2,q3.

Deadlock freedom, i.e. all computations mayprogress:

∀ _

1≤i≤3

(PC1=pi∧ ∃PC16=pi)∨ _

1≤i≤3

(PC2=qi∧ ∃PC26=qi)

(15)

CTL properties on transition systems

Hunter/wolf/goat/cabbage puzzle.

Does the initial state satisfy∀♦(h=1∧w=1∧g=1∧c=1)?

What is the right property that says that the puzzle has a solution?

∃♦(h=1∧w=1∧g=1∧c=1) Deadlock freedom:

Suppose the states of each process are p1,p2,p3, resp. q1,q2,q3.

Deadlock freedom, i.e. all computations mayprogress:

∀ _

1≤i≤3

(PC1=pi∧ ∃PC16=pi)∨ _

1≤i≤3

(PC2=qi∧ ∃PC26=qi)

(16)

Sample tautologies

Tautology: formula that is true regardless of the truth values given to the atomic propositions.

Examples:

¬∀ p↔ ∃ ¬p

p→ ∀♦p

∃♦∃♦p→ ∃♦p

∀(p∧q)↔ ∀p∧ ∀q (∃♦p→ ∃♦q)→ ∃♦(p→q)

Formulas which are not tautologies:

∀♦(p∨q)↔ ∀♦p∨ ∀♦q

To prove they are not tautologies, give a counter-model!

(17)

Minimal set of operators

All CTL formulas can be expressed using the following set of operators : Boolean operators (further reducible, e.g., to∧and¬).

∀ .

∀ U.

∀.

Examples – express the following:

∃(pUq).

p.

The dual set of path-temporal operators can also be used as minimal set of operators!

(18)

Other (linear) temporal operators: weak until, release

Weak untilpWq: pWqpUqp.

ReleasepRq: pRq≡ ¬(¬pU ¬q).

Can be extended to CTL operators:∀pWq,∃pRq, etc.

(19)

Fixpoints

Globally, forward, until, release can be defined “inductively”:

∃♦pp∨ ∃ ∃♦p

∀♦p≡...?

p≡...?

p≡...?

∃pUqqp∧ ∃ (pUq)

∀pUq≡...?

∃pRqqp∨ ∃(pRq)

(20)

Remarks on LTL vs. CTL (to be continued!)

Both LTL and CTL formulas are interpreted over transition systems.

An LTL formula speaks aboutwhat happens on one runthat starts in a state.

Time passage is determined by some superior entity, choices do not exist and no dilemma about possible continuations exists.

A posteriori analysis of the behavior of a system (but behaviors may be infinite!).

A CTL formula speaks aboutwhat could happen in various runsthat starts in a state.

Time is nondeterministic and choices must be taken into account,

good/bad things may happen due to good/bad decisions and continuations depend on them.

A priori analysis of the possible evolution of a system.

Some LTL formulas (but not all!) can be represented as CTL formulas:

Checkingp holdsat a state qin a transition system requires checking thatall runs starting in qsatisfyp.

Hence, from this state-centered point of view, checkingp amounts to checking∀p.

No longer holds for more complex formulas!

(21)

The model-checking problem

Given a CTL formulaφand afinitely presentablemodel M, does M|=φhold?

Finitely presentable tree =transition systemover AP.

The tree = theunfoldingofA. Note the difference with LTL models :

A transition system embodiesan uncountable set of modelsfor LTL !

A transition system embodiesa unique modelfor CTL !

(22)

CTL model-checking instances

p

Which state satisfies∃♦p?

Search for areachable statelabeled with p.

Which state satisfies∃p?

Search for areachable strongly connected setlabeled with p.

Only states in this SCC satisfy∃p.

(23)

CTL model-checking [Clarke & Emerson]

State labeling algorithm:

Given formulaφ, split Q intoQφandQ¬φ

Structural induction on the syntactic tree ofφ.

Add a new propositional symbol pφfor each analyzedφ.

Label Qφwith pφand do not label Q¬φwith pφ.

(24)

CTL model-checking (2)

Forφ=∀p

Qp=

qQ| ∀q∈δ(q),p∈π(q) Q¬ ∀p=

qQ| ∃q∈δ(q),p6∈π(q)

Example...

(25)

CTL model-checking (3)

φ=∃p.

Qpcontains state q iff q is labeled with p and belongs to acircuit containing only p states.

Q¬∃p=Q\Qp. Example...

(26)

CTL model-checking (4)

φ=∃(p1Up2)

Q∃(p1Up2)contains state q iffqQ s.t.:

p1

p2

q q

Q¬∃(p1Up2))=Q\Q∃(p1Up2). Example...

(27)

CTL model-checking example

p p,q

p,q p p

p p,q

pp

∃pUq ∀pUq ∃ ∀ p

(28)

Properties of the (first variant of the) model-checking algorithm

It seems that the model-checking algorithm requiresgraph algorithms

Successorsfor∃ .

Reachability analysisfor∃ U.

Circuitsfor∃.

But could we take advantage of thefixpointexpansions of the temporal operators?

pp∧ ∃ ∃p

pUqqp∧ ∃ (pUq)

(29)

Fixpoint variant of the model-checking algorithm

Given a formulaφand a transition system M= (Q,q0, δ), ... denote SatM(φ)the set of states in Q which satisfyφ.

... and denote post(q) ={r ∈Q|(q,r)∈δ}.

Theorem

Sat(∃(φUψ))is thesmallestsubset T of Q such that:

1 Sat(ψ)⊆T and

2 If qSat(φ)and post(q)∩T 6=∅then qT .

Sat(∀φ)is thelargestsubset T of Q such that:

3 Sat(ψ)⊇T and

4 If qT then post(q)T 6=∅.

The last line can also be read as:

4 For any qQ, if post(q)∩T =∅then q6∈T .

(30)

Fixpoint variant of the model-checking algorithm

How to compute Sat(∃(φUψ)):

1 Start with T=Sat(ψ).

2 Appendq to T if qSat(φ)and post(q)T 6=∅.

3 .... until T no longer grows.

How to compute Sat(∃φ):

1 Start with T=Sat(φ).

2 Eliminate, inductively, from T all states for which post(q)∩T =∅.

3 ... until T no longer diminishes.

Examples....

(31)

Fixpoint variant of the model-checking algorithm

p p,q

p,q p p

p p,q

∃(∃ qU ∀ p)

Compute Sat(∃ q).

Compute Sat(∀ p).

Instantiate T =Sat(∀ p).

Append st to T if stSat(∃ q)and post(st)T .

(32)

Fixpoint variant of the model-checking algorithm

p p,q

p,q p p

p p,q

∃(∃ qU ∀ p) ∀(∃♦pU ∃q)

(33)

post and pre

How to compute Sat(∃φUψ):

1 Start with T=Sat(ψ).

2 Appendq to T if qSat(φ)and post(q)T 6=∅.

3 The same with T :=pre(T)∩Sat(φ).

4 Here pre(T) ={q| ∃r ∈Q,(q,r)∈δ}.

How to compute Sat(∃φ):

1 Start with T=Sat(φ).

2 Eliminate, inductively, from T all states for which post(q)∩T =∅.

3 The same with T :=pre(T)∩T

4 Here pre(T) =Q\pre(Q\T).

5 In other words, pre(T)contains all the states whosesuccessors all belong toT .

(34)

post and pre

How to compute Sat(∃φUψ):

1 Start with T=Sat(ψ).

2 Appendq to T if qSat(φ)and post(q)T 6=∅.

3 The same with T :=pre(T)∩Sat(φ).

4 Here pre(T) ={q| ∃r ∈Q,(q,r)∈δ}.

How to compute Sat(∃φ):

1 Start with T=Sat(φ).

2 Eliminate, inductively, from T all states for which post(q)∩T =∅.

3 The same with T :=pre(T)∩T

4 Here pre(T) =Q\pre(Q\T).

5 In other words, pre(T)contains all the states whosesuccessors all belong toT .

Références

Documents relatifs

1 The problem of identifying logics is not only of interest for proof theory, but for the whole area of logic, including mathematical logic as well as philosophical logic.. This

In a more specific mean- ing a Boolean category should provide the abstract algebraic structure underlying the proofs in Boolean Logic, in the same sense as a Carte- sian

One should recall that the success of the execution of a plan implies not only that the state of affairs representing its goal is the case but that all those states of affairs

Various approaches on trust modeling have developed modal logics that capture the important elements of the cognitive theory of trust as proposed in [5]. In these approaches, trust

We proposed in [3] an approach to translate the Interaction Overview Diagram (IOD) to CP-nets for simulation and state space analysis using CPNtools.. To specify

It is thus the combination of our two contributions, a CTL-based extension of OCL, whose formal syntax and semantics extend the OCL standard without modifying existing definitions,

[Hint] The semantic model checking algorithm calls the conjunctive query answering algorithm n× | S | times, where n is the number of conjunctive queries in the temporal specification

In this paper we show how to use Description Logic reasoning to perform explicit state model checking of the basic modalities of CTL on a synchronous model of computation, with the