Operators, Functions, and Properties – part 2

In the previous post I introduced the idea of a device like the one pictured below:

where the single digit on the little screen was observed to cycle through a repeating pattern every time the red button is pushed, as follows:

I suggested that there are many possible models that could underlie this behavior, and said I’d address three of them.  In this post, I’ll show one that doesn’t involve any kind of arithmetic whatsoever, and in subsequent posts I’ll show two more that do involve arithmetic or other traditional “math” stuff.  The model shown here is mechanical.  We imagine a disk, as below:

and imagine that it can move around an axle in the center, and that the button activates a rotation clockwise over 36 degrees.  The screen is simply a window,  a transparent piece of the cover which hides the rest of the machinery.

You may think that this model is too simple, too primitive, to reveal anything interesting, let alone reveal anything mathematical.

Yet once you have a model that matches an underlying behavior, you can play with the model to see what it can do, and what else it might be good for.  The essence of  this particular model is that it has ten different states, and that it supports a cyclical progression from one state to the next.  Each state (in this case, the position of the disk)  is characterized by a particular digit showing underneath the window on the screen.  Yet is clear that the state controls what is shown on the screen, and that the button causes the transition from the current state to the next, regardless of what is shown on the screen.

For example, if we replaced the disk with the following disk:

we may start to appreciate that it is not the numbers that are cycling, but the states.  There is still ten states, in regular cyclical progression, but the outputs (the number visible on the screen) now cycles as follows: 0 – 1 – 2 – 3 – 4 – 0 – 1 – 2 – 3 – 1 – 0 – 1 – 2 – 3 – 4 – 0 – 1 – 2 – 3 – 1 – 0 – 1 – 2… without a pattern that is immediately obvious.  Moreover, what comes after “1” is no longer unique, nor is what comes after “3”.  Sometimes the 1 is followed by 2, and sometimes the 1 is followed by 0.  Sometimes the 3 is followed by 4, and sometimes by 1.

The diagram above shows both state transitions and outputs.  The states have been named A,B,…,J, and their progression is simple, cyclical and regular.  To interpret the diagram, let’s look at the third row, with entries “C”, “2”, and “D”.  What this row tells us is that if the current state is “C”, then the number shown will be “2”, and the next state (when you push the button) will be “D”.

You can determine the output from the state, but you can’t always determine the state from the output.  This is a common situation; we say that the device has hidden state.  The black box of the mechanism can hide state that is relevant to what is visibly happening.  A friendlier way of saying this is that the box has memory.  It remembers something that affects how it responds to a stimulus.  Here, the stimulus is the pushing of the button.  How it responds to the pushing of the button is directly related to its internal state, which in this example we have assumed to be one of ten states.  If we knew the exact construction of the disk and the rest of the mechanism, and we were given the device when it shows “0”, it will take us several button presses to determine what state it was in when we got it.  At least, because the progression through states is cyclical, we always have a way to get back to a particular state.  There is no “painting ourselves into a corner” with this device.

The model for the device that we’ve shown here is a simple case of what is called a finite state machine.  Machines that more-or-less fit the model of a finite state machine are very common and practical.  It is rare, of course, to find machines with only a single button.  When there are multiple buttons (inputs), the next state will depend not only on the current state but also on which button was pushed.  Most vending machines fit the model of a finite state machine very well, as does a basic four-function calculator.  However, the number of different states in even a small four-function calculator (i.e. narrow screen) is very large, and unwieldy.

To bring us back to the title of the post, the main point I want to make about the simple mechanical model with the rotating disk is this: the button is an example of an operator, and what it operates on is the state of the device, not the numbers.  The numbers just come along for the ride.