From bounded affine types to automatic timing analysis (original) (raw)
Related papers
A type-based algorithm for the control-flow analysis of higher-order concurrent programs
Lecture Notes in Computer Science, 1997
We address, in a type-based framework, the problem of control-flow analysis for concurrent and functional languages. We present an efficient algorithm that propagates automatically types, communication effects and call graphs. The algorithm comes with a logical characterization that consists of a type proof system. The latter operates on a Concurrent ML core-syntax: a strongly typed, polymorphic kernel that supports higher-order functions and concurrency primitives. Effects are represented as algebraic terms that record communication effects resulting from channel creation, sending and receiving. Call graphs record function calls and are captured by a term algebra that is close to usual process algebras. Types are annotated with effects and call graphs. For the sake of flexibility, a subtyping relation is considered on the type algebra. We present the language syntax together with its static semantics that consists of the typing rules and an inference algorithm. The latter is proved to be consistent and complete with respect to the typing rules.
A type system with usage aspects
Journal of Functional Programming, 2008
Linear typing schemes can be used to guarantee non-interference and so the soundness of in-place update with respect to a functional semantics. But linear schemes are restrictive in practice, and more restrictive than necessary to guarantee soundness of in-place update. This limitation has prompted research into static analysis and more sophisticated typing disciplines to determine when in-place update may be safely used, or to combine linear and non-linear schemes. Here we contribute to this direction by defining a new typing scheme that better approximates the semantic property of soundness of in-place update for a functional semantics. We begin from the observation that some data is used only in a "read-only" context, after which it may be safely re-used before being destroyed. Formalising the in-place update interpretation in a machine model semantics allows us to refine this observation, motivating three usage aspects apparent from the semantics that are used to annotate function argument types. The aspects are (1) used destructively, (2) used read-only but shared with result, and (3) used read-only and not shared with the result. The main novelty is aspect (2) that allows a linear value to be safely read and even aliased with a result of a function without being consumed. This novelty makes our type system more expressive than previous systems for functional languages in the literature. The system remains simple and intuitive, but it enjoys a strong soundness property whose proof is non-trivial. Moreover, our analysis features principal types and feasible type reconstruction, as shown in (Konecny, 2003b).
The Analysis of Resource Use in the λ-Calculus by Type Inference
PhD Thesis, 1995
This thesis is concerned primarily with the definition and semantics of resource use in the λ-calculus and the implicational fragment of intuitionistic propositional logic. A secondary aim is the subsequent derivation of a type system which can infer the expected reduction behaviour of functions upon their arguments. The term resource use refers to the view of arguments as the resources a function requires to produce a result. In this thesis, resource use will be taken to mean a property of the formal parameter of a function that describes the use the function will make of arguments substituted for the parameter. Knowledge of the resource use of a function parameter can lead to many practical benefits in the efficient compilation of functional programs. Recent research has investigated the derivation of resource use information using type inference. Types inferred for functions contain resource use information about the way that arguments will be evaluated when applied to those functions. However, the justification of the correctness of these type systems relies on the given interpretation of type expressions as sets of terms possessing those types. The main contribution of this thesis is the definition of resource use in both the λ-calculus and in the implicational fragment of intuitionistic propositional logic that corresponds to the typed λ-calculus under the Curry-Howard isomorphism. We are able to demonstrate the cor- respondence of resource use between (typed) λ-terms and the proofs in intuitionistic logic, though we find that this correspondence is not up to equivalence. Subsequently, we derive a type system for inferring resource use in λ-terms and also discuss the implementation of the type system. We find that we are unable to apply previously-used methods of unification over types containing resource use information when the range of resource use information is expanded.
An effective theory of type refinements
ACM SIGPLAN Notices, 2003
We develop an explicit two level system that allows programmers to reason about the behavior of effectful programs. The first level is an ordinary ML-style type system, which confers standard properties on program behavior. The second level is a conservative extension of the first that uses a logic of type refinements to check more precise properties of program behavior. Our logic is a fragment of intuitionistic linear logic, which gives programmers the ability to reason locally about changes of program state. We provide a generic resource semantics for our logic as well as a sound, decidable, syntactic refinement-checking system. We also prove that refinements give rise to an optimization principle for programs. Finally, we illustrate the power of our system through a number of examples.
Optimizing the runtime processing of types in a higher-order logic programming language
2005
The traditional purpose of types in programming languages of providing correctness assurances at compile time is increasingly being supplemented by a direct role for them in the computational process. In the specific context of typed logic programming, this is manifest in their effect on the unification operation. Their influence takes two different forms. First, in a situation where polymorphism is permitted, type information is needed to determine if different occurrences of the same name in fact denote an identical constant. Second, type information may determine the specific form of a binding for a variable. When types are needed for the second purpose as in the case of higher-order unification, these have to be available with every variable and constant. However, in many situations such as first-order and higher-order pattern unification it turns out that types have no impact on the variable binding process. As a consequence, type examination is needed in these situations only for the first of the two purposes described and even here a careful preprocessing can considerably reduce their runtime footprint. We develop a scheme for treating types in these contexts that exploits this observation. Under this scheme, type information is elided in most cases and is embedded into term structure when this is not entirely possible. Our approach obviates types when properties known as definitional genericity and type preservation are satisfied and has the advantage of working even when these conditions are violated.
The Implicit Calculus of Constructions as a Programming Language with Dependent Types
2008
In this paper, we show how Miquel’s Implicit Calculus of Constructions (ICC) can be used as a programming language featuring dependent types. Since this system has an undecidable type-checking, we introduce a more verbose variant, called ICC* which fixes this issue. Datatypes and program specifications are enriched with logical assertions (such as preconditions, postconditions, invariants) and programs are decorated with proofs of those assertions. The point of using ICC* rather than the Calculus of Constructions (the core formalism of the Coq proof assistant) is that all of the static information (types and proof objects) is transparent, in the sense that it does not affect the computational behavior. This is concretized by a built-in extraction procedure that removes this static information. We also illustrate the main features of ICC* on classical examples of dependently typed programs.
Typed compilation of recursive datatypes
ACM SIGPLAN Notices, 2003
Standard ML employs an opaque (or generative) semantics of datatypes, in which every datatype declaration produces a new type that is different from any other type, including other identically defined datatypes. A natural way of accounting for this is to consider datatypes to be abstract. When this interpretation is applied to type-preserving compilation, however, it has the unfortunate consequence that datatype constructors cannot be inlined, substantially increasing the run-time cost of constructor invocation compared to a traditional compiler. In this paper we examine two approaches to eliminating function call overhead from datatype constructors. First, we consider a transparent interpretation of datatypes that does away with generativity, altering the semantics of SML; and second, we propose an interpretation of datatype constructors as coercions, which have no run-time effect or cost and faithfully implement SML semantics.
A Sized Time System for a Parallel Functional Language
Glasgow Functional Programming Workshop, 1996
This paper describes an inference system, whose purpose is to determine the cost of evaluating expressions in a strict purely functional language. Upper bounds can be derived for both computation cost and the size of data structures. We outline a static analysis based on this inference system for inferring size and cost information. The analysis is a synthesis of the sized types of Hughes et al., and the polymorphic time system of Dornic et al., which was extended to static dependent costs by Reistad and Gifford.
The hierarchical development of a generic type mechanism for functional languages
Computer Languages, 1990
Adoption of a scientific approach to language design, featuring the identification of language design with programming, leads to the advocacy of an explicitly hierarchical approach to language development. Choice of the lambda-calculus as basis of the linguistic hierarchy is determined when "elegance" is the predominant criterion for assessing the quality of designs. The consequence is that the hierarchy is primarily comprised of a family of untyped functional languages. We embark upon the hierarchical development of a quality data type system for such languages, including a powerful mechanism for generic data abstraction, in five stages. We show that the expressiveness of the system, in comparison with the widespread "polymorphic'" typing approach, is well worth the price of the necessarily dynamic checking for type conformance. Applicative (functional) programming Software tools and techniques Extensible languages