Results 1  10
of
25
Semantic subtyping with an SMT solver
, 2010
"... We study a firstorder functional language with the novel combination of the ideas of refinement type (the subset of a type to satisfy a Boolean expression) and typetest (a Boolean expression testing whether a value belongs to a type). Our core calculus can express a rich variety of typing idioms; ..."
Abstract

Cited by 31 (1 self)
 Add to MetaCart
We study a firstorder functional language with the novel combination of the ideas of refinement type (the subset of a type to satisfy a Boolean expression) and typetest (a Boolean expression testing whether a value belongs to a type). Our core calculus can express a rich variety of typing idioms; for example, intersection, union, negation, singleton, nullable, variant, and algebraic types are all derivable. We formulate a semantics in which expressions denote terms, and types are interpreted as firstorder logic formulas. Subtyping is defined as valid implication between the semantics of types. The formulas are interpreted in a specific model that we axiomatize using standard firstorder theories. On this basis, we present a novel typechecking algorithm able to eliminate many dynamic tests and to detect many errors statically. The key idea is to rely on an SMT solver to compute subtyping efficiently. Moreover, interpreting types as formulas allows us to call the SMT solver at runtime to compute instances of types.
Contracts Made Manifest
, 2009
"... Since Findler and Felleisen [2002] introduced higherorder contracts, many variants of their system have been proposed. Broadly, these fall into two groups: some follow Findler and Felleisen in using latent contracts, purely dynamic checks that are transparent to the type system; others use manifest ..."
Abstract

Cited by 23 (4 self)
 Add to MetaCart
Since Findler and Felleisen [2002] introduced higherorder contracts, many variants of their system have been proposed. Broadly, these fall into two groups: some follow Findler and Felleisen in using latent contracts, purely dynamic checks that are transparent to the type system; others use manifest contracts, where refinement types record the most recent check that has been applied. These two approaches are generally assumed to be equivalent—different ways of implementing the same idea, one retaining a simple type system, and the other providing more static information. Our goal is to formalize and clarify this folklore understanding. Our work extends that of Gronski and Flanagan [2007], who defined a latent calculus λC and a manifest calculus λH, gave a translation φ from λC to λH, and proved that if a λC term reduces to a constant, then so does its φimage. We enrich their account with a translation ψ in the opposite direction and prove an analogous theorem for ψ. More importantly, we generalize the whole framework to dependent contracts, where the predicates in contracts can mention variables from the local context. This extension is both pragmatically crucial, supporting a much more interesting range of contracts, and theoretically challenging. We define dependent versions of λC (following Findler and Felleisen’s semantics) and λH, establish type soundness—a challenging result in itself, for λH—and extend φ and ψ accordingly. Interestingly, the intuition that the two systems are equivalent appears to break down here: we show that ψ preserves behavior exactly, but that a natural extension of φ to the dependent case will sometimes yield terms that blame more because of a subtle difference in the treatment of dependent function contracts when the codomain contract itself abuses the argument. Note to reviewers: This is a preliminary version. It is technically complete, but not yet fully polished. Please do not distribute. 1 1
Energy types
 In OOPSLA’12
, 2012
"... This paper presents a novel type system to promote and facilitate energyaware programming. Energy Types is built upon a key insight into today’s energyefficient systems and applications: despite the popular perception that energy and power can only be described in joules and watts, realworld ener ..."
Abstract

Cited by 17 (4 self)
 Add to MetaCart
(Show Context)
This paper presents a novel type system to promote and facilitate energyaware programming. Energy Types is built upon a key insight into today’s energyefficient systems and applications: despite the popular perception that energy and power can only be described in joules and watts, realworld energy management is often based on discrete phases and modes, which in turn can be reasoned about by type systems very effectively. A phase characterizes a distinct pattern of program workload, and a mode represents an energy state the program is expected to execute in. This paper describes a programming model where phases and modes can be intuitively specified by programmers or inferred by the compiler as type information. It demonstrates how a typebased approach to reasoning about phases and modes can help promote energy efficiency. The soundness of our type system and the invariants related to interphase and intermode interactions are rigorously proved. Energy Types is implemented as the core of a prototyped objectoriented language ET for smartphone programming. Preliminary studies show ET can lead to significant energy savings for Android Apps.
Nested refinements: A logic for duck typing
"... Programs written in dynamic languages make heavy use of features — runtime type tests, valueindexed dictionaries, polymorphism, and higherorder functions — that are beyond the reach of type systems that employ either purely syntactic or purely semantic reasoning. We present a core calculus, Syste ..."
Abstract

Cited by 12 (2 self)
 Add to MetaCart
