Category Theory
Zulip Server
Archive

You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.


Stream: practice: software

Topic: Drawing diagrams


view this post on Zulip Julius Hamilton (May 19 2024 at 17:14):

I thought I knew how to draw commutative diagrams directly in Zulip but have now forgotten.

The documentation says Zulip uses Katex: https://zulip.com/help/latex

I thought I could use the tikz-cd or CD environments, with or without including amscd, but they haven’t been working for me.

Thanks

view this post on Zulip Peva Blanchard (May 19 2024 at 17:59):

I use the online diagram editor quiver, and take screenshots.

view this post on Zulip Tim Hosgood (May 19 2024 at 19:31):

xfyabxfy\begin{CD} x @>f>> y \\@VaVV @VVbV \\x' @>>f'> y' \end{CD}

seems like the CD environment works?

view this post on Zulip Julius Hamilton (May 19 2024 at 19:43):

There we go thanks a lot

view this post on Zulip Julius Hamilton (May 24 2024 at 12:37):

I’d like to focus on finding some better ways to draw diagrams today. I’m considering using a programming language like Python instead of a typesetting language like Latex.

view this post on Zulip Mike Shulman (May 24 2024 at 15:11):

I very much doubt that's going to be a good idea.

view this post on Zulip Kevin Carlson (May 24 2024 at 18:26):

Better ways than what alternatives, and better in what ways? Tikz and Asymptote are the canonical languages for drawing mathematical diagrams; note that neither of them is LaTeX, though Tikz is implemented in LaTeX and Asymptote embeds LaTeX for very high-quality labelling features. It's not obvious what it would even mean to "use Python" for drawing diagrams; you'd be picking out some particular graphics libraries written in Python. But Asymptote, in particular, is a complete programming language that's designed specifically for drawing diagrams.

view this post on Zulip Eric M Downes (May 27 2024 at 12:21):

As a pedagogical exercise or as a product other people would use?

As a pedagogical exercise for yourself to internalize the concepts of how to represent and manipulate diagrams it could be quite useful. Just be ok that other people probably will not use it, as existing tools work pretty well. But also, take a look at wiggle.py and other tools here, they can be used to make cool and beautiful string diagrams etc. One could look at the code and learn a bunch I suspect.

If instead you are looking to simply have an impact using tools in your area of expertise, you could reach out to the folks maintaining that repo above; I don't see any active issues, but who knows. Alternately if you know javascript, quiv.er has open issues, and I know from using it weekly that it could use some quality-of-life improvements for iOS devices, plus sometimes the export-to-latex option doesn't work reliably (the URIs it creates couldn't always be reimported). None of that is really "fun", of course. :)

view this post on Zulip Nathanael Arkor (May 27 2024 at 20:07):

I know from using it weekly that it could use some quality-of-life improvements for iOS devices

If you report them on GitHub, then there's a chance they can be fixed.

plus sometimes the export-to-latex option doesn't work reliably (the URIs it creates couldn't always be reimported)

This absolutely should not happen, and if you encounter such a situation, that's a serious bug. Please post a bug report if you encounter this again.

view this post on Zulip Eric M Downes (May 28 2024 at 02:27):

Done! It looks like the export-to-latex issues are just Issue #219. Thankfully all the URIs of my old diagrams work, so could not reproduce an error there. (How do you generate the b64-blob so that it will remain stable through future releases? That's cool.)

view this post on Zulip Nathanael Arkor (May 30 2024 at 09:40):

Eric M Downes said:

(How do you generate the b64-blob so that it will remain stable through future releases? That's cool.)

Essentially through careful design of the data structure used to represent pasting diagrams so that it could be extended backwards compatibly.

view this post on Zulip Eric M Downes (May 30 2024 at 10:07):

Sounds... categorical :) If you ever want to give a talk on the design / data structures you use, let us know! I for one would be psyched.

view this post on Zulip Stanislav Kapulkin (Jun 09 2024 at 14:29):

Julius Hamilton said:

I’d like to focus on finding some better ways to draw diagrams today. I’m considering using a programming language like Python instead of a typesetting language like Latex.

I'm developing a categorical editor at editor.viete.io. It allows exporting diagrams to SVG files. Perhaps the diagrams don't have the best design. I would appreciate any feedback on how to improve their look and feel.

Another tool that I released recently is a Visual Code extension for creating Mermaid diagrams from Python code: https://marketplace.visualstudio.com/items?itemName=viete.viete. The diagrams are more inspired by category theory than strictly categorical. May be it will be useful.

view this post on Zulip Julius Hamilton (Jun 09 2024 at 18:51):

I’m experienced with Python so I’m sure there are some interesting things to try out. I’ve already found some relevant libraries.

That said, I just now was thinking about a mathematical formulation of “drawing diagrams”.

