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: tools for diagrams


view this post on Zulip James Fairbanks (Mar 25 2020 at 17:58):

Per Jules' request to shift streams:
https://categorytheory.zulipchat.com/#narrow/stream/229111-general/topic/Tools.20for.20diagrams/near/191786550

view this post on Zulip James Fairbanks (Mar 27 2020 at 00:05):

@Evan Patterson I was thinking more about graph drawing with symmetry and found this paper https://link.springer.com/content/pdf/10.1007/3-540-36151-0_9.pdf

view this post on Zulip Evan Patterson (Mar 27 2020 at 01:08):

Thanks James, this paper looks extremely relevant. I've even seen commutative diagrams that look like the second panel of Fig 1. The 2D version of it appears in Fong & Spivak's paper on supply, for example.

view this post on Zulip Evan Patterson (Mar 27 2020 at 01:10):

Their implementation is in Magma, but nauty is used under the hood.

view this post on Zulip Evan Patterson (Mar 27 2020 at 01:11):

I'll have to read the paper carefully but I really like the idea of this approach.

view this post on Zulip Christian Williams (Mar 27 2020 at 06:29):

This is a basic question: I've been playing with a made-up notation for a language I care about, and I was just wondering what software would be the best way to draw things like this:
rho-notation.jpg

view this post on Zulip Jelle Herold (Mar 27 2020 at 14:36):

Christian Williams said:

This is a basic question: I've been playing with a made-up notation for a language I care about, and I was just wondering what software would be the best way to draw things like this:
rho-notation.jpg

they look like trees? do you just need to draw a few for a paper?

view this post on Zulip Antonin Delpeuch (Mar 27 2020 at 16:31):

I would go for TikzIt intuitively.

view this post on Zulip Simon Burton (Mar 27 2020 at 19:36):

I use a python package called PyX for most of my diagrams... https://pyx-project.org/

view this post on Zulip Christian Williams (Mar 27 2020 at 19:39):

@Jelle Herold yes, they are just trees with red/green/blue/black/white nodes. plus a bit more complexity, because they are really "operads with binding"... but I'm still working on a good notation for that.

initially I want to just draw a few for a paper, but in the long run I would love to have a something like what y'all have done for string diagrams, where you can really code with it.

view this post on Zulip Christian Williams (Mar 27 2020 at 19:40):

thanks, that looks nice.

view this post on Zulip Eduardo Ochs (Mar 28 2020 at 01:44):

@Christian Williams, if you like the idea of editing these trees in ascii art I can extend dednat6 to produce these kinds of diagrams very quickly... take a look at http://angg.twu.net/dednat6.html#a-big-example and http://angg.twu.net/dednat6/demo-underbrace.pdf - btw, I need to fix that PDF! Doing that now!!!

view this post on Zulip sarahzrf (Mar 28 2020 at 21:02):

wow this looks exactly like one of the figures in brent yorgey's thesis :eyes:

view this post on Zulip sarahzrf (Mar 28 2020 at 21:03):

ok wait it wasnt quite as exact as i was thinking image.png

view this post on Zulip sarahzrf (Mar 28 2020 at 21:04):

but! regardless! use his diagrams library!!!!

view this post on Zulip sarahzrf (Mar 28 2020 at 21:04):

(if you like writing code to generate this kind of thing)

view this post on Zulip sarahzrf (Mar 28 2020 at 21:04):

i went on a ramble about that library just yesterday over in another stream

view this post on Zulip sarahzrf (Mar 28 2020 at 21:05):

see here https://categorytheory.zulipchat.com/#narrow/stream/229199-basic-questions/topic/functional.20programming.20101/near/192079928

view this post on Zulip sarahzrf (Mar 28 2020 at 21:11):

@Christian Williams i would not be surprised if you could get a working prototype of something that programmatically generates such trees from abstract syntax in under a few hours, playing around with diagrams in ihaskell—uh, well, if you already knew how to use diagrams :sweat_smile:

view this post on Zulip sarahzrf (Mar 28 2020 at 21:11):

initial learning carries some overhead.

view this post on Zulip Evan Patterson (Mar 28 2020 at 21:21):

In Julia, the package Compose.jl offers similar capabilities. Its authors say it is partly inspired by the Haskell diagrams package.

https://giovineitalia.github.io/Compose.jl/latest/tutorial/

I've used this package a bit, and I like it.

view this post on Zulip sarahzrf (Mar 28 2020 at 21:24):

hmm, it looks nice but probably a lot less powerful

view this post on Zulip sarahzrf (Mar 28 2020 at 21:26):

yeah this is a ton more limited in scope

view this post on Zulip sarahzrf (Mar 28 2020 at 21:26):