(Show Context)
Programs written in dynamic languages make heavy use of features — runtime type tests, valueindexed dictionaries, polymorphism, and higherorder functions — that are beyond the reach of type systems that employ either purely syntactic or purely semantic reasoning. We present a core calculus, System D, that merges these two modes of reasoning into a single powerful mechanism of nested refinement types wherein the typing relation is itself a predicate in the refinement logic. System D coordinates SMTbased logical implication and syntactic subtyping to automatically typecheck sophisticated dynamic language programs. By coupling nested refinements with McCarthy’s theory of finite maps, System D can precisely reason about the interaction of higherorder functions, polymorphism, and dictionaries. The addition of type predicates to the refinement logic creates a circularity that leads to unique technical challenges in the metatheory, which we solve with a novel stratification approach that we use to prove the soundness of System D.
HALO: Haskell to Logic through Denotational Semantics
"... Even welltyped programs can go wrong, by encountering a patternmatch failure, or simply returning the wrong answer. An increasinglypopular response is to allow programmers to write contracts that express semantic properties, such as crashfreedom or some useful postcondition. We study the static ..."
Abstract

Cited by 11 (2 self)
 Add to MetaCart
(Show Context)
Even welltyped programs can go wrong, by encountering a patternmatch failure, or simply returning the wrong answer. An increasinglypopular response is to allow programmers to write contracts that express semantic properties, such as crashfreedom or some useful postcondition. We study the static verification of such contracts. Our main contribution is a novel translation to firstorder logic of both Haskell programs, and contracts written in Haskell, all justified by denotational semantics. This translation enables us to prove that functions satisfy their contracts using an offtheshelf firstorder logic theorem prover. 1.
Gradual Typing for Smalltalk
, 2013
"... Being able to combine static and dynamic typing within the same language has clear benefits in order to support the evolution of prototypes or scripts into mature robust programs. While being an emblematic dynamic objectoriented language, Smalltalk is lagging behind in this regard. We report on the ..."
Abstract

Cited by 10 (4 self)
 Add to MetaCart
(Show Context)
Being able to combine static and dynamic typing within the same language has clear benefits in order to support the evolution of prototypes or scripts into mature robust programs. While being an emblematic dynamic objectoriented language, Smalltalk is lagging behind in this regard. We report on the design, implementation and application of Gradualtalk, a graduallytyped Smalltalk meant to enable incremental typing of existing programs. The main design goal of the type system is to support the features of the Smalltalk language, like metaclasses and blocks, live programming, and to accomodate the programming idioms used in practice. We studied a number of existing projects in order to determine the features to include in the type system. As a result, Gradualtalk is a practical approach to gradual types in Smalltalk, with a novel blend of type system features that accomodate most programming idioms. Keywords: Type systems, gradual typing, Smalltalk
Refinement Types For Haskell
"... SMTbased checking of refinement types for callbyvalue languages is a wellstudied subject. Unfortunately, the classical translation of refinement types to verification conditions is unsound under lazy evaluation. When checking an expression, such systems implicitly assume that all the free var ..."
Abstract

Cited by 8 (4 self)
 Add to MetaCart
(Show Context)
SMTbased checking of refinement types for callbyvalue languages is a wellstudied subject. Unfortunately, the classical translation of refinement types to verification conditions is unsound under lazy evaluation. When checking an expression, such systems implicitly assume that all the free variables in the expression are bound to values. This property is trivially guaranteed by eager, but does not hold under lazy, evaluation. Thus, to be sound and precise, a refinement type system for Haskell and the corresponding verification conditions must take into account which subset of binders actually reduces to values. We present a stratified type system that labels binders as potentially diverging or not, and that (circularly) uses refinement types to verify the labeling. We have implemented our system in LIQUIDHASKELL and present an experimental evaluation of our approach on more than 10,000 lines of widely used Haskell libraries. We show that LIQUIDHASKELL is able to prove 96 % of all recursive functions terminating, while requiring a modest 1.7 lines of terminationannotations per 100 lines of code. 1.
Abstract Refinement Types
"... Abstract. We present abstract refinement types which enable quantification over the refinements of data and functiontypes. Our key insight is that we can avail of quantification while preserving SMTbased decidability, simply by encoding refinement parameters as uninterpreted propositions within t ..."
Abstract

Cited by 8 (4 self)
 Add to MetaCart
(Show Context)
Abstract. We present abstract refinement types which enable quantification over the refinements of data and functiontypes. Our key insight is that we can avail of quantification while preserving SMTbased decidability, simply by encoding refinement parameters as uninterpreted propositions within the ground refinement logic. We illustrate how this simple mechanism yields a variety of sophisticated and automatic means for reasoning about programs, including: parametric refinements for reasoning with type classes, indexdependent refinements for reasoning about keyvalue maps, recursive refinements for reasoning about data structures, and inductive refinements for reasoning about higherorder traversal routines. We have implemented our approach in HSOLVE, a refinement type checker for Haskell, and present experiments using HSOLVE to verify correctness invariants of various programs. 1
Hybrid contract checking via symbolic simplification
 In: Proceedings of the ACM SIGPLAN 2012 workshop on Partial evaluation and program manipulation
, 2012
"... appor t de r ech er ch e ..."
(Show Context)