A category can be specified by two sets (Obj and Arr), one partial function :Arr×ArrArr\circ: Arr \times Arr \to Arr, and two relations Dom and Cod. (I would like to see this expressed as a signature in first-order logic, soon).

To “draw” a category, the computer returns pixel values in a 2D-array; but there can be prior “layers” in how the data of the category is arranged before it gets converted to an image file. A 2D-array is a doubly-indexed set i:I×JPi: I \times J \to P. What format do we want the data in before we use it to calculate the pixel values?

It would be cool to find an algorithm that does that - must think.

view this post on Zulip Eric M Downes (Jun 10 2024 at 11:16):

Its worth noting if you make the partial function that takes two arrows to their composite defined over the whole domain you need only a default zero/sink value; it's equivalent to a faithful projective functor that takes your original category to a monoid-with-zero. This construction is a [[category algebra]], and is a generalization of group and incidence algebras. (Sanity-check: you may wish to convince yourself that 0 with property xF(C).arr;0x=x0=0\forall x\in F(\mathsf{C}).arr; 0\circ x=x\circ0=0 is the only default value that ensures the resulting image is a monoid for general C\sf C.)

view this post on Zulip Eric M Downes (Jun 10 2024 at 11:19):

And this is the data representation they used in projects like smallcats; don't know if others have used it, or a sparse version thereof.

view this post on Zulip Julius Hamilton (Jun 16 2024 at 19:11):

Thanks.

Let me see if I can get a sketch of what this would be like.

In set theory, every defined mathematical object is a particular set. So if a category C\mathcal C is a set of arrows and of objects, plus a partial operation :Arr×ArrArr\circ : Arr \times Arr \to Arr (which is also a set, because functions are sets of ordered pairs), we can write out the exact set this category is (is equivalent to, is represented by).

Now, imagine there is an alternative, yet equivalent, definition of a category. Even if the change is subtle. For example, instead of saying there is a single set of arrows, we say that for each pair of objects, there is a set (a Hom-set) of arrows. And we continue building up the definition from here. (I actually don’t immediately see how you could define \circ across all elements of distinct Hom-sets… you’d have to define a function which selects a Hom set and then selects an element in the Hom-set).

When we look at the defined object, as a set, do the two equivalent definitions of a category C\mathcal C correspond to the exact same set, or just to isomorphic sets?

If the latter, I would want to study equivalence classes of sets, which are different “forms” or “presentations” of the same category. That is how one could explore “formats” for the data of some given category.

view this post on Zulip Nathan Corbyn (Jun 22 2024 at 12:01):

We can make this much simpler. The usual coding of the cartesian product A×BA \times B in set theory is Kuratowski's: A×B={{{a},{a,b}}aA,bB}A \times B = \{ \{ \{a\}, \{ a , b \} \} \:|\: a \in A, b \in B \}. However, we can equally well code up cartesian products as dependent functions: A×B={f(AB)2f(0)Af(1)B}A \times' B = \{ f \in (A \cup B)^{\underline{2}} \:|\: f(0) \in A \wedge f(1) \in B \}. You will find these two sets are isomorphic (they satisfy the same universal property), but if you choose AA and BB appropriately, you can find pairs of elements aA,bBa \in A, b \in B such that the representations of the pair (a,b)(a,b) under the two encodings are not isomorphic as sets (hint: A=B,a=bA = B, a = b). In other words, the same pair does not necessarily determine the same set under two distinct encodings, even up to isomorphism.

view this post on Zulip Julius Hamilton (Jun 22 2024 at 20:15):

That sounds like exactly what I’m looking to learn more about.

What is a “dependent” function as opposed to a function?

What does superscript 2^2 mean here?

view this post on Zulip Julius Hamilton (Jun 22 2024 at 20:30):

I think that (AB)2(A \cup B)^{\underline{2}} is the product of ABA \cup B with itself, excluding the diagonal set.

I think this pre-assumes the existence of the product, so I wonder if you are showing me that the definition of ×\times' produces the same set as ×\times.

But then I think you say that the two sets are isomorphic, but the elements in the sets are not necessarily isomorphic.

view this post on Zulip Eric M Downes (Jun 22 2024 at 23:36):

He is using superscript here to denote an exponential object, which is an object isomorphic to the morphisms from the exponent object to the base object. This is guaranteed to exist in Set\sf Set.

So concretely. The exponent uses notation n={0,1,,n1}\underline{n}=\{0,1,\ldots,n-1\}. So (AB)2(A\cup B)^{\underline{2}} is the set of all functions f:{0,1}ABf:\set{0,1}\to A\cup B. He then restricts this set by the stuff after | so that f(0)f(0) always assumes a value in AA and f(1)f(1) always assumes a value in BB.

