• No se han encontrado resultados

Stationary states in the reinfection case

2.2 Spread of bacteria within a population of multiple hosts

2.2.1 Stationary states in the reinfection case

Temporal logic model checking is a fully automatic verification technique.

It refers to the question of whether a model of a software system satisfies certain temporal logic correctness requirements. In common approaches, a Kripke structure [90] is used to model the state space of the system under consideration.

Definition 2.1 (Kripke Structure).

A Kripke structure over a set of atomic predicates AP is a tuple K = (S, R, L, F) where

• S is a finite set of states,

• R : S × S → {true, f alse} is a total transition function, i.e. ∀s ∈ S : ∃s0∈ S : R(s, s0) = true,

• L : S × AP → {true, f alse} is a labelling function that associates a truth value with each predicate in each state,

• F ⊆ P(R−1({true}))is a set of fairness constraints where each constraint F∈ F is a set of true transitions.

A path π of a Kripke structure K is an infinite sequence of states s0s1s2. . .with R(si, si+1) = true. πidenotes the i-th state of π and Πsdenotes the set of all

2.1 Classical Temporal Logic Model Checking 15 paths starting in s ∈ S. A path π is fair if it takes infinitely often a transition from every F ∈ F. By Πsf air we denote the set of all fair paths starting in s∈ S. Fairness constraints in Kripke structures are used to rule out unrealistic (i.e. unfair) behaviour of the modelled system. In Chapter 3 we will provide more details on unrealistic system behavior, and moreover, show how fairness constraints can be derived from a given system. Henceforth, we solely focus on fair paths. For illustration of the aforementioned definitions, we consider the Kripke structure K1in Figure 2.1.

s0

K1::

s1

s3

s4

s2

s5

p= f q= f

p= t q= f

p= t q= f

p= t q= f

p= t q= t

p= t q= t

Fig. 2.1 Kripke structure K1 over AP = {p, q} with fairness constraint F = {F} where F= {(s2, s2), (s3, s3), (s5, s5)}. In the labelling, t abbreviates true, and f abbreviates f alse.

As we can see, the infinite sequence π = s0s1s1s1. . .is a path of K1. However, since π does not take any transition from the set F infinitely often, this path is not fair. A fair path of K1is e.g. π0= s0s1s2s2. . ..

Requirements, i.e. desirable properties of systems represented as Kripke struc-tures can be formalised in temporal logic, an extension of the classical propo-sitional logic. The computation tree logic (CTL) [37] is a branching-time logic for specifying such properties. The syntax of CTL can be defined in two steps.

We can distinguish CTL state and path formulae:

Definition 2.2 (Syntax of CTL).

Let AP be a set of atomic predicates. The syntax of CTL state formulae is given by the following grammar:

ψ ::= p | ¬ψ | ψ ∧ ψ | ψ ∨ ψ | Eφ | Aφ

where p ∈ AP and φ is a CTL path formula. Thus, state formulae permit the logical connectives ¬, ∧, ∨ as well as the existential (E) or universal (A) quantification over path formulae. The syntax of CTL path formulae is given by the following grammar:

φ ::= Xψ | Fψ | Gψ | ψ Uψ

where ψ is a CTL state formula. State formulae refer to properties of states and their branching structure, whereas path formulae characterise temporal properties of paths. As temporal operators, we have next (X), eventually (F), globally (G) and until (U). The formal semantics of these operators follows from Definition 2.3. In the evaluation of CTL formulae on Kripke structures only state formulae are considered – which, however, may be composed of path formulae. Henceforth, we refer to CTL state formulae just as CTL formulae.

Definition 2.3 (Fair Evaluation of CTL).

Let K = (S, R, L, F) be a Kripke structure over a set of atomic predicates AP.

Then the fair evaluation of a CTL formula ψ in a state s of K, written [K, s |= ψ], is inductively defined as follows

[K, s |= p] := W

π ∈Πsf airL(π0, p) [K, s |= ¬ψ] := W

π ∈Πsf air¬ [K, π0|= ψ]

[K, s |= ψ ∧ ψ0] := W

π ∈Πsf air[K, π0|= ψ] ∧ [K, π0|= ψ0] [K, s |= ψ ∨ ψ0] := W

π ∈Πsf air[K, π0|= ψ] ∨ [K, π0|= ψ0] [K, s |=EXψ] := W

π ∈Πsf air[K, π1|= ψ]

[K, s |=EGψ] := W

π ∈Πsf air

V

i∈N[K, πi|= ψ]

[K, s |=E(ψUψ0)] := W

π ∈Πsf air W

i∈N [K, πi|= ψ0] ∧V0≤ j<i[K, πj|= ψ] If [K, s |= ψ] evaluates to true then the system modelled by K satisfies the property formalised by ψ. In case the evaluation yields false, the modelled system violates the property. The evaluation of the remaining CTL operators can be derived by the following equivalences

EFψ ≡ E(trueUψ), AFψ ≡ A(trueUψ), EGψ ≡ ¬AF¬ψ, AGψ ≡ ¬EF¬ψ,

AXψ ≡ ¬EX¬ψ

