• No results found

4.2 Spotlight Abstraction

4.2.3 Region Summarisation

Spotlight abstraction is based on a three-valued domain for predicates. The third truth value unknown is then propagated to the level of Krikpe structures and temporal logic formulae. A three-valued Kripke structure is used to model the abstract, and thus, partially unknown system. Based on the three-valued CTL semantics (Definition 2.10) it can be deduced whether such a model is still concrete enough to obtain a definite result in verification. This approach is known as three-valued model checking [22, 23] – a verification technique that can be generally applied to any partially unknown system that is representable as a three-valued Kripke structure. However, the universality of three-valued model checking also entails that certain details about the system that exceed the modelling capabilities of Kripke structures, can not be regarded in the verification task. This may lead to cases where, according to the three-valued CTL semantics, model checking yields unknown – whereas an additional look at the semantics of the system would clearly reveal a definite result. In this section, we show that additional knowledge about the considered system can

sometimes be exploited in constructing the abstraction, which finally gives us more definite results in verification.

At first, we take a look at a typical verification task where we obtain unknown under the three-valued CTL semantics, but a short glance at the system already reveals a definite answer. In Figure 4.10 we have a message passing system where several processes communicate via channel c, but only Proc1attempts to communicate via d.

c, d :channel [1] of integer

Obviously, Proc1will never terminate because no communication partner for channel d is available. Following our formal approach to verification, we check the temporal logic propertyAF(pc1= 3). The model checker internally negates this universally quantified formula, i.e. it verifies whether the negation EG¬(pc1= 3)does not hold for the system. Now, we construct a spotlight abstraction of the system, given by Spot(Proc) = {Proc1} and Spot(Pred) = {emptyd}. Note that we require no shade component here, because the shade processes Proc2to Procm do not affect the spotlight predicate emptyd. The resulting abstract control flow graph of Proc1and the corresponding three-valued Kripke structure are depicted in Figure 4.11.

1

Fig. 4.11 Abstract control flow graph Ga1of Proc1over Spot(Pred) = {emptyd} and corre-sponding three-valued Kripke structure Ka.

When we look at the Kripke structure, it is still obvious that there exists no path starting in the state h1, emptydi that reaches the end location. However, all paths have at least one transition with the truth value ⊥. Hence, checking EG¬(pc1= 3)yields unknown according to ther three-valued CTL semantics.

4.2 Spotlight Abstraction 73 And consequently, neither forEG¬(pc1= 3)nor forAF(pc1= 3)we obtain a definite verification result on the current abstraction.

Now, we will see how this abstraction can be enriched by additional knowl-edge about the concurrent system Sys11. Considering Proc1in Figure 4.10, we observe that the control flow from location 1 to 2 depends on the suc-cess of the operation receive(c, x). More precisely, an empty channel c will cause busy waiting at location 1, whereas a non-empty channel permits the process to proceed to location 2. The corresponding control flow transitions 1 → 1and 1 → 2 have complementary guards. Hence, in every state where Proc1 is at location 1, either a transition associated with 1 → 1 is enabled and a transition associated with 1 → 2 is disabled, or vice versa. We want to exploit this fact for our abstraction, without adding the predicate emptycto the spotlight. Therefore, we look again at the three-valued Kripke structure Ka in Figure 4.11. According to the concreteness preorder (see Definition 2.11), we have that each CTL formulae that evaluates to a definite value on Ka, evaluates to the same truth value on every concretisation of Ka. Such a concretisation can be obtained by replacing the ’unknowns’ in the three-valued Kripke structure by true or false. Considering the fact that we have identified a pair of complementary transitions in the abstraction, we get exactly the following two-valued concretisations of Ka:

h1, emptydi K1c::

h2, emptydi

h3, emptydi

h1, emptydi K2c::

h2, emptydi

h3, emptydi

Fig. 4.12 Two-valued concretisations K1cand K2cof the three-valued Kripke structure Ka.

As we can see, the temporal logic formulaAF(pc1= 3)holds for none of the concretisations of Ka. The fact that K1cand K2care the only possible two-valued concretisations allows us to transfer this refutation result to the three-valued Kripke structure Ka, and finally, also to the concrete system Sys11. However, incorporating this exemplified approach into a model checking procedure is not straightforward. The construction of all two-valued concretisations of a three-valued Kripke structure generally involves an exponential overhead – which is usually unacceptable for the verification of real-life systems.

Nevertheless, we will see that we can exploit the basic idea of constructing concretisations in our approach to abstraction – which eventually gives us more precision without increasing the complexity. Looking again at Figure

