-
Central Submonads and Notions of Computation: Soundness, Completeness and Internal Languages
Authors:
TItouan Carette,
Louis Lemonnier,
Vladimir Zamdzhiev
Abstract:
Monads in category theory are algebraic structures that can be used to model computational effects in programming languages. We show how the notion of "centre", and more generally "centrality", i.e. the property for an effect to commute with all other effects, may be formulated for strong monads acting on symmetric monoidal categories. We identify three equivalent conditions which characterise the…
▽ More
Monads in category theory are algebraic structures that can be used to model computational effects in programming languages. We show how the notion of "centre", and more generally "centrality", i.e. the property for an effect to commute with all other effects, may be formulated for strong monads acting on symmetric monoidal categories. We identify three equivalent conditions which characterise the existence of the centre of a strong monad (some of which relate it to the premonoidal centre of Power and Robinson) and we show that every strong monad on many well-known naturally occurring categories does admit a centre, thereby showing that this new notion is ubiquitous. More generally, we study central submonads, which are necessarily commutative, just like the centre of a strong monad. We provide a computational interpretation by formulating equational theories of lambda calculi equipped with central submonads, we describe categorical models for these theories and prove soundness, completeness and internal language results for our semantics.
△ Less
Submitted 28 April, 2023; v1 submitted 19 July, 2022;
originally announced July 2022.
-
Quantum Expectation Transformers for Cost Analysis
Authors:
Martin Avanzini,
Georg Moser,
Romain Péchoux,
Simon Perdrix,
Vladimir Zamdzhiev
Abstract:
We introduce a new kind of expectation transformer for a mixed classical-quantum programming language. Our semantic approach relies on a new notion of a cost structure, which we introduce and which can be seen as a specialisation of the Kegelspitzen of Keimel and Plotkin. We show that our weakest precondition analysis is both sound and adequate with respect to the operational semantics of the lang…
▽ More
We introduce a new kind of expectation transformer for a mixed classical-quantum programming language. Our semantic approach relies on a new notion of a cost structure, which we introduce and which can be seen as a specialisation of the Kegelspitzen of Keimel and Plotkin. We show that our weakest precondition analysis is both sound and adequate with respect to the operational semantics of the language. Using the induced expectation transformer, we provide formal analysis methods for the expected cost analysis and expected value analysis of classical-quantum programs. We illustrate the usefulness of our techniques by computing the expected cost of several well-known quantum algorithms and protocols, such as coin tossing, repeat until success, entangled state preparation, and quantum walks.
△ Less
Submitted 23 January, 2022;
originally announced January 2022.
-
The Central Valuations Monad
Authors:
Xiaodong Jia,
Michael Mislove,
Vladimir Zamdzhiev
Abstract:
We give a commutative valuations monad Z on the category DCPO of dcpo's and Scott-continuous functions. Compared to the commutative valuations monads given in [Jia et al., 2021], our new monad Z is larger and it contains all push-forward images of valuations on the unit interval [0,1] along lower semi-continuous maps. We believe that this new monad will be useful in giving domain-theoretic denotat…
▽ More
We give a commutative valuations monad Z on the category DCPO of dcpo's and Scott-continuous functions. Compared to the commutative valuations monads given in [Jia et al., 2021], our new monad Z is larger and it contains all push-forward images of valuations on the unit interval [0,1] along lower semi-continuous maps. We believe that this new monad will be useful in giving domain-theoretic denotational semantics for statistical programming languages with continuous probabilistic choice.
△ Less
Submitted 21 November, 2021;
originally announced November 2021.
-
Qimaera: Type-safe (Variational) Quantum Programming in Idris
Authors:
Liliane-Joy Dandy,
Emmanuel Jeandel,
Vladimir Zamdzhiev
Abstract:
Variational Quantum Algorithms are hybrid classical-quantum algorithms where classical and quantum computation work in tandem to solve computational problems. These algorithms create interesting challenges for the design of suitable programming languages. In this paper we introduce Qimaera, which is a set of libraries for the Idris 2 programming language that enable the programmer to implement (va…
▽ More
Variational Quantum Algorithms are hybrid classical-quantum algorithms where classical and quantum computation work in tandem to solve computational problems. These algorithms create interesting challenges for the design of suitable programming languages. In this paper we introduce Qimaera, which is a set of libraries for the Idris 2 programming language that enable the programmer to implement (variational) quantum algorithms where the full power of the elegant Idris language works in synchrony with quantum programming primitives that we introduce. The two key ingredients of Idris that make this possible are (1) dependent types which allow us to implement unitary (i.e. reversible and controllable) quantum operations; and (2) linearity which allows us to enforce fine-grained control over the execution of quantum operations that ensures compliance with the laws of quantum mechanics. We demonstrate that Qimaera is suitable for variational quantum programming by providing implementations of the two most prominent variational quantum algorithms -- QAOA and VQE. To the best of our knowledge, this is the first implementation of these algorithms that has been achieved in a type-safe framework.
△ Less
Submitted 21 November, 2021;
originally announced November 2021.
-
Semantics for Variational Quantum Programming
Authors:
Xiaodong Jia,
Andre Kornell,
Bert Lindenhovius,
Michael Mislove,
Vladimir Zamdzhiev
Abstract:
We consider a programming language that can manipulate both classical and quantum information. Our language is type-safe and designed for variational quantum programming, which is a hybrid classical-quantum computational paradigm. The classical subsystem of the language is the Probabilistic FixPoint Calculus (PFPC), which is a lambda calculus with mixed-variance recursive types, term recursion and…
▽ More
We consider a programming language that can manipulate both classical and quantum information. Our language is type-safe and designed for variational quantum programming, which is a hybrid classical-quantum computational paradigm. The classical subsystem of the language is the Probabilistic FixPoint Calculus (PFPC), which is a lambda calculus with mixed-variance recursive types, term recursion and probabilistic choice. The quantum subsystem is a first-order linear type system that can manipulate quantum information. The two subsystems are related by mixed classical/quantum terms that specify how classical probabilistic effects are induced by quantum measurements, and conversely, how classical (probabilistic) programs can influence the quantum dynamics. We also describe a sound and computationally adequate denotational semantics for the language. Classical probabilistic effects are interpreted using a recently-described commutative probabilistic monad on DCPO. Quantum effects and resources are interpreted in a category of von Neumann algebras that we show is enriched over (continuous) domains. This strong sense of enrichment allows us to develop novel semantic methods that we use to interpret the relationship between the quantum and classical probabilistic effects. By doing so we provide the first denotational analysis that relates models of classical probabilistic programming to models of quantum programming.
△ Less
Submitted 28 July, 2021;
originally announced July 2021.
-
Commutative Monads for Probabilistic Programming Languages
Authors:
Xiaodong Jia,
Bert Lindenhovius,
Michael Mislove,
Vladimir Zamdzhiev
Abstract:
A long-standing open problem in the semantics of programming languages supporting probabilistic choice is to find a commutative monad for probability on the category DCPO. In this paper we present three such monads and a general construction for finding even more. We show how to use these monads to provide a sound and adequate denotational semantics for the Probabilistic FixPoint Calculus (PFPC) -…
▽ More
A long-standing open problem in the semantics of programming languages supporting probabilistic choice is to find a commutative monad for probability on the category DCPO. In this paper we present three such monads and a general construction for finding even more. We show how to use these monads to provide a sound and adequate denotational semantics for the Probabilistic FixPoint Calculus (PFPC) -- a call-by-value simply-typed lambda calculus with mixed-variance recursive types, term recursion and probabilistic choice. We also show that in the special case where we consider continuous dcpo's, then all three monads coincide with the valuations monad of Jones and we fully characterise the induced Eilenberg-Moore categories by showing that they are all isomorphic to the category of continuous Kegelspitzen of Keimel and Plotkin.
△ Less
Submitted 31 January, 2021;
originally announced February 2021.
-
Computational Adequacy for Substructural Lambda Calculi
Authors:
Vladimir Zamdzhiev
Abstract:
Substructural type systems, such as affine (and linear) type systems, are type systems which impose restrictions on copying (and discarding) of variables, and they have found many applications in computer science, including quantum programming. We describe one linear and one affine type systems and we formulate abstract categorical models for both of them which are sound and computationally adequa…
▽ More
Substructural type systems, such as affine (and linear) type systems, are type systems which impose restrictions on copying (and discarding) of variables, and they have found many applications in computer science, including quantum programming. We describe one linear and one affine type systems and we formulate abstract categorical models for both of them which are sound and computationally adequate. We also show, under basic assumptions, that interpreting lambda abstractions via a monoidal closed structure (a popular method for linear type systems) necessarily leads to degenerate and inadequate models for call-by-value affine type systems with recursion. In our categorical treatment, a solution to this problem is clearly presented. Our categorical models are more general than linear/non-linear models used to study linear logic and we present a homogeneous categorical account of both linear and affine type systems in a call-by-value setting. We also give examples with many concrete models, including classical and quantum ones.
△ Less
Submitted 25 January, 2021; v1 submitted 11 May, 2020;
originally announced May 2020.
-
Semantics for first-order affine inductive data types via slice categories
Authors:
Vladimir Zamdzhiev
Abstract:
Affine type systems are substructural type systems where copying of information is restricted, but discarding of information is permissible at all types. Such type systems are well-suited for describing quantum programming languages, because copying of quantum information violates the laws of quantum mechanics. In this paper, we consider a first-order affine type system with inductive data types a…
▽ More
Affine type systems are substructural type systems where copying of information is restricted, but discarding of information is permissible at all types. Such type systems are well-suited for describing quantum programming languages, because copying of quantum information violates the laws of quantum mechanics. In this paper, we consider a first-order affine type system with inductive data types and present a novel categorical semantics for it. The most challenging aspect of this interpretation comes from the requirement to construct appropriate discarding maps for our data types which might be defined by mutual/nested recursion. We show how to achieve this for all types by taking models of a first-order linear type system whose atomic types are discardable and then presenting an additional affine interpretation of types within the slice category of the model with the tensor unit. We present some concrete categorical models for the language ranging from classical to quantum. Finally, we discuss potential ways of dualising and extending our methods and using them for interpreting coalgebraic and lazy data types.
△ Less
Submitted 19 January, 2020;
originally announced January 2020.
-
Quantum Programming with Inductive Datatypes: Causality and Affine Type Theory
Authors:
Romain Péchoux,
Simon Perdrix,
Mathys Rennela,
Vladimir Zamdzhiev
Abstract:
Inductive datatypes in programming languages allow users to define useful data structures such as natural numbers, lists, trees, and others. In this paper we show how inductive datatypes may be added to the quantum programming language QPL. We construct a sound categorical model for the language and by doing so we provide the first detailed semantic treatment of user-defined inductive datatypes in…
▽ More
Inductive datatypes in programming languages allow users to define useful data structures such as natural numbers, lists, trees, and others. In this paper we show how inductive datatypes may be added to the quantum programming language QPL. We construct a sound categorical model for the language and by doing so we provide the first detailed semantic treatment of user-defined inductive datatypes in quantum programming. We also show our denotational interpretation is invariant with respect to big-step reduction, thereby establishing another novel result for quantum programming. Compared to classical programming, this property is considerably more difficult to prove and we demonstrate its usefulness by showing how it immediately implies computational adequacy at all types. To further cement our results, our semantics is entirely based on a physically natural model of von Neumann algebras, which are mathematical structures used by physicists to study quantum mechanics.
△ Less
Submitted 21 October, 2019;
originally announced October 2019.
-
Reflecting Algebraically Compact Functors
Authors:
Vladimir Zamdzhiev
Abstract:
A compact T-algebra is an initial T-algebra whose inverse is a final T-coalgebra. Functors with this property are said to be algebraically compact. This is a very strong property used in programming semantics which allows one to interpret recursive datatypes involving mixed-variance functors, such as function space. The construction of compact algebras is usually done in categories with a zero obj…
▽ More
A compact T-algebra is an initial T-algebra whose inverse is a final T-coalgebra. Functors with this property are said to be algebraically compact. This is a very strong property used in programming semantics which allows one to interpret recursive datatypes involving mixed-variance functors, such as function space. The construction of compact algebras is usually done in categories with a zero object where some form of a limit-colimit coincidence exists. In this paper we consider a more abstract approach and show how one can construct compact algebras in categories which have neither a zero object, nor a (standard) limit-colimit coincidence by reflecting the compact algebras from categories which have both. In doing so, we provide a constructive description of a large class of algebraically compact functors (satisfying a compositionality principle) and show our methods compare quite favorably to other approaches from the literature.
△ Less
Submitted 14 September, 2020; v1 submitted 23 June, 2019;
originally announced June 2019.
-
LNL-FPC: The Linear/Non-linear Fixpoint Calculus
Authors:
Bert Lindenhovius,
Michael Mislove,
Vladimir Zamdzhiev
Abstract:
We describe a type system with mixed linear and non-linear recursive types called LNL-FPC (the linear/non-linear fixpoint calculus). The type system supports linear ty**, which enhances the safety properties of programs, but also supports non-linear ty** as well, which makes the type system more convenient for programming. Just as in FPC, we show that LNL-FPC supports type-level recursion, whi…
▽ More
We describe a type system with mixed linear and non-linear recursive types called LNL-FPC (the linear/non-linear fixpoint calculus). The type system supports linear ty**, which enhances the safety properties of programs, but also supports non-linear ty** as well, which makes the type system more convenient for programming. Just as in FPC, we show that LNL-FPC supports type-level recursion, which in turn induces term-level recursion. We also provide sound and computationally adequate categorical models for LNL-FPC that describe the categorical structure of the substructural operations of Intuitionistic Linear Logic at all non-linear types, including the recursive ones. In order to do so, we describe a new technique for solving recursive domain equations within cartesian categories by constructing the solutions over pre-embeddings. The type system also enjoys implicit weakening and contraction rules that we are able to model by identifying the canonical comonoid structure of all non-linear types. We also show that the requirements of our abstract model are reasonable by constructing a large class of concrete models that have found applications not only in classical functional programming, but also in emerging programming paradigms that incorporate linear types, such as quantum programming and circuit description programming languages.
△ Less
Submitted 21 April, 2021; v1 submitted 22 June, 2019;
originally announced June 2019.
-
A Framework for Rewriting Families of String Diagrams
Authors:
Vladimir Zamdzhiev
Abstract:
We describe a mathematical framework for equational reasoning about infinite families of string diagrams which is amenable to computer automation. The framework is based on context-free families of string diagrams which we represent using context-free graph grammars. We model equations between infinite families of diagrams using rewrite rules between context-free grammars. Our framework represents…
▽ More
We describe a mathematical framework for equational reasoning about infinite families of string diagrams which is amenable to computer automation. The framework is based on context-free families of string diagrams which we represent using context-free graph grammars. We model equations between infinite families of diagrams using rewrite rules between context-free grammars. Our framework represents equational reasoning about concrete string diagrams and context-free families of string diagrams using double-pushout rewriting on graphs and context-free graph grammars respectively. We prove that our representation is sound by showing that it respects the concrete semantics of string diagrammatic reasoning and we show that our framework is appropriate for software implementation by proving the membership problem is decidable.
△ Less
Submitted 5 February, 2019; v1 submitted 11 September, 2018;
originally announced September 2018.
-
Enriching a Linear/Non-linear Lambda Calculus: A Programming Language for String Diagrams
Authors:
Bert Lindenhovius,
Michael Mislove,
Vladimir Zamdzhiev
Abstract:
Linear/non-linear (LNL) models, as described by Benton, soundly model a LNL term calculus and LNL logic closely related to intuitionistic linear logic. Every such model induces a canonical enrichment that we show soundly models a LNL lambda calculus for string diagrams, introduced by Rios and Selinger (with primary application in quantum computing). Our abstract treatment of this language leads to…
▽ More
Linear/non-linear (LNL) models, as described by Benton, soundly model a LNL term calculus and LNL logic closely related to intuitionistic linear logic. Every such model induces a canonical enrichment that we show soundly models a LNL lambda calculus for string diagrams, introduced by Rios and Selinger (with primary application in quantum computing). Our abstract treatment of this language leads to simpler concrete models compared to those presented so far. We also extend the language with general recursion and prove soundness. Finally, we present an adequacy result for the diagram-free fragment of the language which corresponds to a modified version of Benton and Wadler's adjoint calculus with recursion.
△ Less
Submitted 25 April, 2018;
originally announced April 2018.
-
Rewriting Context-free Families of String Diagrams
Authors:
Vladimir Nikolaev Zamdzhiev
Abstract:
String diagrams provide a convenient graphical framework which may be used for equational reasoning about morphisms of monoidal categories. However, unlike term rewriting, rewriting string diagrams results in shorter equational proofs, because the string diagrammatic representation allows us to formally establish equalities modulo any rewrite steps which follow from the monoidal structure.
Manip…
▽ More
String diagrams provide a convenient graphical framework which may be used for equational reasoning about morphisms of monoidal categories. However, unlike term rewriting, rewriting string diagrams results in shorter equational proofs, because the string diagrammatic representation allows us to formally establish equalities modulo any rewrite steps which follow from the monoidal structure.
Manipulating string diagrams by hand is a time-consuming and error-prone process, especially for large string diagrams. This can be ameliorated by using software proof assistants, such as Quantomatic.
However, reasoning about concrete string diagrams may be limiting and in some scenarios it is necessary to reason about entire (infinite) families of string diagrams. When doing so, we face the same problems as for manipulating concrete string diagrams, but in addition, we risk making further mistakes if we are not precise enough about the way we represent (infinite) families of string diagrams.
The primary goal of this thesis is to design a mathematical framework for equational reasoning about infinite families of string diagrams which is amenable to computer automation. We will be working with context-free families of string diagrams and we will represent them using context-free graph grammars. We will model equations between infinite families of diagrams using rewrite rules between context-free grammars. Our framework represents equational reasoning about concrete string diagrams and context-free families of string diagrams using double-pushout rewriting on graphs and context-free graph grammars respectively. We will prove that our representation is sound by showing that it respects the concrete semantics of string diagrammatic reasoning and we will show that our framework is appropriate for software implementation by proving important decidability properties.
△ Less
Submitted 21 May, 2017;
originally announced May 2017.
-
Equational reasoning with context-free families of string diagrams
Authors:
Aleks Kissinger,
Vladimir Zamdzhiev
Abstract:
String diagrams provide an intuitive language for expressing networks of interacting processes graphically. A discrete representation of string diagrams, called string graphs, allows for mechanised equational reasoning by double-pushout rewriting. However, one often wishes to express not just single equations, but entire families of equations between diagrams of arbitrary size. To do this we defin…
▽ More
String diagrams provide an intuitive language for expressing networks of interacting processes graphically. A discrete representation of string diagrams, called string graphs, allows for mechanised equational reasoning by double-pushout rewriting. However, one often wishes to express not just single equations, but entire families of equations between diagrams of arbitrary size. To do this we define a class of context-free grammars, called B-ESG grammars, that are suitable for defining entire families of string graphs, and crucially, of string graph rewrite rules. We show that the language-membership and match-enumeration problems are decidable for these grammars, and hence that there is an algorithm for rewriting string graphs according to B-ESG rewrite patterns. We also show that it is possible to reason at the level of grammars by providing a simple method for transforming a grammar by string graph rewriting, and showing admissibility of the induced B-ESG rewrite pattern.
△ Less
Submitted 13 October, 2015; v1 submitted 10 April, 2015;
originally announced April 2015.
-
Quantomatic: A Proof Assistant for Diagrammatic Reasoning
Authors:
Aleks Kissinger,
Vladimir Zamdzhiev
Abstract:
Monoidal algebraic structures consist of operations that can have multiple outputs as well as multiple inputs, which have applications in many areas including categorical algebra, programming language semantics, representation theory, algebraic quantum information, and quantum groups. String diagrams provide a convenient graphical syntax for reasoning formally about such structures, while avoiding…
▽ More
Monoidal algebraic structures consist of operations that can have multiple outputs as well as multiple inputs, which have applications in many areas including categorical algebra, programming language semantics, representation theory, algebraic quantum information, and quantum groups. String diagrams provide a convenient graphical syntax for reasoning formally about such structures, while avoiding many of the technical challenges of a term-based approach. Quantomatic is a tool that supports the (semi-)automatic construction of equational proofs using string diagrams. We briefly outline the theoretical basis of Quantomatic's rewriting engine, then give an overview of the core features and architecture and give a simple example project that computes normal forms for commutative bialgebras.
△ Less
Submitted 13 October, 2015; v1 submitted 3 March, 2015;
originally announced March 2015.
-
!-Graphs with Trivial Overlap are Context-Free
Authors:
Aleks Kissinger,
Vladimir Zamdzhiev
Abstract:
String diagrams are a powerful tool for reasoning about composite structures in symmetric monoidal categories. By representing string diagrams as graphs, equational reasoning can be done automatically by double-pushout rewriting. !-graphs give us the means of expressing and proving properties about whole families of these graphs simultaneously. While !-graphs provide elegant proofs of surprising…
▽ More
String diagrams are a powerful tool for reasoning about composite structures in symmetric monoidal categories. By representing string diagrams as graphs, equational reasoning can be done automatically by double-pushout rewriting. !-graphs give us the means of expressing and proving properties about whole families of these graphs simultaneously. While !-graphs provide elegant proofs of surprisingly powerful theorems, little is known about the formal properties of the graph languages they define. This paper takes the first step in characterising these languages by showing that an important subclass of !-graphs--those whose repeated structures only overlap trivially--can be encoded using a (context-free) vertex replacement grammar.
△ Less
Submitted 10 April, 2015; v1 submitted 24 January, 2015;
originally announced January 2015.
-
The ZX-calculus is incomplete for quantum mechanics
Authors:
Christian Schröder de Witt,
Vladimir Zamdzhiev
Abstract:
We prove that the ZX-calculus is incomplete for quantum mechanics. We suggest the addition of a new 'color-swap' rule, of which currently no analytical formulation is known and which we suspect may be necessary, but not sufficient to make the ZX-calculus complete.
We prove that the ZX-calculus is incomplete for quantum mechanics. We suggest the addition of a new 'color-swap' rule, of which currently no analytical formulation is known and which we suspect may be necessary, but not sufficient to make the ZX-calculus complete.
△ Less
Submitted 29 December, 2014; v1 submitted 14 April, 2014;
originally announced April 2014.