Introduction to Machine Tables

Author: Peter Bradley

In order to create a symbolic model, we need two things: a set of symbols and a set of rules to operate on those symbols. Let us construct the latter, and harder, of these two: the rules. In order to do that, we'll start with a familiar example: a soda machine.

In this case, suppose that a soda costs $1. The soda machine takes two sorts of inputs: 50c and $1, and it has two outputs: a soda and 50c (just in case you put in 50c, and then realize that you don't have the other 50c, but you do have a dollar). We need to create a model of how the machine emits soda and change given all the possible inputs. In this case, we are concerned with specifying the rules, not the symbols themselves. We will assume that the machine has some internal representation of both the inputs.

A Soda Machine

As above, this machine takes two inputs: $1 and 50c, and it has two outputs: a soda and 50c. In order to specify the rules for its operation succinctly, let us represent the soda output as a 'S', and the 50c output as a 'C' thus:

SEmit a soda
CEmit 50c in change

We represent the rules for the operation of the soda machine in what is called a 'machine table'. The machine specifies which actions the machine should take given which inputs. In this case, we need 2 columns (for the two inputs), and at least 1 row (for the 'state' of the machine):

When the machine receives $1 in input, it should emit a soda. So the State 1 - $1 Dollar Input cell of the table is easy:

But, the other cell is more complicated. If the machine receives 50c in input, it shouldn't give out a soda, yet it needs to somehow store the fact that it has already received 50c. We can do this by adding a new state to the machine table thus:

Now, when the machine receives 50c input in state 1, it should go into state 2 and await another 50c. We specify state transitions by writing the number of the state the machine should enter in the appropriate cell in the table:

1Go to state 1
2Go to state 2

We can, therefore, represent the command 'Emit a soda and go to state 2' as 'S2'. And 'Emit 50c and go to state 1 as 'C1'. Note that the language we have just developed is not the list of representations required for a symbolic model. This is a language that tells the machine what to do with the representations of 50c and $1. In the next few modules, we will look at how to develop a set of representations that can be used in a symbolic model, and eventually, how to specify the rules in terms of those representations. But for the time being, we will simply consider the rules.

Our machine table now looks like this:

Note that we specify that the machine should stay in state 1 after emitting a soda (after receiving a dollar). State one is the machine's 'default' or 'standing' state. The machine is in state 1 when it is waiting for the next customer to purchase a soda. Thus, once the transaction of 'soda-for-a-dollar' is complete, the machine must return to, or stay in, state 1.

Now we just have to specify what the machine does in state 2. Try to complete the table on your own, and press 'Check' when you are finished.

1 2
If the machine receives 50c, it does not have enough to emit a soda, so it has to go into a state that will emit a soda with an additional 50c. That must be a different state than this one, as in this state, it cannot emit a soda. So, we specify that the machine goes to state 2.
If the machine receives 1$, it does have enough to emit a soda, so do so, and stay in the current state.
2 S1
If the machine is in this state, it has already received 50c, so if it receives another 50c, emit a soda and go to the starting state (1).
If the machine is in this state, if has already received 50c, so if it receives another dollar, it must emit 50c AND a soda, and return to the starting state (1).

Congratulations! You have just completed a machine table! A machine table is a table that specifies how a machine should act given two conditions: input and the current state of the machine. In the next module, we will see how machine tables can be used to model more complex operations.

A machine table is a method of specifying the rules with which a symbolic model operates.


Copyright: 2002