## Types, Potency, and Idempotency: Why Nonlinearity and Amnesia Make a Type System Work (2004)

### Cached

### Download Links

- [www.cs.brandeis.edu]
- [www.church-project.org]
- [www.church-project.org]
- [www.church-project.org]
- DBLP

### Other Repositories/Bibliography

Venue: | In Proc. 9th Int’l Conf. Functional Programming |

Citations: | 8 - 1 self |

### BibTeX

@INPROCEEDINGS{Neergaard04types,potency,,

author = {Peter Møller Neergaard and Harry G. Mairson},

title = {Types, Potency, and Idempotency: Why Nonlinearity and Amnesia Make a Type System Work},

booktitle = {In Proc. 9th Int’l Conf. Functional Programming},

year = {2004},

publisher = {ACM Press}

}

### Years of Citing Articles

### OpenURL

### Abstract

Useful type inference must be faster than normalization. Otherwise, you could check safety conditions by running the program. We analyze the relationship between bounds on normalization and type inference. We show how the success of type inference is fundamentally related to the amnesia of the type system: the nonlinearity by which all instances of a variable are constrained to have the same type.

### Citations

936 | A theory of type polymorphism in progra.mming
- Milner
- 1978
(Show Context)
Citation Context ... lead to its success. Like other forms of static safety analysis, type inference predicts at compile-time the behavior of the program at run-time—recall Milner’s “well-typed programs do not go wrong” =-=[35]-=-. A crucial requirement for type inference is that it is substantially faster than running the program—otherwise, you could get the same result as follows: run the program, and watch! This efficiency ... |

731 |
Structure and Interpretation of Computer Programs
- Abelson, Sussman
- 1996
(Show Context)
Citation Context ... s z = s(iter n s z)—but now, if iter is to have type Int → α, what is α? Even worse, typing simple programming examples, such as Abelson and Sussman’s square-root program via iterative approximation =-=[1]-=-, become compiler exercises in numerical analysis. The interaction net vernacular underlines the similarities between intersection types and linear logic. Sharing nodes capture the behavior of non-ACI... |

329 | Theorems for free
- Wadler
- 1989
(Show Context)
Citation Context ...is invariant under reduction. Principal typings and normal forms are consequently isomorphic, following the intuitive understanding all functional programmers have of reading a function from its type =-=[45, 33]-=- and vice versa. Combining these insights, we conclude that type inference is normalization: we can either normalize a term (which terminates due to the normalization bounds) and read back the princip... |

154 |
The Lambda Calculus: its Syntax and Semantics. NorthHolland, revised edition
- Barendregt
- 1984
(Show Context)
Citation Context ... λ-calculus. The set of λ-terms Λ is given by following grammar: Λ ∋ M,N,P,Q ::= x | λx.M | MN (1) where the variables x are drawn from the countable set VΛ. We adopt Barendregt’s variable convention =-=[5]-=-. We use #x(M) for the number of free occurrences of the variable x in M. We use the standard size measure |·| on terms. We use xn y to denote n applications of x to y; e.g., s3 z = s (s (sz)); the Ch... |

