<<

Cent. Eur. J. Comp. Sci. • 4(3) • 2014 • 96-106 DOI: 10.2478/s13537-014-0220-7

Central European Journal of

Categorical structures as expressing tool for differential calculus

Research Article

William Steingartner1∗, Davorka Radaković2†

1 Department of Computers and Informatics, Faculty of El. Engineering and Informatics Technical University of Košice, Letná 9, 04200 Košice, Slovakia 2 Department of Mathematics and Informatics, Faculty of Sciences University of Novi Sad, Trg D. Obradovića 4, 21000 Novi Sad, Serbia

Received 28 February 2014; accepted 01 September 2014

Abstract: is a mathematical structure consisting of objects and between objects with some specific properties. Categories examine in abstract way the properties of particular mathematical concepts by formalizing them as collections of objects and morphisms. Categorical structures are widely used in computer science for ex- act mathematical modeling. This paper highlights the most typical use of categories for constructing the model of part of differential calculus by using special category named arrow category; and codomain and domain functors. Keywords: arrow category• • categorical model• codomain functor• derivative © Versita sp. z o.o.

1. Introduction

Category theory is an area of study in mathematics that examines in abstract way the properties of particular math- ematical concepts by formalizing them as collections of objects and arrows (called morphisms, although this term also has a specific, non category-theoretical meaning), where these collections satisfy some basic conditions [1–3]. Category theory has been developed over the last fifty years, and it has concerned with the study of algebraic structures [4, 5]. Many significant areas of mathematics and informatics can be formalized by using categories. The use of category theory allows many intricate and subtle mathematical results in some fields to be stated and proved, in a much simpler way than without the use of categories [6]. Infinitesimal calculus is widely used in mathematics and often applied in computer science or other industrial branches. Many communication systems and control systems, for example, are based on engineering topics which rely heavily on integral ([7, 8]) and differential calculus (for example [9]). Since computers work with fixed-precision numbers (integers or floating-point), the math-book-style calculus of continuous functions has to be translated into forms that are computable ∗ E-mail: [email protected] (Corresponding author) † E-mail: [email protected]

96 William Steingartner, Davorka Radaković

using discrete functions. For example, in digital signal processing we often see a discrete convolution (used in filtering, etc.) which is more or less the same operation as a convolution, only replacing the integrals with summations. On the other hand, typical computer work like database design, operating systems, web-based applications, point-of-sale terminals, etc. - these types of algebraic and logical systems would rarely use integral or differential calculus; only in the case when the knowledge of probability and statics is required and they are useful in several areas of computer science. When we need to analyze the correctness of computation in program [3, 10–12], we can use many approaches. One of the fruitful method is the construction of categorical model based on methodsrôle like Curry-Howard correspondence or linear logic. We want to extend this method also with an analysis of computations in differential calculus because they are very often a part of some another computation. In our paper we show the of categorical structures in a part infinitesimal calculus, namely in differential calculus. We show how to express derivatives in two manners in categories and we formulate relation between these two approaches. 2. Practical foundations from category theory

Some basic notions from category theory needed for our approach are briefly introduced here. Category theory is a part of mathematics. Its importance for theoretical computer science grew in the last decades. Categories are interesting mathematical structures, consisting of objects and morphisms between them with some specific properties. Objects can be sets, data structures or other mathematical structures. Fundamentals of category theory are relations between objects. These relations are expressed by morphisms. In application of category theory, morphisms usually correspond to computations, proofs or other forms [13]. The existence of identity for any object and composition of morphisms is also important for category. A structure which expresses equality inrôle category is commutative diagram. It is a diagram of objects and morphisms such that all directed paths in the diagram with the same start and endpoints lead to the same result by composition. Commutative diagrams play the crucial in category theory that equations play in algebra [2]. A general form of commutative diagram is depicted in Fig. 1. f - fn−- A ··· An− - 2 1 1 1 f f n

1 - A B -

g - g m 1 0 - - 0 A ··· Am− g gm− 1 1 2 1

Figure 1. General form of commutative diagram.