where two CTL formulae ψ1, ψ2are equivalent, written ψ1≡ ψ2, iff for all Kripke structures K and for all states s of K: [K, s |= ψ1] = [K, s |= ψ2].

For our example Kripke structure K1we e.g. have that [K1, s0|=AFp] yields true, i.e. for all fair paths starting in s0eventually p holds. It is sufficient to consider the substructure πK1 of K1depicted in Figure 2.2 in order to validate [K1, s0|=AFp]. Such a substructure that proves the validity of a temporal logic formula ψ is called a witness for ψ.

2.1 Classical Temporal Logic Model Checking 17

s0

πK1::

s1

s3

s4 p= f

q= f

p= t q= f

p= t q= f

p= t q= f

Fig. 2.2 Witness πK1for [K1, s0|=AFp] in the Kripke structure K1.

As another example, [K1, s0|=AG(AF(EXq))] evaluates to false. This can be disproved by the fair path πK01 = s0s3s3. . .in K1, a path where at some time p never holds next. We call such a path that refutes a CTL formula ψ a counterexample for ψ. Counterexamples for temporal logic properties are not necessarily paths, i.e. linear traces. Since CTL is a branching-time logic, counterexamples may also have a tree-like structure. Moreover, there is a duality between witnesses and counterexamples. A substructure π of a Kripke structure is a counterexample for a temporal logic formula ψ if and only if π is a witness for the formula ¬ψ . Thus, the tree-like witness πK1 forAFp is also a counterexample for the negated property EG¬p, and the linear counterexample πK0

1 forAG(AF(EXq)) is a witness for EF(EG(AX¬q)).

Conversely to the equivalence between CTL formulae, we have that two states of Kripke structures are equivalent with respect to the branching-time logic iff they satisfy the same set of CTL formulae. Such an equivalence relation on states of Kripke structures is denoted as a bisimulation.

Definition 2.4 (Bisimulation).

Let K1= (S1, R1, L1, F1)and K2= (S2, R2, L2, F2)be two Kripke structures, both defined over the same set of atomic predicates AP. Then a bisimulation be-tween K1and K2is the greatest relation ∼b⊆ S1× S2such that s1bs2implies

• ∀p ∈ AP : L1(s1, p) = L2(s2, p),

• ∀s01∈ S1such that R1(s1, s01)there is a state s02∈ S2with R2(s2, s02)and s01bs02,

• ∀s02∈ S2 such that R2(s2, s02) there is a state s01∈ S1 with R1(s1, s01) and s01bs02.

We say, the Kripke structures K1and K2are bisimilar, denoted by K1bK2, if there exists such a bisimulation between them. Moreover, two paths π1 in K1and π2in K2are bisimilar iff ∀k ∈ N : πk1bπk2. Then we also say, the path π1simulates the path π2and vice versa. Since bisimulation is reflexive,

transitive and symmetric, it is an equivalence relation. So far, there is no notion of fairness in this basic definition of a bisimulation relation. However, a bisimulation can be easily extended with fairness constraints [41]:

Definition 2.5 (Fair Bisimulation).

Let K1= (S1, R1, L1, F1)and K2= (S2, R2, L2, F2)be two Kripke structures, both defined over the same set of atomic predicates AP. Then a fair bisimulation between K1 and K2 is the greatest relation ∼b⊆ S1× S2 such that s1bs2 implies

• ∀p ∈ AP : L1(s1, p) = L2(s2, p).

• For every fair path π1∈ Πsf air1 in K1exists a fair path π2∈ Πsf air2 in K2such that ∀k ∈ N : πk1bπk2.

• For every fair path π2∈ Πsf air2 in K2exists a fair path π1∈ Πsf air1 in K1such that ∀k ∈ N : πk1bπk2.

Two Kripke structures are fair bisimilar if there exists such a fair bisimulation between them. Henceforth, we just write bisimulation when we refer to the fair bisimulation. In Figure 2.3 we see a Kripke structure K2that is bisimilar to the structure K1in Figure 2.1.

s00 K2::

s01

s03

s02 p= f

q= f

p= t q= f

p= t q= f

p= t q= t

Fig. 2.3 Kripke structure K2 over AP = {p, q} with fairness constraint F = {F} where F= {(s02, s02), (s03, s03)}.

The bisimulation between K1and K2is defined by ∼b= {(s0, s00), (s1, s01), (s2, s02), (s3, s03),(s4, s01), (s5, s02)}. We have that the path π2= s00s01s02. . .in K2simulates the paths π1= s0s1s2. . .and π01= s0s4s5. . .in K1 and vice versa. Moreover, we can observe that K2is significantly smaller, with respect to the number of states and transitions, than the bisimilar K1. From [41] we get the following result for bisimilar Kripke structures:

Theorem 2.1.

Let K1= (S1, R1, L1, F1)and K2= (S2, R2, L2, F2)be two bisimilar Kripke struc-tures and let ∼b⊆ S1× S2be the respective bisimulation. Moreover, let s1∈ S1,

2.1 Classical Temporal Logic Model Checking 19 s2∈ S2. Then

