7 research outputs found
The Sketch of a Polymorphic Symphony
In previous work, we have introduced functional strategies, that is,
first-class generic functions that can traverse into terms of any type while
mixing uniform and type-specific behaviour. In the present paper, we give a
detailed description of one particular Haskell-based model of functional
strategies. This model is characterised as follows. Firstly, we employ
first-class polymorphism as a form of second-order polymorphism as for the mere
types of functional strategies. Secondly, we use an encoding scheme of run-time
type case for mixing uniform and type-specific behaviour. Thirdly, we base all
traversal on a fundamental combinator for folding over constructor
applications.
Using this model, we capture common strategic traversal schemes in a highly
parameterised style. We study two original forms of parameterisation. Firstly,
we design parameters for the specific control-flow, data-flow and traversal
characteristics of more concrete traversal schemes. Secondly, we use
overloading to postpone commitment to a specific type scheme of traversal. The
resulting portfolio of traversal schemes can be regarded as a challenging
benchmark for setups for typed generic programming.
The way we develop the model and the suite of traversal schemes, it becomes
clear that parameterised + typed strategic programming is best viewed as a
potent combination of certain bits of parametric, intensional, polytypic, and
ad-hoc polymorphism
(Leftmost-Outermost) Beta Reduction is Invariant, Indeed
Slot and van Emde Boas' weak invariance thesis states that reasonable
machines can simulate each other within a polynomially overhead in time. Is
lambda-calculus a reasonable machine? Is there a way to measure the
computational complexity of a lambda-term? This paper presents the first
complete positive answer to this long-standing problem. Moreover, our answer is
completely machine-independent and based over a standard notion in the theory
of lambda-calculus: the length of a leftmost-outermost derivation to normal
form is an invariant cost model. Such a theorem cannot be proved by directly
relating lambda-calculus with Turing machines or random access machines,
because of the size explosion problem: there are terms that in a linear number
of steps produce an exponentially long output. The first step towards the
solution is to shift to a notion of evaluation for which the length and the
size of the output are linearly related. This is done by adopting the linear
substitution calculus (LSC), a calculus of explicit substitutions modeled after
linear logic proof nets and admitting a decomposition of leftmost-outermost
derivations with the desired property. Thus, the LSC is invariant with respect
to, say, random access machines. The second step is to show that LSC is
invariant with respect to the lambda-calculus. The size explosion problem seems
to imply that this is not possible: having the same notions of normal form,
evaluation in the LSC is exponentially longer than in the lambda-calculus. We
solve such an impasse by introducing a new form of shared normal form and
shared reduction, deemed useful. Useful evaluation avoids those steps that only
unshare the output without contributing to beta-redexes, i.e. the steps that
cause the blow-up in size. The main technical contribution of the paper is
indeed the definition of useful reductions and the thorough analysis of their
properties.Comment: arXiv admin note: substantial text overlap with arXiv:1405.331
Ferrite: A Judgmental Embedding of Session Types in Rust
This paper introduces Ferrite, a shallow embedding of session types in Rust.
In contrast to existing session type libraries and embeddings for mainstream
languages, Ferrite not only supports linear session types but also shared
session types. Shared session types allow sharing (aliasing) of channels while
preserving session fidelity (preservation) using type modalities for acquiring
and releasing sessions. Ferrite adopts a propositions as types approach and
encodes typing derivations as Rust functions, with the proof of successful
type-checking manifesting as a Rust program. We provide an evaluation of
Ferrite using Servo as a practical example, and demonstrate how safe
communication can be achieved in the canvas component using Ferrite
Pattern discovery for parallelism in functional languages
No longer the preserve of specialist hardware, parallel devices
are now ubiquitous. Pattern-based approaches to parallelism,
such as algorithmic skeletons, simplify traditional low-level
approaches by presenting composable high-level patterns of
parallelism to the programmer. This allows optimal parallel
configurations to be derived automatically, and facilitates the
use of different parallel architectures. Moreover, parallel patterns
can be swap-replaced for sequential recursion schemes,
thus simplifying their introduction. Unfortunately, there is no
guarantee that recursion schemes are present in all functional
programs. Automatic pattern discovery techniques can be used
to discover recursion schemes. Current approaches are limited
by both the range of analysable functions, and by the range of
discoverable patterns. In this thesis, we present an approach
based on program slicing techniques that facilitates the analysis
of a wider range of explicitly recursive functions. We then
present an approach using anti-unification that expands the
range of discoverable patterns. In particular, this approach is
user-extensible; i.e. patterns developed by the programmer can
be discovered without significant effort. We present prototype
implementations of both approaches, and evaluate them on
a range of examples, including five parallel benchmarks and
functions from the Haskell Prelude. We achieve maximum
speedups of 32.93x on our 28-core hyperthreaded experimental
machine for our parallel benchmarks, demonstrating
that our approaches can discover patterns that produce good
parallel speedups. Together, the approaches presented in this
thesis enable the discovery of more loci of potential parallelism
in pure functional programs than currently possible.
This leads to more possibilities for parallelism, and so more
possibilities to take advantage of the potential performance
gains that heterogeneous parallel systems present
A type-theoretic framework for software component synthesis
A language-agnostic approach for type-based component-oriented software synthesis is developed from the fundamental principles of abstract algebra and Combinatory Logic. It relies on an enumerative type inhabitation algorithm for Finite Combinatory Logic with Intersection Types (FCL) and a universal algebraic construction to translate terms of Combinatory Logic into any given target language. New insights are gained on the combination of semantic domains of discourse with intersection types. Long standing gaps in the algorithmic understanding of the type inhabitation question of FCL are closed. A practical implementation is developed and its applications by the author and other researchers are discussed. They include, but are not limited to, vast improvements in the context of synthesis of software product line members. An interactive theorem prover, Coq, is used to formalize and check all the theoretical results. This makes them more reusable for other developments and enhances confidence in their correctness.Es wird ein sprachunabhängiger Ansatz für die typbasierte und komponentenorientierte Synthese von Software entwickelt. Hierzu werden grundlegende Erkenntnisse über abstrakte Algebra und kombinatorische Logik verwendet. Der Ansatz beruht auf dem enumerativen Typinhabitationsproblem der endlichen kombinatorischen Logik mit Intersektionstypen, sowie einer universellen algebraischen Konstruktion, um Ergebnisterme in jede beliebe Zielsprache übersetzen zu können. Es werden neue Einblicke gewonnen, wie verschiedene semantische Domänen des Diskurses über Softwareeigenschaften miteinander verbunden werden können. Offene Fragestellungen im Zusammenhand mit der Algorithmik des Typinhabitationsproblems für Intersektionstypen werden beantwortet. Eine praktische Implementierung des Ansatzes wird entwickelt und ihre bisherigen Anwendungen durch den Autor und andere Wissenschaftler werden diskutiert. Diese beinhalten starke Verbesserungen im Zusammenhang mit der Synthese von Ausprägungen von Software Produktlinien. Ein interaktiver Theorembeweiser wir genutzt, um alle Ergebnisse der Arbeit zu formalisieren und mechanisch zu überprüfen.
Dies trägt zum einen zur Wiederverwendbarkeit der theoretischen Ergebnisse in anderen Kontexten bei, und erhöht zum andern das Vertrauen in ihre Korrektheit
Distributive laws in programming structures
Distributive laws in Computer Science are rules governing the transformation of one programming structure into another. In programming, they are programs satisfying certain formal conditions. Their importance has been to date documented in several isolated cases by diverse formal approaches. These applications have always meant leaps in understanding the nature of the subject. However, distributive laws have not yet been given the attention they deserve. One of the reasons for this omission is certainly the lack of a formal notion of distributive laws in their full generality. This hinders the discovery and formal description of occurrences of distributive laws, which is the precursor of any formal manipulation.
In this thesis, an approach to formalisation of distributive laws is presented based on the functorial approach to formal Category Theory pioneered by Lawvere and others, notably Gray. The proposed formalism discloses a rather simple nature of distributive laws of the kind found in programming structures based on lax 2-naturality and Gray's tensor product of 2-categories. It generalises the existing more specific notions of distributive laws. General notions of products, coproducts and composition of distributive laws are studied and conditions for their construction given. Finally, the proposed formalism is put to work in establishing a semantical equivalence between a large class of functional and object-based programs