19 research outputs found
Session Types with Arithmetic Refinements
Session types statically prescribe bidirectional communication protocols for message-passing processes. However, simple session types cannot specify properties beyond the type of exchanged messages. In this paper we extend the type system by using index refinements from linear arithmetic capturing intrinsic attributes of data structures and algorithms. We show that, despite the decidability of Presburger arithmetic, type equality and therefore also subtyping and type checking are now undecidable, which stands in contrast to analogous dependent refinement type systems from functional languages. We also present a practical, but incomplete algorithm for type equality, which we have used in our implementation of Rast, a concurrent session-typed language with arithmetic index refinements as well as ergometric and temporal types. Moreover, if necessary, the programmer can propose additional type bisimulations that are smoothly integrated into the type equality algorithm
Rast: A Language for Resource-Aware Session Types
Traditional session types prescribe bidirectional communication protocols for
concurrent computations, where well-typed programs are guaranteed to adhere to
the protocols. However, simple session types cannot capture properties beyond
the basic type of the exchanged messages. In response, recent work has extended
session types with refinements from linear arithmetic, capturing intrinsic
attributes of processes and data. These refinements then play a central role in
describing sequential and parallel complexity bounds on session-typed programs.
The Rast language provides an open-source implementation of session-typed
concurrent programs extended with arithmetic refinements as well as ergometric
and temporal types to capture work and span of program execution. To further
support generic programming, Rast also enhances arithmetically refined session
types with recently developed nested parametric polymorphism. Type checking
relies on Cooper's algorithm for quantifier elimination in Presburger
arithmetic with a few significant optimizations, and a heuristic extension to
nonlinear constraints. Rast furthermore includes a reconstruction engine so
that most program constructs pertaining the layers of refinements and resources
are inserted automatically. We provide a variety of examples to demonstrate the
expressivity of the language
On Session Typing, Probabilistic Polynomial Time, and Cryptographic Experiments
A system of session types is introduced as induced by a Curry Howard correspondence applied to bounded linear logic, suitably extended with probabilistic choice operators and ground types. The resulting system satisfies some expected properties, like subject reduction and progress, but also unexpected ones, like a polynomial bound on the time needed to reduce processes. This makes the system suitable for modelling experiments and proofs from the so-called computational model of cryptography
Rast: A Language for Resource-Aware Session Types
Traditional session types prescribe bidirectional communication protocols for
concurrent computations, where well-typed programs are guaranteed to adhere to
the protocols. However, simple session types cannot capture properties beyond
the basic type of the exchanged messages. In response, recent work has extended
session types with refinements from linear arithmetic, capturing intrinsic
attributes of processes and data. These refinements then play a central role in
describing sequential and parallel complexity bounds on session-typed programs.
The Rast language provides an open-source implementation of session-typed
concurrent programs extended with arithmetic refinements as well as ergometric
and temporal types to capture work and span of program execution. To further
support generic programming, Rast also enhances arithmetically refined session
types with recently developed nested parametric polymorphism. Type checking
relies on Cooper's algorithm for quantifier elimination in Presburger
arithmetic with a few significant optimizations, and a heuristic extension to
nonlinear constraints. Rast furthermore includes a reconstruction engine so
that most program constructs pertaining the layers of refinements and resources
are inserted automatically. We provide a variety of examples to demonstrate the
expressivity of the language
Refinements for multiparty message-passing protocols: specification-agnostic theory and implementation
Multiparty message-passing protocols are notoriously difficult to design, due to interaction mismatches
that lead to errors such as deadlocks. Existing protocol specification formats have been developed to
prevent such errors (e.g. multiparty session types (MPST)). In order to further constrain protocols,
specifications can be extended with refinements, i.e. logical predicates to control the behaviour of
the protocol based on previous values exchanged. Unfortunately, existing refinement theories and
implementations are tightly coupled with specification formats.
This paper proposes a framework for multiparty message-passing protocols with refinements
and its implementation in Rust. Our work decouples correctness of refinements from the underlying
model of computation, which results in a specification-agnostic framework.
Our contributions are threefold. First, we introduce a trace system which characterises valid
refined traces, i.e. a sequence of sending and receiving actions correct with respect to refinements.
Second, we give a correct model of computation named refined communicating system (RCS), which
is an extension of communicating automata systems with refinements. We prove that RCS only
produce valid refined traces. We show how to generate RCS from mainstream protocol specification
formats, such as refined multiparty session types (RMPST) or refined choreography automata. Third,
we illustrate the flexibility of the framework by developing both a static analysis technique and
an improved model of computation for dynamic refinement evaluation. Finally, we provide a Rust
toolchain for decentralised RMPST, evaluate our implementation with a set of benchmarks from the
literature, and observe that refinement overhead is negligible
Relating Functional and Imperative Session Types
Imperative session types provide an imperative interface to session-typed
communication. In such an interface, channel references are first-class objects
with operations that change the typestate of the channel. Compared to
functional session type APIs, the program structure is simpler at the surface,
but typestate is required to model the current state of communication
throughout.
Following an early work that explored the imperative approach, a significant
body of work on session types has neglected the imperative approach and opts
for a functional approach that uses linear types to manage channel references
soundly. We demonstrate that the functional approach subsumes the early work on
imperative session types by exhibiting a typing and semantics preserving
translation into a system of linear functional session types.
We further show that the untyped backwards translation from the functional to
the imperative calculus is semantics preserving. We restrict the type system of
the functional calculus such that the backwards translation becomes type
preserving. Thus, we precisely capture the difference in expressiveness of the
two calculi and conclude that the lack of expressiveness in the imperative
calculus is largely due to restrictions imposed by its type system.Comment: 39 pages, insubmissio
Session Kotlin: A hybrid session type embedding in Kotlin
Concurrency and distribution have become essential for building modern applications.
However, developing and maintaining these apps is not an easy task. Communication
errors are a common source of problems: unexpected messages cause runtime errors, and
mutual dependencies lead to deadlocks. To address these issues, developers can define
communication protocols that detail the structure and order of the transmitted messages,
but maintaining protocol fidelity can be complex if carried out manually. Session types
formalize this concept by materializing the communication protocol as a type that can be
enforced by the language’s type system. In this thesis we present the first embedding of
session types in Kotlin: we propose a Domain-Specific Language (DSL) for multiparty ses-
sion types that lets developers write safe concurrent applications, with built-in validation
and integrating code generation in the language’s framework.A concorrência e a distribuição têm-se tornado essenciais na construção de aplicações
modernas. No entanto, desenvolver e manter estas aplicações não é tarefa fácil. Erros de
comunicação são uma fonte comum de problemas: mensagens inesperadas causam erros
durante a execução de código, e dependências mútuas levam a deadlocks. Para resolver
estas questões, é tipico definir protocolos de comunicação que detalham a estrutura e a
ordem das mensagens transmitidas, mas garantir o seu cumprimento pode ser complexo
se feito manualmente. Os tipos de sessão formalizam este conceito ao materializar o
protocolo de comunicação como um tipo que pode ser gerido pelo sistema de tipos da
linguagem. Nesta tese apresentamos o primeiro embedding de tipos de sessão em Kotlin:
propomos uma Linguagem de DomÃnio EspecÃfica para tipos de sessão com múltiplos
participantes que permite aos programadores a escrita de aplicações concorrentes seguras,
incorporando validação e integrando a geração de código no framework da linguagem