## Semantic Types and Approximation for Featherweight Java

### BibTeX

@MISC{Rowe_semantictypes,

author = {R. N. S. Rowe and S. J. Van Bakel},

title = {Semantic Types and Approximation for Featherweight Java},

year = {}

}

### OpenURL

### Abstract

We consider semantics for the class-based object-oriented calculus Featherweight Java based upon approximation. We also define an intersection type assignment systems for this calculus and show that it is sound and complete, i.e. types are preserved under conversion. We establish the link with between type assignment and the approximation semantics by showing an approximation result, which leads to a sufficient condition for head-normalisation and termination. We show the expressivity of our predicate system by defining an encoding of Combinatory Logic into our calculus. We show that this encoding preserves predicate-ability and also that our system characterises the normalising and strongly normalising terms for this encoding. We thus demonstrate that the great analytic capabilities of intersection types can be applied to the context of class-based object orientation.

### Citations

1694 |
The Java Language Specification
- GOSLING, JOY, et al.
- 1996
(Show Context)
Citation Context ...lisation and termination of terms through assignable types. Semantics for object-oriented programming The object-oriented (oo) programming paradigm, as exemplified by languages such as C++ [62], Java =-=[45]-=-, C# [1], Ruby [43], ECMAscript (or Javascript) [2] and Python [60], has been the subject of extensive theoretical study over the last two decades. oo-languages come in two broad flavours: the object ... |

1619 | The De of Standard ML
- Milner, Tofte, et al.
- 1990
(Show Context)
Citation Context ...t Java [27], a restriction of Java defined by removing all but the most essential features of the full language; Featherweight Java bears a similar relation to Java as LC does to languages such as ML =-=[30]-=- and Haskell [26]. We illustrate the expressive power of our calculus by showing that it is Turing complete through an embedding of Combinatory Logic (CL) – and thereby also LC. We will use two approa... |

1584 | The C++ Programming Language
- Stroustrup
- 1986
(Show Context)
Citation Context ...erise normalisation and termination of terms through assignable types. Semantics for object-oriented programming The object-oriented (oo) programming paradigm, as exemplified by languages such as C++ =-=[62]-=-, Java [45], C# [1], Ruby [43], ECMAscript (or Javascript) [2] and Python [60], has been the subject of extensive theoretical study over the last two decades. oo-languages come in two broad flavours: ... |

1161 |
Lambda Calculus: its Syntax and Semantics
- Barendregt
- 1984
(Show Context)
Citation Context ... expressive type systems have been defined and investigated for a variety of calculi. Amongst those, the intersection type discipline (ITD) [15, 16, 12, 2], first defined for the Lambda Calculus (LC) =-=[11]-=-, stands out as a system that is closed under β-equality and gives rise to a filter model; it is defined as an extension of Curry’s basic type system for LC, by allowing term-variables to have many, p... |

923 | A Theory of Objects
- Abadi, Cardelli
- 1996
(Show Context)
Citation Context ...Ruby [37], ECMAscript (or Javascript) [21] and Python [35]. OO languages come in two broad flavours: the object (or prototype) based, and the class based. A number of formal models has been developed =-=[13, 14, 31, 22, 23, 1, 27]-=- which attempt to distill the many features of OO into a core set of primitive operations. Of these, the ς-calculus [1] and Featherweight Java (FJ) [27] have been well received as elementary models fo... |

778 | Rewrite systems
- Dershowitz, Jouannaud
- 1990
(Show Context)
Citation Context ...bility of intersection type assignment for other computational models: for example, van Bakel and Fernández [14, 15, 16] have studied intersection types in the context of Term Rewriting Systems (trs) =-=[52, 36]-=- and van Bakel studied them [10, 12] in the context of sequent calculi [33, 17]. In addition, van Bakel and de’Liguoro [13] have developed a system for the ς-calculus, bringing intersection types to t... |

583 | Featherweight Java: A minimal core calculus for Java and GJ
- Igarashi, Pierce, et al.
- 1999
(Show Context)
Citation Context ...Ruby [37], ECMAscript (or Javascript) [21] and Python [35]. OO languages come in two broad flavours: the object (or prototype) based, and the class based. A number of formal models has been developed =-=[13, 14, 31, 22, 23, 1, 27]-=- which attempt to distill the many features of OO into a core set of primitive operations. Of these, the ς-calculus [1] and Featherweight Java (FJ) [27] have been well received as elementary models fo... |

