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 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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
In fact, this relation is a partial function.
References
Borceux, F.: Handbook of Categorical Algebra: Volume 1, Basic Category Theory, vol. 1. Cambridge University Press, Cambridge (1994)
Clairambault, P., de Visme, M., Winskel, G.: Game semantics for quantum programming. PACMPL 3(POPL), 321–3229 (2019). https://doi.org/10.1145/3290345
Day, B.: On closed categories of functors II. In: Kelly, G.M. (ed.) Category Seminar. LNM, vol. 420, pp. 20–54. Springer, Heidelberg (1974). https://doi.org/10.1007/BFb0063098
Fiore, M.P.: Axiomatic domain theory in categories of partial maps. Ph.D. thesis, University of Edinburgh, UK (1994)
Girard, J.: Linear logic. Theor. Comput. Sci. 50, 1–102 (1987). https://doi.org/10.1016/0304-3975(87)90045-4
Jacobs, B.: Semantics of lambda-I and of other substructure lambda calculi. In: Bezem, M., Groote, J.F. (eds.) TLCA 1993. LNCS, vol. 664, pp. 195–208. Springer, Heidelberg (1993). https://doi.org/10.1007/BFb0037107
Kornell, A.: Quantum collections. Int. J. Math. 28(12), 1750085 (2017). https://doi.org/10.1142/S0129167X17500859
Laird, J.: A game semantics of linearly used continuations. In: Gordon, A.D. (ed.) FoSSaCS 2003. LNCS, vol. 2620, pp. 313–327. Springer, Heidelberg (2003). https://doi.org/10.1007/3-540-36576-1_20
Lehmann, D.J., Smyth, M.B.: Algebraic specification of data types: a synthetic approach. Math. Syst. Theory 14, 97–135 (1981). https://doi.org/10.1007/BF01752392
Lindenhovius, B., Mislove, M., Zamdzhiev, V.: Mixed linear and non-linear recursive types. Proc. ACM Program. Lang. 3(ICFP), 1111–11129 (2019). https://doi.org/10.1145/3341715
Lindenhovius, B., Mislove, M., Zamdzhiev, V.: Semantics for a lambda calculus for string diagrams (2020). preprint
Lindenhovius, B., Mislove, M.W., Zamdzhiev, V.: Enriching a Linear/non-linear Lambda Calculus: a programming language for string diagrams. In: Dawar, A., Grädel, E. (eds.) Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2018, Oxford, UK, 09–12 July 2018, pp. 659–668. ACM (2018). https://doi.org/10.1145/3209108.3209196
Lindenhovius, B., Mislove, M.W., Zamdzhiev, V.: LNL-FPC: the linear/non-linear fixpoint calculus (2020). preprint. http://arxiv.org/abs/1906.09503
Mellies, P.A.: Categorical semantics of linear logic. Panoramas et syntheses 27, 15–215 (2009)
Pagani, M., Selinger, P., Valiron, B.: Applying quantitative semantics to higher-order quantum computing. In: Jagannathan, S., Sewell, P. (eds.) The 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2014, San Diego, CA, USA, 20–21 January 2014. pp. 647–658. ACM (2014). https://doi.org/10.1145/2535838.2535879
Péchoux, R., Perdrix, S., Rennela, M., Zamdzhiev, V.: Quantum programming with inductive datatypes (2020). preprint
Péchoux, R., Perdrix, S., Rennela, M., Zamdzhiev, V.: Quantum programming with inductive datatypes: causality and affine type theory. FoSSaCS 2020. LNCS, vol. 12077, pp. 562–581. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-45231-5_29
Rios, F., Selinger, P.: A categorical model for a quantum circuit description language. In: QPL 2017 (2017). https://doi.org/10.4204/EPTCS.266.11
Selinger, P.: Towards a quantum programming language. Math. Struct. Comput. Sci. 14(4), 527–586 (2004). https://doi.org/10.1017/S0960129504004256
Selinger, P., Valiron, B.: Quantum Lambda Calculus (2009). https://doi.org/10.1017/CBO9781139193313.005
Smyth, M.B., Plotkin, G.D.: The category-theoretic solution of recursive domain equations. SIAM J. Comput. 11(4), 761–783 (1982). https://doi.org/10.1137/0211062
Takesaki, M.: Theory of Operator Algebras, vol. I. II and III. Springer, Heidelberg (2002). https://doi.org/10.1007/978-1-4612-6188-9
Wootters, W.K., Zurek, W.H.: A single quantum cannot be cloned. Nature 299(5886), 802–803 (1982)
Acknowledgements
I thank Romain Péchoux, Simon Perdrix and Mathys Rennela for discussions about the methods in this paper. I also thank the anonymous referees for the very useful feedback they provided. Finally, I gratefully acknowledge financial support from the French projects ANR-17-CE25-0009 SoftQPro and PIA-GDN/Quantex.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Proof of Theorem 42
A Proof of Theorem 42
As a simple consequence of Soundness (Theorem 40), we get the following corollary.
Corollary 43
Let \(\vdash \langle \cdot \rangle \ M\ \langle \varSigma \rangle \) be a closed term. If \( M \Downarrow \text { then } {\llbracket M \rrbracket } \ne \perp . \)
Proof
Assume for contradiction \({\llbracket M \rrbracket } = \perp .\) Let \(M' \equiv M;\ \mathbf{discard} \ \varSigma \) be the program that discards all output variables of M. Clearly, \((M'\ |\ \cdot ) \leadsto _* (\mathbf{skip} \ |\ \cdot )\) and therefore \(\text {id}_I = {\llbracket M' \rrbracket } = \diamond \circ {\llbracket M \rrbracket } = \perp \), which contradicts Definition 41. \(\square \)
In the remainder of this appendix, we will show that the converse implication also holds which therefore completes the proof of Theorem 42. Our proof strategy is a simplification of the proof strategy of [17] which is in turn based on the proof strategy of [15].
We provide a brief outline of our proof strategy. In Subsect. A.1, we extend the language with finitary (or bounded) primitives for recursion and show that our extension preserves all of the fundamental properties of the language stated so far (Theorem 44). Any finitary configuration terminates in the extended language (Lemma 45) which allows us to easily prove a finitary version of adequacy (Corrolary 46). We then show that finitary configurations approximate ordinary ones both operationally (Lemma 48) and denotationally (Lemma 49) which then allows us to finish the proof.
1.1 A.1 Language Extension
We extend the term language by adding two new terms:
where \(n \ge 0\) ranges over the natural numbers. Well-formed configuration are defined in the same way as before. We extend the operational semantics by adding the following rules:
We extend the denotational semantics by adding interpretations for the newly added terms:
Configurations are interpreted as before. We update the notion of terminal configuration to also include configurations of the form \((\perp \ |\ V )\).
Theorem 44
([17]). Subject Reduction (Theorem 6), Progress (Theorem 8) and Soundness (Theorem 40) also hold true for the extended language (using the updated language notions).
1.2 A.2 The Proof
We shall say that a term is finitary if it does not contain any unindexed while loops and we shall say a term is ordinary if it does not contain any indexed while loops or \(\perp _{\varGamma , \varSigma }\) subterms. So, an ordinary term is simply a term in the ordinary (unextended) language. Similarly, a finitary (ordinary) configuration is a configuration \((M\ |\ V )\) where M is finitary (ordinary). A finitary configuration is called as such, because all of its reduction sequences terminate.
Lemma 45
([17]). For any finitary configuration \(\mathcal {C}\), there exists \(n \in \mathbb {N}\), such that the length of every reduction sequence from \(\mathcal {C}\) is at most n.
Note that, every terminal finitary configuration \(\mathcal {T}\) has to be of the form \((\mathbf{skip} \ |\ V )\), in which case we say it is a \(\mathbf{skip} \)-configuration, or of the form \((\perp \ |\ V )\), in which case we say \(\mathcal {T}\) is a \(\perp \)-configuration. For any closed term \(\vdash \langle \cdot \rangle \ M\ \langle \varSigma \rangle \) in the extended language, we shall write \(M \Downarrow _o\), if M terminates in the ordinary sense, i.e., if \((M\ |\ \cdot ) \leadsto _* (\mathbf{skip} \ |\ V)\), for some value assignment V.
Corollary 46
For any closed finitary term M, if \({\llbracket M \rrbracket } \ne \perp \) then \(M \Downarrow _o\).
Proof
By Lemma 45, we know \((M\ |\ \cdot ) \leadsto _* (T'\ |\ V)\), where \(T'\) is either skip or \(\perp \). If \(T' = \perp \), then by soundness, it follows \({\llbracket M \rrbracket } = \perp \). Therefore \(M \Downarrow _o\). \(\square \)
We proceed by defining an approximation relation \((- \blacktriangleleft -)\) between finitary terms and ordinary terms. It is the smallest relation that satisfies the rules:
We also define an approximation relation \((- \sqsubset - )\) between finitary configurations and ordinary configurations to be the smallest relation satisfying the rule:
Remark 47
If \( (M'\ |\ V ) \sqsubset (M\ |\ V )\), then M and \(M'\) do not contain any \(\perp \) subterms.
Next, we show the relation \(( - \sqsubset -) \) approximates the ordinary operational semantics.
Lemma 48
Let \(\mathcal {C}\) be an ordinary configuration and \(C'\) a finitary configuration with \(\mathcal {C}' \sqsubset \mathcal {C}\). Assume that \(\mathcal {C}' \leadsto _* \mathcal {T} \), where \(\mathcal {T}\) is a \(\mathbf{skip} \)-configuration. Then \(\mathcal {C} \leadsto _* \mathcal {T}\).
Proof
This is just a simple special case of [17, Lemma 40]. \(\square \)
The above lemma shows that if a finitary configuration terminates in the ordinary sense, then so does the ordinary configuration which is approximated by it. Next we show that ordinary configurations are also approximated by finitary configurations in a denotational sense.
Lemma 49
([17]). For any ordinary term M and configuration \(\mathcal {C}\):
Finally, we can state the proof of Theorem 42.
Proof of Theorem 42. By Corollary 43, it suffices to show that if \({\llbracket M \rrbracket } \ne \perp \) then \(M \Downarrow _o.\) By Lemma 49, we have \({\llbracket M \rrbracket } = \bigvee _{M' \blacktriangleleft M} {\llbracket M' \rrbracket }\). Since \({\llbracket M \rrbracket } \ne \perp \), then it follows there exists a finitary term \(M' \blacktriangleleft M\), such that \({\llbracket M' \rrbracket } \ne \perp \). By Corollary 46, it follows \(M' \Downarrow _o\) and by Lemma 48 it follows \(M \Downarrow _o\). \(\square \)
Rights and permissions
Copyright information
© 2020 IFIP International Federation for Information Processing
About this paper
Cite this paper
Zamdzhiev, V. (2020). Semantics for First-Order Affine Inductive Data Types via Slice Categories. In: Petrişan, D., Rot, J. (eds) Coalgebraic Methods in Computer Science. CMCS 2020. Lecture Notes in Computer Science(), vol 12094. Springer, Cham. https://doi.org/10.1007/978-3-030-57201-3_10
Download citation
DOI: https://doi.org/10.1007/978-3-030-57201-3_10
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-57200-6
Online ISBN: 978-3-030-57201-3
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)