explicitly described states
The protocol consists of two processes, Sender and Receiver, each having a data buffer and a one-bit state. Sender and Receiver use two channels to communicate with each other, as they do not share any common memory: (a) a data channel from Sender to Receiver for sending bit-packet pairs, and (b) an acknowledgement channel from Receiver to Sender for sending single bits for confirmation. The protocol works as follows:
< bit, pac >
to the data channel, where bit
is the Sender's bit and pac
is the Sender's data to transmit.
If the Sender receives bit
from Receiver over the acknowledgement channel, then that is a confirmation that the packet sent has been delivered.
In that case, Sender flips its bit and select the next packet to send. < bit, pac >
such that bit
is different from its bit, then it stores pac
and flips its bit. For the ABP we are interested in verifying the following safety property: all messages from Sender are successfully delivered to Receiver, in the correct order, despite the fact that the two communication channels may lose or duplicate messages.
This is achieved in three main steps. The overall structure is similar to that of the OTS/CafeOBJ method, but the formalization is different.
We prove the following four invariants by simulteneous induction.
ceq [inv1]: B = B1 if[B1,N,(Ch1,< B,P >,Ca1,< B1,P1 >,Cn1),B2,D,Ch2]: Reach
ceq [inv2]: B = B1 if [B1,N,(Ch1,< B,P >,Cn1),B1,D,Ch2]: Reach
ceq [inv3]: B2 = B1 if [B1,N,Ch1,B2,D,(Ch2,B1,Cn2)]: Reach
ceq [inv4]: B = B1 if[B1,N,Ch1,B2,D,(Ch2,B,Ca2,B1,Cn2)]: Reach
See inv.maude for the full proof.
We prove another invariant, inv5, using inv1, inv2, inv3 and inv4 as lemmas.
< B, P >
such that B
is Sender's bit, then P
is Sender's current packet.
ceq [inv5]: P = pac(N) if [B,N,(Ch1,< B,P >,Cn1),B2,D,Ch2]: Reach
See inv5.maude for the full proof.
The safety property of interest is formalized as the conjunction of two goals.
ceq [goal1]: mk(next(S:Sys)) = list(S:Sys) if bit2(S:Sys) = bit1(S:Sys)
ceq [goal2]: mk(next(S:Sys)) = pac(next(S:Sys)),list(S:Sys) if not bit2(S:Sys) = bit1(S:Sys)
See goal.maude for the full proof.