562 research outputs found
Control Flow Analysis for SF Combinator Calculus
Programs that transform other programs often require access to the internal
structure of the program to be transformed. This is at odds with the usual
extensional view of functional programming, as embodied by the lambda calculus
and SK combinator calculus. The recently-developed SF combinator calculus
offers an alternative, intensional model of computation that may serve as a
foundation for developing principled languages in which to express intensional
computation, including program transformation. Until now there have been no
static analyses for reasoning about or verifying programs written in
SF-calculus. We take the first step towards remedying this by developing a
formulation of the popular control flow analysis 0CFA for SK-calculus and
extending it to support SF-calculus. We prove its correctness and demonstrate
that the analysis is invariant under the usual translation from SK-calculus
into SF-calculus.Comment: In Proceedings VPT 2015, arXiv:1512.0221
Meta-F*: Proof Automation with SMT, Tactics, and Metaprograms
We introduce Meta-F*, a tactics and metaprogramming framework for the F*
program verifier. The main novelty of Meta-F* is allowing the use of tactics
and metaprogramming to discharge assertions not solvable by SMT, or to just
simplify them into well-behaved SMT fragments. Plus, Meta-F* can be used to
generate verified code automatically.
Meta-F* is implemented as an F* effect, which, given the powerful effect
system of F*, heavily increases code reuse and even enables the lightweight
verification of metaprograms. Metaprograms can be either interpreted, or
compiled to efficient native code that can be dynamically loaded into the F*
type-checker and can interoperate with interpreted code. Evaluation on
realistic case studies shows that Meta-F* provides substantial gains in proof
development, efficiency, and robustness.Comment: Full version of ESOP'19 pape
Recommended from our members
Information flow analysis for a dynamically typed language with staged metaprogramming
Web applications written in JavaScript are regularly used for dealing with sensitive or personal data. Consequently, reasoning about their security properties has become an important problem, which is made very difficult by the highly dynamic nature of the language, particularly its support for runtime code generation via eval. In order to deal with this, we propose to investigate security analyses for languages with more principled forms of dynamic code generation. To this end, we present a static information flow analysis for a dynamically typed functional language with prototype-based inheritance and staged metaprogramming. We prove its soundness, implement it and test it on various examples designed to show its relevance to proving security properties, such as noninterference, in JavaScript. To demonstrate the applicability of the analysis, we also present a general method for transforming a program using eval into one using staged metaprogramming. To our knowledge, this is the first fully static information flow analysis for a language with staged metaprogramming, and the first formal soundness proof of a CFA-based information flow analysis for a functional programming language
PyCUDA and PyOpenCL: A Scripting-Based Approach to GPU Run-Time Code Generation
High-performance computing has recently seen a surge of interest in
heterogeneous systems, with an emphasis on modern Graphics Processing Units
(GPUs). These devices offer tremendous potential for performance and efficiency
in important large-scale applications of computational science. However,
exploiting this potential can be challenging, as one must adapt to the
specialized and rapidly evolving computing environment currently exhibited by
GPUs. One way of addressing this challenge is to embrace better techniques and
develop tools tailored to their needs. This article presents one simple
technique, GPU run-time code generation (RTCG), along with PyCUDA and PyOpenCL,
two open-source toolkits that support this technique.
In introducing PyCUDA and PyOpenCL, this article proposes the combination of
a dynamic, high-level scripting language with the massive performance of a GPU
as a compelling two-tiered computing platform, potentially offering significant
performance and productivity advantages over conventional single-tier, static
systems. The concept of RTCG is simple and easily implemented using existing,
robust infrastructure. Nonetheless it is powerful enough to support (and
encourage) the creation of custom application-specific tools by its users. The
premise of the paper is illustrated by a wide range of examples where the
technique has been applied with considerable success.Comment: Submitted to Parallel Computing, Elsevie
Software that Learns from its Own Failures
All non-trivial software systems suffer from unanticipated production
failures. However, those systems are passive with respect to failures and do
not take advantage of them in order to improve their future behavior: they
simply wait for them to happen and trigger hard-coded failure recovery
strategies. Instead, I propose a new paradigm in which software systems learn
from their own failures. By using an advanced monitoring system they have a
constant awareness of their own state and health. They are designed in order to
automatically explore alternative recovery strategies inferred from past
successful and failed executions. Their recovery capabilities are assessed by
self-injection of controlled failures; this process produces knowledge in
prevision of future unanticipated failures
Maintaining software through intentional source-code views
Maintaining the source code of large software systems is hard. One underlying cause is that existing modularisation mechanisms are inadequate to handle crosscutting concerns. We propose intentional source-code views as an intuitive and lightweight means of modelling such concerns. They increase our ability to understand, modularise and browse the source code by grouping together source-code entities that address the same concern. They facilitate software development and evolution, because alternative descriptions of the same intentional view can be checked for consistency and relations among intentional views can be defined and verified. Finally, they enable us to specify knowledge developers have about source code that is not captured by traditional program documentation mechanisms. Our intentional view model is implemented in a logic metaprogramming language that can reason about and manipulate object-oriented source code directly. The proposed model has been validated on the evolution of a medium-sized object-oriented application in Smalltalk, and a prototype tool has been implemented
Static Computation and Reflection
Thesis (PhD) - Indiana University, Computer Sciences, 2008Most programming languages do not allow programs to inspect their
static type information or perform computations on it. C++, however,
lets programmers write template metaprograms, which enable programs to
encode static information, perform compile-time computations,
and make static decisions about run-time behavior. Many C++ libraries
and applications use template metaprogramming to build specialized
abstraction mechanisms, implement domain-specific safety checks, and
improve run-time performance.
Template metaprogramming is an emergent capability of the C++ type
system, and the C++ language specification is informal and imprecise.
As a result, template metaprogramming often involves heroic
programming feats and often leads to code that is difficult to read and
maintain. Furthermore, many template-based code generation and
optimization techniques rely on particular compiler implementations,
rather than language semantics, for performance gains.
Motivated by the capabilities and techniques of C++ template
metaprogramming, this thesis documents some common programming patterns,
including static computation, type analysis, generative programming, and the
encoding of domain-specific static checks. It also documents notable
shortcomings to current practice, including limited support for reflection,
semantic ambiguity, and other issues that arise from the pioneering nature of
template metaprogramming. Finally, this thesis presents the design of a
foundational programming language, motivated by the analysis of template
metaprogramming, that allows programs to statically inspect type information,
perform computations, and generate code. The language is specified as a core
calculus and its capabilities are presented in an idealized setting
Sized Types for low-level Quantum Metaprogramming
One of the most fundamental aspects of quantum circuit design is the concept
of families of circuits parametrized by an instance size. As in classical
programming, metaprogramming allows the programmer to write entire families of
circuits simultaneously, an ability which is of particular importance in the
context of quantum computing as algorithms frequently use arithmetic over
non-standard word lengths. In this work, we introduce metaQASM, a typed
extension of the openQASM language supporting the metaprogramming of circuit
families. Our language and type system, built around a lightweight
implementation of sized types, supports subtyping over register sizes and is
moreover type-safe. In particular, we prove that our system is strongly
normalizing, and as such any well-typed metaQASM program can be statically
unrolled into a finite circuit.Comment: Presented at Reversible Computation 2019. Final authenticated
publication is available online at
https://doi.org/10.1007/978-3-030-21500-2_
- …