    PDF e-Pub

Section: New Results

Free Theorems for Curry

Participant : Lutz Straßburger.

Free theorems  are a means of type-based reasoning and are being successfully applied for typed functional programming languages like Haskell, e.g., for program transformation and generally establishing semantic properties  ,  . As a simple example, for every polymorphic function $f::\left[\alpha \right]\to \left[\alpha \right]$ from lists to lists, arbitrary types ${\tau }_{1}$ and ${\tau }_{2}$, and a function $g::{\tau }_{1}\to {\tau }_{2}$, we have $f\circ \left(\mathrm{𝗆𝖺𝗉}\phantom{\rule{3.33333pt}{0ex}}g\right)=\left(\mathrm{𝗆𝖺𝗉}\phantom{\rule{3.33333pt}{0ex}}g\right)\circ f$, for the standard function $\mathrm{𝗆𝖺𝗉}::\left(\alpha \to \beta \right)\to \left[\alpha \right]\to \left[\beta \right]$ which takes a function and a list and applies that function to every entry of the list. It would be of interest to also have such free theorems available for typed functional-logic languages like Curry.

Previous work  has investigated free theorems for such a language, Curry   , phenomenologically and provides intuition for premises of free theorems as well as counterexamples. Proof of the positive claims has been elusive so far, mainly because Curry's type system fails to reflect the key feature: nondeterminism. This avoidance is convenient for programmers, as they do not have to distinguish between deterministic and nondeterministic values. However, it is a hindrance to formal reasoning: the conditions identified in   include a notion of determinism, and hence it is a serious weakness of the type system not to capture this.

In a joint work with colleagues at the University of Bonn, published in  , we have developed an intermediate language, called SaLT, that allowed us to prove a Parametricity Theorem which could be used to derive free theorems for Curry.

This work is the result of the PHC Procope collaboration with the University of Bonn (duration 2012-2013).