skip to main content
US FlagAn official website of the United States government
dot gov icon
Official websites use .gov
A .gov website belongs to an official government organization in the United States.
https lock icon
Secure .gov websites use HTTPS
A lock ( lock ) or https:// means you've safely connected to the .gov website. Share sensitive information only on official, secure websites.


Title: A computational interpretation of compact closed categories: reversible programming with negative and fractional types
Compact closed categories include objects representing higher-order functions and are well-established as models of linear logic, concurrency, and quantum computing. We show that it is possible to construct such compact closed categories for conventional sum and product types by defining a dual to sum types, a negative type, and a dual to product types, a fractional type. Inspired by the categorical semantics, we define a sound operational semantics for negative and fractional types in which a negative type represents a computational effect that ``reverses execution flow'' and a fractional type represents a computational effect that ``garbage collects'' particular values or throws exceptions. Specifically, we extend a first-order reversible language of type isomorphisms with negative and fractional types, specify an operational semantics for each extension, and prove that each extension forms a compact closed category. We furthermore show that both operational semantics can be merged using the standard combination of backtracking and exceptions resulting in a smooth interoperability of negative and fractional types. We illustrate the expressiveness of this combination by writing a reversible SAT solver that uses backtracking search along freshly allocated and de-allocated locations. The operational semantics, most of its meta-theoretic properties, and all examples are formalized in a supplementary Agda package.  more » « less
Award ID(s):
1936353
PAR ID:
10602203
Author(s) / Creator(s):
 ;  
Publisher / Repository:
Association for Computing Machinery (ACM)
Date Published:
Journal Name:
Proceedings of the ACM on Programming Languages
Volume:
5
Issue:
POPL
ISSN:
2475-1421
Format(s):
Medium: X Size: p. 1-29
Size(s):
p. 1-29
Sponsoring Org:
National Science Foundation
More Like this
  1. Hicks, Michael (Ed.)
    We propose a novel approach to soundly combining linear types with multi-shot effect handlers. Linear type systems statically ensure that resources such as file handles and communication channels are used exactly once. Effect handlers provide a rich modular programming abstraction for implementing features ranging from exceptions to concurrency to backtracking. Whereas conventional linear type systems bake in the assumption that continuations are invoked exactly once, effect handlers allow continuations to be discarded (e.g. for exceptions) or invoked more than once (e.g. for backtracking). This mismatch leads to soundness bugs in existing systems such as the programming language Links, which combines linearity (for session types) with effect handlers. We introduce control-flow linearity as a means to ensure that continuations are used in accordance with the linearity of any resources they capture, ruling out such soundness bugs. We formalise the notion of control-flow linearity in a System F-style core calculus Feff∘, equipped with linear types, an effect type system, and effect handlers. We define a linearity-aware semantics in order to formally prove that Feff∘ preserves the integrity of linear values in the sense that no linear value is discarded or duplicated. In order to show that control-flow linearity can be made practical, we adapt Links based on the design of Feff∘, in doing so fixing a long-standing soundness bug. Finally, to better expose the potential of control-flow linearity, we define an ML-style core calculus Qeff∘, based on qualified types, which requires no programmer provided annotations, and instead relies entirely on type inference to infer control-flow linearity. Both linearity and effects are captured by qualified types. Qeff∘ overcomes a number of practical limitations of Feff∘, supporting abstraction over linearity, linearity dependencies between type variables, and a much more fine-grained notion of control-flow linearity. 
    more » « less
  2. We present a grammar for a robust class of data types that includes algebraic data types (ADTs), (truly) nested types, generalized algebraic data types (GADTs), and their higher-kinded analogues. All of the data types our grammar defines, as well as their associated type constructors, are shown to have fully functorial initial algebra semantics in locally presentable categories. Since local presentability is a modest hypothesis, needed for such semantics for even the simplest ADTs, our semantic framework is actually quite conservative. Our results thus provide evidence that if a category supports fully functorial initial algebra semantics for standard ADTs, then it does so for advanced higher-kinded data types as well. To give our semantics we introduce a new type former called Lan that captures on the syntactic level the categorical notion of a left Kan extension. We show how left Kan extensions capture propagation of a data type’s syntactic generators across the entire universe of types, via a certain completion procedure, so that the type constructor associated with a data type becomes a bona fide functor with a canonical action on morphisms. A by-product of our semantics is a precise measure of the semantic complexity of data types, given by the least cardinal λ for which the functor underlying a data type is λ-accessible. The proof of our main result allows this cardinal to be read off from a data type definition without much effort. It also gives a sufficient condition for a data type to have semantic complexity ω, thus characterizing those data types whose data elements are effectively enumerable. 
    more » « less
  3. We prove a number of results on the survival of the type-I property under extensions of locally compact groups: (a) that given a closed normal embedding N ⊴<#comment/> E \mathbb {N}\trianglelefteq \mathbb {E} of locally compact groups and a twisted action ( α<#comment/> , τ<#comment/> ) (\alpha ,\tau ) thereof on a (post)liminal C ∗<#comment/> C^* -algebra A A the twisted crossed product A ⋊<#comment/> α<#comment/> , τ<#comment/> E A\rtimes _{\alpha ,\tau }\mathbb {E} is again (post)liminal and (b) a number of converses to the effect that under various conditions a normal, closed, cocompact subgroup N ⊴<#comment/> E \mathbb {N}\trianglelefteq \mathbb {E} is type-I as soon as E \mathbb {E} is. This happens for instance if N \mathbb {N} is discrete and E \mathbb {E} is Lie, or if N \mathbb {N} is finitely-generated discrete (with no further restrictions except cocompactness). Examples show that there is not much scope for dropping these conditions. In the same spirit, call a locally compact group G \mathbb {G} type-I-preserving if all semidirect products N ⋊<#comment/> G \mathbb {N}\rtimes \mathbb {G} are type-I as soon as N \mathbb {N} is, andlinearlytype-I-preserving if the same conclusion holds for semidirect products V ⋊<#comment/> G V\rtimes \mathbb {G} arising from finite-dimensional G \mathbb {G} -representations. We characterize the (linearly) type-I-preserving groups that are (1) discrete-by-compact-Lie, (2) nilpotent, or (3) solvable Lie. 
    more » « less
  4. Sum-product networks have recently emerged as an attractive representation due to their dual view as a special type of deep neural network with clear semantics and a special type of probabilistic graphical model for which inference is always tractable. Those properties follow from some conditions (i.e., completeness and decomposability) that must be respected by the structure of the network. As a result, it is not easy to specify a valid sum-product network by hand and therefore structure learning techniques are typically used in practice. This paper describes a new online structure learning technique for feed-forward and recurrent SPNs. The algorithm is demonstrated on real-world datasets with continuous features for which it is not clear what network architecture might be best, including sequence datasets of varying length. 
    more » « less
  5. We construct an ancient solution to planar curve shortening. The solution is at all times compact and embedded. For t ≪<#comment/> 0 t\ll 0 it is approximated by the rotating Yin-Yang soliton, truncated at a finite angle α<#comment/> ( t ) = −<#comment/> t \alpha (t) = -t , and closed off by a small copy of the Grim Reaper translating soliton. 
    more » « less