505 | A semantics of multiple inheritance
- Cardelli
- 1988
(Show Context)
Citation Context ...Ruby [37], ECMAscript (or Javascript) [21] and Python [35]. OO languages come in two broad flavours: the object (or prototype) based, and the class based. A number of formal models has been developed =-=[13, 14, 31, 22, 23, 1, 27]-=- which attempt to distill the many features of OO into a core set of primitive operations. Of these, the ς-calculus [1] and Featherweight Java (FJ) [27] have been well received as elementary models fo... |

337 | An algorithmic interpretation of classical natural deduction - Parigot - 1992 |

272 |
Domains for denotational semantics
- Scott
- 1982
(Show Context)
Citation Context ...ics is a well-established area of research for both functional and imperative languages; for the functional programming language side, semantics is mainly denotational, based on Scott’s domain theory =-=[38]-=-, whereas for Email addresses: rnr07@doc.ic.ac.uk (R.N.S. Rowe), svb@doc.ic.ac.uk (S.J. van Bakel) Preprint submitted to Elsevier April 19, 2011imperative languages it is mainly operational [34]. In ... |

221 | Intensional interpretations of functionals of finite type I - Tait - 1967 |

219 |
A filter lambda model and the completeness of type assignment
- Barendregt, Coppo, et al.
- 1983
(Show Context)
Citation Context ...s-based object orientation. Introduction Over the years many expressive type systems have been defined and investigated for a variety of calculi. Amongst those, the intersection type discipline (ITD) =-=[15, 16, 12, 2]-=-, first defined for the Lambda Calculus (LC) [11], stands out as a system that is closed under β-equality and gives rise to a filter model; it is defined as an extension of Curry’s basic type system f... |

175 | The duality of computation
- Curien, Herbelin
- 2000
(Show Context)
Citation Context ...ple, van Bakel and Fernández [14, 15, 16] have studied intersection types in the context of Term Rewriting Systems (trs) [52, 36] and van Bakel studied them [10, 12] in the context of sequent calculi =-=[33, 17]-=-. In addition, van Bakel and de’Liguoro [13] have developed a system for the ς-calculus, bringing intersection types to the context of oo; the main characteristic of that system is that it sees assign... |

169 | A lambda-calculus of objects and method specialization
- Fisher, Honsell, et al.
- 1994
(Show Context)
Citation Context |

145 |
Type systems for programming languages
- MITCHELL
- 1990
(Show Context)
Citation Context |

142 | Palsberg, A denotational semantics of inheritance and its correctness
- Cook, Jens
- 1994
(Show Context)
Citation Context ...n relation (i.e. conversion) - it is certainly the first to study an approximation model of oo. Other related work includes Cook and Palsberg’s denotational treatment of inheritance and method lookup =-=[29, 30]-=-. Reddy [58] also gives a denotational semantics to objectoriented concepts, in which objects are viewed as closures (i.e. let-bound functions). The main point of this work is to give a more fundament... |

127 | Comparing object encodings, in
- Bruce, Cardelli, et al.
- 1997
(Show Context)
Citation Context ... an oo-calculus and a denotational PER semantics for it. Using an alternative approach, semantics for oo has been studied by encoding oo-calculi in various typed λ-calculi. Cardelli, Bruce and Pierce =-=[23]-=- gave a survey of some of the main approaches in this direction, and compare four different encodings. Glew [44] builds on this, and presents a different typed encoding and gives a very comprehensive ... |

121 | A paradigmatic object-oriented programming language: design, static typing and semantics
- Bruce
- 1994
(Show Context)
Citation Context ...al semantics for Java. Two major contributions are Abadi and Cardelli’s denotational PER model for the ς-calculus [3] and Bruce’s semantics mapping his oo-languages to F-bounded second order λ-models =-=[22]-=-. Since both consider the language explicitly typed, programs and their types are strongly linked; Abadi and Cardelli used their semantics to show that the type system for the ς-calculus is sound. Bru... |

120 |
Family polymorphism
- Ernst
- 2001
(Show Context)
Citation Context ...ith the explicit permission of the programmer). We should point out here that some other solutions to this particular problem have been proposed in the literature (see the work on family polymorphism =-=[39, 48]-=-), but these solutions persist in the nominal typing approach and can thus only be achieved by extending the language itself. The fj c intersection type system we have presented in this paper has two... |