4.12, we can make the observation that in any case (or rather, under each concretisation) the system will remain in the states h1, emptydi and h2, emptydi forever – but it is still unpredictable, in which exact state the system will be at a certain point of time. This missing detail is however not relevant in the current verification task. In our extended approach to abstraction, we introduce regions of states: subsets of the overall state space where we are solely interested in whether the system will remain inside or outside the set.

Our running example thus hints at the states h1, emptydi and h2, emptydi as a region. We will see that by defining a region, we can subsume a set of possible concretisations in one region state. In our technique we detect the regions on the level of control flow graphs and subsequently propagate them to the states of the corresponding Kripke structure. Hence, we choose the locations 1and 2 of the process Proc1as our region. In the next step, we perform region summarisation – a local modification of the abstraction.

Definition 4.10 (Region Summarisation).

Let Sys = kni=1Procibe a concurrent system and Pred the set of all predicates over the system variables. Let Spot = Spot(Proc) ∪ Spot(Pred) be a given set of spotlight processes and predicates. Moreover, let Prock∈ Spot(Proc) be a spotlight process with the corresponding control flow graph G = (Loc, δ ), and let Reg ⊆ Loc be a subset of G’s locations, called a region. Then GReg= (LocReg, δReg)approximates G iff

• LocReg:= (Loc\Reg) ∪ {r}.

(The locations in the region Reg are replaced by the new location r.)

• δReg:

1. Let δ (l, bop, l0)with l ∈ Loc\Reg and l0∈ Loc\Reg. Then δReg(l, bopa, l0) with bopa bop.

(Transitions outside the region are not affected by the summarisation.) 2. Let δ (l, bop, l0)with l ∈ Loc\Reg and l0∈ Reg. Then δReg(l, bopa, r)with

bopa bop.

(Transitions entering the region are redirected to the new location r.) 3. Let δ (l, bop, l0)with l ∈ Reg, l0∈ Loc\Reg and bop = grd : ass where grd

denotes the guard of bop and ass is the assignment part of bop. Then δReg(r, grda∧ ⊥ : assa, l0)with grda grd and assa ass.

(Transitions leaving the region now start at the new location r and their guards are conjuncted with ⊥.)

4. Let Grd be the set of guards on transitions from Reg to Loc\Reg in G and let Ass be the set of assignments on transitions within Reg. Then δReg(r, grda: assa, r)with grda≡ ⊥ ∨Vg∈Grd¬gawhere ga g, and ∀ass ∈ Ass: assa ass.

4.2 Spotlight Abstraction 75 (Transitions within the region are summarised into one self-loop of r, the new guard is ⊥, disjuncted with a conjunction over all negated guards of transitions leaving the region. The new assignment approximates all assignments on transitions within Reg.)

Each transition in GRegconforms to either 1, 2, 3 or 4.

According to this definition, we can summarise the region (i.e. the subset of locations) Reg = {1, 2} of the spotlight process Proc1 into a new location r.

This modification requires an update of the transition relation of the corre-sponding control flow graph. For the region location r we introduce a self-loop labelled with an abstract basic operation grda: assa (4). Since we want to map all original transitions within the region Reg onto this new self-loop, the assignment part assahas to approximate all assignments of basic operations associated with these original transitions. In our example, the transitions within Reg have no assignments, and thus, there is no assignment part in our grda: assa. The only way to leave a region is to take a transition starting in Regthat leads to a location outside the region. Moreover, the guard of this transition has to be true. Hence, as long as all guards associated with such outgoing transitions are false, the process will definitely remain in the region.

As a consequence, the guard of the new self-loop is a conjunction over all negated guards of the transitions leaving the region – which is just emptydin our example. Even if one of the guards of transitions leaving the region is true, there is no guarantee that the process will leave the region – the process will maybe still remain inside. Therefore, we disjunct the guard of the self-loop with ⊥. Next, we look at transitions that in fact leave the region (3). After applying region summarisation, these transitions start in the new location rwhereas their destination location lies outside the region. Since we have lost the information about the exact location within the region, it is uncertain whether these transitions can be actually taken, and thus, we conjunct their guards with ⊥. Figure 4.13 illustrates the application of region summarisation for our running example, and moreover, shows the corresponding Kripke structure.

As we can see, in the finally obtained Kripke structure the former states h1, emptydi and h2, emptydi are summarised into the region state hr, emptydi.

These state unites all possible concretisations (compare Figure 4.12) of our original Kripke structure (compare Figure 4.11). The price that we pay is the loss of information about the exact control flow location of Proc1within the region Reg = {1, 2}. This is however not relevant for verifyingAF(pc1= 3).