but ill keep it in mind if i ever have to use julia instead of haskell c:

view this post on Zulip Evan Patterson (Mar 28 2020 at 21:29):

Out of curiosity, what does Diagrams have that Compose.jl doesn't? I have never used Diagrams.

view this post on Zulip sarahzrf (Mar 28 2020 at 21:32):

well, it does have a whole little ecosystem, but even if we just restrict ourselves to the core library—like, the library diagrams-core... (actually, the diagrams package itself pulls in a bunch of extra stuff besides that too)

view this post on Zulip sarahzrf (Mar 28 2020 at 21:32):

https://hackage.haskell.org/package/diagrams-core

view this post on Zulip sarahzrf (Mar 28 2020 at 21:33):

so like, diagrams is fundamentally built on a bunch of abstractions for geometry

view this post on Zulip sarahzrf (Mar 28 2020 at 21:33):

a diagram has spatial extent and stuff

view this post on Zulip sarahzrf (Mar 28 2020 at 21:34):

it has an origin

view this post on Zulip sarahzrf (Mar 28 2020 at 21:35):

well ok, i think compose has an origin too

view this post on Zulip sarahzrf (Mar 28 2020 at 21:35):

but it doesnt look to me like it has an envelope or a trace

view this post on Zulip Christian Williams (Mar 28 2020 at 21:35):

yeah, this is awesome. I'm not yet much of a programmer, but I'll try it out

view this post on Zulip sarahzrf (Mar 28 2020 at 21:36):

also, diagrams's approach to applying properties seems to be different from Compose.jl's, and I'm not sure I like the latter's as much

view this post on Zulip Christian Williams (Mar 28 2020 at 21:36):

this is a topic for another time, but I am amazed that people have not developed a standard notation for operads with binding. rather than just monoids and other algebraic gadgets, you can use this stuff for actual programming languages.

view this post on Zulip sarahzrf (Mar 28 2020 at 21:37):

ooh!

view this post on Zulip sarahzrf (Mar 28 2020 at 21:37):

that sounds really cool :eyes:

view this post on Zulip sarahzrf (Mar 28 2020 at 21:37):

actually i remember one of the talks i went to at POPL was about generalized theories of syntax using monads and stuff and i think maybe binding was part of it

view this post on Zulip Jules Hedges (Mar 28 2020 at 21:38):

