8
$\begingroup$

Suppose I have a string diagram $D$ which involves a set of strings $S$ and atomic processes $A$. Formally, we should think of this as a canonically chosen map in the free symmetric monoidal category (SMC) $Free(D)$ generated by objects $S$ and arrows $A\rightrightarrows List(S)$.

Now suppose that I assign a duration to each atomic process $d:A\to\mathbb{R}^+$. I would like to extend this to all the maps in $Free(D)$ and, ideally, this assignment would define a functor on $Free(D)$.

Intuitively, the extension (also denoted $d$) would be defined by $d(f\circ g)=d(f)+d(g)$ and $d(f\otimes g)=max(d(f),d(g))$.

A problem arises for diagrams like this:

---(f)---(g)---

---(h)---(k)---

On one hand, the SMC laws tell us that $$(g\circ f)\otimes (k\circ h)=(g\otimes k)\circ(f\otimes h),$$ but in general we only know that $$\max(d(f)+d(g),d(k)+d(h)) \leq \max(d(f),d(h))+\max(d(g),d(k)).$$

Of course, the assignment of durations to diagrams is not difficult to describe algorithmically: for each path through the diagram, sum up the durations along that path, and take the maximum over those sums (though there are certainly better algorithms).

Ultimately, I am less interested in how to calculate the duration of a diagram, and more interested in whether/how we can express that assignment functorially?

$\endgroup$
3
  • 1
    $\begingroup$ The first question to answer is what the target category should be. Based on your comments it should be the symmetric monoidal category with one object whose endomorphisms form the commutative semiring $\mathbb{R}$ under addition and max. Unfortunately, you simply don't get a (symmetric monoidal) functor this way: the diagram you wrote down shows that if you write a process as a composition or tensor product of two other processes, the duration of the whole thing is not determined by the duration of the subthings. You need some laxness, I guess. $\endgroup$ Mar 18, 2016 at 16:18
  • $\begingroup$ @Quaochu: Indeed you are correct. There seem to be (at least) two ways out. One is to modify the target category. (1) One option is to take the positive reals with their usual order (is this the delooping of the one-object category?); however, this forces us to make some unnatural choices such as, e.g., mapping input objects to 0 or something similar. (2) Alternatively, we might be able to leave the target category alone and represent the assignment as a lax functor. $\endgroup$
    – pnips
    Mar 18, 2016 at 17:42
  • $\begingroup$ Sorry, I misspoke. In fact a symmetric monoidal category with one object is just a commutative monoid, not a commutative semiring. So you're forced to choose between addition and max for the composition operation; can't have both. This means the target probably shouldn't have one object. $\endgroup$ Mar 19, 2016 at 4:13

1 Answer 1

3
$\begingroup$

As you correctly note, the overall duration alone is not compositional data on your processes/diagrams. However, the algorithm you describe gives a clue as to how one could obtain duration data on processes which IS compositional, given the same data on the atomic processes.

Instead of keeping track of the overall duration of a process, you can keep track of the minimum duration from any input of the process to any output of the process. When two processes compose (in sequence or in parallel) you can then use the data for each process to compute data for the composite process, as sketched in your algorithm. For atomic processes, you can set the minimum time to be the same number from any input to any output (or you can use a more sophisticated assignment, if you wish). The overall duration for a process is obtained (non-compositionally) by taking the maximum of the minimum times between any input and any output.

To make it formal, let $(R, \max, -\infty, +, 0)$ be any semiring (e.g. the max-plus semiring $\mathbb{R}^+ \sqcup\{-\infty\}$) and consider the symmetric monoidal category $\text{Mat}(R)$ of $R$-valued matrices, with matrix multiplication as composition and direct sum as monoidal product. The duration data described above for a process is easily encoded in a matrix $M$: columns indexed by inputs, rows indexed by outputs, element $M_{i, j}$ encoding the "minimum duration" from the $i$-th input to the $j$-th output. The overall process duration is then the maximum $\max_{i,j}M_{i,j}$ of the matrix elements.

Any assignment of $R$-valued matrices to the atomic processes automatically extends to a monoidal functor, by sending sequential composition of processes to the multiplication of the corresponding matrices and parallel composition of processes to the direct sum of the corresponding matrices. The only thing to check is that the matrices thus associated to sequential and parallel compositions actually encode the data described informally above.

If two processes with matrices $M$ and $N$ are composed in sequence, the matrix for the sequential composition is the matrix product $NM$, encoding the following minimum process duration from input $k$ to output $i$: $$ (NM)_{ik} = \max_j\left(N_{ij}+M_{jk}\right) $$ This is the maximum over all paths from input $k$ to output $i$, as expected.

If two processes with matrices $M$ and $N$ are composed in parallel, the matrix for the parallel composition is the matrix direct sum $M \oplus N$, encoding the following minimum process duration from input $k$ to output $i$:

  • if $k$ and $i$ are an input and an output of the first process, $(M \oplus N) = M_{ik}$;
  • if $k$ and $i$ are an input and an output of the second process, $(M \oplus N) = N_{ik}$;
  • otherwise, $(M \oplus N) = -\infty$.

This is also as expected: the $-\infty$ indicates that there are no paths between inputs of one process and outputs of the other, and hence there are no minimum duration requirements from one to the other.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.