Model checking this temporal logic property yields false for our new Kripke structure, and again we can transfer this result to the concrete system:

Theorem 4.4.

Let Sys = kni=1Procibe a concurrent system and Spot = Spot(Proc) ∪ Spot(Pred) be a given set of spotlight processes and predicates. Moreover, let Prock ∈ Spot(Proc) be a spotlight process and let Reg be a region of its control loca-tions. Let Sysa= kProci∈Spot(Proc)Procai k ProcShadebe the corresponding abstract

1 G::

2

3

¬emptyd: emptyd:= true

emptyd

Reg : r

GReg::

3

¬emptyd∧ ⊥ : emptyd:= true

⊥ ∨ emptyd hr, emptydi K::

h3, emptydi

Fig. 4.13 Abstract control flow graph G of Proc1over Spot(Pred) = {emptyd} with selected region Reg = {1, 2}. Control flow graph GRegafter applying region summarisation. Corre-sponding Kripke structure K.

system where region summarisation is applied to Prock with regard to Reg.

Furthermore, let K = (S, R, L, F) be the three-valued Kripke structure represent-ing Sys, and Ka= (Sa, Ra, La, Fa)the three-valued Kripke structure representing Sysa, both defined over AP = Spot(Pred)∪{pci= j|Proci∈ Spot(Proc)\Prock, j ∈ Loci} ∪ {pck= j| j ∈ Lock\Reg ∨ j = r}. Then for any two corresponding states s∈ S and sa∈ Sa, i.e. La(sa) ≤K3L(s), and for any CTL formula ψ over AP the following holds:

[Ka, sa|= ψ] ≤K3 [K, s |= ψ]

Note that the Kripke structures are no longer defined over control locations inside the region.

Proof (Theorem 4.4).

