This commit is contained in:
Boris Marinov 2020-05-06 10:42:18 +03:00
parent cd86095ea4
commit 57f559fc72
52 changed files with 444402 additions and 444211 deletions

View File

@ -1,7 +1,7 @@
From Sets to Categories
===
In this chapter we will continue with set theory and at the same time we will start exploring categories.
In this chapter we will continue with set theory and at the same time we will start exploring categories, and talking about why they are important.
Products
===
@ -18,7 +18,7 @@ It is the set of *pairs* of **b**'s and **y**'s.
The product is denoted **B x Y** and it comes equipped with two functions for retrieving the **b** and the **y** from each **(b, y)**.
Question: Why is this called a product? Hint: How many elements does it have?
**Question**: Why is this called a product? Hint: How many elements does it have?
Products as Objects
---
@ -115,7 +115,7 @@ Like with the product, there is a low-level way to express a sum using sets alon
![A member of a coproduct, examined](coproduct_member_set.svg)
Again, this distinction is only rellevant only when the two sets have common elements.
But again, this distinction is only rellevant only when the two sets have common elements.
Defining Sums in Terms of Functions
@ -155,19 +155,18 @@ If we have to compare the concepts of sum or and product we will find out that t
Actually, the two concepts are captured by one and the same external diagram, just the arrows are flipped - many-to-one relationships become one-to-many and the other way around.
That's normal right? After all, *AND* **is** the opposite of *OR*. The connection between the two has always been there, evidenced, for example, by the De Morgan's law, citing that **NOT (A AND B) <=>(NOT A) OR (NOT B)** (or to put it in everyday language, "If either A or B is false, then (and only then) A *and* B is also false). But only with category theory, this connection can be expressed in such a concise way:
That's normal right? After all, **AND** *is* the opposite of **OR**. The connection between the two has always been there, evidenced, for example, by the De Morgan's law, citing that **NOT (A AND B) (NOT A) OR (NOT B)** (or to put it in everyday language, "If either A or B is false, then (and only then) A *and* B is also false). But only with category theory, this connection can be expressed in such a concise way:
![Coproduct and product](coproduct_product_duality.svg)
Otherwise, when two concepts are captured by the same diagram, only with reversed arrows, we can say that the two concepts are **dual** to each other. So *product* and *sum* are dual. This is why sum is also known as *converse product*, or *coproduct* in short.
Otherwise, when in category theory two concepts are captured by the same diagram, only with reversed arrows, we can say that the two concepts are **dual** to each other. That means that the concepts of *product* and *sum* are dual (this is why sum is also known as *converse product*, or *coproduct* in short).
Category Theory - brief definition
===
Maybe it is time to see what a category is. Well, a category is about objects (an example of which are sets) and morphisms which go from one object to another (which can be viewed as functions) and which should be composable. We can say a lot more about categories, and even present a formal definition, but for now it is suffice for you to remember that sets are one example of a category and that categorical objects are like sets, except that we don't *see* their elements. This is why category-theoretic notions being captured by the external diagrams and strictly set-theoretic notions being captured by internal ones.
Maybe it is time to see what a category is. Well, a category consists of objects (an example of which are sets) and morphisms which go from one object to another (which can be viewed as functions) and which should be composable. We can say a lot more about categories, and even present a formal definition, but for now it is suffice for you to remember that sets are one example of a category and that categorical objects are like sets, except that we don't *see* their elements. This is why category-theoretic notions being captured by the external diagrams and strictly set-theoretic notions being captured by internal ones.
What other categories, or applications of category theory are there, other than sets? We already discussed one - types in programming languages. Remember that we said that programming types (classes) are somewhat similar to sets and programming functions are somewhat similar to functions between sets? This is another example of a connection that we can made rigorous using category theory.
What other categories, or applications of category theory are there, other than sets? We already discussed one - types in programming languages. Remember that we said that programming types (classes) are somewhat similar to sets and programming functions are somewhat similar to functions between sets? This is another example of a connection between two things that we can be defined using category theory:
| Category Theory | Set theory | Programming Languages |
@ -176,7 +175,7 @@ What other categories, or applications of category theory are there, other than
| Objects and Morphisms | Sets and Functions | Classes and functions |
| N/A | Element | Object |
This diagram illustrates how category theory allows us to see the big picture when it comes to sets and similar structures - when we are at the realm of sets we can view the set as a collection of individual elements. In category theory we don't have such notion. We saw how taking the notion away allows us to define concepts such as the sum and product sets in a whole different and more general way.
This diagram illustrates how category theory allows us to see the big picture when it comes to sets and similar structures - when we are at the realm of sets we can view the set as a collection of individual elements. In category theory we don't have such notion, but we saw how taking this notion away allows us to define concepts such as the sum and product sets in a whole different and more general way.
**NB: Do note how the world "Object" is used in both programming languages and in category theory, but for completely different things. The equivalent a categorical object is equivalent to a class in programming language.**
@ -184,12 +183,15 @@ Looking at the table I cannot help but notice the somehow weird, but otherwise c
| Category Theory | Set theory |
| --- | --- |
| Category | *N/A* |
| Objects and Morphisms |
| *N/A* | Element |
| Category | **N/A** |
| Objects and Morphisms | Sets and functions |
| **N/A** | Element |
It really says it all - by switching to external diagrams, we have lost sight of the particular elements of our sets, but we have gained the ability to see the whole universe that we have been previously trapped in. The whole realm of sets, can be thought as one category, a programming language can also be thought as a category. The concept of a category allows us to find and analyse similarities between the two.
By switching to external diagrams, we lose sight of the particular (the elements of our sets), but we have gained the ability to see the whole universe that we have been previously trapped in. The whole realm of sets, can be thought as one category, a programming language can also be thought as a category. The concept of a category allows us to find and analyse similarities between these and other structures.
![Category theory and set theory compared](set_category.svg)
Don't let my talking about how better category theory is than set theory get in your head - categories and sets are just two languages, each of which has its own use cases, and arguing over which of the two is more basic, or more general, is just a chicken-and-egg problem, as you would see in the next chapter.
One remark before we go - the last paragraphs I sound as if I'm *comparing* categories and sets and rooting for categories. I don't want you to get the wrong impression that the two concepts are somehow competing with one another.
Perhaps that notion would be somewhat correct if category and set theory were meant to describe *concrete* phenomena, in the way that the theory of relativity and the theory of quantum mechanics in physics. Concrete theories are conceived mainly as *descriptions* of the world, and as such it makes sense for them to be connected to one another in some sort of hierarchy. Abstract theories, like category theory and set theory, on the other hand, are more like languages for expressing such descriptions. They still can be connected, and are connected in more than one way, but there is no inherent hierarchy between the two and therefore arguing over which of the two is more basic, or more general, is just a chicken-and-egg problem, as you would see in the next chapter.

View File

@ -2,7 +2,7 @@
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:ns1="&amp;#38;#38;#38;ns_ai;"
xmlns:ns1="&amp;#38;#38;#38;#38;ns_ai;"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@ -23,7 +23,7 @@
height="200"><metadata
id="metadata21615"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs21613" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
@ -38,7 +38,7 @@
id="namedview21611"
showgrid="false"
inkscape:zoom="2.8284271"
inkscape:cx="263.5868"
inkscape:cx="206.13437"
inkscape:cy="148.46878"
inkscape:window-x="-8"
inkscape:window-y="-8"
@ -116,4 +116,16 @@
stroke-miterlimit="10"
style="fill:#e1e1e1;fill-opacity:1;stroke:#808285;stroke-width:15.83508873;stroke-miterlimit:10;stroke-dasharray:none"
rx="89.267967"
ry="84.777237" /></g></svg>
ry="84.777237" /><text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:51.63809586px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#6d6d6d;fill-opacity:1;stroke:none;stroke-width:1.29095244"
x="255.19595"
y="289.32361"
id="text1729-5"
transform="scale(0.99633854,1.0036749)"><tspan
sodipodi:role="line"
id="tspan1727-8"
x="255.19595"
y="289.32361"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:1.29095244">ID</tspan></text>
</g></svg>

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

175
03_logic/isomorpism.svg Normal file
View File

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:i="&amp;#38;ns_ai;"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 595.3 200"
enable-background="new 0 0 595.3 359"
xml:space="preserve"
id="svg29165"
sodipodi:docname="isomorpism.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
width="595.29999"
height="200"><metadata
id="metadata29171"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs29169">
</defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1057"
id="namedview29167"
showgrid="false"
inkscape:zoom="2.7272253"
inkscape:cx="345.89448"
inkscape:cy="187.27831"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g29161"
units="in"
inkscape:snap-text-baseline="false" />
<switch
id="switch29163"
transform="translate(0,-159)">
<foreignObject
requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/"
x="0"
y="0"
width="1"
height="1">
</foreignObject>
<g
i:extraneous="self"
id="g29161">
<g
id="Layer_2"
transform="matrix(1.2421138,0.50680151,-0.50680151,1.2421138,2.0550193,-192.89532)">
</g>
<g
transform="matrix(-1.2201296,0.60572002,0.6457003,1.144582,661.42344,-84.837383)"
id="g38229-2-1"
style="fill:#6d6d6d;fill-opacity:1;stroke-width:0.30000001;stroke-miterlimit:4;stroke-dasharray:none"><g
id="g38227-3-8"
style="fill:#6d6d6d;fill-opacity:1;stroke-width:0.30000001;stroke-miterlimit:4;stroke-dasharray:none"><g
id="g38225-0-8"
style="fill:#6d6d6d;fill-opacity:1;stroke-width:0.30000001;stroke-miterlimit:4;stroke-dasharray:none"><path
style="fill:#6d6d6d;fill-opacity:1;stroke-width:0.30000001;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:connector-curvature="0"
d="m 395.9,86.5 c 0,0 -1,0.2 -2.7,0.6 -0.9,0.2 -1.9,0.4 -3.1,0.7 -1.2,0.3 -2.5,0.6 -4,1 -5.8,1.5 -13.4,4 -20.7,7.1 -7.3,3.1 -14.4,6.9 -19.5,10.1 -2.5,1.6 -4.7,2.9 -6.1,3.9 -0.6,0.4 -0.9,0.6 -0.9,0.6 l -6.6,-9.5 c -4.3,8.3 -7.8,16.7 -10.3,25.1 8.5,-2 17,-3.1 25.2,-3.4 l -6.5,-9.5 c 0,0 0.3,-0.2 0.9,-0.6 1.4,-1 3.5,-2.3 6,-3.8 5,-3.1 11.9,-6.8 19.1,-9.8 7.2,-3.1 14.6,-5.5 20.3,-7 1.4,-0.4 2.7,-0.7 3.9,-1 1.2,-0.3 2.2,-0.5 3,-0.7 1.7,-0.4 2.6,-0.6 2.6,-0.6 z"
id="path38223-9-1" /></g></g></g><g
transform="matrix(1.3033795,-0.56946081,-0.68975667,-1.0760658,-96.334904,598.6675)"
id="g38229-2-1-4"
style="fill:#6d6d6d;fill-opacity:1;stroke-width:0.30000001;stroke-miterlimit:4;stroke-dasharray:none"><g
id="g38227-3-8-4"
style="fill:#6d6d6d;fill-opacity:1;stroke-width:0.30000001;stroke-miterlimit:4;stroke-dasharray:none"><g
id="g38225-0-8-0"
style="fill:#6d6d6d;fill-opacity:1;stroke-width:0.30000001;stroke-miterlimit:4;stroke-dasharray:none"><path
style="fill:#6d6d6d;fill-opacity:1;stroke-width:0.30000001;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:connector-curvature="0"
d="m 395.9,86.5 c 0,0 -1,0.2 -2.7,0.6 -0.9,0.2 -1.9,0.4 -3.1,0.7 -1.2,0.3 -2.5,0.6 -4,1 -5.8,1.5 -13.4,4 -20.7,7.1 -7.3,3.1 -14.4,6.9 -19.5,10.1 -2.5,1.6 -4.7,2.9 -6.1,3.9 -0.6,0.4 -0.9,0.6 -0.9,0.6 l -6.6,-9.5 c -4.3,8.3 -7.8,16.7 -10.3,25.1 8.5,-2 17,-3.1 25.2,-3.4 l -6.5,-9.5 c 0,0 0.3,-0.2 0.9,-0.6 1.4,-1 3.5,-2.3 6,-3.8 5,-3.1 11.9,-6.8 19.1,-9.8 7.2,-3.1 14.6,-5.5 20.3,-7 1.4,-0.4 2.7,-0.7 3.9,-1 1.2,-0.3 2.2,-0.5 3,-0.7 1.7,-0.4 2.6,-0.6 2.6,-0.6 z"
id="path38223-9-1-9" /></g></g></g><g
transform="matrix(0,0.60836362,-0.66525607,0,502.07303,-136.51302)"
style="stroke:#818485;stroke-width:6.38910723;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="g5251-7-3-9"><g
style="stroke:#f6dd2a;stroke-width:6.38910723;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="g5344-9-0"
transform="matrix(0.89549116,-0.02139737,0.01924054,0.81712904,282.4952,103.1622)"><g
style="fill:none;fill-opacity:1;stroke:#6d6d6d;stroke-width:35.52577591;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="g25662-9-07-9-3"
transform="matrix(0.6961485,-0.04333315,0.04774239,0.64822909,80.807317,48.914181)"><path
id="path25660-5-99-6-8"
d="M 315.1,101.7909 C 325.78189,97.654679 336.86942,94.052162 348.22738,90.716499 339.70891,82.577479 330.64958,74.705313 321.04941,67.1 319.0099,79.218677 317.94578,88.763174 315.1,101.7909 Z"
inkscape:connector-curvature="0"
style="fill:none;fill-opacity:1;stroke:#6d6d6d;stroke-width:35.52577591;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="cccc" /></g><path
style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#6d6d6d;stroke-width:10.64851189;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
d="m 382.50059,152.61214 c -51.1662,72.82269 -109.78507,64.46117 -131.93175,30.38911 -16.47603,-25.34791 -9.29412,-98.302071 48.50484,-93.631865"
id="path5246-5-8-3-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" /></g></g><circle
style="fill:#999491;fill-opacity:1;stroke:#858585;stroke-width:8.04899979;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="circle29154"
cy="98.283379"
cx="456.06403"
stroke-miterlimit="10"
transform="rotate(22.196215)"
r="33.00156" /><g
transform="matrix(0,0.60836362,-0.66525607,0,325.31344,-132.85474)"
style="stroke:#818485;stroke-width:6.38910723;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="g5251-7-3-9-0"><g
style="stroke:#f6dd2a;stroke-width:6.38910723;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="g5344-9-0-6"
transform="matrix(0.89549116,-0.02139737,0.01924054,0.81712904,282.4952,103.1622)"><g
style="fill:none;fill-opacity:1;stroke:#6d6d6d;stroke-width:35.52577591;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="g25662-9-07-9-3-9"
transform="matrix(0.6961485,-0.04333315,0.04774239,0.64822909,80.807317,48.914181)"><path
id="path25660-5-99-6-8-9"
d="M 315.1,101.7909 C 325.78189,97.654679 336.86942,94.052162 348.22738,90.716499 339.70891,82.577479 330.64958,74.705313 321.04941,67.1 319.0099,79.218677 317.94578,88.763174 315.1,101.7909 Z"
inkscape:connector-curvature="0"
style="fill:none;fill-opacity:1;stroke:#6d6d6d;stroke-width:35.52577591;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="cccc" /></g><path
style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#6d6d6d;stroke-width:10.64851189;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
d="m 382.50059,152.61214 c -51.1662,72.82269 -109.78507,64.46117 -131.93175,30.38911 -16.47603,-25.34791 -9.29412,-98.302071 48.50484,-93.631865"
id="path5246-5-8-3-3-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" /></g></g><circle
style="fill:#999491;fill-opacity:1;stroke:#858585;stroke-width:8.04899979;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="circle29154-1"
cy="172.90698"
cx="286.77554"
stroke-miterlimit="10"
transform="rotate(22.196215)"
r="33.00156" /><text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:24.2466259px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#6d6d6d;fill-opacity:1;stroke:none;stroke-width:0.60616565"
x="342.85718"
y="211.48004"
id="text1729"><tspan
sodipodi:role="line"
id="tspan1727"
x="342.85718"
y="211.48004"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.60616565">ID</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:24.2466259px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#6d6d6d;fill-opacity:1;stroke:none;stroke-width:0.60616565"
x="166.80447"
y="214.73524"
id="text1729-5"><tspan
sodipodi:role="line"
id="tspan1727-8"
x="166.80447"
y="214.73524"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.60616565">ID</tspan></text>
</g>
</switch>
</svg>

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -1,9 +1,9 @@
Some other categories
===
Every category theory guide (including mine) starts by talking about set theory. However looking back I really don't know why that is the case (most books that center around a specific subject don't start by introducing a different subject). Perhaps the set-first approach is the best way to introduce people to categories, or perhaps that is just one of the things that people just do, simply because everyone else does it.
Every category theory guide (including mine) starts by talking about set theory. However, looking back, I really don't know why that is the case - most other books that focus around a specific subject don't start by introducing an entirely different subject. Perhaps the set-first approach is the best way to introduce people to categories, or perhaps that is just one of the things that people just do, simply because everyone else does it. But one thing is for sure - we don't need to study sets in order to understand categories. So in this chapter I would like to start over and talk about categories as a first concept.
One thing is for sure - we don't need to study sets in order to understand categories. So in this chapter I would like to start over and talk about categories as a first concept. Pretend like it's a new book:
Pretend like it's a new book:
Starting over with categories
===
@ -12,41 +12,41 @@ So, a category is a collection of objects (things) where the "things" can be any
![Balls](elements.svg)
A category consists of a collection of objects **as well as** some arrows connecting some of them, that we call (the arrows) morphisms.
A category consists of a collection of objects as well as some arrows connecting some of them to one another, that we call (the arrows) morphisms.
![A category](category.svg)
We said that all sets form a category, but at the same time any one set can be seen as a category by itself (just one which has no morphisms). This is an example of a phenomenon that is very characteristic of category theory - one structure can be examined in many different ways and play many different roles, often in a recursive fashion.
Wait a minute - we said that all sets form a category, but at the same time any one set can be seen as a category on its own right (just one which has no morphisms). This is an example of a phenomenon that is very characteristic of category theory - one structure can be examined in many different ways and play many different roles, often in a recursive fashion.
This particular role of a set as a category with no morphisms is, however, not very useful - category theory is **all about the morphisms**. If in set theory, an arrow is nothing but its source and destination, in category theory, an **object** is nothing but a source and destination for the arrows that connect it to other objects. This is why in this chapter the arrows and not the objects are displayed in different colours the category of sets is really the category of set functions.
This particular analogy (a set as a category with no morphisms) is, however, not very useful - category theory is *all about the morphisms*. If in set theory, arrows are nothing but a connection between a source and a destination, in category theory it's the *objects* that are nothing but a source and destination for the arrows that connect them to other objects. This is why in this chapter the arrows, and not the objects, are coloured - the category of sets should really be called the category of set functions.
Speaking of which, note that objects in a category can be connected by multiple arrows and that arrows having the same domain and codomain does not in any way make the equivalent.
Speaking of which, note that objects in a category can be connected by multiple arrows and that arrows having the same domain and codomain does not in any way make them equivalent.
![Two objects connected with multiple arrows](arrows.svg)
That's pretty obvious if we go back to set theory for a second - there are, for example, an infinite number of functions that go from number to boolean and the fact that they have the same signature does in no way make them equivalent to one another.
Why is that is pretty obvious if we go back to set theory for a second (maybe we really have to do this from time to time) - there are, for example, an infinite number of functions that go from number to boolean and the fact that they have the same signature does in no way make them equivalent to one another.
![Two sets connected with multiple functions](set_arrows.svg)
Composition
---
One of the few, or maybe even the only, requirement for a structure to be called a category is that two morphisms can make a third, or that morphisms are *composable*. In practice this means that given two successive arrows, we can draw a third one that is equivalent to the consecutive application of the other two.
One of the few, or maybe even the only, requirement for a structure to be called a category is that two morphisms can make a third, or in other words that morphisms are *composable*. In practice this means that given two successive arrows, we can draw a third one that is equivalent to the consecutive application of the other two.
![Composition of morphisms](composition.svg)
Again, note that this criteria is not met by just *any* morphism with this type signature. There is *exactly one* morphism that fits these criteria.
Again, note that this criteria is not met by just *any* morphism with this type signature. There is *exactly one* morphism that fits these criteria and there may be some which don't.
![Composition of morphisms in the context of additional morphism](composition_arrows.svg)
Commuting diagrams
---
In the function composition diagrams above, we used colors to illustrate that the third morphism is equivalent to the other two and not just some unrelated morphism. In practice this notation is a little redundant - the only reason to draw diagrams with arrows in the first place is represent paths between objects that are equivalent to each other.
The diagram above, uses colors to illustrate the fact that the third morphism is equivalent to the other two (and not just some unrelated morphism), but in practice this notation is a little redundant - the only reason to draw diagrams with arrows in the first place is represent paths between objects that are equivalent to each other, all other paths should just go in different diagrams. So let's drop the colors:
![Composition of morphisms - a commuting diagram](composition_commuting_diagram.svg)
Diagrams that are like that in which any two paths between two objects are equivalent to one another are called commutative diagrams (or diagrams that commute). All diagrams that we have here (except the wrong ones) commute.
Diagrams that are like that (ones in which any two paths between two objects are equivalent to one another) are called commutative diagrams (or diagrams that commute). All diagrams that we have here (except the wrong ones) commute.
Identity
---
@ -55,14 +55,16 @@ In order to be able to define more stuff using morphisms, we define what we call
![The identity morphism (but can also be any other morphism)](identity.svg)
Let's add the very important (and also very boring) reminder that there can be many morphisms from one object to the same object, that actually do stuff, for example mathematics deals with a multitude of functions that have the set of numbers as domain and codomain (e.g. negate, square, add one etc.) and are not at all the identity morphism.
It's important to mark this morphism, because there can be (let's add the very important (and also very boring) reminder) many morphisms from one object to the same object, that actually do stuff. For example mathematics deals with a multitude of functions that have the set of numbers as domain and codomain (e.g. negate, square, add one etc.) and are not at all the identity morphism.
**Question:** What is the identity morphism in the category of sets?
Isomorphisms
---
The concept of identity morphism, provides us with a category-theoretic definition of an isomoprhism - an isomorphism between two objects (**A** and **B**) consists of two functions - (**A → B**. and **B → A**) such that their composition is equivalent to the identity function.
The concept of identity morphism, provides us with a category-theoretic definition of an isomoprhism. We can say that an isomorphism between two objects (**A** and **B**) consists of two functions - (**A → B**. and **B → A**) such that their composition is equivalent to the identity function. Or alternatively we can express that by the following commuting diagram.
![Isomorphism](isomorphism.svg)
What the diagram expresses is that going from the one object to the other one and then back again is the same as applying the identity morphism i.e. doing nothing.