Proving Lazy Folklore with Mixed Lazy/strict Semantics
نویسنده
چکیده
Abstract. Explicit enforcement of strictness is used by functional programmers for many different purposes. Few functional programmers, however, are aware that explicitly enforcing strictness has serious consequences for (formal) reasoning about their programs. Some vague “folklore” knowledge has emerged concerning the correspondence between lazy and strict evaluation but this is based on experience rather than on rigid proof. This paper employs a model for formal reasoning with enforced strictness based on John Launchbury’s lazy graph semantics. In this model Launchbury’s semantics are extended with an explicit strict let construct. Examples are given of the use of these semantics in formal proofs. We formally prove some “folklore” properties that are often used in informal reasoning by programmers.
منابع مشابه
Mixed Lazy/Strict Graph Semantics
Explicitly enforcing strictness is often used by functional programmers as an important tool for making applications fit time and space efficiency requirements. Few functional programmers however, are familiar with the consequences of explicitly enforcing strictness for formal reasoning about their programs. Some “folklore” knowledge has emerged but this is based on experience rather than on ri...
متن کاملReasoning about explicit strictness in a lazy language using mixed lazy/strict semantics
Abstract. Many functional programmers are familiar with the concept of enforcing strictness for making applications fit their time and space efficiency requirements. Few functional programmers however, are familiar with the consequences of enforcing strictness for formal reasoning about their programs. This paper attempts to fill the gap between the few and the many. Some typical examples are g...
متن کاملFine Control of Demand in Haskell
Functional languages have the -calculus at their core, but then depart from this rm foundation by including features that alter their default evaluation order. The resulting mixed evaluation|partly lazy and partly strict|complicates the formal semantics of these languages. The functional language Haskell is such a language, with features such as pattern-matching, case expressions with guards, e...
متن کاملA Con ict Between Call - by - Need Computationand
In functional language implementation, there is a folklore belief that there is a connict between implementing call-by-need semantics and parallel evaluation. In this note we illustrate this by proving that reduction algorithms of a certain general and commonly used form which give call-by-need semantics ooer very little parallelism. The analysis of lazy pattern-matching which leads to the abov...
متن کاملDeriving a Lazy Abstract Machine
We derive a simple abstract machine for lazy evaluation of the lambda calculus, starting from Launchbury's natural semantics. Lazy evaluation here means non-strict evaluation with sharing of argument evaluation, that is, call-by-need. The machine we derive is a lazy version of Krivine's abstract machine, which was originally designed for call-by-name evaluation. We extend it with datatype const...
متن کامل