We prove this theorem by showing that the notion of corresponding states in three-valued abstractions (Definition 4.7) with region summarisation (Defi-nition 4.10) conforms to a fair concreteness preorder (Defi(Defi-nition 2.12). This can be established based on the following lemma:

Lemma 4.3.

Let K and Kabe defined as in Theorem 4.4. Moreover, let s ∈ S and sa∈ Sabe any two corresponding states, i.e. La(sa) ≤K3L(s). Then for the spotlight process Prockwith the summarised region Reg we have that:

1. If s0a∈ Sa is any abstract state such that Rak(sa, s0a) = true, then there is a concrete state s0∈ S such that Rk(s, s0) = trueand La(s0a) ≤K3L(s0).

2. If s0∈ S is any concrete state such that Rk(s, s0) , f alse, then there is an abstract state s0a∈ Sasuch that Rak(sa, s0a) , f alse and La(s0a) ≤K3L(s0).

Proof (Lemma 4.3).

We start with (1). Let G = (Loc, δ ) be the CFG of Prockbefore applying region summarisation, and let GReg= (LocReg, δReg)be the abstract CFG of Prockafter

4.2 Spotlight Abstraction 77 applying region summarisation. Moreover, let l be the location of GRegin sa and l0be the location of GRegin s0a. We can distinguish the following cases:

• The transition Rak(sa, s0a)is independent from the region Reg. Then l , r and l0, r, and there is an abstract basic operation bopawith δReg(l, bopa, l0).

According to Definition 4.10 (1) there exists a transition δ (l, bop, l0)in G with bopa bop. Thus, taking the transition corresponding to δ (l, bop, l0) in the concrete state s of K leads us to a state s0with La(s0a) ≤K3 L(s0).

• Rak(sa, s0a)is a transition that enters the region Reg. Then l , r and l0= r, and there is an abstract basic operation bopawith δReg(l, bopa, l0). According to Definition 4.10 (2) there exists a location ˜l ∈ Reg with δ (l, bop, ˜l) in G and bopa bop. Thus, taking the transition corresponding to δ (l, bop, ˜l) in the concrete state s of K leads us to a state s0with La(s0a) ≤K3L(s0).

• Rak(sa, s0a)is a transition that leaves the region Reg. Then l = r and l0, r, and there is an abstract basic operation bopa with δReg(l, bopa, l0). According to Definition 4.10 (3) the guard of bopa contains a conjunction with ⊥.

We can conclude that Rak(sa, s0a) <K3true, i.e. it is not a definite transition.

Hence, the premise of 1 does not hold.

• Rak(sa, s0a)corresponds to the self-loop associated with region Reg. Then l= rand l0= r, and there is an abstract basic operation bopa= grda: assa with δReg(l, bopa, l0). The premise of 1 is that Rak(sa, s0a) = true. According to Definition 4.10 (4), this is only the case if sais a state where all guards of transitions in G that leave the region evaluate to false. According to the semantics of our systems, in each state there is at least one enabled transition for each process. Hence, there must be two locations ˆl, ˇl in Reg with δ (ˆl, grd : ass, ˇl) in G and the guard grd is true in s. According to Definition 4.10 (4), the assignment part assaof the operation bopain δReg(l, bopa, l0)approximates all assignments of operations on transitions within Reg, and thus, we have that assa ass. Hence, taking the transition corresponding to δ (ˆl, grd : ass, ˇl) in the concrete state s of K leads us to a state s0with La(s0a) ≤K3L(s0).

Next, we prove (2). Let G = (Loc, δ ) be the CFG of Prockbefore applying region summarisation, and let GReg= (LocReg, δReg)be the abstract CFG of Prockafter applying region summarisation. Moreover, let l be the location of G in s and l0 be the location of G in s0. We again can distinguish the following cases:

• Rk(s, s0)is a transition independent from the region Reg. Then l < Reg and l0< Reg, and there is a basic operation bop with δ (l, bop, l0). According to Definition 4.10 (1), there exists a transition δReg(l, bopa, l0)in GReg with bopa bop. Thus, taking the transition corresponding to δReg(l, bopa, l0)in the abstract state saof Kaleads us to a state s0awith La(s0a) ≤K3L(s0).

• Rk(s, s0)is a transition that enters the region Reg. Then l < Reg and l0∈ Reg, and there is a basic operation bop with δ (l, bop, l0). According to Definition 4.10 (2), there exists a transition δReg(l, bopa, r)in GRegwith bopa bop.

Thus, taking the transition corresponding to δReg(l, bopa, r)in the abstract state saleads us to a state s0awith La(s0a) ≤K3L(s0).

• Rk(s, s0)is a transition that leaves the region Reg. Then l ∈ Reg and l0< Reg, and there is a basic operation bop = grd : ass with δ (l, bop, l0). According to Definition 4.10 (3), there exists a transition δReg(r, bopa, l)in GRegwith bopa= grda∧ ⊥ : assawhere grda grd and assa ass; i.e. bopa approxi-mates bop. Since l ∈ Reg, we have that La(sa, pcj= r) = true. Thus, taking the transition corresponding to δReg(r, bopa, l)in the abstract state saleads us to a state s0awith La(s0a) ≤K3L(s0).

• Rk(s, s0)is a transition within the region Reg. Then l ∈ Reg and l0∈ Reg, and there is a basic operation bop = grd : ass with δ (l, bop, l0). According to Definition 4.10 (4), there is a transition δReg(r, grda: assa, r)in GRegwith grda≡ ⊥ ∨Vg∈Grd¬gawhere ga g and ∀ass ∈ Ass : assa ass. Hence, assa approximates the assignment part ass of bop. Moreover, we have that Rak(sa, s0a) , f alse because the guard grda contains a disjunction with ⊥.

Thus, taking the transition corresponding to δReg(r, grda: assa, r)in saleads us to a state s0awith La(s0a) ≤K3L(s0).

u t

In Theorem 4.4 we assume that region summarisation is applied to a single process Prockonly. Transitions associated with processes different to Prockare not affected by our modification of the abstraction. Hence, from Lemma 4.3 together with our prior results on spotlight abstraction we get the following corollary:

Corollary 4.6.

Let Sys = kni=1Procibe a concurrent system and Spot = Spot(Proc) ∪ Spot(Pred) be a given set of spotlight processes and predicates. Moreover, let Prock ∈ Spot(Proc) be a spotlight process and let Reg be a region of its control loca-tions. Let Sysa= kProc

i∈Spot(Proc)Procai k ProcShadebe the corresponding abstract system where region summarisation is applied to Prock with regard to Reg.

Furthermore, let K = (S, R, L, F) be the three-valued Kripke structure represent-ing Sys, and Ka= (Sa, Ra, La, Fa)the three-valued Kripke structure representing Sysa, both defined over AP = Spot(Pred)∪{pci= j|Proci∈ Spot(Proc)\Prock, j ∈ Loci} ∪ {pck= j| j ∈ Lock\Reg ∨ j = r}. Then the set of all pairs of correspond-ing states s ∈ S and sa∈ Sacharacterises a fair concreteness preorder cSa× S between Kaand K.

The correctness of Theorem 4.4 now immediately follows from Theorem 2.3, which states that a fair concreteness preorder preserves all CTL properties.

u t

4.3 Related Work 79