Pretty much all I am doing is literally reading off what is called "set-builder notation" (with some common math notation like 2\underline{2} that you pick up with exposure) see Ch 2.1 in Newstead (which appears to be down rn...) one can learn all this and more in an intro proofs class, fwiw. (Unlike category theory courses, you can even take such a class with TAs and everything online!)

This is a really nice problem Nathan has set and its worthy of pouring over until you really understand it.

view this post on Zulip Eric M Downes (Jun 22 2024 at 23:39):

Here set builder notation

view this post on Zulip John Baez (Jun 23 2024 at 08:32):

Julius Hamilton said:

I think that (AB)2(A \cup B)^{\underline{2}} is the product of ABA \cup B with itself, excluding the diagonal set.

Eric gave you some hints but I'll just come out with it: if XX is a set then X2X^2 means the product of that set with itself.

view this post on Zulip Nathan Corbyn (Jun 23 2024 at 12:31):

John Baez said:

Julius Hamilton said:

I think that (AB)2(A \cup B)^{\underline{2}} is the product of ABA \cup B with itself, excluding the diagonal set.

Eric gave you some hints but I'll just come out with it: if XX is a set then X2X^2 means the product of that set with itself.

In this instance I didn’t mean this but rather the set of functions {0,1}AB\{ 0,1 \} \to A \cup B, as Eric suggested. While isomorphic, for this example, the intentionality is important. (You don’t get a counter-example the way I suggested without exploiting the coding of functions.)

view this post on Zulip John Baez (Jun 23 2024 at 14:07):

To me [[product]] is a concept defined up to canonical isomorphism, and the set of functions from {0,1} to X is a fine way to form the product of X with itself. But of course you're free to take a different attitude.

view this post on Zulip Nathan Corbyn (Jun 23 2024 at 14:26):

I am of the same opinion, but the conversation is specifically about encodings in naïve set theory and whether they agree elementwise

view this post on Zulip John Baez (Jun 23 2024 at 16:56):

Okay, sorry - I should stay out of this then, I'll only confuse things. I just saw Julius asking what 2{}^2 meant, and thought I'd help. Whoops.

view this post on Zulip Julius Hamilton (Jun 24 2024 at 02:08):

Your contributions are always welcome!

view this post on Zulip Julius Hamilton (Jul 16 2024 at 22:39):

Eric M Downes said:

Its worth noting if you make the partial function that takes two arrows to their composite defined over the whole domain you need only a default zero/sink value; it's equivalent to a faithful projective functor that takes your original category to a monoid-with-zero.

Could you explain how a sink value a[0a=0]\forall a [0 \cdot a = 0] would be used in this scenario?

Could you provide some formal definitions, propositions or proofs regarding projective functors? I read that something being “projective” has to do with a “lifting” property that I haven’t learned yet.

This construction is the cayley table portion of a [[category algebra]], a generalization of group and incidence algebras;

Could you provide more detail about what “the Cayley table portion of a category algebra” is? I want to read that nlab article but there are too many unknown concepts in it for me now.

like a vector space with the morphisms of C\sf C as unit vectors. (Sanity-check: you may wish to convince yourself that 0 with property xF(C).arr;0x=x0=0\forall x\in F(\mathsf{C}).arr; 0\circ x=x\circ0=0 is the only default value that ensures the resulting image is a monoid for general C\sf C.)

view this post on Zulip Julius Hamilton (Jul 16 2024 at 22:52):

Nathan Corbyn said:

We can make this much simpler. The usual coding of the cartesian product A×BA \times B in set theory is Kuratowski's: A×B={{{a},{a,b}}aA,bB}A \times B = \{ \{ \{a\}, \{ a , b \} \} \:|\: a \in A, b \in B \}. However, we can equally well code up cartesian products as dependent functions: A×B={f(AB)2f(0)Af(1)B}A \times' B = \{ f \in (A \cup B)^{\underline{2}} \:|\: f(0) \in A \wedge f(1) \in B \}. You will find these two sets are isomorphic (they satisfy the same universal property), but if you choose AA and BB appropriately, you can find pairs of elements aA,bBa \in A, b \in B such that the representations of the pair (a,b)(a,b) under the two encodings are not isomorphic as sets (hint: A=B,a=bA = B, a = b). In other words, the same pair does not necessarily determine the same set under two distinct encodings, even up to isomorphism.

So you offer an alternative definition of the product as the set of all functions from {0,1}\{0,1\} to ABA \cup B, such that f(0)Af(0) \in A and f(1)Bf(1) \in B, and you say that the representation of the pair (a,b)(a,b) is not isomorphic under taken these encodings? For example, if A=BA = B, we have {{a},{a,b}}\{\{a\}, \{a, b\}\} for all a,ba, b for ×\times, and for ×\times' we have {{{0},{aA}},{{1},{bB}}},}\{\{\{0\}, \{a \in A\}\}, \{\{1\}, \{b \in B\}\}\}, \ldots \}?

