Journal of Computer Science 3 (8): 639-645, 2007 ISSN 1549-3636 © 2007 Science Publications Corresponding Author: Mahmoud Ahmed Abou Ghaly, Mathematics Department, Faculty of Science, Ain Shams University, Cairo, 11566, Egypt, Tel +20242219893 Mob +20125243452 Fax: +20248262201 639 Operational Semantics for Lazy Evaluation Mahmoud A. Abou Ghaly, Sameh S. Daoud, Azza A. Taha and Salwa M. Aly Mathematics Department, Faculty of Science, Ain Shams University, Cairo, 11566, Egypt Abstract: An operational semantics for lazy evaluation of a calculus without higher order functions was defined. Although it optimizes many aspects of implementation, e.g. there is a sharing in the recursive computation, there is no conversion, the heap is automatically reclaimed, and an attempt to evaluate an argument is done at most once. It is still suitable for reasoning about program behavior and proofs of program correctness; this is primarily due to the definition via inferences and axioms which allows for proofs by induction on the height of the proof tree. We also proved the correctness of this operational semantics by showing that it is equivalent with respect to the values calculated to the operational semantics of LAZY-PCF+SHAR due to S. Purushothaman Iyer and Jill Seaman. Keywords: Higher order functions, conversion, LAZY-PCF+SHAR INTRODUCTION Lazy evaluation delays expression evaluation and avoids multiple evaluation of the same expression. Any implementation of lazy evaluation or call by need has two ingredients [1] . 1. Arguments to functions should be evaluated only when their values are needed. 2. Arguments should only be evaluated once, further uses of them within the function body should use the values computed before. This means that there is a sharing of arguments. The first ingredient is taken form normal order evaluation, and the second ingredient is taken from applicative order evaluation, i.e. Lazy evaluation is a normal order evaluation with sharing of arguments. In Lazy evaluation we pursue normal order evaluation and stop the evaluation when there is no top level redex. The existence of higher order functions in a calculus increase its expressive power, but makes obstacles in defining simple semantics and efficient implementations for lazy evaluation, for this sake, we will waive part of the expressive power of the calculus, by waiving higher order functions from the calculus. This is not a big problem, since higher order functions do not exist in imperative languages. So we will use a calculus with the terms; variable, number, the recursive operator μx.e, and the application of a function to arguments (with the context conditions that a function cannot be the result or the arguments of another function). We will define an operational semantics for lazy evaluation of this calculus. We call this calculus with its operational semantics rules Lmßr, since we will use multi ß reductions of the terms. Also we will compare the simplicity and the efficiency of this operational semantics with the operational semantics for lazy evaluation of the general lambda calculus. Although Lmßr operational semantics is mainly to model sharing of arguments, it also perform many implementation optimizations, like, The heap is automatically reclaimed, since there is an automatic deletion of out of scope variables from the heap. An attempt to evaluate an argument is done at most once, since once an argument is evaluated the result of evaluation is stored and latter reference to the argument will copy this stored value directly. There is no conversion (a renaming of variables with a completely fresh variables to avoid name clashes). There is a sharing in the recursive computation. The key reason for all such optimizations is Lmßr uses multi argument reduction for terms. There have already been some attempts to provide semantics of lazy evaluation for lambda calculus, but all of them require extra overhead to deal with the existence of higher order functions in the calculus. For