scispace - formally typeset
Open AccessJournal Article

The Impact of seq on Free Theorems-Based Program Transformations

TLDR
This paper uses asymmetry introduced by left-closedness to derive criteria ensuring that both equational and inequational versions of short cut fusion and related program transformations based on free theorems hold in the presence of seq.
Abstract
Parametric polymorphism constrains the behavior of pure functional programs in a way that allows the derivation of interesting theorems about them solely from their types, i.e., virtually for free. Unfortunately, standard parametricity results - including so-called free theorems - fail for nonstrict languages supporting a polymorphic strict evaluation primitive such as Haskell's seq. A folk theorem maintains that such results hold for a subset of Haskell corresponding to a Girard-Reynolds calculus with fixpoints and algebraic datatypes even when seq is present provided the relations which appear in their derivations are required to be bottom-reflecting and admissible. In this paper we show that this folklore is incorrect, but that parametricity results can be recovered in the presence of seq by restricting attention to left-closed, total, and admissible relations instead. The key novelty of our approach is the asymmetry introduced by left-closedness, which leads to "inequational" versions of standard parametricity results together with preconditions guaranteeing their validity even when seq is present. We use these results to derive criteria ensuring that both equational and inequational versions of short cut fusion and related program transformations based on free theorems hold in the presence of seq

read more

Citations
More filters
Journal ArticleDOI

The impact of higher-order state and control effects on local relational reasoning

TL;DR: This paper defines the first fully abstract logical relation for an ML-like language with recursive types, abstract types, general references and call/cc, and shows how it can enhance the proving power of the possible-worlds model in correspondingly orthogonal ways.
Proceedings ArticleDOI

The impact of higher-order state and control effects on local relational reasoning

TL;DR: The first fully abstract logical relation for an ML-like language with recursive types, abstract types, general references and call/cc is defined, and it is shown how the proving power of this model can be enhanced under orthogonal restrictions to the expressive power of the language.
Journal ArticleDOI

Logical Step-Indexed Logical Relations

TL;DR: A logic LSLR is defined, which is inspired by Plotkin and Abadi's logic for parametricity, but also supports recursively defined relations by means of the modal"later" operator from Appel et al.'s "very modal model" paper.
Journal ArticleDOI

Proofs for free: Parametricity for dependent types

TL;DR: It is shown how a typing judgement in System F can be translated into a relational statement (in second-order predicate logic) about inhabitants of the type, and it is obtained that for pure type systems (PTSs) there is a PTS that can be used as a logic for parametricity.
References
More filters
Book

Generative Programming: Methods, Tools, and Applications

TL;DR: This chapter discusses Domain Engineering and Object-Oriented Analysis and Design, and main development steps in Generative Programming, as well as Static versus Dynamic Parameterization, and a Fresh Look at Polymorphism.
Book

Haskell 98 language and libraries : the revised report

Peyton Jones, +1 more
TL;DR: The Haskell 98 Language: Lexical structure, Declarations and bindings, Predefined types and classes, and Libraries.
Book ChapterDOI

Towards a theory of type structure

TL;DR: It can be shown that B maps every type expression into a functor from C T into C, that w = w' implies w[w] = B[w'], and that B[WlI: 2](~) = B [Wl][ D I t I B[ w2](D) ]
Proceedings Article

Types, Abstraction and Parametric Polymorphism.

TL;DR: The findings of a Web-based questionnaire aimed at discovering both patterns of use of videoconferencing systems within HP and the reasons people give for either not using, or for using such systems are discussed.
Proceedings ArticleDOI

How to make ad-hoc polymorphism less ad hoc

TL;DR: Type classes extend the Hindley/Milner polymorphic type system, and provide a new approach to issues that arise in object-oriented programming, bounded type quantification, and abstract data types.