Diagram in Fig. 1 expresses the equalityfn of◦ f twon− ◦ paths::: ◦ (twof compositions)gm ◦ gm− ◦ ::: as◦ g follows:

1 1 1 1 m; n ∈ N = (1) for . C A;B;::: We define category as it was defined in [2, 4]. A category is mathematical structure consisting of a collection of objects, e.g. and composable morphisms betweenf A them→ B: in the form

: 97 Categorical structures as expressing tool for differential calculus

f; g cod f dom g

From each pair of two morphisms which fulfillg ◦ thef dom conditionf → cod( g) = ( ) we can compose new morphism

associativity : ( ) ( )

subject to the axiom of h ◦ g ◦ f h ◦ g ◦ f

f A → B g B → C h C → D ( ) = ( )

for all morphisms : , : and : A .

An identity morphisms is defined for each object , idA A → A;

unit :

subject to the axioms of : f ◦ idA idB ◦ f f

f A → B = = (2)

for all : such that the diagram at Fig. 2 commutes. id A A - A id f B ◦ ◦ id f f A - ? - B - B idB

Figure 2. Diagram of unit in category.

C → The previous laws are required because of their ability to represent arbitrary structuresC → that are not expressible by sets.C In our approach we work with special type of category called arrowC category, usually denoted . This category is a kindC of a comma category - with a construction in category. An arrow category is defined over a base category and it holds, that its objects are the morphisms of metacategory , and its morphisms are commuting squares (diagrams) in , depicted in the Fig. 3. a dom f - dom g

f ( ) g( ) ? ? cod f - cod g b

( ) ( )

Figure 3. Commutative square of objects f and g in arrow category.

f A → B

The identity in arrow category for : is defined as follows: idf idA; idB :

= ( ) 98 William Steingartner, Davorka Radaković

a ; b f → f a ; b f → f

1 1 1 2 2 2 2 3 A composition of two morphisms ( ): a and◦ a (; b ◦ b): f → fis defined as follows:

2 1 2 1 1 3 ( ): and it is depicted in diagram in the Fig. 4. a a dom f - dom f - dom f 1 2 1 2 3 f ( ) (f ) (f ) ? ? ? 1 b 2 b 3 cod f - codm f - cod f 1 2 ( 1) ( 2) ( 3) Figure 4. Composition of morphism in arrow category.

functors

The relation between categories is expressed by special morphisms called which preserve structure: objects are sent to objects and morphisms into morphisms betweenF imagesC → D of objects in source morphism. A functor

C D : from a category into a category (or between categories) considered as a structure-preserving mapping between categoriesF f asA follows:→ B F f F A → F B

1. F(id:A idF)A = ( ): ( ) ( );

( ) 2. F(g ◦)f = F g; ◦ F f

3. ( F ) = ( ) ( ). Codomain functor A functor preserves domains and codomains, identity arrows, and composition. is the special functor defined for arrow category. Codomain functor is always defined for the arrow category and the appropriate base category [14]. ItC isod definedC → → asC; follows:

f A → B : which assigns to each object : in arrow categoryCod f its codomain,B;

a; b ( ) = and to each morphism ( ) from arrow category (Fig.Cod3)a; the b morphismb: between appropriate codomains,

(( )) = domain functor A general scheme of codomain functor is in the Fig. 5. A is another functor necessary for expressing the model of our approach. Domain functor is defined analogously as codomain functor, from arrow categoryD om intoC metacategory,→ → C;

:

99 Categorical structures as expressing tool for differential calculus

C →

f (a, b) g

od C

C

A C f g B

Figure 5. A general scheme of codomain functor.

f A → B

Domain functor assigns to each object : in arrowD om categoryf A; its domain,

a; b ( ) =

and to each morphism ( ) from arrow category (Fig.D om3)a; the b morphisma: between appropriate domains,

(( )) =

Taking domain and codomain functor over metacategory of sets for differentiable functions we construct categorical model of a part of differential calculus. 3. Categorical Structures in Differential Calculus

Derivatives in category can be expressed as follows:Der functions and their derivatives are morphisms. Objects are domains and codomains of functions. All these functions must to be differentiable. Identity and composition in this category are defined by obvious way. We denote this category and we define it as a category of sets for differentiable functions 3.1.- only differentiable How to express functions derivatives are morphisms. in category

