Impredicative Overloading in Explicit Mathematics - CiteSeerX

1 downloads 0 Views 214KB Size Report
May 1, 2000 - We work with a two-sorted language L which comprises individual ..... in M a code subA for the subset decidability operation on the power set.
Impredicative Overloading in Explicit Mathematics Thomas Studer



May 1, 2000

Abstract In this article we introduce the system OTN of explicit mathematics based on elementary separation, product, join and weak power types. We present a set-theoretical model for OTN, and we develop in OTN a theory of impredicative overloading. Together this yields a solution to the problem of impredicativity encountered in denotational semantics for overloading and late-binding. Further, our work provides a first example of an application of power types in explicit mathematics.

Keywords: Object-oriented constructs, type structure, proof theory.

1

Introduction

Overloading is an important concept in object-oriented programming. For example, it occurs when a method is redefined in a subclass or when a class provides several methods with the same name but with different argument types. Theoretically speaking, overloading denotes the possibility that several functions fi with respective types Si → Ti may be combined to a new overloaded function f of type {Si → Ti }i∈I . We then say fi is a branch of f . If an overloaded function f is applied to an argument x, then the type of the argument selects a branch fi , and the result of f (x) is fi (x), i.e. the chosen branch is applied to x. If the type at compile time selects the branch, then we speak of early-binding. If the selection of the branch is based on the run-time type, i.e. the type of the fully evaluated argument, then we call this ∗

Research supported by the Swiss National Science Foundation.

1

discipline late-binding. Postponing the resolution of overloaded functions to run-time would not have any effect if types cannot change during the computation. Therefore we need the concept of subtyping in order to obtain the real power of overloading. Then types can evolve during the execution of a program and this may affect the final result. Ghelli [11] first defined typed calculi with overloading and late-binding to model object-oriented programming. This approach was further developed in Castagna, Ghelli and Longo [5]. They introduce λ&, a calculus for overloaded functions with subtyping. Castagna [3] points out that this calculus provides a foundation for both Simula’s and CLOS’s style of programming. In λ& we encounter the following form of impredicativity. Consider a term M with type {{S → T } → T, S → T }. Since this type is a subtype of {S → T } the term M also belongs to {S → T }, and therefore it is possible to apply M to itself, i.e. the type {{S → T } → T, S → T } is a part of its own domain. The interpretation of that type refers to itself, whence the impredicativity. Impredicativity is not the only problem in the construction of a semantics for calculi with overloading and late-binding. We also have: subtyping, type-dependent execution and late-binding. Castagna, Ghelli and Longo [4] present a category-theoretical model for a variant of λ& with early-binding that solves the problems of subtyping and type-dependent execution. The problem of late-binding is tackled in Studer [19] where a stratified subsystem of λ& is interpreted in a theory of explicit mathematics. Systems of explicit mathematics have been introduced by Feferman [6, 7] as a framework for Bishop style constructive mathematics. More recently, Feferman’s systems were used to develop a unitary axiomatic framework for representing programs, stating properties of programs and proving properties of programs. Important references for the use of explicit mathematics in this context are Feferman [8, 9, 10] and St¨ark [17, 18]. Turner [21, 22] also uses Feferman-style theories to provide a constructive foundation for functional programming. Theories of explicit mathematics are formulated in a two sorted language. The first-order part, consisting of so-called applicative theories, is based on partial combinatory logic, cf. e.g. J¨ager, Kahle and Strahm [16]. Types build the second sort of objects. They are extensional in the usual set-theoretic sense, but a special naming relation due to J¨ager [13] allows us to deal with names of the types on the first-order level. Hence they can be used in computations which is the key to model overloading and late-binding. In this article we introduce the system OTN of explicit mathematics based on elementary separation, product, join and weak power types. We present a set-theoretical model for OTN, and we develop in OTN a theory of im2

predicative overloading. Together this yields a solution to the problem of impredicativity encountered in denotational semantics for overloading and late-binding. Power types were introduced in explicit mathematics by Feferman [7], but their use has always been doubted. Glass [12] showed that weak power types add nothing to the proof-theoretic strength of various systems of explicit mathematics without join, and J¨ager [15] proved the inconsistency of strong power types with elementary comprehension. Our work provides a first example of an application of power types in explicit mathematics.

2

Explicit Mathematics

In this section we introduce a system of explicit mathematics based on elementary separation, join, product and weak power types. We will not use Feferman’s original formalization of explicit mathematics but treat it as a theory of types and names as developed in J¨ager [13]. We work with a two-sorted language L which comprises individual variables a, b, c, f, g, x, y, z as well as type variables S, T, U, V, X, Y (both possibly with subscripts). The individual constants and the individual terms (r, s, t, r1 , s1 , t1 , . . . ) of L are defined by simultaneous induction. 1. Our language L includes the individual constants k, s (combinators), p, p0 , p1 (pairing and projections), 0 (zero), sN (successor), pN (predecessor), dN (definition by numerical cases) and if t is a closed individual term, then we have an individual constant subt (subset decidability). There are additional individual constants, called generators, which will be used for the uniform naming of types, namely nat (natural numbers), for every natural number e a generator ce (elementary separation), un (union), j (join), prod (product) and pow (power type). 2. Every individual variable and every individual constant is an individual term of L and the individual terms are closed under the binary function symbol · for (partial) application. In the following we often abbreviate (s·t) simply as (st), st or sometimes also as s(t); the context will always assure that no confusion arises. We further adopt the convention of association to the left so that s1 s2 . . . sn stands for (. . . (s1 ·s2 ) . . . sn ). Finally, we define general n tupling by induction on n ≥ 2 as follows: (s1 , s2 ) := ps1 s2 and (s1 , . . . , sn+1 ) := ((s1 , . . . , sn ), sn+1 ). The atomic formulas of L are the formulas s↓, N(s), s = t, s ∈ U , U = V and

Suggest Documents