Arxiv:1908.01212V3 [Math.CT] 3 Nov 2020 Step, One Needs to Apply a For-Loop to Divide a Matrix Into Blocks
Total Page:16
File Type:pdf, Size:1020Kb
Typing Tensor Calculus in 2-Categories Fatimah Ahmadi Department of Computer Science University of Oxford November 4, 2020 Abstract We introduce semiadditive 2-categories, 2-categories with binary 2- biproducts and a zero object, as a suitable framework for typing tensor calculus. Tensors are the generalization of matrices, whose components have more than two indices. 1 Introduction Linear algebra is the primary mathematical toolbox for quantum physicists. Categorical quantum mechanics re-evaluates this toolbox by expressing each tool in the categorical language and leveraging the power of graphical calculus accompanying monoidal categories to gain an alternative insight into quantum features. In the categorical description of quantum mechanics, everything is typed in FHilb; the category whose objects are finite dimensional Hilbert spaces and morphisms are linear maps/matrices. In this category, Hilbert spaces associated with physical systems are typed as objects, and processes between systems as morphisms. MacLane [7] proposed the idea of typing matrices as morphisms while intro- ducing semiadditive categories(categories with well-behaved additions between objects). This line of research, further, has been explored by Macedo and Oliveira in the pursuit of avoiding the cumbersome indexed-based operations of matrices [6]. They address the quest for shifting the traditional perspective of formal methods in software development[10]. To observe why index-level operations do not offer an optimal approach, take the divide-and-conquer algorithm to multiplicate two matrices. In each arXiv:1908.01212v3 [math.CT] 3 Nov 2020 step, one needs to apply a for-loop to divide a matrix into blocks. While the division happens automatically if one takes matrices whose sources or targets are biproducts of objects. In addition, instead of looping over rows and columns to obtain sections of a matrix, we can multiply a matrix by projections and injections. Developing this project to include higher ranks matrices or tensors motivates us throughout this paper. The name “tensor” has been used in the literature widely for different purposes. In the current context, tensor signifies an umbrella term for scalars, vectors, and matrices. Scalars are tensors without any index; vectors have one index, and matrices denote tensors with two indices. 1 To take the first step towards this goal, one needs to identify a suitable category. Category Mat|, which captures all structures of a semiadditive cat- egory, provides an intuition for us. Translating Category Mat|in the lan- guage of higher categories, one observes vectors as 0-morphisms, matrices as 1-morphisms, and tensors with at most four indices as 2-morphisms. This sim- ple observation demonstrates that the suitable category for our purpose should be a 2-category with extra structures. This 2-category needs to have biproducts between objects, biproducts be- tween 1-morphisms and additions between 2-morphisms. Such a generalization yields a semiadditive 2-category. Current literature lacks a rigorous definition for biproducts in 2-categories and semiadditive 2-categories. In this paper, we define 2-biproducts and semi- additive 2-categories. We propose both the algebraic and limit-form definitions of biproducts and show their compatibility. Considering this 2-category as a basic framework, we demonstrate the details of typing tensor calculus. 2Vec is given as an example of symmetric monoidal 2-categories by Kapra- nov and Voevodsky [4]. Objects of 2Vec are natural numbers, 1-morphisms are matrices between natural numbers whose entries are finite dimensional vector spaces, and 2-morphisms are linear maps between vector spaces. It is folklore that 2Vec also represents a prototype of semiadditive 2-categories. Neverthe- less, lacking a rigorous definition for semiadditive 2-categories, this claim has not been examined closely. We examine the algebraic form of 2-biproducts in 2Vec and explore the details of the multiplication of tensors. We con- clude with a thorough analysis of enrichment in semiadditive 2-categories. Ul- timately, based on our observations about the behavior of zero 1-morphisms in 2-categories, we raise a critical non-trivial question about the relationship between limits and 2-limits in 2-categories. Remark 1. For a concise review of bicategories, consult Leinster’s paper [5]. By a 2-category, we mean a strict 2-category: bicategories whose associators and unitors are identities. Remark 2. In this paper, all categories and 2-categories are small. Remark 3. We use the pasting lemma [11] whenever we intend to recognize equal 2-morphisms. Notation. Capital letters, A; B; :: are reserved for objects, small letters f; g; ::: for 1-morphisms and Greek letters α; β; ::: for 2-morphisms. The horizontal composition is denoted by juxtaposition and vertical composi- tion of 2-morphisms by “odot" . Plus sign + represents addition of morphisms in categories and addition of 2-morphisms in 2-categories. Addition (biproduct) of objects in categories and addition of 1-morphisms in 2-categories are shown by “oplus" ⊕. Finally, addition of objects in 2-categories or 2-biproducts is represented by “boxplus" . For every object A, the identity 1-morphism or 1-identity is shown by idA and for every 1-morphism f, the identity 2-morphism or 2-identity by 1f . Whenever, it is clear from the context, in the horizontal composition of 1-identities with 2-morphisms, we leave out 1 and use whiskering convention 1f ◦ α = fα. Remark 4. If you are reading this paper in monochromatic, in Figures 1 and 2 and Lemma 9, red lines are dashed and blue lines are solid. 2 2 Semiadditive categories This section is devoted to a review of definitions and propositions of semiadditive categories, to establish the 2-dimensional version of them in the next section. The review part is based on [1, 2, 3]. 2.1 Constant morphisms in categories A constant morphism is a particular morphism whose left and right composites for all composable morphisms are equal. Generally, a category can have constant morphisms for some pairs of objects, but not all of them. If all hom-sets, however, have constant morphisms, then they should be compatible and unique. Definition 1. A morphism f : X −! Y is left constant if for every object W and every pair of morphisms h; g : W −! X, the right composition with f is the same, fg = fh. Definition 2. A morphism f : X −! Y is right constant if for every object Y and for every pair of morphisms h; g : Y −! Z , the left composition with f is the same, gf = hf. Definition 3. A morphism is constant if it is both left and right constant. The following definition indicates the compatibility condition between con- stant morphisms in hom-sets. Definition 4. A locally pointed category is a category whose hom-sets for every pair of objects (A; B) have constant morphisms ?B;A : A −! B such that for f g an arbitrary pair of morphisms A −! B −! C, Diagram 1 commutes. ?B;A A B f ?C;A g B C ?C;B (1) Proposition 1. In a locally pointed category, the family of constant morphisms is unique. Proof. Consider two different families of constant morphisms f?g and f?0g. If ?B;A ?C;B 0 0 0 A −−−! B −−−! C ? ? ?B;A = ? 0 , then from left constantness of , we have C;B C;A ?C;B 0 and from right constantness of ?, we have ?C;B?B;A = ?C;A therefore, ?C;A = 0 ?C;A for every (A; C). Definition 5. A zero object is an object which is simultaneously initial and terminal. Definition 6. A pointed category is a category with a zero object. Definition 7. In a category with a zero object, a zero morphism is a morphism which factorizes through the zero object. 3 Remark 5. In a pointed category, the family of zero morphisms is the only family of constant morphisms thanks to Proposition 1. Remark 6. A category might have constant morphisms but not a zero object. 2.2 Biproducts in categories In limit-form definition, a biproduct in a category is an addition between objects that induces an addition between morphisms. But in the algebraic form, one needs to start with a CMon-enriched category. These two initial conditions shake hands when we examine enrichment in Proposition 2. Definition 8. A CMon-enriched category is a category whose hom-sets are commutative monoids and the composition of morphisms is bilinear. Lemma 1. Every CMon-enriched category is a locally pointed category. f g Proof. Consider A −−−! B −! C, for which e is the unit element. From linearity eB;A of composition g(f + eB;A) = gf + geB;A and since eB;A is the unit element of monoid hom(A; B), so, g(f + eB;A) = gf, and geB;A is the unit element of monoid hom(A; C). A pair of objects in a category can have non-isomorphic products and co- products, but if they are isomorphic, we say this pair of objects has a biproduct. Another definition is in the algebraic form. Algebraic definitions, whenever they exist, are more desirable, since for in- stance: checking whether an algebraic definition is preserved by a particular functor, boils down to checking functionality. Definition 9. In a category, a product of pair of objects (A; B) is a tuple (A × B; pA; pB) such that for an arbitrary cone (X; f : X −! A; g : X −! B) shown in Figure 1, there exists a unique morphism b : X −! A × B which satisfies pAb = f and pBb = g. Morphisms pA and pB are called projections. X b f g A × B pA pB A B Figure 1: Product of (A; B). Definition 10. In a category, a coproduct of pair of objects (A; B) is a tuple (A t B; iA; iB) such that for an arbitrary cone (X; f : A −! X; g : B −! X) there exists a unique morphism b : A t B −! X which satisfies biA = f and biB = g.