In this paper we develop an analogue of the graph-theoretic `modular
decomposition' in automata theory. This decomposition allows us to identify
hierarchical finite state machines (HFSMs) equivalent to a given finite state
machine (FSM). We provide a definition of a module in an FSM, which is a
collection of nodes which can be treated as a nested FSM. We identify a
well-behaved subset of FSM modules called thin modules, and represent these
using a linear-space directed graph we call a decomposition tree. We prove that
every FSM has a unique decomposition tree which uniquely stores each thin
module. We provide an O(n2k) algorithm for finding the decomposition tree of
an n-state k-alphabet FSM. The decomposition tree allows us to extend FSMs
to equivalent HFSMs. For thin HFSMs, which are those where each nested FSM is a
thin module, we can construct an equivalent maximally-hierarchical HFSM in
polynomial time.Comment: 38 pages, 11 figures. Submitted to Theoretical Computer Scienc