Der→ Der Der→ Der For another defining the derivatives in category we considerDer→ the arrow category over the metacategory . The arrow categoryf overf 0 a base metacategory of sets exists according to the definition, so we can define any as object in arrow category. MorphismsDer→ of Der are the operations of differentiation which assign to any function its derivative according to the definition. This arrow category contains all differentiable functions as objects. CodomainDer→ functor and domain functor from to expres relations between functions and their domains and codomains. In that manner we express a relation between functions and their derivatives. f; f 0;::: Der The category is defined as follows: a; b 1. objects are functions and their derivatives These functions are arrows in the base category ;

2. morphisms are tuples ( ) of mappings between domainsa; b f → andf 0 codomains of objects:

( ): 100 William Steingartner, Davorka Radaković

f f 0 a b a; b der is a differentiation operation which assigns to function its derivative , where is a mapping between domains and between codomains. We denote the tuple ( ) as morphism ; and it satisfies the commutative diagram in Fig. 6. a dom f - dom f 0

f ( ) (f 0 ) ? ? cod f - cod f 0 b

( ) ( )

Figure 6. Commutative square of morphisms f and f 0.

f

3. an identity morphism which sends any object to itself is defined for any object as follows: idf f → f;

zero derivative :

0 0 00 and it is considered as ; der f → f der f → f der ◦ der f → f 00 f 1 2 4. composition of morphismsf 0 is defined as follows: for two morphisms : and : , their 2 1 0 composition : is a new morphismf that0 assignsf 00 to function its the second derivative, which is the first derivative of ,  = ;

5. composition of morphisms is associativeder operation◦ der ◦ der definedder as follows◦ der (Fig.◦ der7)::

3 2 1 3 2 1 ( ) = ( ) der der 2 ◦ 1

f der1 f 0 der2 f 00

Figure 7. Composition of differentiations.

Cod Der→ −→ Der f Der→ cod f Der der f → f 0 Der→ der Der Cod The codomain functor : assigns to any object in its codomain ( ) in , and to any morphism : in DomtheDer arrow→ −→ betweenDer codomains of inf Der. A→ general structuredom f of theDer functor is in the Fig.der8. f → f 0 Der→ der Der Similarly, a domain functor : assigns to any object in its domain ( ) in , and to any 3.2.morphism Example: of expressingin the arrow the derivatives between domains in category of in .

As an example of expressing derivatives in category, we show our approach on natural logarithmic function. This function has the following specification: 101 Categorical structures as expressing tool for differential calculus

Der→

f 0 der

f

Der od C f 0

f

Figure 8. The codomain functor between categories.

f ∞ → R:

: (0; )

The logarithmic function is a morphism with the domain of positive real numbers, and its codomain is the set of all reals. When finding the derivative of function, we use rules for differentiation. A derivative of logarithmic function is defined as follows: f 0 x x 0 ; x 1 ( ) = (ln ) =

0 which is well-knownf basicx x reciprocal linear rational function, simply called reciprocal function. This function is defined on set of non-zero reals, and1 it sends every real number to its reciprocal value, i.e. its multiplication inverse. The 0 reciprocal function ( ) = has the specificationf R\{ } → R\{ } ;

: 0 0 0 f x x f x x where both sets - the domain and the codomain are identical, namely the set of non-zero1 real numbers. The second 0 derivative of ( ) = ln is also the first derivative off 00 thex reciprocalf 0 x : function ( ) = according to the following rule:  ( ) = ( )

and it is the function f 00 x − ; x 1 ( ) = 2

00 which has the following specification: f R\{ } → −∞ :

: 0 ( ; 0) Der f; f 0 f 00 All functions listed above are depicted in the Fig. 9. In the category , the functionsf ∞ and→ R are the followingdom f morphisms∞ cod in categoryf R (with their domains and codomains): f 0 R\{ } → R\{ } dom f 0 R\{ } cod f 0 R\{ } f 00: (0;R\{) } → −∞ dom(f 00) = (0;R\{) } cod(f)00 = −∞ : : 0 0 ( ) = 0 ( ) = 0 ∞ \{ } −∞ R R : 0 ( ; 0) ( ) = 0 ( ) = ( ; 0)

