scholarly journals Solver-based gradual type migration

2021 ◽  
Vol 5 (OOPSLA) ◽  
pp. 1-27
Author(s):  
Luna Phipps-Costin ◽  
Carolyn Jane Anderson ◽  
Michael Greenberg ◽  
Arjun Guha

Gradually typed languages allow programmers to mix statically and dynamically typed code, enabling them to incrementally reap the benefits of static typing as they add type annotations to their code. However, this type migration process is typically a manual effort with limited tool support. This paper examines the problem of automated type migration: given a dynamic program, infer additional or improved type annotations. Existing type migration algorithms prioritize different goals, such as maximizing type precision, maintaining compatibility with unmigrated code, and preserving the semantics of the original program. We argue that the type migration problem involves fundamental compromises: optimizing for a single goal often comes at the expense of others. Ideally, a type migration tool would flexibly accommodate a range of user priorities. We present TypeWhich, a new approach to automated type migration for the gradually-typed lambda calculus with some extensions. Unlike prior work, which relies on custom solvers, TypeWhich produces constraints for an off-the-shelf MaxSMT solver. This allows us to easily express objectives, such as minimizing the number of necessary syntactic coercions, and constraining the type of the migration to be compatible with unmigrated code. We present the first comprehensive evaluation of GTLC type migration algorithms, and compare TypeWhich to four other tools from the literature. Our evaluation uses prior benchmarks, and a new set of "challenge problems." Moreover, we design a new evaluation methodology that highlights the subtleties of gradual type migration. In addition, we apply TypeWhich to a suite of benchmarks for Grift, a programming language based on the GTLC. TypeWhich is able to reconstruct all human-written annotations on all but one program.

2018 ◽  
Vol 29 (8) ◽  
pp. 1092-1124
Author(s):  
JOSÉ ESPÍRITO SANTO ◽  
RALPH MATTHES ◽  
LUÍS PINTO

A new approach to inhabitation problems in simply typed lambda-calculus is shown, dealing with both decision and counting problems. This approach works by exploiting a representation of the search space generated by a given inhabitation problem, which is in terms of a lambda-calculus for proof search that the authors developed recently. The representation may be seen as extending the Curry–Howard representation of proofs by lambda terms. Our methodology reveals inductive descriptions of the decision problems, driven by the syntax of the proof-search expressions, and produces simple, recursive decision procedures and counting functions. These allow to predict the number of inhabitants by testing the given type for syntactic criteria. This new approach is comprehensive and robust: based on the same syntactic representation, we also derive the state-of-the-art coherence theorems ensuring uniqueness of inhabitants.


2020 ◽  
Vol 4 (POPL) ◽  
pp. 1-27 ◽  
Author(s):  
Aloïs Brunel ◽  
Damiano Mazza ◽  
Michele Pagani

2013 ◽  
pp. 5-54
Author(s):  
Henk Barendregt ◽  
Wil Dekkers ◽  
Richard Statman

2003 ◽  
Vol 10 (25) ◽  
Author(s):  
Dariusz Biernacki ◽  
Olivier Danvy

Starting from a continuation-based interpreter for a simple logic programming language, propositional Prolog with cut, we derive the corresponding logic engine in the form of an abstract machine. The derivation originates in previous work (our article at PPDP 2003) where it was applied to the lambda-calculus. The key transformation here is Reynolds's defunctionalization that transforms a tail-recursive, continuation-passing interpreter into a transition system, i.e., an abstract machine. Similar denotational and operational semantics were studied by de Bruin and de Vink in previous work (their article at TAPSOFT 1989), and we compare their study with our derivation. Additionally, we present a direct-style interpreter of propositional Prolog expressed with control operators for delimited continuations.<br /><br />Superseded by BRICS-RS-04-5.


2016 ◽  
Vol 11 (10) ◽  
pp. 5766-5773
Author(s):  
Salar Y Alsardary ◽  
Hwee Jung Kim ◽  
Julie George

Instant Insanity [1] consists of four cubes, each of whose six faces are colored with one of the four colors: red, blue, white, and green. The object is to stack the cubes in such a way that each of the four colors appears on each side of the resulting column. See figure 1 below[2]. Traditionally, this could be solved using graph theory.However, in this article, we introduce a new technique to solve the problem without using graph theory. We also used a Perl programming language to implement the new approach for the Instant Insanity.


Sign in / Sign up

Export Citation Format

Share Document