256 research outputs found
Reaching for the Star: Tale of a Monad in Coq
Monadic programming is an essential component in the toolbox of functional programmers. For the pure and total programmers, who sometimes navigate the waters of certified programming in type theory, it is the only means to concisely implement the imperative traits of certain algorithms. Monads open up a portal to the imperative world, all that from the comfort of the functional world. The trend towards certified programming within type theory begs the question of reasoning about such programs. Effectful programs being encoded as pure programs in the host type theory, we can readily manipulate these objects through their encoding. In this article, we pursue the idea, popularized by Maillard [Kenji Maillard, 2019], that every monad deserves a dedicated program logic and that, consequently, a proof over a monadic program ought to take place within a Floyd-Hoare logic built for the occasion. We illustrate this vision through a case study on the SimplExpr module of CompCert [Xavier Leroy, 2009], using a separation logic tailored to reason about the freshness of a monadic gensym
Modules over Monads and Operational Semantics
This paper is a contribution to the search for efficient and high-level mathematical tools to specify and reason about (abstract) programming languages or calculi. Generalising the reduction monads of Ahrens et al., we introduce transition monads, thus covering new applications such as ???-calculus, ?-calculus, Positive GSOS specifications, differential ?-calculus, and the big-step, simply-typed, call-by-value ?-calculus. Finally, we design a suitable notion of signature for transition monads
Modules over monads and operational semantics
This paper is a contribution to the search for efficient and high-level
mathematical tools to specify and reason about (abstract) programming languages
or calculi. Generalising the reduction monads of Ahrens et al., we introduce
transition monads, thus covering new applications such as
lambda-bar-mu-calculus, pi-calculus, Positive GSOS specifications, differential
lambda-calculus, and the big-step, simply-typed, call-by-value lambda-calculus.
Moreover, we design a suitable notion of signature for transition monads
Fundamental Constructs in Programming Languages
Specifying the semantics of a programming language formally can have many
benefits. However, it can also require a huge effort. The effort can be
significantly reduced by translating language syntax to so-called fundamental
constructs (funcons). A translation to funcons is easy to update when the
language evolves, and it exposes relationships between individual language
constructs.
The PLanCompS project has developed an initial collection of funcons
(primarily for translation of functional and imperative languages). The
behaviour of each funcon is defined, once and for all, using a modular variant
of structural operational semantics. The definitions are available online.
This paper introduces and motivates funcons. It illustrates translation of
language constructs to funcons, and how funcons are defined. It also relates
funcons to notation used in previous frameworks, including monadic semantics
and action semantics.Comment: 20 pages plus appendix, submitted to ISoLA 202
Reduction Monads and Their Signatures
International audienc
Abstract Clones for Abstract Syntax
We give a formal treatment of simple type theories, such as the simply-typed ?-calculus, using the framework of abstract clones. Abstract clones traditionally describe first-order structures, but by equipping them with additional algebraic structure, one can further axiomatize second-order, variable-binding operators. This provides a syntax-independent representation of simple type theories. We describe multisorted second-order presentations, such as the presentation of the simply-typed ?-calculus, and their clone-theoretic algebras; free algebras on clones abstractly describe the syntax of simple type theories quotiented by equations such as ?- and ?-equality. We give a construction of free algebras and derive a corresponding induction principle, which facilitates syntax-independent proofs of properties such as adequacy and normalization for simple type theories. Working only with clones avoids some of the complexities inherent in presheaf-based frameworks for abstract syntax
Reasoning about the garden of forking paths
Lazy evaluation is a powerful tool for functional programmers. It enables the
concise expression of on-demand computation and a form of compositionality not
available under other evaluation strategies. However, the stateful nature of
lazy evaluation makes it hard to analyze a program's computational cost, either
informally or formally. In this work, we present a novel and simple framework
for formally reasoning about lazy computation costs based on a recent model of
lazy evaluation: clairvoyant call-by-value. The key feature of our framework is
its simplicity, as expressed by our definition of the clairvoyance monad. This
monad is both simple to define (around 20 lines of Coq) and simple to reason
about. We show that this monad can be effectively used to mechanically reason
about the computational cost of lazy functional programs written in Coq.Comment: 28 pages, accepted by ICFP'2
Call-by-name Gradual Type Theory
We present gradual type theory, a logic and type theory for call-by-name
gradual typing. We define the central constructions of gradual typing (the
dynamic type, type casts and type error) in a novel way, by universal
properties relative to new judgments for gradual type and term dynamism, which
were developed in blame calculi and to state the "gradual guarantee" theorem of
gradual typing. Combined with the ordinary extensionality () principles
that type theory provides, we show that most of the standard operational
behavior of casts is uniquely determined by the gradual guarantee. This
provides a semantic justification for the definitions of casts, and shows that
non-standard definitions of casts must violate these principles. Our type
theory is the internal language of a certain class of preorder categories
called equipments. We give a general construction of an equipment interpreting
gradual type theory from a 2-category representing non-gradual types and
programs, which is a semantic analogue of Findler and Felleisen's definitions
of contracts, and use it to build some concrete domain-theoretic models of
gradual typing
- âŠ