113 |
The principal type scheme of an object in combinatory logic
- Hindley
- 1969
(Show Context)
Citation Context ...d CL. This is illustrated by a type preservation result. We present Curry’s type system for CL and then show we can give equivalent types to OOCL programs. Definition 56 (Curry Type Assignment for CL =-=[46]-=-). 1. The set of simple types (also known as Curry types) is defined by the following grammar: A, B ::= ϕ| A→B 2. A basis Γ is a mapping from variables to Curry types, written as a set of statements o... |

105 | Complete restrictions of the intersection type discipline
- Bakel
- 1992
(Show Context)
Citation Context ...rms in the Curry system correspond to types in our system that can be assigned to the interpreted cl-terms. This could then easily be extended to the strict intersection type assignment system for lc =-=[6]-=-; combined with the results we show in this paper, this then implies that the collection of typeable oo-expressions correspond to the terms that are typeable using intersection types, i.e. all λ-terms... |

105 |
1936b: ‘A Note on the Entscheidungsproblem
- Church
- 1965
(Show Context)
Citation Context ...ith a context; as such, the types express run-time behaviour of expressions. On the other hand, our notion of approximation is defined similarly to Wadsworth’s notion [66, 67] for the λ-calculus (lc) =-=[28, 20]-=-: masking out computationally active subterms on a reduction sequence (all the terms created by the execution of a term) creates a notion of approximation for terms that induces a semantics. We will s... |

105 | Sound polymorphic type inference for objects
- Eifrig, Smith, et al.
- 1995
(Show Context)
Citation Context ...type system for oo in the literature with these characteristics: for example, the work of Palsberg for the ς-calculus, who showed decidable type inference [56], and that of Eifrig, Smith and Trifonov =-=[38, 37]-=-. But our system is, we believe, the first such system which is faithful to a semantic model of the language, and this is the main contribution of our work. The case for the nominal type checking appr... |

98 |
The relation between computational and denotational properties for Scott’s D∞-models of the lambda-calculus
- Wadsworth
- 1976
(Show Context)
Citation Context ...uring’ argument (as is done in [11] for LC). 2. Approximation Semantics In this section, we define an approximation semantics for FJ ¢ . The notion of approximant was first introduced by Wadsworth in =-=[41]-=- for LC. Essentially, approximants are partially evaluated expressions in which the locations of incomplete evaluation (i.e. where reduction may still take place) are explicitly marked by the element ... |

93 |
An extension of the basic functionality theory for the λ-calculus
- Coppo, Dezani-Ciancaglini
- 1980
(Show Context)
Citation Context ...s-based object orientation. Introduction Over the years many expressive type systems have been defined and investigated for a variety of calculi. Amongst those, the intersection type discipline (ITD) =-=[15, 16, 12, 2]-=-, first defined for the Lambda Calculus (LC) [11], stands out as a system that is closed under β-equality and gives rise to a filter model; it is defined as an extension of Curry’s basic type system f... |

91 |
A language and axioms for explicit mathematics
- Feferman
- 1975
(Show Context)
Citation Context ...s were published that consider denotational semantics for (Featherweight) Java. Studer [63] defined a semantics for Featherweight Java using a model based on Feferman’s Explicit Mathematics formalism =-=[40]-=-. Studer mentions that his model is theoretically weaker than other models that have previously been considered (as mentioned above), and his result is that his semantics is adequate with respect to t... |

84 | Type inference for recursively constrained types and its application to OOP
- Eifrig, Smith, et al.
- 1995
(Show Context)
Citation Context ...type system for oo in the literature with these characteristics: for example, the work of Palsberg for the ς-calculus, who showed decidable type inference [56], and that of Eifrig, Smith and Trifonov =-=[38, 37]-=-. But our system is, we believe, the first such system which is faithful to a semantic model of the language, and this is the main contribution of our work. The case for the nominal type checking appr... |

82 |
Report on the Programming Language Haskell
- Hudak, Jones, et al.
- 1988
(Show Context)
Citation Context ...striction of Java defined by removing all but the most essential features of the full language; Featherweight Java bears a similar relation to Java as LC does to languages such as ML [30] and Haskell =-=[26]-=-. We illustrate the expressive power of our calculus by showing that it is Turing complete through an embedding of Combinatory Logic (CL) – and thereby also LC. We will use two approaches, by defining... |

82 | Objects as closures: abstract semantics of object oriented languages
- Reddy
- 1998
(Show Context)
Citation Context ... conversion) - it is certainly the first to study an approximation model of oo. Other related work includes Cook and Palsberg’s denotational treatment of inheritance and method lookup [29, 30]. Reddy =-=[58]-=- also gives a denotational semantics to objectoriented concepts, in which objects are viewed as closures (i.e. let-bound functions). The main point of this work is to give a more fundamental view of w... |