The sets (0; ), , 0 and ( ; 0) are objects in this category. 102 William Steingartner, Davorka Radaković

Figure 9. Natural logarithm function and its the first and the second derivative.

Der → f;f0 f 00 der In category , the functions and are objectsder andf the→ morphismsf 0; between objects are differentiations, denoted : : der a; b and they are defined as tuples of two arrows fora mappingdom f of→ domainsdom f 0 and; codomains of objects, =( ), where b cod f → cod f 0 : : ( ) ( ) : ( ) ( ) 0 f x x 00 f x − x 1 The composition1 of functions represents the gradual increasing of order of differentiation. Here, for the functions ( )= 2 0 and (der)= f →, thef differentiations are: f

1 0 00 0 • der : f → f for the first derivative of f;

2 • : derfor theder first derivative of . der ◦ der der

1 2 2 1 12 By composition of and we obtain a newder morphism◦ der f → f 00; (which we can also denote ):

2 1 f : f 00 x x 00 − : and it is the second derivative of : x 1 ( )=(ln ) = 2 der der

1 2 The following commutative diagram (Fig. 10) is a composition of morphisms and The following equality from the diagram in theb Fig.◦ b10◦holds:f f 00 ◦ a ◦ a :

→ 2 1 2 1 Der Der =

The relation between categories and isCod expressedDer → −→ togetherDer ; by the codomain functor and the domain functor: D om Der → −→ Der : : :

103 Categorical structures as expressing tool for differential calculus

a a ∞ - R\{ } - R\{ } 1 2 (0;f ) f 0 0 f000 ? ? ? R - R\{ } - −∞ b b

1 0 2 ( ; 0)

Figure 10. Diagram of the second derivative.

Der→ Der

Here, codomain functor assigns to every object in its codomain - a set in : Cod f R; Cod f 0 R\{ } ; Cod(f)00 = −∞ ; ( ) = 0 ( ) = ( ; 0)

and to any differentiation it assigns morphismC betweenod der codomains:b ; Cod der b ; 1 1 Cod(der )◦ =der b ◦ b : 2 2 ( ) = 2 1 2 1 ( Der→ ) = Der

Analogously, domain functor assigns to every objectD om in f its∞ domain; - a set in : D om f 0 R\{ } ; D om(f)00 = (0;R\{) } ; ( ) = 0 ( ) = 0

and to any differentiation it assigns morphismD betweenom der domains:a ; D om der a ; 1 1 D om(der )◦ =der a ◦ a : 2 2 ( ) = 2 1 2 1 Der→ ( ) = Der

This functor assigns to every object in its codomainCod -f a setB in :

f A → B Der→ ( ) =

for any morphism : , and any morphism in Cod itder sendsC to a morphism between the appropriate codomains:

der f → f 0 C ( ) = C cod f → cod f 0 : for any : , where morphism is : ( ) ( )

104 William Steingartner, Davorka Radaković

4. Conclusion

We have presented an expressing of some part of differential calculus in arrow category. A similar approach devoted to expressing of definite integrals as some parts of integral calculus in categories is shown in our previous paper [15]. Derivatives are dual toDer integrals [16–18] and their representationDer→ in categories forms a foundation for the whole categor- ical model of infinitesimal calculusCod without losingDom its exactness. The derivatives were expressed in category of sets for differentiable functions and in category of derivatives and we presented relation between these two categories. We used in this work codomain and domain functor to demonstrate this relationship in categorical terms. There exists another approach for differential calculus published by L. D. Nel [19] in the early 1990s. This paper shows an infinite dimensional calculus , based on special categorical constructions, which can be applied to functions defined on non-convex domains with empty interior, a situation of great importance in the solution of partial differential equations. For representing other algebraic operations such as multiplication and dividing of functions, the codomain functor does not have sufficient power. To solve this problem we would like to extend our approach by using of polynomial functors [20]. We want also to use our approach for whole infinitesimal calculus and we want to apply our results in practical approach connected to [21]. Acknowledgment

