## Theorems for free! (1989)

Venue: | FUNCTIONAL PROGRAMMING LANGUAGES AND COMPUTER ARCHITECTURE |

Citations: | 329 - 6 self |

### BibTeX

@INPROCEEDINGS{Wadler89theoremsfor,

author = {Philip Wadler},

title = {Theorems for free!},

booktitle = {FUNCTIONAL PROGRAMMING LANGUAGES AND COMPUTER ARCHITECTURE},

year = {1989},

pages = {347--359},

publisher = {ACM Press}

}

### Years of Citing Articles

### OpenURL

### Abstract

From the type of a polymorphic function we can derive a theorem that it satisfies. Every function of the same type satisfies the same theorem. This provides a free source of useful theorems, courtesy of Reynolds' abstraction theorem for the polymorphic lambda calculus.

### Citations

1562 | The Definition of Standard ML - Miller, Tofte, et al. - 1990 |

1308 | Monads for functional programming
- Wadler
- 1995
(Show Context)
Citation Context ...re filter , takewhile, and dropwhile. For example, filter odd [3 ; 1 ; 4 ; 5 ; 2 ] = [3 ; 1 ; 5 ] takewhile odd [3 ; 1 ; 4 ; 5 ; 2 ] = [3 ; 1 ] dropwhile odd [3 ; 1 ; 4 ; 5 ; 2 ] = [4 ; 5 ; 2 ] 7 See =-=[BW88]-=- for the definitions of these functions. For every such f we can define a corresponding function of type g : 8X :(X \Theta Bool) ! X such that f and g are related by the equation f A (p) = g A ffi hI ... |

936 | A theory of type polymorphism in progra.mming - Milner - 1978 |

364 |
Towards a theory of type structure
- Reynolds
- 1974
(Show Context)
Citation Context ...tment to allow fixpoints is described in Section 7. The fundamental idea of parametricity is not new. A restricted version of it appears in Reynolds' original paper on the polymorphic lambda calculus =-=[Rey74]-=-, where it is called the representation theorem, and a version similar to that used here appears in [Rey83], where it is called the abstraction theorem. Other versions include the logical relations of... |

364 |
Types, abstraction and parametric polymorphism
- Reynolds
- 1983
(Show Context)
Citation Context ...sential way on parametric polymorphism (types of the form 8X: T ). Parametricity is just a reformulation of Reynolds' abstraction theorem: terms evaluated in related environments yield related values =-=[Rey83]-=-. The key idea is that types may be read as relations. This result will be explained in Section 2 and stated more formally in Section 6. Some further applications of parametricity are shown in Figure ... |

352 |
Proofs and Types
- Girard, Lafont, et al.
- 1989
(Show Context)
Citation Context ...x and X do not occur free in t . As is well known, familiar types such as booleans, pairs, lists, and natural numbers can be defined as types constructed from just ! and 8; see for example [Rey85] or =-=[GLT89]-=-. Alternatively, we could add suitable types and individual constants to the pure language described above. 5 Semantics of polymorphic lambda calculus We will give a semantics using a version of the f... |

345 | How to make ad-hoc polymorphism less ad hoc - Wadler, Blott - 1989 |

233 | Principal type schemes for functional programs - Damas, Milner - 1982 |

143 |
Miranda: a non-strict functional language with polymorphic types
- Turner
- 1985
(Show Context)
Citation Context ...y Sheeran [She89]. So there is reason to believe that further research will further extend the applicability of this method. Many functional languages, including Standard ML [Mil84, Mil87], Miranda 1 =-=[Tur85]-=-, and Haskell [HW88], are based on the Hindley/Milner type system [Hin69, Mil78, DM82]. This system is popular because types need not be given explicitly; instead, the principal (most general) type of... |

141 | The system F of variable types, fifteen years later. Theoretical Computer Science 45 - Girard - 1986 |

