1,098 research outputs found
Initial Algebra Semantics for Cyclic Sharing Tree Structures
Terms are a concise representation of tree structures. Since they can be
naturally defined by an inductive type, they offer data structures in
functional programming and mechanised reasoning with useful principles such as
structural induction and structural recursion. However, for graphs or
"tree-like" structures - trees involving cycles and sharing - it remains
unclear what kind of inductive structures exists and how we can faithfully
assign a term representation of them. In this paper we propose a simple term
syntax for cyclic sharing structures that admits structural induction and
recursion principles. We show that the obtained syntax is directly usable in
the functional language Haskell and the proof assistant Agda, as well as
ordinary data structures such as lists and trees. To achieve this goal, we use
a categorical approach to initial algebra semantics in a presheaf category.
That approach follows the line of Fiore, Plotkin and Turi's models of abstract
syntax with variable binding
Cyclic Datatypes modulo Bisimulation based on Second-Order Algebraic Theories
Cyclic data structures, such as cyclic lists, in functional programming are
tricky to handle because of their cyclicity. This paper presents an
investigation of categorical, algebraic, and computational foundations of
cyclic datatypes. Our framework of cyclic datatypes is based on second-order
algebraic theories of Fiore et al., which give a uniform setting for syntax,
types, and computation rules for describing and reasoning about cyclic
datatypes. We extract the "fold" computation rules from the categorical
semantics based on iteration categories of Bloom and Esik. Thereby, the rules
are correct by construction. We prove strong normalisation using the General
Schema criterion for second-order computation rules. Rather than the fixed
point law, we particularly choose Bekic law for computation, which is a key to
obtaining strong normalisation. We also prove the property of "Church-Rosser
modulo bisimulation" for the computation rules. Combining these results, we
have a remarkable decidability result of the equational theory of cyclic data
and fold.Comment: 38 page
Polynomial Size Analysis of First-Order Shapely Functions
We present a size-aware type system for first-order shapely function
definitions. Here, a function definition is called shapely when the size of the
result is determined exactly by a polynomial in the sizes of the arguments.
Examples of shapely function definitions may be implementations of matrix
multiplication and the Cartesian product of two lists. The type system is
proved to be sound w.r.t. the operational semantics of the language. The type
checking problem is shown to be undecidable in general. We define a natural
syntactic restriction such that the type checking becomes decidable, even
though size polynomials are not necessarily linear or monotonic. Furthermore,
we have shown that the type-inference problem is at least semi-decidable (under
this restriction). We have implemented a procedure that combines run-time
testing and type-checking to automatically obtain size dependencies. It
terminates on total typable function definitions.Comment: 35 pages, 1 figur
Constructing medium sized efficient functional programs in Clean
Contains fulltext :
107652.pdf (author's version ) (Open Access
Linear lambda terms as invariants of rooted trivalent maps
The main aim of the article is to give a simple and conceptual account for
the correspondence (originally described by Bodini, Gardy, and Jacquot) between
-equivalence classes of closed linear lambda terms and isomorphism
classes of rooted trivalent maps on compact oriented surfaces without boundary,
as an instance of a more general correspondence between linear lambda terms
with a context of free variables and rooted trivalent maps with a boundary of
free edges. We begin by recalling a familiar diagrammatic representation for
linear lambda terms, while at the same time explaining how such diagrams may be
read formally as a notation for endomorphisms of a reflexive object in a
symmetric monoidal closed (bi)category. From there, the "easy" direction of the
correspondence is a simple forgetful operation which erases annotations on the
diagram of a linear lambda term to produce a rooted trivalent map. The other
direction views linear lambda terms as complete invariants of their underlying
rooted trivalent maps, reconstructing the missing information through a
Tutte-style topological recurrence on maps with free edges. As an application
in combinatorics, we use this analysis to enumerate bridgeless rooted trivalent
maps as linear lambda terms containing no closed proper subterms, and conclude
by giving a natural reformulation of the Four Color Theorem as a statement
about typing in lambda calculus.Comment: accepted author manuscript, posted six months after publicatio
Compositional Reasoning for Explicit Resource Management in Channel-Based Concurrency
We define a pi-calculus variant with a costed semantics where channels are
treated as resources that must explicitly be allocated before they are used and
can be deallocated when no longer required. We use a substructural type system
tracking permission transfer to construct coinductive proof techniques for
comparing behaviour and resource usage efficiency of concurrent processes. We
establish full abstraction results between our coinductive definitions and a
contextual behavioural preorder describing a notion of process efficiency
w.r.t. its management of resources. We also justify these definitions and
respective proof techniques through numerous examples and a case study
comparing two concurrent implementations of an extensible buffer.Comment: 51 pages, 7 figure
Functional Ownership through Fractional Uniqueness
Ownership and borrowing systems, designed to enforce safe memory management
without the need for garbage collection, have been brought to the fore by the
Rust programming language. Rust also aims to bring some guarantees offered by
functional programming into the realm of performant systems code, but the type
system is largely separate from the ownership model, with type and borrow
checking happening in separate compilation phases. Recent models such as
RustBelt and Oxide aim to formalise Rust in depth, but there is less focus on
integrating the basic ideas into more traditional type systems. An approach
designed to expose an essential core for ownership and borrowing would open the
door for functional languages to borrow concepts found in Rust and other
ownership frameworks, so that more programmers can enjoy their benefits.
One strategy for managing memory in a functional setting is through
uniqueness types, but these offer a coarse-grained view: either a value has
exactly one reference, and can be mutated safely, or it cannot, since other
references may exist. Recent work demonstrates that linear and uniqueness types
can be combined in a single system to offer restrictions on program behaviour
and guarantees about memory usage. We develop this connection further, showing
that just as graded type systems like those of Granule and Idris generalise
linearity, Rust's ownership model arises as a graded generalisation of
uniqueness. We combine fractional permissions with grading to give the first
account of ownership and borrowing that smoothly integrates into a standard
type system alongside linearity and graded types, and extend Granule
accordingly with these ideas.Comment: 23 pages + references. In submissio
- …