Version 1 of Finite State Machine

Updated 2003-04-09 16:28:22

Page by Theo Verelst

The mathematical model for a Finite State Machine is a mapping where

 from (Din,Dstate) |--> to (Rout,Rstate)
 FSM(in,state) --> (out,new state)

schematically the machine applies the mapping like:

           |----|
  in    -->|    |--> out
           |    |
  state -->|    |--> next state
           |----|

Or machinewise

  clock ------    or 'trigger new state'
             |
             V
           |----|
  in    -->|    |--> out
           |    |
  state -->|    |--> next state
        |  |----| |
        |         |
        -<---------

The mappings from (in,state) to out and another to next_state are functions acting on domains which are respectively all possible inputs and all states (possibly minus the first or last), and which have ranges of all possible output values and all possible new state values.

From straigtforward reasoning one may take it that it holds that

 Domain(state) is subset of Range(newstate) minus newstate(initial)

Surely you rather meant to write

 Dstate is superset of Rstate union initial_states

or something to that effect? - Lars H

and it makes most sense practically to take

 Domain(state) equals range Range(newstate) except for state(inital) and state(final)

The sequence of states which are traversed by starting from a given input and initial state is predictable and known when the model is no ill-defined. It can be a repeating sequence, or, by a changing input, infinite sequence without repetition, for instance by taking as states range and domain the decimal numbers 0 to 9 mapped to the some random output and a newstate equal to the previous input, and feeding the input with the decimals of PI.

See also eigenvalues and electronics and bwise applications and examples for an example on what logical functions can act as building block for remembering the state, this page has the same block and the bwise code:

 http://195.241.128.75//Diary/ldiary6.html#bwise

This page is an example of how many bytes of source code Finite State Machines can be used to encode the number of states which often would fit in a byte, and the transitions could probably be coded pretty shortly as well. Then again, an assembly program is usually much bigger than the resulting object code.