Index

There is a difference between set theory and category theory?

axioms that must be satisfied for something to be called a category

programming languages in terms of category theory

domain, co-domain, image, injection, surjection, inversion

There is a difference between set theory and category theory?

Yes, sets in general are a collection of elements that share common characteristics. Black people could be considered to be of the same set, so could brown people...so could white people, Follower of a religion could be put to a set. Now if you have a set of Christians who believe Christ is the messiah and a set of people who are Jews, there is a relation between both of these set of people as there are people in both sets who believe Moses was a prophet. You see, both the sets of religions have a intersection relation between them, this forms the set of people who believe Moses is the prophet in the above example. Now that we are clear with the definition of set and a relation, let us draw the line between category theory and set theory, In Category theory, we would not bother ourselves with the elements that form the set, but rather the relations between one set and another and that is the difference between both. In Category theory, we look at the relationships between the elements and in Set theory, we look at the elements in the set as well as the relations between the sets. Sets are called Objects in Category theory and relationships are called morphisms.

axioms that must be satisfied for something to be called a category

The three axioms(criteria) that must be met are Associativity, Composition and Identity Associativity states that if you are using morphisms to reach to another object, you must be able to use the morphisms in any order to reach to the same object Composition states that if we are able to go to Object B from Object A via a morphism and Object C from Object B via a morphism, then there must exist a morphism to take us from Object A to Object C Identity states that there must exist a morphism for every object that transforms into the same object

programming languages in terms of category theory

If we are to look at the terms in programming languages from the lens of Category theory, Objects are types and morphisms are functions, Objects consist of values that are categorized by similar properties, all the Integer values could be grouped into an object, so can all the Floats, Decimals and Characters and constitute an object. We can transform a String that consists of characters between '0' and '9' to an Integer Object with a morphism that is responsible for parsing and mapping of the same. Now, there are two types of functions/morphisms, Pure/Total and partial. If all the elements of an Object have a mapping in the resulting Object from the morphism, it is a Total function. Otherwise, if there are elements in Object 1 that cannot be passed into the Morphism to get a resultant element from Object 2, it is a partial function. If we have an Object that contains all the Integers, then the function Is_Odd that is used to detect if an Integer is odd or not, can only map to the Object that contains the elements True and False. Hence, Is_Odd is a total function. If we take the Object of all Characters, then the function/morphism convert_Character_to_Integer is only defined for the characters between '0' and '9', for other we will have to introduce error handling to remove all other characters, this is an example of partial function.

domain, co-domain, image, injection(mono-morphism), surjection(epi-morphism), isomorphism

Some of these are defined in terms of set and some in Category theory. The source on which the function is applied on is the Domain, the Set whose elements we will get as results on application of function is the co-Domain. The set of elements in co-domain which are results of the function from domain are called image. Now, if all the elements from domain map to different elements from image and no two elements in the domain map to the same element in the image, then this is called a injection. If the image and co-domain are the same i.e. image is not a subset of co-domain but covers all the elements for the co-domain then it is called a surjection. Now, if there is a relation which is injective and surjective i.e it maps to every element in co-domain and no two elements are mapped to from the same element in domain, then we can invert the function to get the reverse-mapping from relation. So if a relation is mapping to unique elements and all elements of the co-domain, then we can derive a reverse-relation that will convert the domain to co-domain and vice-versa, this is called invertible Now, so far we have been defining all these in terms of set theory but when we move to category theory, we have to define everything in terms of relations or morphisms and not in terms of elements inside the set or Objects.

Home