s1bs2iff (∀ CTL formulae ψ : [K1, s1|= ψ] = [K2, s2|= ψ]) .

This theorem can be exploited to reduce the complexity of temporal logic model checking. Assume there is a verification task given by [K1, s1|= ψ]. Then the general approach is to find a smaller Kripke structure K2with K1bK2, a state s2in K2with s1bs2, and then evaluate [K2, s2|= ψ]. By Theorem 2.1 the obtained result can be transferred to the original verification task. Due to the smaller K2this approach is usually more efficient than directly evaluating [K1, s1|= ψ]. For our running example with the Kripke structure K2in Figure 2.3 we have that [K2, s00|=AFp] = true and [K2, s00|=AG(AF(EXq))] = f alse, which is compliant with the results obtained for the larger bisimilar Kripke structure K1in Figure 2.1.

However, given a Kripke structure K1, then the smallest bisimilar K2might be still too large for an efficient verification. A less restrictive relation on Kripke structures is the simulation.

Definition 2.6 (Simulation).

Let K1= (S1, R1, L1, F1)and K2= (S2, R2, L2, F2)be two Kripke structures, both defined over the same set of atomic predicates AP. Then a simulation between K1and K2is the greatest relation s⊆ S1× S2such that s1ss2implies

• ∀p ∈ AP : L1(s1, p) = L2(s2, p),

• ∀s01∈ S1 such that R1(s1, s01) there is a state s02∈ S2 with R2(s2, s02) and s01ss02,

As we can see, a bisimulation corresponds to a simulation which additionally relates transitions of K2to transitions of K1. Hence, every bisimulation is also a simulation. The basic definition of simulation can be extended with fairness constraints [41]:

Definition 2.7 (Fair Simulation).

Let K1= (S1, R1, L1, F1)and K2= (S2, R2, L2, F2)be two Kripke structures, both defined over the same set of atomic predicates AP. Then a fair simulation between K1 and K2 is the greatest relation s⊆ S1× S2 such that s1s s2 implies

• ∀p ∈ AP : L1(s1, p) = L2(s2, p).

• For every fair path π1∈ Πsf air1 in K1there exists a fair path π2∈ Πsf air2 in K2 such that ∀k ∈ N : πk1sπk2.

Henceforth, we just write simulation when we refer to the fair simulation. If there exists such a relation sbetween K1and K2then we say, K1is simulated by K2or, conversely, K2simulates K1. Simulation is not an equivalence relation

but a preorder. Thus, it is reflexive, transitive but not symmetric. For two states s1 in K1 and s2 in K2 with s1ss2 every path starting in s1 can be simulated by a path starting in s2, but not vice versa. Hence, CTL properties are generally not preserved under simulation. Nevertheless, we will see that simulation preserves properties from the universal fragment of CTL (ACTL).

ACTL is restricted to universal quantification, and moreover, negation is solely permitted for atomic predicates.

Definition 2.8 (Syntax of ACTL).

Let AP be a set of atomic predicates. The syntax of ACTL state formulae is given by the following grammar:

ψ ::= p | ¬ p | ψ ∧ ψ | ψ ∨ ψ | Aφ where p ∈ AP and φ is a CTL path formula.

The semantics of ACTL is the same as for CTL. Note that we have the same equivalences as before, and thus, an ACTL formula can be transferred into an equivalent CTL formula which may contain existential quantification as well.

From [41] we get the following result:

Theorem 2.2.

Let K1= (S1, R1, L1, F1)and K2= (S2, R2, L2, F2)be two Kripke structures with K1sK2and let s⊆ S1× S2be the respective simulation. Moreover, let s1∈ S1, s2∈ S2. Then

s1ss2iff (∀ ACTL formulae ψ : [K2, s2|= ψ] ⇒ [K1, s1|= ψ]) .

Thus, given a verification task [K1, s1|= ψ], a common approach is to find a smaller Kripke structure K2that simulates K1, a state s2in K2with s1ss2, and then evaluate [K2, s2|= ψ]. In case [K2, s2|= ψ] yields true, this result can be transferred to the original verification task, whereas a false result for K2tells us nothing about K1. However, since the simulation relation is less restrictive than the bisimulation, finding a small Kripke structure that simulates the original one is usually easier than finding a bisimilar Kripke structure. And moreover, many verification tasks can already be successfully accomplished under simulation.

We want to consider an example for such a simulation. In Figure 2.4 we have a Kripke stucture K3 that simulates the structure K2from Figure 2.3 – and due to transitivity also K1 from Figure 2.1. The simulation between K2and K3is defined by s= {(s00, s000), (s01, s001), (s02, s002), (s03, s001)}. Again we get [K3, s000|=AFp] = true, which conforms to the results obtained for the simulated Kripke structures K1and K2. However, for the non-ACTL formulaAG(AF(EXq)) we have [K3, s000|=AG(AF(EXq))] = true, which is not compliant with our for-mer results for K1and K2. This illustrates that under a simulation K2sK3 there might be feasible paths in K3that are not feasible in the simulated K2. In our example, π = s000s001s001s001. . .in K3is such a spurious path.

Documento similar