I need to study this more to see that they are not isomorphic.

I want to understand how to formulate the “class of logically equivalent set theoretic encodings” of a given thing. For example, you provided two possible ways to encode products. Do we know how to find all possible encodings?

view this post on Zulip Eric M Downes (Jul 17 2024 at 09:49):

Julius Hamilton said:

Could you explain how a sink value a[0a=0]\forall a [0 \cdot a = 0] would be used in this scenario?

In constructing a category algebra we use a functor F:CDF:\mathsf{C}\to\mathsf{D} that is injective on non-identity morphisms and surjective on objects; D0={}\mathsf{D}_0=\set*. For a generic functor F:CDF:{\sf C\to D} the image FCF\mathsf{C} need not be a category, however. And we want to study C\sf C not something merely generated by C\sf C.

Luckily, if you introduce the universal sink 0D10\in {D}_1, and define, for all ff that could not have composed after gg in C\sf C, then
FfFg:=0Ff\circ Fg := 0
introduces the bare minimum of extra crap with no arbitrary choices.

This means concretely that for small C\sf C the image of the homset needs only be extended slightly I:=(FC1){0}I:=(F{\sf C}_1)\cup\set0 to be closed under composition. And diagrams commuting “in” II without commuting preimages in C\sf C must do so trivially: the composites are 00 or idid_*. This is a nice property to have.

If you pick anything other than 00 I claim this will not hold in general, or not be self-consistent, and I have given you enough to confirm that. (If you’re stuck, consider the two object discrete category with 2 morphisms per object C1={idA,idB, a=aa:AA, bb=idB:BB}\mathsf{C}_1=\set{id_A,id_B,~a=a\circ a:A\to A,~b\circ b=id_B:B\to B}. Consider its image under FF to a monoid big enough to contain whatever morphisms you might want, including 00. What happens if FaFb=idFa\circ F b=id_*? Do you see why the other choices, besides 00 even if self-consistent would require extra information to justify? Stretch goal: Is this 00 choice “natural” in the technical sense?)

(For a category algebra over field k\mathbb{k}, one also identifies 0kh=0 hD10_\mathbb{k}\cdot h=0~\forall h\in {\sf D}_1, just like in vector spaces, but you don’t need to think about the group action by the field k\mathbb{k} to see the above.)

I mentioned category algebras in this thread because they allow us to use standard tools from algebra to represent a category faithfully and simply without having to worry about partial operations or resorting to explicit sets beyond the homset we are given. FCCF{\sf C\nsim C} but FF does preserve commuting diagrams, so in a sense the monoid of a category algebra is a natural choice for a simple data object (an array!) representing a diagram / category. (If you use the algebra B[FC]\mathbb{B}[F\mathsf{C}] you can express toggle switches etc for whether to display objects/morphisms.) This also opens up computer algorithms and tools like GAP, etc.

Could you provide some proofs about projective functors…

If you want to think about projectives my recommendation is to think about Wikipedia’s def. of a projective object instead. Worry about the left-lifting property later.

(If preserving epis sounds snoozeful, here is a fun example demonstrating that it can be a highly nontrivial (to prove) feature for a functor to have, despite the seeming plethora of left adjoints.)

If you really want proofs on projective functors, I can say they are used in the representation theory of modules because a projective functor decomposes as a direct sum of projective functors. Look here’s some notes But without knowing representation theory, I don’t think that will be useful to you at all and I don’t recommend that approach.

Could you provide more detail about what “the Cayley table” …

I would not use nLab to learn about Cayley tables. Pick instead almost any book on group theory. A Cayley table is a matrix whose (a,b)(a,b) -th entry is aba\cdot b for some binary operator :M×MM\cdot:M\times M\to M. So above M=End()M=End(*) and that entry would be aba\circ b.

The rows of a Cayley table for a group are also elements in a permutation representation of a (free transitive) left-action of that group. Like the cyclic group of order three C3C_3 (addition mod 3) is an abstract group, often represented as a set of three functions from {0,1,2}{0,1,2}\set{0,1,2}\to\set{0,1,2}… what exactly are those functions? What happens when you compose them? Now you start to see what a group action is. (Can you write out the two Cayley tables for the associated ring Z/3Z\mathbb{Z}/3\mathbb{Z}.)

Highly esteemed mathematician Richard Borcherds says that Cayley tables are not very useful because two very different-looking tables can describe the same group, and the graph isomorphism problem rears its ugly head here. For a pure mathematician I think they are mostly used as disposable teaching tools, but I use them for computing (as in “with a computer”) Moore closures of finite non-associative binary operators in parallel, and they are useful generally for summarizing finite binary operations…. People like tables and have programmed computers to digest them very efficiently! :)

view this post on Zulip Julius Hamilton (Jul 17 2024 at 13:51):

Thank you for this extremely generous and detailed response, which I will study today.