141 |
Type systems for programming languages
- Mitchell
- 1990
(Show Context)
Citation Context ... computational difficulty of type inference for intersection types with ACI, comparing it to the expressive power of the language. They develop a naïve type inference algorithm based on let-expansion =-=[36]-=-. Let the Kalmar elementary functions be K(0,n)=n and K(t + 1,n)=2 K(t,n) ; they prove that type-inference for a term M of rank r is in dtime[K(r,|M|)], while the expressiveness is in dtime[K(K(r,|M|)... |

132 |
The structure of multiplicatives
- Danos, Regnier
- 1989
(Show Context)
Citation Context ...ame variables in the type environment. graphs containing either the root port, or the port marking a weakening from a K-abstraction. (This is in essence the correctness criterion of Danos and Regnier =-=[14]-=-.) If Π without annotations and orientations of the wires is the net I, we call Π a typing of I. We say that I has typing 〈x1 : τ1,...,xn : τn;τ〉 where τ is the type of the conclusion of Π and τi is t... |

119 | An algorithm for optimal lambda calculus reduction
- Lamping
- 1990
(Show Context)
Citation Context .... From the context semantics of a term, we may recover intersection typing information. The method is an elaboration of a readback algorithm we have used to prove the correctness of optimal reduction =-=[30, 15, 3, 34]-=-, where we not only want to read back a λ-term, but also the location of linear logic boxes (representing expansion variables), and the existence, commutativity, and associativity of sharing nodes. Fo... |

108 |
The principal type scheme of an object in combinatory logic
- Hindley
- 1969
(Show Context)
Citation Context ...er than running the program—otherwise, you could get the same result as follows: run the program, and watch! This efficiency has been achieved for simple types [43], the Hindley/Milner ML type system =-=[18, 35, 32, 25]-=-, and some intersection type systems [24]. In these systems, there is an exponential or super-exponential leap from the worst-case bound on type inference to the worst-case bound on normalization (run... |

97 | The geometry of optimal lambda reduction, in - Gonthier, Abadi, et al. - 1992 |

93 | What are principal typings and what are they good for
- Jim
- 1996
(Show Context)
Citation Context ...lysis [20], dead-code elimination [10, 13], and totality analysis [8]. Moreover, intersection types have been advocated for modular compilation [6, 26, 12, 4] as they (usually) have principal typings =-=[21]-=-— that is, there exists a single typing from which all other typings of aterm can be derived. 1 A significant, interesting, and representative example of an intersection type system is the prototype ... |

78 |
Optimal reductions in the lambda-calculus
- Lévy
- 1980
(Show Context)
Citation Context ...tly proved the step-wise correspondence between type inference and normalization in the setting of System E [7]. Carlier et al. also show how System E can do the analysis corresponding to Lévy labels =-=[31]-=-. 1.6 Acknowledgements We thank Joe Wells for explaining the intricate details of System-I, and for his invitation to visit Heriot-Watt University during summer 2003, as well as Sébastien Carlier for ... |

75 |
The Optimal Implementation of Functional Programming Languages
- Asperti, Guerrini
- 1998
(Show Context)
Citation Context .... From the context semantics of a term, we may recover intersection typing information. The method is an elaboration of a readback algorithm we have used to prove the correctness of optimal reduction =-=[30, 15, 3, 34]-=-, where we not only want to read back a λ-term, but also the location of linear logic boxes (representing expansion variables), and the existence, commutativity, and associativity of sharing nodes. Fo... |

58 |
Principal type schemes for an extended type theory
- Rocca, S, et al.
- 1984
(Show Context)
Citation Context ...y of sharing nodes. For space reasons we cannot provide further details, but hope to in a longer version of this paper. 1.5 Related work Coppo, Dezani, and Venneri [9], Ronchi della Rocca and Venneri =-=[41]-=-, van Bakel [44], and Sayag and Mauny [42] have all established a connection between inferring the principal intersection typing and normalization as they (essentially) infer the principal typing thro... |

58 | Typability and Type Checking in System F are Equivalent and Undecidable
- Wells
- 1999
(Show Context)
Citation Context ...ersection types is motivated by 3 concerns: Typing more terms: In full generality, type inference with both universal types and intersection types is undecidable—Wells proves this for universal types =-=[47]-=-; for intersection types, observe that such types characterize exactly the strongly normalizing terms [2] 3 ; see also Cor. 5.9. Practical implementations therefore employ a restriction. For example, ... |

55 | From Proof Nets to Interaction Nets - Lafont - 1995 |

54 | A modular, polyvariant and type-based closure analysis
- Banerjee
- 1997
(Show Context)
Citation Context ...phism is itemized explicitly using a type constructor ∧: a term of type τ ∧ σ can have both type τ and type σ. Intersection types have gained recent interest for such varied purposes as flow analysis =-=[4]-=-, strictness analysis [20], dead-code elimination [10, 13], and totality analysis [8]. Moreover, intersection types have been advocated for modular compilation [6, 26, 12, 4] as they (usually) have pr... |

54 |
Functional characters of solvable terms. Zeitschrift für Mathematische Logik und 81 der Mathematik
- Coppo, Dezani-Ciancaglini, et al.
- 1981
(Show Context)
Citation Context ...nce, commutativity, and associativity of sharing nodes. For space reasons we cannot provide further details, but hope to in a longer version of this paper. 1.5 Related work Coppo, Dezani, and Venneri =-=[9]-=-, Ronchi della Rocca and Venneri [41], van Bakel [44], and Sayag and Mauny [42] have all established a connection between inferring the principal intersection typing and normalization as they (essenti... |

53 | Linear logic without boxes
- Gonthier, Abadi, et al.
- 1992
(Show Context)
Citation Context ...yped programs as nets, flow analysis for programs becomes essentially a reformulation of Girard’s geometry of interaction (GoI), made mundane for computer scientists in the guise of context semantics =-=[16, 15, 34]-=-. From the context semantics of a term, we may recover intersection typing information. The method is an elaboration of a readback algorithm we have used to prove the correctness of optimal reduction ... |

52 |
Lambda-calcul et réseaux
- Regnier
- 1992
(Show Context)
Citation Context ...he crucial fact that System-I lacks type idempotency: a∧a = a. The analysis establishes the following: A formal connection between intersection types and linear logic originally suggested by Regnier =-=[39]-=-. Most notably, the expansion variables [28, 6] of System-I are shown to be a syntactic rendition of the boxes from proofnets [29]. Further, the ∧ in types are sharing nodes, and normalization bounds ... |

51 | Principality and decidable type inference for finite-rank intersection types
- Kfoury, Wells
- 1999
(Show Context)
Citation Context ...ng, or find the principal typing and return the normal form. On the operational level, this correspondence is realized by observing that the unification rules of the original presentation of System-I =-=[27]-=- are exactly the rules for global reduction of interaction nets. How may we interpret these technical results to yield practical insights? Worst-case lower bounds (in ML, for example) have traditional... |

49 |
Deciding ML typability is complete for deterministic exponential time
- Mairson
- 1990
(Show Context)
Citation Context ...er than running the program—otherwise, you could get the same result as follows: run the program, and watch! This efficiency has been achieved for simple types [43], the Hindley/Milner ML type system =-=[18, 35, 32, 25]-=-, and some intersection type systems [24]. In these systems, there is an exponential or super-exponential leap from the worst-case bound on type inference to the worst-case bound on normalization (run... |

46 | Intersection Type Disciplines in Lambda Calculus and Applicative Term Rewriting Systems
- Bakel
- 1993
(Show Context)
Citation Context ...es. For space reasons we cannot provide further details, but hope to in a longer version of this paper. 1.5 Related work Coppo, Dezani, and Venneri [9], Ronchi della Rocca and Venneri [41], van Bakel =-=[44]-=-, and Sayag and Mauny [42] have all established a connection between inferring the principal intersection typing and normalization as they (essentially) infer the principal typing through normalizatio... |

42 | Unification and ML type reconstruction
- KANELLAKIS, MAIRSON, et al.
- 1991
(Show Context)
Citation Context ...rm takes an enormous leap to K(K(t,n),1). But without ACI, the “base” calculus is the linear λ-calculus, not the simply-typed one, and there is no such boost. Finally, using standard machinery (e.g., =-=[22, 17]-=-) we may conclude: Theorem 4.3. LetPbeaλ-term of length n; then deciding if P is typable in rank t is complete for dtime[K(t,n)]. 5 Type inference is never cheaper than normalization We have now reach... |

29 |
Principal type scheme and unification for intersection type discipline
- Rocca
- 1988
(Show Context)
Citation Context ...y duplicating (parts of) the principal type with fresh names to obtain (a ◦ → a ◦ ) ∧ (a • → a • ). We then apply the simultaneous substitution {a ◦ = τN,a • = a}. This is formalized in numerous ways =-=[41, 40, 44, 42]-=-, but unfortunately with a very heavy notation. Kfoury and Wells made a significant simplification by extending the types with expansion variables which marks where the expansions should take place. C... |

28 | The complexity of type inference for higher-order typed lambda calculi
- Henglein, Mairson
- 1994
(Show Context)
Citation Context ...most elementary time. In lower bounds on type inference, the fundamental technical question is how to iterate a linear function with different domain and range types. As shown by Henglein and Mairson =-=[17]-=-, any Turing machine transition function can be encoded as a linear λ-term; we can therefore represent the transition function by a simple System-I term. Since the Turing machine state is implicitly c... |

28 | A calculus with polymorphic and polyvariant flow types
- Wells, Dimock, et al.
(Show Context)
Citation Context ...m System-I [28, 26] (and its descendant, System E [6]), which has both principal typings, and automatic type inference [26, 7]. These type systems serve as a foundation of the Church compiler project =-=[48]-=-. We analyze here the relationship in System-I between the cost of type inference, and the cost of normalization. We focus on the crucial fact that System-I lacks type idempotency: a∧a = a. The analy... |

27 | Outline of a proof theory of parametricity
- Mairson
- 1991
(Show Context)
Citation Context ...is invariant under reduction. Principal typings and normal forms are consequently isomorphic, following the intuitive understanding all functional programmers have of reading a function from its type =-=[45, 33]-=- and vice versa. Combining these insights, we conclude that type inference is normalization: we can either normalize a term (which terminates due to the normalization bounds) and read back the princip... |

26 | Principality and type inference for intersection types using expansion variables
- Kfoury, Wells
- 2001
(Show Context)
Citation Context ... exists a single typing from which all other typings of aterm can be derived. 1 A significant, interesting, and representative example of an intersection type system is the prototype system System-I =-=[28, 26]-=- (and its descendant, System E [6]), which has both principal typings, and automatic type inference [26, 7]. These type systems serve as a foundation of the Church compiler project [48]. We analyze he... |

25 | System E: Expansion variables for flexible typing with linear and non-linear types and intersection types
- Carlier, Polakow, et al.
- 2004
(Show Context)
Citation Context ...uch varied purposes as flow analysis [4], strictness analysis [20], dead-code elimination [10, 13], and totality analysis [8]. Moreover, intersection types have been advocated for modular compilation =-=[6, 26, 12, 4]-=- as they (usually) have principal typings [21]— that is, there exists a single typing from which all other typings of aterm can be derived. 1 A significant, interesting, and representative example of... |

23 |
The Typed lambda-Calculus is not Elementary Recursive. FOCS
- Statman
- 1977
(Show Context)
Citation Context ...ference is that it is substantially faster than running the program—otherwise, you could get the same result as follows: run the program, and watch! This efficiency has been achieved for simple types =-=[43]-=-, the Hindley/Milner ML type system [18, 35, 32, 25], and some intersection type systems [24]. In these systems, there is an exponential or super-exponential leap from the worst-case bound on type inf... |

21 |
Domains and lambda-calculi, volume 46 of Cambridge Tracts
- Amadio, Curien
- 1998
(Show Context)
Citation Context ...h universal types and intersection types is undecidable—Wells proves this for universal types [47]; for intersection types, observe that such types characterize exactly the strongly normalizing terms =-=[2]-=- 3 ; see also Cor. 5.9. Practical implementations therefore employ a restriction. For example, ML allows only outermost quantification and therefore rejects fn f => (f 3, f true) since f must have mon... |

21 | Relating Typability and Expressibility in Finite-Rank Intersection Type Systems
- Kfoury, Mairson, et al.
- 1999
(Show Context)
Citation Context ...the same result as follows: run the program, and watch! This efficiency has been achieved for simple types [43], the Hindley/Milner ML type system [18, 35, 32, 25], and some intersection type systems =-=[24]-=-. In these systems, there is an exponential or super-exponential leap from the worst-case bound on type inference to the worst-case bound on normalization (running time). As a nonobvious consequence, ... |

16 | Inference of polymorphic and conditional strictness properties
- Jensen
- 1998
(Show Context)
Citation Context ...tly using a type constructor ∧: a term of type τ ∧ σ can have both type τ and type σ. Intersection types have gained recent interest for such varied purposes as flow analysis [4], strictness analysis =-=[20]-=-, dead-code elimination [10, 13], and totality analysis [8]. Moreover, intersection types have been advocated for modular compilation [6, 26, 12, 4] as they (usually) have principal typings [21]— that... |

11 | 2004): Type Inference with Expansion Variables and Intersection Types in System E and an Exact Correspondence with β -reduction
- Carlier, Wells
(Show Context)
Citation Context ... and representative example of an intersection type system is the prototype system System-I [28, 26] (and its descendant, System E [6]), which has both principal typings, and automatic type inference =-=[26, 7]-=-. These type systems serve as a foundation of the Church compiler project [48]. We analyze here the relationship in System-I between the cost of type inference, and the cost of normalization. We focus... |

11 | Rank 2 intersection types for local definitions and conditional expressions
- Damiani
(Show Context)
Citation Context ... way of counting, is the lowest non-trivial rank—all ML programs and more can be typed, e.g., the program above has intersection type ((int → a) ∧ (bool → b)) → a × b. This is well-studied by Damiani =-=[11]-=-. Modular compilation, where the different parts of a software system are developed and compiled independently, becomes increasingly important as program size increases. Intersection types are a stron... |

10 | A linearization of the lambda-calculus - Kfoury |

10 | From Hilbert spaces to Dilbert spaces: Context semantics made simple
- Mairson
- 2002
(Show Context)
Citation Context ...yped programs as nets, flow analysis for programs becomes essentially a reformulation of Girard’s geometry of interaction (GoI), made mundane for computer scientists in the guise of context semantics =-=[16, 15, 34]-=-. From the context semantics of a term, we may recover intersection typing information. The method is an elaboration of a readback algorithm we have used to prove the correctness of optimal reduction ... |

9 | Exact flow analysis
- Mossin
- 1997
(Show Context)
Citation Context ...urrence has a unique non-ACI intersection type, typed-based flow analysis between call sites and functions can optimize specific procedure applications. This has been exploited for instance by Mossin =-=[37]-=-. 1.2 Comparing expressiveness, type inference We observe that without idempotency, linearity is enforced in the types: if a variable occurs twice, it has type a ∧ b, evenifa = b. Consequently, in a t... |

8 | Implementing compositional analysis using intersection types with expansion variables
- Kfoury, Washburn, et al.
- 2002
(Show Context)
Citation Context ...uch varied purposes as flow analysis [4], strictness analysis [20], dead-code elimination [10, 13], and totality analysis [8]. Moreover, intersection types have been advocated for modular compilation =-=[6, 26, 12, 4]-=- as they (usually) have principal typings [21]— that is, there exists a single typing from which all other typings of aterm can be derived. 1 A significant, interesting, and representative example of... |

8 | A new presentation of the intersection type discipline through principal typings of normal forms
- Sayag, Mauny
- 1996
(Show Context)
Citation Context ...annot provide further details, but hope to in a longer version of this paper. 1.5 Related work Coppo, Dezani, and Venneri [9], Ronchi della Rocca and Venneri [41], van Bakel [44], and Sayag and Mauny =-=[42]-=- have all established a connection between inferring the principal intersection typing and normalization as they (essentially) infer the principal typing through normalization. In fact, we share the o... |

7 | Strictness, totality, and non-standard type inference
- Coppo, Damiani, et al.
- 2002
(Show Context)
Citation Context ...e both type τ and type σ. Intersection types have gained recent interest for such varied purposes as flow analysis [4], strictness analysis [20], dead-code elimination [10, 13], and totality analysis =-=[8]-=-. Moreover, intersection types have been advocated for modular compilation [6, 26, 12, 4] as they (usually) have principal typings [21]— that is, there exists a single typing from which all other typi... |

7 | Rank 2 intersection types for modules
- Damiani
- 2003
(Show Context)
Citation Context ...uch varied purposes as flow analysis [4], strictness analysis [20], dead-code elimination [10, 13], and totality analysis [8]. Moreover, intersection types have been advocated for modular compilation =-=[6, 26, 12, 4]-=- as they (usually) have principal typings [21]— that is, there exists a single typing from which all other typings of aterm can be derived. 1 A significant, interesting, and representative example of... |

7 |
Automatic useless-code detection and elimination for HOT functional programs
- Damiani, Giannini
- 2000
(Show Context)
Citation Context ... ∧: a term of type τ ∧ σ can have both type τ and type σ. Intersection types have gained recent interest for such varied purposes as flow analysis [4], strictness analysis [20], dead-code elimination =-=[10, 13]-=-, and totality analysis [8]. Moreover, intersection types have been advocated for modular compilation [6, 26, 12, 4] as they (usually) have principal typings [21]— that is, there exists a single typin... |

4 |
A conjunctive type system for useless-code elimination
- Damiani
(Show Context)
Citation Context ... ∧: a term of type τ ∧ σ can have both type τ and type σ. Intersection types have gained recent interest for such varied purposes as flow analysis [4], strictness analysis [20], dead-code elimination =-=[10, 13]-=-, and totality analysis [8]. Moreover, intersection types have been advocated for modular compilation [6, 26, 12, 4] as they (usually) have principal typings [21]— that is, there exists a single typin... |

3 | ML typability is DEXPTIME complete - Kfoury, Tiuryn, et al. - 1990 |

1 |
System I experimentation tool. http://types.bu.edu/modular/compositional/ experimentation-tool
- Washburn, Kfoury, et al.
(Show Context)
Citation Context ...reduction rules for proofnets. A corollary of this analysis is that normalization and type inference are identical in every single case. This is evidenced by the Church Project’s experimentation tool =-=[46]-=-: inference for a seemingly innocent ML-program like (fn s=>fn z=> s(s(s z)))(fn s=>fn z=> s(s z))(fn s=>fn z=>s(s z)) times out. The I in System-I therefore reminds us of its computational impotence.... |