next up previous contents
Next: Reduction strategies Up: Rewriting as a model Previous: Rewriting as a model   Contents

Theorem

Let $e$ be a Haskell expression with two reductions $e \ensuremath\leadsto f_1
\ensuremath\leadsto f_2 \ensuremath\leadsto \cdots \ensuremath\leadsto f_k \ensuremath\leadsto g$ and $e
\ensuremath\leadsto f'_1 \ensuremath\leadsto f'_2 \ensuremath\leadsto \cdots \ensuremath\leadsto f'_{\ell}
\ensuremath\leadsto g'$ such that $g$ and $g'$ cannot be further reduced. Then, $g = g'$.


In general, we need a strategy for reduction--that is, a rule telling us how to apply the rules! Some questions we might ask are:

  1. Are all reduction strategies equivalent with respect to the final result (this property is called confluence)?

  2. Can we tell whether the reduction process will terminate? For example, consider what happens to the expression factorial -1 with respect to the definition

         factorial:: Int -> Int
         factorial n = n * (factorial (n-1))
    

  3. Given a choice of reduction strategies, can we always identify the optimal one, in terms of efficiency? Notice in the reduction of square (4+3) that the first reduction sequence is shorter than the other two.



Madhavan Mukund 2004-04-29