Fall 98, CSE 520: Lecture 16 (Oct 19)

Implementation of a two-cells buffer by using two one-cell buffers

We have seen that a one-cell buffer can be defined as follows:
B = in(x).C(x)
C(x) = ^out(x).B
Where B represent the buffer in the empty state, and C(x) represents the buffer in the state of storing a data x. This buffer has capacity one (one-cell) because it cannot store more than one datum at the time, i.e. C(x) cannot input another datum.

If we want to implement a buffer with capacity two, one way is to use two one-cell buffers. The idea is to connect the "out" port of the first buffer with the "in" port of the second buffer. This can be done by renaming "out" by "a" in the first buffer and "in" by "a" in the second buffer, where "a" is a new name. Furthermore, we have to restrict the use of "a", so that an external process cannot access it. It must be for "internal use" of the two buffers only. In conclusion, we can specify the two-cell buffer B2 as follows:

B2 = (B[f] | B[g])\{a}
where f is the function which renames "out" in "a" (out |-> a) and g is the function which renames "in" in "a" (in |-> a).