[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Understanding "OneBitProtocol"



I'm working on understanding the one-bit protocol in the "Principles" section of the hyperbook, and have a question about the following construction. The book says on page 10:

Since we don't want to worry about what the other process might do if it
reads x[self] to be a non-Boolean value, the process should set x[self]
to a Boolean. Here is a PlusCal statement that sets x[self] to an
arbitrarily (nondeterministically) chosen Boolean value:

with (v \in BOOLEAN ) { x[self] = v }
...

The algorithm should allow this with statement to be executed any number
of times before the process reaches e1. We can express this by letting the while
loop begin:

r : while(true)
    { either { with (v \in BOOLEAN ) { x[self] = v } ;
               goto r
             }
      or skip ;
...

Doesn't this code allow the statement to be executed zero times, in particular, if the "or skip" is nondeterministically chosen? If so, can't we reach later code with x[self] having no value, in particular, no Boolean value? If so, doesn't that defeat the purpose of the construction, which is "... set x[self] to a Boolean..."