73 | A delegation-based object calculus with subtyping
- Fisher, Mitchell
- 1995
(Show Context)
Citation Context |

68 | Structural operational semantics
- Plotkin
- 1981
(Show Context)
Citation Context ...eory [38], whereas for Email addresses: rnr07@doc.ic.ac.uk (R.N.S. Rowe), svb@doc.ic.ac.uk (S.J. van Bakel) Preprint submitted to Elsevier April 19, 2011imperative languages it is mainly operational =-=[34]-=-. In this paper we aim to develop denotational semantics for classbased OO; in order to be able to concentrate on the essential difficulties, we focus on Featherweight Java [27], a restriction of Java... |

68 |
Inheritance in smalltalk-80: A denotational definition
- Kamin
- 1988
(Show Context)
Citation Context ...her than to consider their reduction behaviour - the paper does not consider reduction and its relationship to the semantics at all. A similar semantics is defined for the language SmallTalk by Kamin =-=[50]-=-, but differs in that the interpretation of an object is simply a record of its field values; Reddy and Kamin together compared their two semantics and proving them equivalent [51]. Additionally, Cast... |

63 | Intersection type assignment systems
- Bakel
- 1997
(Show Context)
Citation Context ...imation Semantics, Derivation Reduction, Strong Normalisation Introduction In this paper we will study semantics for Featherweight Java (fj) [47] through both a notion of intersection type assignment =-=[31, 32, 21, 7]-=- and of approximation [66]. Our types are functional (expressing the types of methods, in particular, as functions, and assigned to untyped expressions, as common in functional programming), contain f... |

56 |
Object-Oriented Programming: A Unified Foundation
- Castagna
- 1997
(Show Context)
Citation Context ... differs in that the interpretation of an object is simply a record of its field values; Reddy and Kamin together compared their two semantics and proving them equivalent [51]. Additionally, Castagna =-=[27]-=- has done work on defining an oo-calculus and a denotational PER semantics for it. Using an alternative approach, semantics for oo has been studied by encoding oo-calculi in various typed λ-calculi. C... |

54 |
Functional characters of solvable terms. Zeitschrift für Mathematische Logik und Grundlagen der Mathematik
- Coppo, Dezani-Ciancaglini, et al.
- 1981
(Show Context)
Citation Context ...s-based object orientation. Introduction Over the years many expressive type systems have been defined and investigated for a variety of calculi. Amongst those, the intersection type discipline (ITD) =-=[15, 16, 12, 2]-=-, first defined for the Lambda Calculus (LC) [11], stands out as a system that is closed under β-equality and gives rise to a filter model; it is defined as an extension of Curry’s basic type system f... |

53 | Efficient inference of object types
- Palsberg
- 1995
(Show Context)
Citation Context ...int out that our type system is not the only type system for oo in the literature with these characteristics: for example, the work of Palsberg for the ς-calculus, who showed decidable type inference =-=[56]-=-, and that of Eifrig, Smith and Trifonov [38, 37]. But our system is, we believe, the first such system which is faithful to a semantic model of the language, and this is the main contribution of our ... |