I talked with somebody about building a string diagrams tool around diagrams (I don't remember who... was it @Jelle Herold?) Idea is that if the data structure you use to represent morphisms is proof trees with \otimes and cut (aka kd trees) then turning the proof tree into a diagram is just a fold, more or less out of the box using the things provided by diagrams

view this post on Zulip sarahzrf (Mar 28 2020 at 21:38):

but. i dont remember super well :|

view this post on Zulip sarahzrf (Mar 28 2020 at 21:38):

yeah jules i started doing something like that once

view this post on Zulip sarahzrf (Mar 28 2020 at 21:38):

but it was kinda broken

view this post on Zulip sarahzrf (Mar 28 2020 at 21:38):

and i petered out

view this post on Zulip sarahzrf (Mar 28 2020 at 21:38):

take a look: https://github.com/sarahzrf/compact-closed/blob/master/StringDiagrams2.ipynb

view this post on Zulip Evan Patterson (Mar 28 2020 at 21:39):

@Jules Hedges , I implemented something very much like that using Compose.jl. It's a nice approach.

view this post on Zulip Jules Hedges (Mar 28 2020 at 21:40):

Cool! Looks like what I had in mind

view this post on Zulip sarahzrf (Mar 28 2020 at 21:40):

anyway check out the index for diagrams-lib, which gets pulled in as part of the diagrams package https://hackage.haskell.org/package/diagrams-lib-1.4.3/docs/doc-index-All.html

view this post on Zulip sarahzrf (Mar 28 2020 at 21:40):

it's a hell of a lot more extensive than Compose.jl!

view this post on Zulip sarahzrf (Mar 28 2020 at 21:40):

oh wait actually a bunch of this is probably re-exports lol

view this post on Zulip sarahzrf (Mar 28 2020 at 21:42):

@Jules Hedges the other thing i did in this repo was uh

view this post on Zulip sarahzrf (Mar 28 2020 at 21:42):

abstract index notation @_@

view this post on Zulip sarahzrf (Mar 28 2020 at 21:42):

idea being you can write

[tensor| tens^a_x = s w^ba v_xb |]

view this post on Zulip sarahzrf (Mar 28 2020 at 21:43):

where s, w, and v are identifiers in scope

view this post on Zulip sarahzrf (Mar 28 2020 at 21:43):

and this generates a binding for tens

view this post on Zulip sarahzrf (Mar 28 2020 at 21:43):

purely in terms of compact closed category operations

view this post on Zulip sarahzrf (Mar 28 2020 at 21:44):

i copied and pasted that line from an actual example that compiles https://github.com/sarahzrf/compact-closed/blob/master/src/CompactClosed/Test.hs

view this post on Zulip sarahzrf (Mar 28 2020 at 21:44):

or, well, compiled at one point, good luck figuring out my dependencies :upside_down:

view this post on Zulip sarahzrf (Mar 28 2020 at 21:45):

put the two together and you get this
image.png

view this post on Zulip sarahzrf (Mar 28 2020 at 21:46):

the code for the index notation is here, but don't ask me to try to figure out how black magic i hacked together 2 years ago works or i'll melt https://github.com/sarahzrf/compact-closed/blob/master/src/CompactClosed/AIN.hs

view this post on Zulip Jules Hedges (Mar 28 2020 at 22:15):

Cooool!

view this post on Zulip Nathanael Arkor (Mar 28 2020 at 22:32):

Christian Williams said:

this is a topic for another time, but I am amazed that people have not developed a standard notation for operads with binding. rather than just monoids and other algebraic gadgets, you can use this stuff for actual programming languages.

it seems less surprising when you consider that people don't really use such operads in the first place, and you don't need to represent what you don't use

view this post on Zulip Nathanael Arkor (Mar 28 2020 at 22:32):

but I'd like to see a suggestive notation!

view this post on Zulip Christian Williams (Mar 29 2020 at 05:53):

Yes, the real surprise is that there is not yet public awareness that the notion of "substitution structure" (the monoid definition of operad) has binding implicit in it from the start.

Discussing this with the community is a priority for me; rather than waiting for one of us to blog about it, perhaps you and I should start a thread about it tomorrow. Probably in #category theory , I guess.

view this post on Zulip Jules Hedges (Mar 29 2020 at 10:20):

Early on when thinking about diagrams software I thought about the idea of letting users define and work in an arbitrary operad, rather than hard coding in certain structured monoidal categories. Gave up on that pretty quickly, I still have no idea how the user could communicate an operad to a computer

view this post on Zulip Antonin Delpeuch (Mar 29 2020 at 13:00):

I guess you partly get that with systems like homotopy.io where you can just truncate n-categories to get the right flavour of monoidal category, but you are still limited to what arises in this way (for instance you do not get traced monoidal categories afaik).

view this post on Zulip Jules Hedges (Mar 29 2020 at 14:19):

Yeah, traced monoidal categories not fitting in anybody's tool was the main thing that motivated me. In the end I decided life's too short, traces should just be hard-coded as a weird but important special case

view this post on Zulip Philip Zucker (Mar 29 2020 at 17:41):

Here's something I've been thinking about that I think is kind of interesting. http://www.philipzucker.com/uniform-continuity-is-kind-of-like-a-lens/

view this post on Zulip Philip Zucker (Mar 29 2020 at 17:41):

I might just be suffering from Lens Madness though

view this post on Zulip Matteo Capucci (he/him) (Mar 29 2020 at 21:09):

Philip Zucker said:

Here's something I've been thinking about that I think is kind of interesting. http://www.philipzucker.com/uniform-continuity-is-kind-of-like-a-lens/

This is very cool!

view this post on Zulip Fabrizio Genovese (Apr 01 2020 at 13:30):

@Antonin Delpeuch what do you use to latex surface diagrams? Is there some macro for them?

view this post on Zulip Antonin Delpeuch (Apr 01 2020 at 13:32):

Something that isn't quite ready to be released yet, so moving to a PM :)

view this post on Zulip Fabrizio Genovese (Apr 01 2020 at 13:32):

:heart:

view this post on Zulip sarahzrf (Apr 01 2020 at 13:34):

oh yeah @Christian Williams did you ever talk about operads & binding?

view this post on Zulip Jules Hedges (Apr 17 2020 at 10:21):

There was a suggestion by @Gershom after my talk on wednesday when I brought up the question of string diagram compilers, to try hacking on Proto-Quipper-M to take out the quantum and make it general purpose..... I don't remember that suggestion ever coming up before, does anyone have any thoughts?

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:38):

We looked into Proto-Quipper. It's already not quantum and way more general (Proto-Quipper != Quipper)

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:39):

It's also written in Haskell, so it could be a good choice if you want to hook it up with your backend

view this post on Zulip Jules Hedges (Apr 17 2020 at 10:39):

Cool! Any idea how feasible/difficult that would be? I saw Vlad talking about it once or twice, but i never looked at the thing itself

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:40):

