Zulip Chat Archive

Stream: general

Topic: Syntax for multicategories /coloured operads


Adrian Marti (Oct 13 2025 at 20:23):

Hello all, like some other people, I do believe that using the internal logic of categories for describing objects, arrows and subobjects in a variety of contexts is a very good candidate for formalization.

The reason for this is that statements proven this level of generality, gives us statements about models in all categories. For example, anything we prove in the theory of groups will be true in for group objects in other categories (Lie groups, etc.). As a first step, I'm seeing that there is the potential for developing an efficient notation for arrows in cartesian/symmetric monoidal/monoidal categories, making their use more convenient.

At the moment, I have the following problem. I am starting with formalizing terms. I've come to the conclusion that the right setting to interpret them are multicategories. These are like categories, but instead of an arrow having a source and a target, an arrow is allowed to have multiple sources. For objects S1,,Sn,TS_1,\cdots,S_n,T, we denote these arrows by Mul(S1,,Sn;T)Mul(S_1,\cdots,S_n;T). The classical example are vector spaces equipped with multilinear maps. In this case, these multicategorical arrows arise from the tensor product (or from a different viewpoint, the tensor product monoidal structure arises from this multicategory).

Multicategorical arrows get composed by taking an arrow fMul(S1,,Sn;T)f \in Mul(S_1,\cdots,S_n;T) and arrows giMul(R1,,Rmi,Si)g_i \in Mul(R_1,\cdots,R_{m_i}, S_i) and putting them together to an arrow Mul(R1,,Rmk,T)Mul(R_1,\cdots, R_{m_k},T). There is also an identity and we have corresponding identity and associativity rules. This models precisely the way that we combine terms in sorted logic. Multicategories also naturally provide a context for interpreting terms, at least terms where each free variable gets used exactly once and we're not able to permute the inputs. If we want to be able to permute the inputs, we need to use symmetric multicategories and if we want to use variables more than once, cartesian multicategories.

In the end, I want to be able to have a notation like term x y z w => f (x, g (y, z), w) for multicategorical arrows f and g be compiled into a multicategorical arrow with four inputs (in particular this then will also work for monoidal categories). I'm thinking of using this as a shallow embedding (i.e. no big Expr types, just notation) to keep this layer "lean" and giving us ways to delaborte arrows in this way and giving us better tactic mode behaviour.

However, with this idea I've quickly run into an important problem. A fully dependent version of multicategorical arrows is horrible, as you can see below. Stating the identity axiom requires transport with Eq.mp, and to me it looks like a pretty complicated type of transport (along two variables that depend on each other).

Header

So what I'm wondering now is:

  • How can I change the definition to make this type-theoretically more pleasant? I've thought about indexing by Fintypes instead of Fin n and another idea where we modify composition so that we only compose one input at the time, but none of the two ideas seem to help. Perhaps approaching this through categories of operators helps, i.e. allowing multiple outputs too, in the same way higher operads are done.
  • Are there any thoughts on the feasibility of developing a term notation as above (or something something similar)? How would you go about it? I am really inexperienced with metaprogramming and macros.

Aaron Liu (Oct 13 2025 at 20:28):

Adrian Marti said:

  • Are there any thoughts on the feasibility of developing a term notation as above (or something something similar)? How would you go about it? I am really inexperienced with metaprogramming and macros.

I remember doing this for cartesian closed categories although now that I'm a bit more experienced with metaprogramming I could probably come up with a better implementation now.

Aaron Liu said:

Here's a prototype I wrote

It's a bit long


Adrian Marti (Oct 13 2025 at 20:31):

I will have a look soon, I think that notation for arrows in CC categories is also something really useful (it also subsumes the cartesian category case).

Adrian Marti (Oct 20 2025 at 18:14):

Sorry for not taking the time earlier, but this is pretty cool :slight_smile: FYI, CategoryTheory.CartesianClosed.applyMapHom does not build on newer mathlib versions.

Adrian Marti (Oct 20 2025 at 18:15):

I was also wondering why the type of the example ~funₑ (g : Y ⟹ Z) (f : X ⟹ Y) (x : X) => g (f x) at the bottom is Y ⟹ Z ⟶ (X ⟹ Y) ⟹ X ⟹ Z.

Adrian Marti (Oct 20 2025 at 18:17):

Wait it actually makes sense, it's just the curried version of ((Y ⟹ Z) ⊗ (X ⟹ Y) ⊗ X) ⟶ Z

Adrian Marti (Oct 20 2025 at 18:19):

And maybe the generated term in the example can be simplified a bit so that it can be worked with better in proofs.


Last updated: Dec 20 2025 at 21:32 UTC