ohnosequences / monochord

An exploration of string diagrams, monoidal categories and functional programming in the browser
GNU Affero General Public License v3.0
0 stars 1 forks source link

A syntax for string diagrams #2

Open mroman42 opened 8 years ago

mroman42 commented 8 years ago

What syntax should we use to represent string diagrams internally?

My first idea is to write the diagrams in terms of vertical and horizontal compositions of natural transformations. Every natural transformation can be seen as a rectangle of the diagram with a number of "inputs" and "outputs". And those rectangles can be composed vertically and horizontally.

As an example, let's take the string diagram for an adjuntion adjuntion

This can be seen as the vertical composition of:

Where the identity transformations have 1 input and 1 output, while epsilon and eta have 2 inputs and 1 output and 1 input and 2 outputs respectively. We are not drawing the identities. In the proposed syntax this would translate to:

(F * ε) o (η * F)

which is equal to F (the identity natural transformation in the functor F) if we read it as an equation.

eparejatobes commented 8 years ago

Yup. The fun starts when you need to work with all that is still implicit in what you write there: ε has arity (2,1), these input/output things are typed, ...

Recommendations:

The actual reason all this works is that cospans (or spans) contain a lot of free monoidal blablabla constructions.

eparejatobes commented 8 years ago

This is a good read for getting some context

mroman42 commented 8 years ago

I see. I'm going to read the papers.