## Expression Refinement: Deriving Bresenham's Algorithm (1994)

Venue: | Functional Programming: Glasgow 1994, SpringerVerlag Workshops in Computing |

Citations: | 1 - 0 self |

### BibTeX

@INPROCEEDINGS{Bunkenburg94expressionrefinement:,

author = {Alexander Bunkenburg and Sharon Flynn},

title = {Expression Refinement: Deriving Bresenham's Algorithm},

booktitle = {Functional Programming: Glasgow 1994, SpringerVerlag Workshops in Computing},

year = {1994}

}

### OpenURL

### Abstract

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. 1 Introduction In this paper we show how a simple specification expression can be refined to an efficient functional program and then further transformed into an imperative program which is cheaper to implement than its functional equivalent. For the purpose of derivation, expressions are easier to manipulate than statements. This can be seen, for example...

### Citations

1335 | The essence of functional programming - Wadler - 1992 |

480 | Programming from Specifications - Morgan - 1994 |

302 |
Algorithm for computer control of digital plotter
- Bresenham
- 1965
(Show Context)
Citation Context ...e obtained by symmetry. The problem is to find, for the list of integer x-values [x1::x2], those y-values which best approximate the mathematical line given by (1). Bresenham's line drawing algorithm =-=[Bre65]-=- solves this problem using only integer arithmetic. We aim to derive this algorithm formally. Since 0sms1, the line segment will be represented well if every x 2 Z between x1 and x2 is paired with som... |

218 | An introduction to the theory of lists - Bird - 1987 |

109 | Lazy functional state threads - Launchbury, Jones, et al. - 1994 |

95 | Algorithmics â€“towards programming as a mathematical activity - Meertens - 1986 |

32 | An exploration of the Bird-Meertens formalism - Backhouse - 1989 |

29 | Lazy imperative programming - Launchbury - 1993 |

17 |
Using program transformations to derive line-drawing algorithms
- Sproull
- 1982
(Show Context)
Citation Context ...entship from the Engineering and Physical Sciences Research Council. 1 This paper describes an approach to program derivation using the example of Bresenham's line drawing algorithm [SS87, Bre65]. In =-=[Spr82]-=- this example is used to demonstrate program derivation by program transformation, using a form of Pascal extended with real numbers (as opposed to floating point numbers). The transformation steps ar... |

14 | Programs from Specifications - Morris - 1990 |

8 | Bidirectional Fold and Scan - O'Donnell - 1993 |

5 | Computer Graphics: Systems and Concepts - Salmon, Slater - 1977 |

1 |
What computing is all about
- Snepscheut
- 1993
(Show Context)
Citation Context ...monstrate program derivation by program transformation, using a form of Pascal extended with real numbers (as opposed to floating point numbers). The transformation steps are justified informally. In =-=[Sne93]-=- the derivation is also presented in an imperative guarded-command language. Its semantics is given by Hoare-triples. Our aim in this paper is to derive the algorithm formally, using expression refine... |