45 |
Grundlagen der kombinatorischen Logik (Inauguraldissertation
- Curry
- 1930
(Show Context)
Citation Context ...m. Thus, we have a predicate-based characterisation of all (terminating) computable functions in OO (see Theorem 73). Combinatory Logic is a Turing complete model of computation defined by H.B. Curry =-=[17]-=- independently of LC. It is a higher-order TRS consisting of the function symbols S,K and the following rewrite rules: K x y → x S x y z → x z (y z) Our encoding of CL in FJ ¢ is based on a Curryfied ... |

38 |
Term rewriting systems: a tutorial
- Klop
- 1987
(Show Context)
Citation Context ...bility of intersection type assignment for other computational models: for example, van Bakel and Fernández [14, 15, 16] have studied intersection types in the context of Term Rewriting Systems (trs) =-=[52, 36]-=- and van Bakel studied them [10, 12] in the context of sequent calculi [33, 17]. In addition, van Bakel and de’Liguoro [13] have developed a system for the ς-calculus, bringing intersection types to t... |

37 | Two semantic models of object-oriented languages
- Kamin, Reddy
- 1994
(Show Context)
Citation Context ... SmallTalk by Kamin [50], but differs in that the interpretation of an object is simply a record of its field values; Reddy and Kamin together compared their two semantics and proving them equivalent =-=[51]-=-. Additionally, Castagna [27] has done work on defining an oo-calculus and a denotational PER semantics for it. Using an alternative approach, semantics for oo has been studied by encoding oo-calculi ... |

35 | A Semantics of Object Types
- Abadi, Cardelli
(Show Context)
Citation Context ... types. Semantics for object-oriented programming The object-oriented (oo) programming paradigm, as exemplified by languages such as C++ [62], Java [45], C# [1], Ruby [43], ECMAscript (or Javascript) =-=[2]-=- and Python [60], has been the subject of extensive theoretical study over the last two decades. oo-languages come in two broad flavours: the object (or prototype) based, 1and the class based. A numb... |

34 | On the relationship between classes, objects, and data abstraction. Theory and Practice of Object Systems - Fisher, Mitchell - 1998 |

31 |
Principal type scheme and unification for intersection type discipline
- Rocca
- 1988
(Show Context)
Citation Context ...tates that, for every intersection type assignable to a term in our system, an approximant of that term exists which can be assigned the same type; for lc, this result was shown by Ronchi della Rocca =-=[59]-=- (see also [7]). Interpreting a fj-program by its set of approximants gives an approximation semantics and the approximation result 3then relates the approximation and the type-based semantics; it de... |

26 | A modality for recursion
- Nakano
(Show Context)
Citation Context ...sing recursive definitions. This observation further motivates and strengthens the case (by no means a new concept in the analysis of OO) for the use of recursive types in this area. Some recent work =-=[32]-=- shows that a restricted but still highly expressive form of recursive types can still characterise strongly normalising terms, and we hope to fuse this approach with our own to come to an equally pre... |

25 | Normalization Results for Typeable Rewrite Systems
- Bakel, Fernández
- 1997
(Show Context)
Citation Context ... of the suitability of intersection type assignment for other computational models: for example, van Bakel and Fernández have studied intersection types in the context of Term Rewriting Systems (TRS) =-=[7, 8]-=- and van Bakel studied them in the context of sequent calculi [4, 5]. The object-oriented programming paradigm has also been the subject of extensive theoretical study over the last two decades, as ex... |

21 | An efficient class and object encoding
- Glew
- 2000
(Show Context)
Citation Context ...n studied by encoding oo-calculi in various typed λ-calculi. Cardelli, Bruce and Pierce [23] gave a survey of some of the main approaches in this direction, and compare four different encodings. Glew =-=[44]-=- builds on this, and presents a different typed encoding and gives a very comprehensive overview of previous and related encodings. Viswanathan [65] uses an encoding of oo into a λ-calculus in order t... |

16 | Computation with Classical Sequents - Bakel, Lescanne |

15 | Cut-Elimination in the Strict Intersection Type Assignment System is Strongly Normalising. To appear in: Notre Dame Journal of Formal Logic
- Bakel
- 2004
(Show Context)
Citation Context ...mal forms are typeable using strict types, whereas in our system they are. 5. Strong Normalisation of Derivation Reduction The approximation result we show in the next section is, as in other systems =-=[3, 8]-=-, a direct consequence of the strong normalisability of derivation reduction 6 which we will define in this section. The notion of derivation reduction is essentially a form of cut-elimination on pred... |

14 | Dynamic Denotational Semantics of Java
- Alves-Foss, Lam
- 1999
(Show Context)
Citation Context ...lly weaker than other models that have previously been considered (as mentioned above), and his result is that his semantics is adequate with respect to the Java nominal class type system. Alves-Foss =-=[5]-=- has done work on giving a denotational semantics to the full Java language; his system is impressively comprehensive but, as far as we can see, is not used for any kind of analysis - at least not in ... |

13 | Lightweight family polymorphism
- Igarashi, Saito, et al.
- 2005
(Show Context)
Citation Context ...ith the explicit permission of the programmer). We should point out here that some other solutions to this particular problem have been proposed in the literature (see the work on family polymorphism =-=[39, 48]-=-), but these solutions persist in the nominal typing approach and can thus only be achieved by extending the language itself. The fj c intersection type system we have presented in this paper has two... |

13 | Full abstraction for first-order objects with recursive types and subtyping
- Viswanathan
(Show Context)
Citation Context ...rection, and compare four different encodings. Glew [44] builds on this, and presents a different typed encoding and gives a very comprehensive overview of previous and related encodings. Viswanathan =-=[65]-=- uses an encoding of oo into a λ-calculus in order to study the observational equivalence/full abstraction issue. More recently, and more immediately relevant to our work, some papers were published t... |