Automata Library for Haskell |
|
This library implements deterministic and non-deterministic finite automata in the programming language Haskell. Numerous standard and esoteric automata constructions are implemented, from minimization and intersection, to quotients and strongly-connected components.
This library is unique because it implements the formal textbook definition of automata directly. This novel representation offers potentially exponential memory savings over the nearly universal representation of automata as arrays of states or lookup tables. It also offers some interesting time tradeoffs. As the traditional representation is subsumed by the new representation, the new representation can always be used in a way that mimics the time complexity of the old.
Direct implementation is possible because Haskell offers higher-order functions, which result when nested function declarations and first-class functions are combined in a meaningful way. (i.e. the lambda calculus) This approach simply is not practical in languages such as C++ and Pascal. This technique is safe because Haskell is purely functional; no function can produce a side-effect. With side-effects this approach requires more discipline but is still applicable.
All this and more is described in the paper A Collection of Functional Libraries for Theory of Computation presented at the 39th ACM Southeast Conference.
You will need a copy of GHC 5, preferably with GHCi, to use this software. I know this software works with GHC 5.04.3, 5.02.x may work as well. To run the software, put the files in the same directory and use the command line
ghci -fglasgow-exts -package data tests.hs
This library uses Edison's interfaces to sets and finite maps. Edison is a rather nice library of data structures by Chris Okasaki. It provides interfaces to sequences, sets, and finite maps, and implements a variety of efficient data structures for each. However, it has been left in a somewhat incomplete state. In particular, it does not provide maps on ordered keys, which our library needs. Tree234Map fixes this. In my opinion, Edison is significantly better than C++'s Standard Template Library (STL), and the Haskell community would benefit greatly from people using and contributing to it more.
Last modified: Tue Apr 30 22:11:41 EDT 2002