118 |
Report on the functional programming language Haskell (v1.1
- Hudak, Wadler
- 1991
(Show Context)
Citation Context ... there is reason to believe that further research will further extend the applicability of this method. Many functional languages, including Standard ML [Mil84, Mil87], Miranda 1 [Tur85], and Haskell =-=[HW88]-=-, are based on the Hindley/Milner type system [Hin69, Mil78, DM82]. This system is popular because types need not be given explicitly; instead, the principal (most general) type of a function can be i... |

108 | The principal type scheme of an object in combinatory logic - Hindley - 1969 |

71 |
Three approaches to type structure
- Reynolds
- 1985
(Show Context)
Citation Context ...function that can be proved total in secondorder Peano arithmetic can be written as a term in the Girard/Reynolds calculus [FLO83, Gir72, GLT89]. This includes, for instance, Ackerman's function (see =-=[Rey85]-=-), but it excludes interpreters for most languages (including the Girard/Reynolds calculus itself). If the power of unbounded recursion is truly required, then fix can be added as a primitive. However... |

48 | Polymorphism is set theoretic, constructively - Pitts - 1987 |

46 |
Polymorphism is not Set-Theoretic
- Reynolds
(Show Context)
Citation Context ...in Reynold's original presentation [Rey83]. That version is expressed in terms of a "naive" set-theoretic model of the polymorphic lambda calculus; Reynolds later proved that such models do =-=not exist [Rey84]-=-. There is nothing wrong with the theorem or the proof itself, just the context in which it is set, and it is straightforward to transpose it to another context. This paper uses the frame modelssof Br... |

45 | Functorial polymorphism - Bainbridge, Freyd, et al. - 1990 |

45 |
Dl-Dom,øins as & Model of Polymorphism
- Gunter, \Minskel
(Show Context)
Citation Context ... elements of the model that correspond to lambda terms will be parametric; many models contain additional elements that are non-parametric. One model that contains only parametric elements is that in =-=[BTC88]-=-. 8sX ; x ; x : T ` x : T !IsX ; x ; x : U ` v : V X ; x ` x : U: v : U ! V !E X ; x ` t : U ! V X ; x ` u : U X ; x ` t u : V 8I X ; x ` t : TsX ; X ; x ` X: t : 8X: T 8EsX ; x ` t : 8X: TsX ; x ` t ... |

37 |
The Standard ML Core Language
- Milner
- 1985
(Show Context)
Citation Context ...(for terms containing the constant). This suggests that we need some way to tame the power of the polymorphic equality operator. Exactly such taming is provided by the eqtype variables of Standard ML =-=[Mil87]-=-, or more generally by the type classes of Haskell [HW88, WB89]. In these languages, we can think of polymorphic equality as having the type (=) : 8 (=) X : X ! X ! Bool : 6 Here 8 (=) X : F (X ) is a... |

34 |
Inheritance and explicit coercion
- Breazu-Tannen, Coquand, et al.
- 1991
(Show Context)
Citation Context ... of a further paper. The remainder of this paper is organised as follows. Sections 2 and 3 present the main new results: Section 2 2 This is similar to the restriction to strict coercion functions in =-=[BCGS89]-=-, and is adopted for a similar reason. 3 Since this paper was written, I have learned that Peter deBruin has recently discovered similar applications [deB89], and that John Reynolds already knew of th... |

34 | The expressiveness of simple and second-order type structures - Fortune, Leivant, et al. - 1983 |

30 | Representation independence and data abstraction - Mitchell - 1986 |

28 | Interprétation functionelle et élimination des coupures de l’arithmétique d’ordre supérieur - Girard - 1972 |

16 |
Second-order logical relations
- Mitchell, Meyer
- 1985
(Show Context)
Citation Context ... types and individual constants to the pure language described above. 5 Semantics of polymorphic lambda calculus We will give a semantics using a version of the frame semantics outlined in [BM84] and =-=[MM85]-=-. We first discuss the semantics of types, and then discuss the semantics of terms. 5.1 Types A type model consists of a universe U of type values, and two operations, ! and 8 that construct types fro... |

3 |
The semantics of second-order polymorphic lambda calculus
- Bruce, Meyer
- 1984
(Show Context)
Citation Context ...dd suitable types and individual constants to the pure language described above. 5 Semantics of polymorphic lambda calculus We will give a semantics using a version of the frame semantics outlined in =-=[BM84]-=- and [MM85]. We first discuss the semantics of types, and then discuss the semantics of terms. 5.1 Types A type model consists of a universe U of type values, and two operations, ! and 8 that construc... |

3 | Semantic parametricity in polymorphic lambda calculus - Freyd, Girard, et al. - 1988 |

3 | Relating models of polymorphism - Meseguer - 1989 |

3 |
Categories for the working hardware designer
- Sheeran
- 1990
(Show Context)
Citation Context ...kes heavy use of mathematical laws. She has found that many of the laws she needs can be generated from types using the methods described here, and has already written a paper describing how to do so =-=[She89]-=-. Not surprisingly, using a more specific type system allows even more theorems to be derived from the type of a function; this has already been explored to a certain extent by Sheeran [She89]. So the... |

1 | Derivation of a pattern-matching compiler
- Barrett, Wadler
- 1986
(Show Context)
Citation Context ... laws in Figure 1 allow one to "push map through a function". ffl Three years ago, Barrett and I wrote a paper on the derivation of an algorithm for compiling pattern-matching in functional =-=languages [BW86]-=-. The derivation used nine general theorems about higher-order functions such as map and sort . Looking at the paper again now, it turns out that of the nine theorems, five follow immediately from the... |

1 |
Naturalness of polymorphism. Submitted to Category Theory
- deBruin
- 1989
(Show Context)
Citation Context ...striction to strict coercion functions in [BCGS89], and is adopted for a similar reason. 3 Since this paper was written, I have learned that Peter deBruin has recently discovered similar applications =-=[deB89]-=-, and that John Reynolds already knew of the application in Section 3.8. presents the parametricity theorem, and Section 3 gives further applications. Sections 4--6 fill in the formalities: Section 4 ... |