Results 1 
2 of
2
Programming by Expression Refinement: the KMP Algorithm
, 1990
"... Introduction We carry out a small exercise in programming by what might be called expression refinement. This is a style of formal programming in which we begin with an expression written in an expressive notation and regarded as a specification, and proceed to manipulate it into a constructive equ ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
Introduction We carry out a small exercise in programming by what might be called expression refinement. This is a style of formal programming in which we begin with an expression written in an expressive notation and regarded as a specification, and proceed to manipulate it into a constructive equivalent. This leads to programs making much use of recursive functions and less use of loops. The exercise is to calculate a patternmatching algorithm, and specifically the algorithm originally due to Knuth, Morris, and Pratt [0]. We begin, however, with a smaller problem, one that turns out to be both similar to, and a subproblem of, the larger problem. We prefer to start with this because it will give the reader a chance to become familiar in a simple setting with the style and notation we employ. We briefly review some basic notation. Function application is denoted by an infix dot which has the highest operator precedence. Finite sequences are regarded as partial fun