If I remember correctly tho, the point of protoquipper wasn't to "compile string diagrams" (whatever this means), but have a programming language to specify classes of string diagrams, and perform operations on them at once

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:40):

I think your best bet is to ask directly to vlad or to @Francisco Rios

view this post on Zulip Jules Hedges (Apr 17 2020 at 10:40):

If you already looked into it at Statebox, why did you choose not to go with it?

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:41):

Various reasons. One of them is that we need formally verified code, so Haskell doesn't cut it

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:41):

But then again the main reason is that as I said protoquipper seems suited to talk about string diagrams in a general setting, while we needed a way to map selected string diagrams to some category

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:42):

so the application domain is different

view this post on Zulip Jules Hedges (Apr 17 2020 at 10:42):

Ah, it also doesn't function as a compiler? I thought part of the point was it could compile to instructions to control quantum hardware...

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:43):

So our core is literally the formally verified implementation of the idea that every free symmetric strict monoidal category has a free functor to some other category if you specify some stuff.

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:43):

I guess so, but there is not such thing as "a compiler", there is a compiler to a very specific domain

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:44):

So if the target is compiling to quantum hardware I don't know how useful will this be to you. It really depends on the implementation strategy adopted, but there is a possibility that you'll have to rewrite parts of it by yourself

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:45):

So, for instance, if protoquipper compiles to Haskell in a way that is useful to you (and then from there there's a way to compile Haskell to quantum stuff), then you could just take that bit

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:45):

I never looked into the implementation stategy of it tho, I merely read the protoquipper paper. So I'd really wait for Francisco to chime in.

view this post on Zulip Jules Hedges (Apr 17 2020 at 10:46):

Definitely sounds like something worth looking into more closely. For my open games DSL specifically, it might be much less effort to build on top of Proto-Quipper-M than to start from my language and add the missing parts to make it nice, like hooking into the haskell compiler properly

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:46):

If you like the idea of coding in idris you may also use our implementation of free smc :P

view this post on Zulip Jules Hedges (Apr 17 2020 at 10:48):

Personally I'd rather run the risk of having bugs. If anyone ever wants to use open games to support business decisions, they can pay for a provably-correct rewrite if they want it.....

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:49):

I can't blame you xD

view this post on Zulip Jules Hedges (Apr 17 2020 at 10:57):

Anyone know whether anyone is using Quipper or Proto-Quipper-M in industry right now? (Is anyone from CQC hanging out here?)

view this post on Zulip Fabrizio Genovese (Apr 17 2020 at 10:58):

Two years ago I remember Francisco was under NDA with an undisclosed party regarding Quipper. I don't know if this is still the case but for sure there'interest in industry for this sort of tech.

view this post on Zulip Francisco Rios (Apr 18 2020 at 05:33):

.
Hi Jules,

Thanks for your interest in Proto-Quipper-M! Certainly, the language does not compile
to instructions to control quantum hardware. Rather, Proto-Quipper-M is a language for
describing families of morphisms in an arbitrary symmetric monoidal category, of which
quantum circuits are but one example. And, indeed, as Fab mentioned, there has been
interest (and support) for Quipper and Proto-Quipper-M from industry and government
agencies for a while now.

Cheers!
.

view this post on Zulip Eduardo Ochs (Apr 18 2020 at 06:58):

Hi! I'm the only weirdo here who uses Lua and LuaLaTeX to typeset diagrams, but

1) I believe that it shouldn't be hard to integrate my package (that is called "Dednat6") with the other ones that people use here - including the ones in Haskell and Scala, and
2) I just made a video about Dednat6! It is here:

http://angg.twu.net/dednat6.html#hacking

A good part of the video is about how Dednat6 can be used outside lualatex as a bunch of Lua libraries, and how I wrote its libraries for planar Heyting Algebras... I started by the code that displayed my HAs and my constructions on them as ASCII art, and I only implemented LaTeX output much, much later.

Cheers! =)

view this post on Zulip Blake Pollard (Jun 03 2020 at 23:09):

This might be cool: http://penrose.ink/media/Penrose_SIGGRAPH2020_Supplemental_Grammars.pdf

view this post on Zulip Eduardo Ochs (Jun 15 2020 at 01:02):

People, where are the good places for asking questions about Tikz?
Is it ok to ask one question about Tikz here besides the meta-question above?

Here it goes... I am working (veeery slowly) on a Tikz back-end for this package for generating categorical diagrams, <http://angg.twu.net/dednat6.html#a-big-example>, and I discovered that I can use <https://tikzcd.yichuanshen.de/> to learn the Tikz syntax for all the modifiers for arrows that I use in the current back-end, that uses diagxy... but tikzcd.yichuanshen.de generates code for tikzcd, like this:

