1,526 research outputs found
Novice Type Error Diagnosis with Natural Language Models
Strong static type systems help programmers eliminate many errors without
much burden of supplying type annotations. However, this flexibility makes it
highly non-trivial to diagnose ill-typed programs, especially for novice
programmers. Compared to classic constraint solving and optimization-based
approaches, the data-driven approach has shown great promise in identifying the
root causes of type errors with higher accuracy. Instead of relying on
hand-engineered features, this work explores natural language models for type
error localization, which can be trained in an end-to-end fashion without
requiring any features. We demonstrate that, for novice type error diagnosis,
the language model-based approach significantly outperforms the previous
state-of-the-art data-driven approach. Specifically, our model could predict
type errors correctly 62% of the time, outperforming the state-of-the-art
Nate's data-driven model by 11%, in a more rigorous accuracy metric.
Furthermore, we also apply structural probes to explain the performance
difference between different language models.Comment: 17 pages, 8 figure
Gradual Liquid Type Inference
Liquid typing provides a decidable refinement inference mechanism that is
convenient but subject to two major issues: (1) inference is global and
requires top-level annotations, making it unsuitable for inference of modular
code components and prohibiting its applicability to library code, and (2)
inference failure results in obscure error messages. These difficulties
seriously hamper the migration of existing code to use refinements. This paper
shows that gradual liquid type inference---a novel combination of liquid
inference and gradual refinement types---addresses both issues. Gradual
refinement types, which support imprecise predicates that are optimistically
interpreted, can be used in argument positions to constrain liquid inference so
that the global inference process e effectively infers modular specifications
usable for library components. Dually, when gradual refinements appear as the
result of inference, they signal an inconsistency in the use of static
refinements. Because liquid refinements are drawn from a nite set of
predicates, in gradual liquid type inference we can enumerate the safe
concretizations of each imprecise refinement, i.e. the static refinements that
justify why a program is gradually well-typed. This enumeration is useful for
static liquid type error explanation, since the safe concretizations exhibit
all the potential inconsistencies that lead to static type errors. We develop
the theory of gradual liquid type inference and explore its pragmatics in the
setting of Liquid Haskell.Comment: To appear at OOPSLA 201
Rodin: an open toolset for modelling and reasoning in Event-B
Event-B is a formal method for system-level modelling and analysis. Key features of Event-B are the use of set theory as a modelling notation, the use of refinement to represent systems at different abstraction levels and the use of mathematical proof to verify consistency between refinement levels. In this article we present the Rodin modelling tool that seamlessly integrates modelling and proving. We outline how the Event-B language was designed to facilitate proof and how the tool has been designed to support changes to models while minimising the impact of changes on existing proofs. We outline the important features of the prover architecture and explain how well-definedness is treated. The tool is extensible and configurable so that it can be adapted more easily to different application domains and development methods
Use of proofs-as-programs to build an anology-based functional program editor
This thesis presents a novel application of the technique known as proofs-as-programs.
Proofs-as-programs defines a correspondence between proofs in a constructive logic
and functional programs. By using this correspondence, a functional program may be
represented directly as the proof of a specification and so the program may be analysed within this proof framework. CʸNTHIA is a program editor for the functional
language ML which uses proofs-as-programs to analyse users' programs as they are
written. So that the user requires no knowledge of proof theory, the underlying proof
representation is completely hidden.
The proof framework allows programs written in CʸNTHIA to be checked to be
syntactically correct, well-typed, well-defined and terminating.
CʸNTHIA also embodies the idea of programming by analogy — rather than starting
from scratch, users always begin with an existing function definition. They then apply
a sequence of high-level editing commands which transform this starting definition into
the one required. These commands preserve correctness and also increase programming
efficiency by automating commonly occurring steps.
The design and implementation of CʸNTHIA is described and its role as a novice
programming environment is investigated. Use by experts is possible but only a sub-set of ML is currently supported. Two major trials of CʸNTHIA have shown that
CʸNTHIA is well-suited as a teaching tool. Users of CʸNTHIA make fewer programming errors and the feedback facilities of CʸNTHIA mean that it is easier to
track down the source of errors when they do occur
Formalizing non-interference for a simple bytecode language in Coq
In this paper, we describe the application of the interactive theorem prover Coq to the security analysis of bytecode as used in Java. We provide a generic specification and proof of non-interference for bytecode languages using the Coq module system. We illustrate the use of this formalization by applying it to a small subset of Java bytecode. The emphasis of the paper is on modularity of a language formalization and its analysis in a machine proof
Linear Haskell: practical linearity in a higher-order polymorphic language
Linear type systems have a long and storied history, but not a clear path
forward to integrate with existing languages such as OCaml or Haskell. In this
paper, we study a linear type system designed with two crucial properties in
mind: backwards-compatibility and code reuse across linear and non-linear users
of a library. Only then can the benefits of linear types permeate conventional
functional programming. Rather than bifurcate types into linear and non-linear
counterparts, we instead attach linearity to function arrows. Linear functions
can receive inputs from linearly-bound values, but can also operate over
unrestricted, regular values.
To demonstrate the efficacy of our linear type system - both how easy it can
be integrated in an existing language implementation and how streamlined it
makes it to write programs with linear types - we implemented our type system
in GHC, the leading Haskell compiler, and demonstrate two kinds of applications
of linear types: mutable data with pure interfaces; and enforcing protocols in
I/O-performing functions
A dependently typed programming language with dynamic equality
Dependent types offer a uniform foundation for both proof systems and programming languages.
While the proof systems built with dependent types have become relatively popular, dependently typed programming languages are far from mainstream.
One key issue with existing dependently typed languages is the overly conservative definitional equality that programmers are forced to use.
When combined with a traditional typing workflow, these systems can be quite challenging and require a large amount of expertise to master.
This thesis explores an alternative workflow and a more liberal handling of equality.
Programmers are given warnings that contain the same information as the type errors that would be given by an existing system.
Programmers can run these programs optimistically, and they will behave appropriately unless a direct contradiction confirming the warning is found.
This is achieved by localizing equality constraints using a new form of elaboration based on bidirectional type inference.
These local checks, or casts, are given a runtime behavior (similar to those of contracts and monitors).
The elaborated terms have a weakened form of type soundness: they will not get stuck without an explicit counter example.
The language explored in this thesis will be a Calculus of Constructions like language with recursion, type-in-type, data types with dependent indexing and pattern matching.
Several meta-theoretic results will be presented.
The key result is that the core language, called the cast system, "will not get stuck without a counter example"; a result called cast soundness.
A proof of cast soundness is fully worked out for the fragment of the system without user defined data, and a Coq proof is available. Several other properties based on the gradual guarantees of gradual typing are also presented.
In the presence of user defined data and pattern matching these properties are conjectured to hold.
A prototype implementation of this work is available
- …