Expression Refinement: Deriving Bresenham's Algorithm

This paper illustrates a method of transforming an initial specification expression, which is not necessarily algorithmic, into an efficient functional implementation using a refinement calculus for expressions. In doing this, we benefit from the ease of manipulation that state-less expressions allow. However, implementations of functional algorithms are not as cheap as imperative implementations. We further show how an imperative program can be derived from a functional expression using algebraic transformations based on the state monad model. The example used to illustrate the method is Bresenham’s line drawing algorithm.