This work has been supported by KEGA grant project No. 050TUKE-4/2012: "Application of Virtual Reality Technologies in Teaching Formal Methods"

References

[1] S. Awodey, Category Theory (Carnegie Mellon University, 2005) [2] M. Barr, C. Wells, Category Theory for Computing Science (Prentice Hall International, 1990) [3] Cs. Szabó, V. Slodičák, Software Engineering Tasks Instrumentation by Category Theory, SAMI 2011, Proceedings of the 9th IEEE International Symposium on Applied Machine Intelligence and Informatics, Smolenice, Slovakia, 27. - 29.1.2011, Košice, elfa, s.r.o., 2011, 195–199 [4] V. Novitzká, V. Slodičák, Categorical structures and their application in informatics, Equilibria (Košice, 2010) (in Slovak) [5] V. Slodičák, P. Macko, New approaches in using algebras and coalgebras, In European Joint Conferrences on Theory and Practise of Software-ETAPS 2011, Universität des Saarlandes, Saarbrücken, Germany, 2011, 13–23 [6] J. Adámek, H. Herrlich, G.E. Strecker, Abstract and Concrete Categories (John Wiley & Sons, 1990) [7] N. Bourbaki, Integration I (Springer–Verlag, 2004) [8] H.J. Keisler, Elementary Calculus: An Infinitesimal Approach (On-line Edition) University of Wisconsin, Copyright 2000/revised 2012, http://www.math.wisc.edu/˜keisler/calc.html [9] T. Harasthy, J. Turán, Ľ. Ovseník, Road line detection based on optical correlator, In: Mipro 2013 : 36th international convention : conference proceedings : May 20-24, 2013, Opatija, Croatia. - Rijeka : MIPRO, 2013, 320–322 [10] M. Fernandez, Models of Computation, An Introduction to Computability Theory (Springer, 2009) [11] S. Aleksić, S. Ristić, I. Luković, M. Čeliković, A Design Specification and a Server Implementation of the Inverse Referential Integrity Constraints, Comput. Sci. Inform. Sys. 10(1), 2013, 283–320 [12] P. Selinger, Lecture Notes on the Lambda Calculus (Dalhousie University, Halifax, Canada, 2007) [13] A. Tarlecki, Categories, Institutions, Abstract Model Theory, and Software Specification, Workshop on Applied and Computational Category Theory - ACCAT/ETAPS 2013, Rome, Italy, 2013 [14] B. Jacobs, Categorical Logic and Type Theory, No. 141 in Studies in Logic and the Foundations of Mathematics (North Holland, Amsterdam, 1999) [15] W. Steingartner, D. Galinec, The Rôle of Categorical Structures in Infinitesimal Calculus, J. Appl. Math. Comput. Mechanics 12(1), 107–119, 2013 105 Categorical structures as expressing tool for differential calculus

[16] D.M. Burton, The History of Mathematics: An Introduction, 6th ed. (McGraw-Hill, 2005) [17] O. Forster, Analysis 1, Differential- und Integralrechnung einer Vernderlichen 7, (Au. Vieweg-Verlag, 2004) [18] J. Taufer, O. Vraštilová, Mathematics 1 - Differential calculus for engineers (Montanex, a.s., 1998) (in Czech) [19] E.E. Rosinger, Nel’s category theory based differential and integral Calculus, or did Newton know category theory? source: http://arxiv.org/abs/math/0504565 (2005) [20] J. Kock, Polynomial functors (On-line Edition), University of Barcelona, Copyright 2013/revised 2014, http://mat.uab.es/ kock/cat/polynomial.html [21] I. Luković, S. Ristić, A. Popović, P. Mogin, An approach to the platform independent specification of a business application, In: Proceedings of the 23rd Central European Conference on Information and Intelligent Systems - CECIIS’2012, 19th-21st Sept 2012, University of Zagreb, Varaždin, Croatia, 2012, 449–456 [22] C. Thomas, Introduction to Differential Calculus (University of Sydney, 1997)

106