The Impact Of seq On Free Theorems-Based Program Transformations
- ASU Author/Contributor (non-ASU co-authors, if there are any, appear on document)
- Patricia Johann Ph.D, Professor (Creator)
- Institution
- Appalachian State University (ASU )
- Web Site: https://library.appstate.edu/
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.
The Impact Of seq On Free Theorems-Based Program Transformations
PDF (Portable Document Format)
506 KB
Created on 9/30/2021
Views: 235
Additional Information
- Publication
- Johann, P. & Voigtlander, J. (2006). The Impact of seq on Free Theorems-Based Program Transformations. Fundamenta Informaticae, Special Issue on Program Transformation, v.69, no. 1-2 (2006), pp. 63-102. This work is based on the paper Free Theorems in the Presence of seq , which appeared in 31st Symposium on Principles of Programming Languages (POPL ’04), Proceedings, ACM Press, 2004. NC Docks permission to re-print granted by author(s). Publisher version of record available at: http://doi.acm.org/10.1145/964001.964010
- Language: English
- Date: 2006
- Keywords
- Haskell, control primitives, correctness proofs, denotational semantics, functional programming languages, logical relations, mixing strict and nonstrict evaluation, parametricity, polymorphism, program transformations, rank-2 types, short cut fusion, theorems for free