Go backward to A.2 The Invariant Go up to A Proving Assertions Go forward to A.4 Termination |
We are now going to prove
A => I'
I' =>o I'
For proving A => I', it suffices to prove A => I and A => forall j (Sj0) (both of which are direct consequences of A).
For proving I' =>o I', we have to establish the truth of I after the transition and to show Sjk; it suffices to consider only those j, k where
send
operation).
We proceed by case distinction on the current state of node j, i.e., on the value of statej:
send
or an assigment operation, nodes other than j are not
affected. There are two potential successor states; it thus suffices to prove
that the following conditions hold after the transition:
send
operation to some node j' /=j
might be the invalidation of Sj'6. However, the statement
satisfies the transition rulec.send(m)
c = q =>o c = q:m(i.e., it appends one element m to the message queue q of channel c), thus inj'(i).length > 0 cannot become false.
It remains to be shown that statej = 2 => Sj2 after the transition. From C(0) at the beginning of the transition, we know outj(1).length = 0, which remains true. Furthermore, by above transition rule, we can easily deduce outj(0).length = 1 and thus C(1) after the transition.
By same reasoning as for the previous case, no Sj'k is affected by the transition. That Sj3 holds after the transition follows directly from the code and from Sj2.
satisfies the transition rulei = s.select()
s.getSize() > 0 =>o 0 <= i < s.getSize(), s(i).length > 0and we know by network construction out.getSize() = 2. Thus, using Sj5, the truth of Sj6 is clear.
satisfies the transition rulem = c.receive()
c = n:q =>o m = n, c = q(for some non-null message n and message queue q). From this and Sj6 and knowing out.getSize() = 2 it is clear that, for some k in {0, 1} and non-negative l,
inj(k).length = 1+lholds before the transition, and that
inj(k).length = l, msgj /= nullholds after the transition and that k = indexj (both before and after the transition). From this and from the overall relationship between input and output channels
Sumj (inj(0).length + inj(1).length) =it is clear that I holds after the transition.
Sumj (outj(0).lenght + outj(1).length)
By above reasoning, it is also clear that Sj7 holds after the transition.
From Sj6 and by above relationship between input and output channels
we know before the transition outj'(p).length > 0 for some
j' /=j and p in {0, 1} (by network construction). Thus
state0 /=0, statej' /=1 (for all j'
/= j) and the transition cannot invalidate Sj'0 and
Sj'1. Sj'2 remains true because
out
j'(1).length() = 0 cannot be changed by a receive
operation; furthermore I and C(1) at the beginning of the
transition implies by the code and above rule also
C(1) at the end of the transition.
Sj'6 remains true because the truth of
inj'(indexj').length > 1 cannot be changed by a
receive
operation in j.
send
shown above.
Similar reasoning as in the previous case also shows that S0j',
Sj'1 and Sj'2 remain true. Sj'6 remains
true because the truth of inj'(indexj').length > 1
cannot be changed by a send
operation.
Thus we have established the invariance of I'.