\begin{tikzcd}
A \arrow[r, "foo"] \arrow[rd, "plic"', maps to]
  & B \arrow[d, "bar", Rightarrow] \\
  & C                             
\end{tikzcd}

and to port that I need to convert these "\arrow"s to something like the "\draw"s below, that connect nodes that I've defined previously and that can be in arbitrary positions... How do I do that? Or: where should I ask that?

\begin{tikzpicture}
  \node (nodeA) at (0.0,0.0) {$A$};
  \node (nodeB) at (2.0,0.0) {$B$};
  \node (nodeC) at (2.0,-1.5) {$C$};
  \draw [->]            (nodeA) -- (nodeB);
  \draw [{}-{>},double] (nodeB) -- (nodeC);
  \draw [{|}-{>}]       (nodeA) -- (nodeC);
\end{tikzpicture}

view this post on Zulip Nathanael Arkor (Jun 15 2020 at 01:14):

I would have thought the tikz-cd documentation might be a better place to start than generating output from a tool. You can find the source code for tikz-cd here, which will tell you what TikZ tikz-cd is outputting, presuming you're already familiar with TikZ itself.

view this post on Zulip Eduardo Ochs (Jun 15 2020 at 03:09):

I am not familiar with Tikz.

view this post on Zulip Eduardo Ochs (Jul 13 2020 at 18:00):

People, what do you use to draw string diagrams like these ones?
marsden.png

view this post on Zulip Fabrizio Genovese (Jul 13 2020 at 18:01):

Most likely tikz

view this post on Zulip Eduardo Ochs (Jul 13 2020 at 18:23):

Ooops, sorry! My question has a second half... here it is.

Those diagrams are from Dan Marsden's "Category Theory Using String Diagrams", that is at <https://arxiv.org/abs/1401.7220>, and its source code can be downloaded from there. The code for those diagrams is a series of "tikzpicture"s in the section "Universality from Representables" in string.tex. Most of its coordinates are hardcoded.

I sort of know how to draw this things in Tikz - I am not proficient yet, so drawing a diagram like that still takes me an evening, but let's pretend that I did not confess this...

The question - to the people here who use string diagrams a lot - is: what is your workflow for drawing them? Do you start with a draft on paper, then program it in Tikz by guessing first approximations the coordinates, then adjust them by changing them in the code and recompiling several times until happy? Do you draw the first version on something like Inkscape instead of on paper? Is there a graphics editor "for Tikz"?

view this post on Zulip Nathanael Arkor (Jul 13 2020 at 18:25):

Is there a graphics editor "for Tikz"?

I've heard TikZiT is pretty good.

view this post on Zulip Jules Hedges (Jul 13 2020 at 18:25):

I would guess they were built in TikZit, which generates TikZ code that looks like it wasn't written by a human

view this post on Zulip Eduardo Ochs (Jul 13 2020 at 18:26):

Thanks!!!

view this post on Zulip Dan Marsden (Jul 14 2020 at 10:26):

They were built manually using just raw tikz and no tools other than a text editor. The reason for this is I care about the layout of the diagrams more than just the topology, as some depictions help with understanding more than others. I've drawn 1000s of these by now for papers and book projects, so I've got quite comfortable doing them from scratch. I only use a small handful of "tricks" to get nice layout, so it's not actually that hard to draw them quickly with a bit of practice. I chose not to use tikzit as it produces quite low level tikz code that is harder to make aesthetic adjustments on later. I made that decision a long time ago, so tikzit output may have changed since then. If you're doing research, rather than focused on exposition, your emphasis might be different. So my workflow, with coauthors, is simply draw on paper, layout in tikz in an editor, adjust until happy, done.

view this post on Zulip Jules Hedges (Jul 14 2020 at 10:30):

I'm equal parts impressed and horrified

view this post on Zulip Jules Hedges (Jul 14 2020 at 10:31):

I mean I always write raw TikZ too, but you make a lot more diagrams than I do

view this post on Zulip Dan Marsden (Jul 14 2020 at 10:38):

Well I should probably mention one other thing. We figured out how to use tikz more effectively to parameterise diagrams, for example by colours or labels. You often end up drawing nearly the same diagram again and again, so being able to instantiate a "template" diagram with a few details reconfigured is a good technique to save typing. You can bundle up these template diagrams as macros or something similar. I also used to be a programmer, so coding stuff up like this is very natural to me.

view this post on Zulip Eduardo Ochs (Jul 14 2020 at 17:29):

I saw your macros!!! They are super-neat!

view this post on Zulip Eduardo Ochs (Jul 14 2020 at 17:29):

I am working with a diagrammatic language that is sort of the opposite of string diagrams - I've drawn thousands of diagrams in it, too -, and at this moment I just need to 1) typeset a handful of string diagrams similar to yours to show how to translate between your diagrams and mine, 2) make the Tikz back-end of my package for drawing diagrams a bit better...

view this post on Zulip Simon Burton (Jul 14 2020 at 19:54):

@Eduardo Ochs sounds interesting! Is it a DSL?

view this post on Zulip Eduardo Ochs (Jul 14 2020 at 20:59):

Simon Burton said:

Eduardo Ochs sounds interesting! Is it a DSL?

Take a look:
http://angg.twu.net/dednat6.html
https://tug.org/TUGboat/tb39-3/tb123ochs-dednat.pdf
http://angg.twu.net/dednat6/tug-slides.pdf

view this post on Zulip Simon Burton (Jul 14 2020 at 21:34):

very nice.

view this post on Zulip Guillaume Boisseau (Jul 31 2020 at 12:34):

I generated my diagrams for https://arxiv.org/abs/2002.11480 using some custom haskell code that takes a morphism as input and lays out the diagram automatically. Would anyone be interested if I put the effort of making it usable?

view this post on Zulip Guillaume Boisseau (Jul 31 2020 at 12:35):

I was thinking it might use https://github.com/statebox/monmor-spec as input format, and of course the wonderful Haskell diagrams library

view this post on Zulip Guillaume Boisseau (Jul 31 2020 at 12:38):

Or actually, if someone else has already done that I would love not to have to do it myself

view this post on Zulip Nathanael Arkor (Jul 31 2020 at 12:42):

@fosco was also working on a modular string diagram library: it might be worth discussing with him to see if there's overlap in the use cases.

view this post on Zulip Eduardo Ochs (Jul 31 2020 at 13:04):

@Guillaume Boisseau , I am interested!

view this post on Zulip fosco (Jul 31 2020 at 13:36):

I will never end writing the documentation :grinning:

view this post on Zulip Eduardo Ochs (Jul 31 2020 at 18:33):

Guillaume Boisseau said:

I generated my diagrams for https://arxiv.org/abs/2002.11480 using some custom haskell code that takes a morphism as input and lays out the diagram automatically. Would anyone be interested if I put the effort of making it usable?

What do you think of starting by making the source code of https://arxiv.org/abs/2002.11480 available and explaining how to compile it? Arxiv only has the "LaTeX source" for the paper with the diagrams already in Tikz - it doesn't have the source for the diagrams in the DSL that you invented, and neither the Haskell code needed to compile them...

view this post on Zulip Guillaume Boisseau (Aug 02 2020 at 14:16):

@Eduardo Ochs It's there: https://github.com/Nadrieril/stridi

view this post on Zulip Guillaume Boisseau (Aug 02 2020 at 14:21):

But right now you need to write Haskell code to generate diagrams, which is both suboptimal and extremely slow to recompile all of the time. That's why I want to rewrite it to just be a binary, and decouple the DSL from the representation to allow more tools

view this post on Zulip Antonin Delpeuch (Oct 27 2020 at 07:21):

Let me introduce yet another string diagram renderer: SheetShow, which works for sheet diagrams in bimonoidal categories. https://wetneb.github.io/sheetshow/
sheet_diagram.png

view this post on Zulip Javier Prieto (Dec 11 2020 at 10:56):

I am trying to compile a list of graphical calculi and their associated tools for manipulating/rewriting and rendering/typesetting them. A quick Google search for "graphical calculi survey" turns up

A survey of graphical languages for monoidal categories

which was written in 2009 and seems to cover a wide variety of string diagrams (I have only skimmed it). Is that all there is? I'm sure I've seen different-looking diagrams for e.g. operads, Petri nets or open games, but maybe they were just string diagrams with bells and whistles. Also, I would like my list to include plain old diagrams with (labeled) dots as objects, (labeled) arrows as morphisms, (labeled) double arrows as 2-morphisms, etc. Am I using the term "graphical calculus" too liberally if I do this?

On the rewriting front, I am only aware of pyzx. Maybe catlab.jl has this too? Is there anything else?

Any help appreaciated!

view this post on Zulip Ralph Sarkis (Dec 11 2020 at 13:54):

A tool for rewriting with string diagrams: cartographer
A tool for drawing opetopic shapes (for higher categories I believe): Opetopic

view this post on Zulip Antonin Delpeuch (Dec 11 2020 at 15:25):

@Javier Prieto I think it would be great to have an updated version of Selinger's survey. Adding the associated tools to manipulate them would be very useful too. I am not sure to which extent a static paper is the best format for this. Perhaps a wiki could be better suited for that, so that people can add their tool at the appropriate place when it is released, for instance. Perhaps the nLab could be used for that? The page about string diagrams is pretty poor, it lacks a lot of images to illustrate (not too long ago there was not a single image on this page!): https://ncatlab.org/nlab/show/string+diagram

view this post on Zulip Eduardo Ochs (Dec 12 2020 at 01:54):

Hi @Javier Prieto,
if by "plain old diagrams" you mean "plain old categorical diagrams (with double arrows as 2-morphisms)" then these notes may be useful to you...
http://angg.twu.net/math-b.html#favorite-conventions

view this post on Zulip Javier Prieto (Dec 12 2020 at 08:43):

@Antonin Delpeuch An "updated version of Sellinger's survey" is perhaps too big a task for me. I was going more for something like a summary table with lots of hyperlinks for those who want to go deeper and minimal text around it, maybe something like a glossary plus examples of diagrams.

I agree that a website would be a much better format. I will have to produce a pdf at some point because I'm doing this as final project for an undergrad course, but I'm confident I can just produce a website and then take the text and tikz code and stick it in Overleaf.

view this post on Zulip Javier Prieto (Dec 12 2020 at 08:44):

@Eduardo Ochs thank you! I'm going through it now and it looks very relevant indeed.

view this post on Zulip John van de Wetering (Dec 12 2020 at 17:33):

On the rewriting front there is also Quantomatic (which is no longer actively developed). There is also homotopy.io, which I haven't used myself

view this post on Zulip John van de Wetering (Dec 12 2020 at 17:34):

I don't know what you mean by "graphical calculi", but there is a whole barrage of graphical languages for reasoning about quantum computation: the ZX-calculus, ZH-calculus, ZW-calculus. You can learn more about this at https://zxcalculus.com

view this post on Zulip John van de Wetering (Dec 12 2020 at 17:35):

I'm not a hundred percent sure, but I thought @Cole Comfort was working on a similar project of cataloging PROPs.

view this post on Zulip Javier Prieto (Dec 13 2020 at 12:58):

John van de Wetering said:

I don't know what you mean by "graphical calculi"

Honestly, neither do I! I was using the term very loosely to refer to anything that "looks like a diagram" and comes with some rewriting rules attached. If there is a (perhaps narrower) rigorous definition, I'd be keen to hear it.

view this post on Zulip Christian Williams (Dec 22 2021 at 23:28):

I'm writing a thesis with many string diagrams for 2-categories and equipments. mates-to-equip-square.png From what I've seen, I have to use TikZit or write macros for TikZ and make them from scratch. There isn't a big difference, and both options are very time-consuming. I wish there were a better option, because string diagrams are very simple.

Does anyone have advice for mass-producing string diagrams? (Also, does anyone have a .tikzstyles file with useful macros? I think Dan Marsden has something similar... I'll be making one.) When will someone make a Quiver for strings?

view this post on Zulip Christian Williams (Dec 22 2021 at 23:36):

We could host TikZit online, and start building a library of TikZ figures and macros.

view this post on Zulip Christian Williams (Dec 22 2021 at 23:38):

Then if you want to make the proof "right adjoints preserve right extensions", you can open Adjunction.tikz and RightExtension.tikz and combine them at the various steps of the proof. (and then upload that proof to the library!)

view this post on Zulip Christian Williams (Dec 22 2021 at 23:38):

I think this is a low-tech solution that could make drawing more accessible.

view this post on Zulip Christian Williams (Dec 22 2021 at 23:48):

@Aleks Kissinger What do you think about this idea? Do you have any advice for making such a site?

view this post on Zulip Christian Williams (Dec 23 2021 at 00:04):

(sent an email)

view this post on Zulip Eduardo Ochs (Dec 23 2021 at 03:47):

Please tell me when you get a prototype working - I would love to play with it!

view this post on Zulip Jules Hedges (Dec 23 2021 at 13:26):

A github repo with a public collection of .tikzstyle files would be low hanging fruit, presumably anybody could create this and then make a pull request against the TikZit documentation to add a link to it

view this post on Zulip Jules Hedges (Dec 23 2021 at 14:34):

I first talked a few years ago about how nice it would be to port (in practice totally rewriting from OCaml to Javascript) TikZit to run in browser for purposes of being a plugin of a "1CatLab" (which is what I used to call the combination pedagogical wiki + ACT wiki, an idea that I'm no longer very attached to). This would be a massive undertaking for a programmer...

view this post on Zulip Alex Gryzlov (Dec 23 2021 at 14:41):

Jules Hedges said:

I first talked a few years ago about how nice it would be to port (in practice totally rewriting from OCaml to Javascript) TikZit to run in browser for purposes of being a plugin of a "1CatLab" (which is what I used to call the combination pedagogical wiki + ACT wiki, an idea that I'm no longer very attached to). This would be a massive undertaking for a programmer...

I guess that's something different from https://1lab.dev/ ? :)

view this post on Zulip Jules Hedges (Dec 23 2021 at 14:44):

Yeah, I know about that, it's just the same name (probably more people than the 2 of us came up with it independently, it's kind of obvious), otherwise I think a totally different idea

view this post on Zulip Ralph Sarkis (Dec 23 2021 at 14:51):

Also : GReTA ExACT

view this post on Zulip Dylan Braithwaite (Dec 23 2021 at 15:00):

Jules Hedges said:

I first talked a few years ago about how nice it would be to port (in practice totally rewriting from OCaml to Javascript) TikZit to run in browser

From what I can see it’s written in C++/QT rather than OCaml and QT has some amount of support for compiling to WASM. That would probably still be quite a lot of work, but probably not as much as completely rewriting it

view this post on Zulip John van de Wetering (Dec 26 2021 at 10:31):

Christian Williams said:

Then if you want to make the proof "right adjoints preserve right extensions", you can open Adjunction.tikz and RightExtension.tikz and combine them at the various steps of the proof. (and then upload that proof to the library!)

My two cents about this: I have worked on papers with hundreds of string diagrams. The problem with reusing them, is that you need to find them first. Sure you might have a adjunction.tikz, but this doesn't tell you what the exact diagram is. The only way I've found that is feasible is to find the diagram I want in the paper and see what the tikz file is called in the latex source. I don't really know how you would make a "tikz diagram browser" where you can search for the diagram you want. The only solution I can think of is to train one of those fancy neural networks that can learn to find a text description of a picture, then you could give a natural language search query to find it. But of course this requires a massive library of annotated tikz diagrams.

view this post on Zulip John van de Wetering (Dec 26 2021 at 10:32):

That being said, having a GitHub repo with several common style files and macros would certainly be useful

view this post on Zulip Ralph Sarkis (Dec 26 2021 at 10:54):

What about something more like detexify where you draw the general shape of what you want and it find diagrams that are close to that.

view this post on Zulip Jules Hedges (Dec 26 2021 at 11:31):

Christian Williams said:

Does anyone have advice for mass-producing string diagrams? (Also, does anyone have a .tikzstyles file with useful macros? I think Dan Marsden has something similar... I'll be making one.) When will someone make a Quiver for strings?

For what it's worth, if I remember correctly Aleks wrote TikZit version 2 specifically for writing Picturing Quantum Processes, which contains maybe thousands of string diagrams

view this post on Zulip Jules Hedges (Dec 26 2021 at 11:51):

John van de Wetering said:

The only solution I can think of is to train one of those fancy neural networks that can learn to find a text description of a picture, then you could give a natural language search query to find it.

Very much easier solution: take an open source TeX editor of your choice that supports sync between code and pdf (eg. TeXshop, which is the one I use), fork it and hack it to open files generated by TikZit (or whatever) in TikZit, instead of opening the raw code itself

view this post on Zulip Jules Hedges (Dec 26 2021 at 11:52):

An emacs wizard could probably hack the emacs TeX mode to do that in 5 minutes

view this post on Zulip Jules Hedges (Dec 26 2021 at 11:53):

Cf. the standard flowchart Do I need a neural network? \to No.

view this post on Zulip John van de Wetering (Dec 26 2021 at 13:41):

Jules Hedges said:

John van de Wetering said:

The only solution I can think of is to train one of those fancy neural networks that can learn to find a text description of a picture, then you could give a natural language search query to find it.

Very much easier solution: take an open source TeX editor of your choice that supports sync between code and pdf (eg. TeXshop, which is the one I use), fork it and hack it to open files generated by TikZit (or whatever) in TikZit, instead of opening the raw code itself

I have this set-up but it doesn't solve the problem I was raising, which is "I know I have the diagram of this thing I want somewhere in this folder with thousands of other diagrams, how do I find it if I don't know the filename"?

view this post on Zulip John van de Wetering (Dec 26 2021 at 13:44):

As long as the diagram is already in a file I am using, it is fine, because I can just search through the PDF to find it, but if I say comment it out because I don't need it at that moment, the diagram is essentially lost forever to me, because there is no way to find it back (unless I remember where I commented it out)

view this post on Zulip Fabrizio Genovese (Dec 29 2021 at 17:08):

Just copy paste all your diagams into a huge pdf in the form
diagram
filename

view this post on Zulip Fabrizio Genovese (Dec 29 2021 at 17:08):

You can use any ordering you want. Then it's just a matter of scrolling the file