#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Options

# Lecture 69 - Chapter 4: Feedback in Collaborative Design

edited February 17

Okay, now we've got all the machinery set up to study co-design diagrams with feedback. Today let's consider a very simple one. This describes someone who buys bread and then sells it, perhaps at a higher price. This is described by the composite of two feasibility relations:

$$\mathrm{Purchase} \colon \mathbb{N} \nrightarrow \mathbb{N}$$ and

$$\mathrm{Sell} \colon \mathbb{N} \nrightarrow \mathbb{N}$$ where $$\mathbb{N}$$ is the set of natural numbers given its usual ordering $$\le$$.

Be careful about which way these feasibility relations go:

• $$\mathrm{Purchase}(j,k) = \texttt{true}$$ if you can purchase $$j$$ loaves of bread for $$k$$ dollars.

• $$\mathrm{Sell}(i,j) = \texttt{true}$$ if you can make $$i$$ dollars selling $$j$$ loaves of bread.

The variable at right is the 'resource', while the variable at left describes what you can obtain using this resource. For example, in purchasing bread, $$\mathrm{Purchase}(j,k) = \text{true}$$ if starting with $$k$$ dollars as your 'resource' you can buy $$j$$ loaves of bread. This is an arbitrary convention, but it's the one in the book!

When we compose these we get a feasibility relation

$$\mathrm{Purchase} \mathrm{Sell} \colon \mathbb{N} \to \mathbb{N}$$ (and again, there's an annoying arbitrary choice of convention in the order here). We have

• $$(\mathrm{Purchase}\mathrm{Sell})(i,k) = \text{true}$$ if you can make $$i$$ dollars if you have $$k$$ dollars to purchase bread which you then sell.

I haven't said what the feasibility relations $$\mathrm{Purchase}$$ and $$\mathrm{Sell}$$ actually are: they could be all sorts of things. But let's pick something specific, so you can do some computations with them. Let's keep it very simple: let's say you can buy a loaf of bread for $$2$$ and sell it for $$3$$.

Puzzle 218. Write down a formula for the feasibility relation $$\mathrm{Purchase}.$$

Puzzle 219. Write down a formula for the feasibility relation $$\mathrm{Sell}.$$

Puzzle 220. Compute the composite feasibility relation $$\mathrm{Purchase} \mathrm{Sell}$$. (Hint: we discussed composing feasibility relations in Lecture 58.)

That was just a warmup. Now let's introduce feedback! Now you can reinvest some of the money you make to buy more loaves of bread! That creates a 'feedback loop'. Obviously this changes things dramatically: now you can start with a little money and keep making more. But how does the mathematics work now?

First, you'll notice this feedback loop has a cap at left and a cup at right. I defined these last time.

But this feedback loop also involves two feasibility relations called $$\hat{\textstyle{\sum}}$$ and $$\check{\textstyle{\sum}}$$. We use the one at left,

$$\hat{\textstyle{\sum}} \colon \mathbb{N} \times \mathbb{N} \nrightarrow \mathbb{N} ,$$ to say that the money we reinvest (which loops back), plus the money we take as profit (which comes out of the diagram at left), equals the money we make by selling bread.

We use the one at right,

$$\check{\textstyle{\sum}} \colon \mathbb{N} \nrightarrow \mathbb{N} \times \mathbb{N} ,$$ to say that the money we have reinvested (which has looped around), plus the new money we put in (which comes into the diagram at right), equals the money we use to purchase bread.

These two feasibility relations are both built from the monotone function

$$\textstyle{\sum} \colon \mathbb{N} \times \mathbb{N} \nrightarrow \mathbb{N}$$ defined in the obvious way:

$$\textstyle{\sum}(m,n) = m + n .$$ Remember, we saw in Lecture 65 that any monotone function $$F \colon \mathcal{X} \to \mathcal{Y}$$ gives two feasibility relations, its 'companion' $$\hat{F} \colon \mathcal{X} \nrightarrow \mathcal{Y}$$ and its 'conjoint' $$\check{F} \colon \mathcal{Y} \nrightarrow \mathcal{X}$$.

Puzzle 221. Give a formula for the feasibility relation $$\hat{\textstyle{\sum}} \colon \mathbb{N} \times \mathbb{N} \nrightarrow \mathbb{N}$$. In other words, say when $$\hat{\textstyle{\sum}}(a,b,c) = \texttt{true}$$.

Puzzle 222. Give a formula for the feasibility relation $$\check{\textstyle{\sum}} \colon \mathbb{N} \nrightarrow \mathbb{N} \times \mathbb{N}$$.

And now finally for the big puzzle that all the others were leading up to:

Puzzle 223. Give a formula for the feasibility relation described by this co-design diagram: You can guess the answer, and then you can work it systematically by composing and tensoring the feasibility relations defined by the boxes, the cap and the cup! This is a good way to make sure you understand everything I've been talking about lately.

To read other lectures go here.

• Options
1.
edited August 2018

I have labeled the wires of the co-design diagram above as follows: Puzzle 218 $$\mathrm{Purchase}(j,k) = \begin{cases} \texttt{true} & \mbox{if } j \leq \frac{k}{2} \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$$ Puzzle 219 $$\mathrm{Sell}(i,j) = \begin{cases} \texttt{true} & \mbox{if } i \leq 3j \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$$ Puzzle 220 $$\mathrm{PurchaseSell}(i,k) = \begin{cases} \texttt{true} & \mbox{if } i \leq \frac{3k}{2} \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$$ Puzzle 221 $$\hat{\textstyle{\sum}}(a,x,i) = \begin{cases} \texttt{true} & \mbox{if } a+x \leq i \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$$ Puzzle 222 $$\check{\textstyle{\sum}}(k,b,x) = \begin{cases} \texttt{true} & \mbox{if } k \leq b+x \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$$ Puzzle 223 $$\hat{\textstyle{\sum}} \circ \mathrm{Sell} \circ \mathrm{Purchase} \circ \check{\textstyle{\sum}}(a,x,b) = \begin{cases} \texttt{true} & \mbox{if } a \leq \frac{3b+x}{2} \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$$

Comment Source:I have labeled the wires of the co-design diagram above as follows: ![Codesign Flowchart](http://aether.co.kr/images/codesign_flowchart.svg) **Puzzle 218** $\mathrm{Purchase}(j,k) = \begin{cases} \texttt{true} & \mbox{if } j \leq \frac{k}{2} \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$ **Puzzle 219** $\mathrm{Sell}(i,j) = \begin{cases} \texttt{true} & \mbox{if } i \leq 3j \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$ **Puzzle 220** $\mathrm{PurchaseSell}(i,k) = \begin{cases} \texttt{true} & \mbox{if } i \leq \frac{3k}{2} \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$ **Puzzle 221** $\hat{\textstyle{\sum}}(a,x,i) = \begin{cases} \texttt{true} & \mbox{if } a+x \leq i \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$ **Puzzle 222** $\check{\textstyle{\sum}}(k,b,x) = \begin{cases} \texttt{true} & \mbox{if } k \leq b+x \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$ **Puzzle 223** $\hat{\textstyle{\sum}} \circ \mathrm{Sell} \circ \mathrm{Purchase} \circ \check{\textstyle{\sum}}(a,x,b) = \begin{cases} \texttt{true} & \mbox{if } a \leq \frac{3b+x}{2} \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$
• Options
2.

Hi, Michael!

Your solutions to Puzzles 218-222 look right to me. Great!

Your solution to Puzzle 223 can't be right because the co-design diagram I drew, and yours too, has just one 'input wire' and one 'output wire', so the feasibility relation described by this diagram must be a relation between two variables: the number of dollars taken in and the number of dollars you make in the end. Also, the left-hand side of your final equation doesn't involve the cap or cup, which are the essence of feedback.

Comment Source:Hi, Michael! Your solutions to Puzzles 218-222 look right to me. Great! Your solution to Puzzle 223 can't be right because the co-design diagram I drew, and yours too, has just one 'input wire' and one 'output wire', so the feasibility relation described by this diagram must be a relation between two variables: the number of dollars taken in and the number of dollars you make in the end. Also, the left-hand side of your final equation doesn't involve the cap or cup, which are the essence of feedback.
• Options
3.
edited August 2018

Is Puzzle 223 especially hard? It might be easiest to start by just solving it using common sense. A certain amount of money, say $$j$$ dollars, comes in from the right. It gets added to the money that's gone around the feedback loop. You can use the total to buy loaves of bread; then you can sell those to make money. Some of this money you can send back around the loop, while you keep the amount that pops out at left, say $$i$$ dollars. What pairs $$(i,j)$$ are allowed? That's all I'm asking here.

It's important to remember that since we're studying feasibility relations, it counts as feasible to buy fewer loaves of bread than you possibly can, and also sell fewer of them than you possible can. Remember, if a feasibility relation is true for some pair $$(a,b)$$, it's also true for some other pair $$(a',b')$$ if $$a' \le a$$ and $$b \le b'$$.

After you've solved this problem using common sense, you can solve it by composing and tensoring feasibility relations. This is how we assemble the little boxes, the cap and the cup into the solution to the puzzle. This merely formalizes your common sense! When you're using common sense, you should be thinking about what's feasible for each little box, the cap, and the cup, and how these fit together to determine what's feasible for the whole situation. Composition is doing one thing after another. Tensoring is doing two things in parallel.

Comment Source:Is Puzzle 223 especially hard? <center><img src = "http://math.ucr.edu/home/baez/mathematical/7_sketches/codesign_diagram_purchase_sell_feedback.png"></center> It might be easiest to start by just solving it using common sense. A certain amount of money, say \$$j\$$ dollars, comes in from the right. It gets added to the money that's gone around the feedback loop. You can use the total to buy loaves of bread; then you can sell those to make money. Some of this money you can send back around the loop, while you keep the amount that pops out at left, say \$$i\$$ dollars. What pairs \$$(i,j)\$$ are allowed? That's all I'm asking here. It's important to remember that since we're studying feasibility relations, it counts as feasible to buy fewer loaves of bread than you possibly can, and also sell fewer of them than you possible can. Remember, if a feasibility relation is true for some pair \$$(a,b) \$$, it's also true for some other pair \$$(a',b') \$$ if \$$a' \le a\$$ and \$$b \le b' \$$. After you've solved this problem using common sense, you can solve it by [composing and tensoring feasibility relations](https://forum.azimuthproject.org/discussion/2300/lecture-66-chapter-4-collaborative-design/p1). This is how we assemble the little boxes, the cap and the cup into the solution to the puzzle. This merely formalizes your common sense! When you're using common sense, you should be thinking about what's feasible for each little box, the cap, and the cup, and how these fit together to determine what's feasible for the whole situation. Composition is doing one thing after another. Tensoring is doing two things in parallel. 
• Options
4.
edited August 2018

Not sure if I was allowed to do this but feedback systems always involve fractions (probably due to $$X^{op}$$) so I tried introducing one more equation because it was the only way to get rid of the variable x.

So we allocate a certain fraction $$0 \leq q \leq 1$$ of profits back into reinvestment:

$$x = qi \tag{1}$$ Plug this into the equation for i :

$$i = \frac{3k}{2} = \frac{3(b+x)}{2} = \frac{3(b+qi)}{2} = \left(\frac{3}{2-3q} \right)b \tag{2}$$ Then we plug (1) and (2) into the equation for a:

$$a = i-x = i-qi = (1-q)i =\left(\frac{3(1-q)}{2-3q}\right)b \tag{3}$$ so we can define the feasibility relation $$\Phi$$ to be:

$$\Phi = (\cup_x \times 1_a) \circ (1_{x^{op}} \times \hat{\textstyle{\sum}}) \circ (1_{x^{op}} \times \mathrm{Sell}) \circ (1_{x^{op}} \times \mathrm{Purchase}) \circ (1_{x^{op}} \times \check{\textstyle{\sum}}) \circ (\cap_x \times 1_b)$$ $$\Phi(a,b) = \begin{cases} \texttt{true} & \mbox{if } a \leq \left(\frac{3(1-q)}{2-3q}\right)b \text{ where } 0 \leq q \leq 1\\ \texttt{false} & \mbox{otherwise.} \end{cases}$$

Comment Source:Not sure if I was allowed to do this but feedback systems always involve fractions (probably due to \$$X^{op}\$$) so I tried introducing one more equation because it was the only way to get rid of the variable x. So we allocate a certain fraction \$$0 \leq q \leq 1\$$ of profits back into reinvestment: $x = qi \tag{1}$ Plug this into the equation for i : $i = \frac{3k}{2} = \frac{3(b+x)}{2} = \frac{3(b+qi)}{2} = \left(\frac{3}{2-3q} \right)b \tag{2}$ Then we plug (1) and (2) into the equation for a: $a = i-x = i-qi = (1-q)i =\left(\frac{3(1-q)}{2-3q}\right)b \tag{3}$ so we can define the feasibility relation \$$\Phi\$$ to be: $\Phi = (\cup_x \times 1_a) \circ (1_{x^{op}} \times \hat{\textstyle{\sum}}) \circ (1_{x^{op}} \times \mathrm{Sell}) \circ (1_{x^{op}} \times \mathrm{Purchase}) \circ (1_{x^{op}} \times \check{\textstyle{\sum}}) \circ (\cap_x \times 1_b)$ $\Phi(a,b) = \begin{cases} \texttt{true} & \mbox{if } a \leq \left(\frac{3(1-q)}{2-3q}\right)b \text{ where } 0 \leq q \leq 1\\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$ 
• Options
5.

I found it hard to guess an intuitive answer to Puzzle 223, because my notion of feedback doesn't seem to match that of the picture. I would imagine that you put $50 dollars into the business, so you can buy 25 loaves of bread, then you can sell them for$75. So you can then take $1 out of the business and plough the$74 dollars back in and buy 37 loaves of bread. You're feeling a bit hungry at this point, so you eat a loaf, and unfortunately goes mouldy, so you have to throw it away. Anyway you now sell these 35 loaves of bread for $105, take out$35 and buy another 40 loaves of bread. Etc. Etc.

The problem I have is that this view of feedback involves evolution over time, but I don't see time in the categorical model of the process here!

Anyway, working with this picture I have in my head, I would say that you can any amount $P on the output, regardless of what is going on the input as you could be in the situation that you have$100P going back round the feedback loop, which would give you enough money to sustain that level of profit and that reinvestment.

I haven't done the calculation yet...

Comment Source:I found it hard to guess an intuitive answer to Puzzle 223, because my notion of feedback doesn't seem to match that of the picture. I would imagine that you put $50 dollars into the business, so you can buy 25 loaves of bread, then you can sell them for$75. So you can then take $1 out of the business and plough the$74 dollars back in and buy 37 loaves of bread. You're feeling a bit hungry at this point, so you eat a loaf, and unfortunately goes mouldy, so you have to throw it away. Anyway you now sell these 35 loaves of bread for $105, take out$35 and buy another 40 loaves of bread. Etc. Etc. The problem I have is that this view of feedback involves evolution over time, but I don't see time in the categorical model of the process here! Anyway, working with this picture I have in my head, I would say that you can any amount $P on the output, regardless of what is going on the input as you could be in the situation that you have$100P going back round the feedback loop, which would give you enough money to sustain that level of profit and that reinvestment. I haven't done the calculation yet... 
• Options
6.
edited August 2018

After some thought (and computation!), I see that my $100P can be reduced to$rP where r is a much smaller number than 100 (but still a nice round number).

Comment Source:After some thought (and computation!), I see that my $100P can be reduced to$rP where r is a much smaller number than 100 (but still a nice round number). 
• Options
7.
edited August 2018

Michael, be aware that your $$\check\Sigma$$ is not the same as John's $$\check\Sigma$$. His has two input and one output, yours has one input, one output and one wire going up in the air, neither an input nor an output. (You probably are aware of this, but be aware that this kind of shortcut can catch you out.)

One thing you might try doing with your calculation is compute an intermediate composite like

$$(\mathrm{Sell}\otimes \mathrm{Id})\circ(\mathrm{Purchase}\otimes \mathrm{Id})\circ\ (\check \Sigma\otimes \mathrm{Id})\circ(\mathrm{Id}\otimes \cup)$$ and then compute the whole thing.

Comment Source:Michael, be aware that your \$$\check\Sigma\$$ is not the same as John's \$$\check\Sigma\$$. His has two input and one output, yours has one input, one output and one wire going up in the air, neither an input nor an output. (You probably are aware of this, but be aware that this kind of shortcut can catch you out.) One thing you might try doing with your calculation is compute an intermediate composite like $(\mathrm{Sell}\otimes \mathrm{Id})\circ$$\mathrm{Purchase}\otimes \mathrm{Id})\circ\ (\check \Sigma\otimes \mathrm{Id})\circ(\mathrm{Id}\otimes \cup)$ and then compute the whole thing. • Options 8. edited August 2018 Simon wrote: Michael, be aware that your \(\check\Sigma$$ is not the same as John's $$\check\Sigma$$. His has two input and one output, yours has one input, one output and one wire going up in the air, neither an input nor an output. (You probably are aware of this, but be aware that this kind of shortcut can catch you out.

Thanks for helping out! Michael's $$\check\Sigma$$ seemed to match mine when he solved Puzzle 222:

$$\check{\textstyle{\sum}}(k,b,x) = \begin{cases} \texttt{true} & \mbox{if } k \leq b+x \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$$

To be more specific, $$\check\Sigma \colon \mathbb{N} \to \mathbb{N} \times \mathbb{N}$$ says that the input is $$\le$$ the sum of the two outputs.

But when he first tried to compute the feasibility relation for this diagram: he gave a relation between three variables instead of two, which couldn't possibly be right since this box has one input and one output. I have a feeling his third variable was supposed to be the number of dollars on the feedback wire.

One thing you might try doing with your calculation is compute an intermediate composite like

$$(\mathrm{Id} \otimes \mathrm{Sell})\circ (\mathrm{Id} \otimes \mathrm{Purchase}) \circ\ (\mathrm{Id} \otimes \check \Sigma)\circ(\cup \otimes \mathrm{Id})$$ and then compute the whole thing.

This is what I expected people to do. I think the problem is that I haven't given enough puzzles where you have to take a co-design diagram and write it out in terms of composites and tensors of the basic building blocks together with caps, cups and identities.

So, a good preliminary puzzle is:

Puzzle. What co-design diagram corresponds to this feasibility relation:

$$(\mathrm{Id} \otimes \mathrm{Sell})\circ (\mathrm{Id} \otimes \mathrm{Purchase}) \circ\ (\mathrm{Id} \otimes \check \Sigma)\circ(\cup \otimes \mathrm{Id}) \quad ?$$

(By the way, I changed your formula because we are reading tensor products from the top to the bottom: for example, $$\mathrm{Id} \otimes \mathrm{Sell}$$ means an identity wire on top of a $$\mathrm{Sell}$$ box! This is one of the $$2^n$$ arbitrary conventions in this game.

Comment Source:Simon wrote: > Michael, be aware that your \$$\check\Sigma\$$ is not the same as John's \$$\check\Sigma\$$. His has two input and one output, yours has one input, one output and one wire going up in the air, neither an input nor an output. (You probably are aware of this, but be aware that this kind of shortcut can catch you out. Thanks for helping out! Michael's \$$\check\Sigma\$$ seemed to match mine when he solved Puzzle 222: > $\check{\textstyle{\sum}}(k,b,x) = \begin{cases} \texttt{true} & \mbox{if } k \leq b+x \\\\ \texttt{false} & \mbox{otherwise.} \end{cases}$ To be more specific, \$$\check\Sigma \colon \mathbb{N} \to \mathbb{N} \times \mathbb{N} \$$ says that the input is \$$\le\$$ the sum of the two outputs. But when he first tried to compute the feasibility relation for this diagram: <center><img src = "http://math.ucr.edu/home/baez/mathematical/7_sketches/codesign_diagram_purchase_sell_feedback.png"></center> he gave a relation between three variables instead of two, which couldn't possibly be right since this box has one input and one output. I have a feeling his third variable was supposed to be the number of dollars on the feedback wire. > One thing you might try doing with your calculation is compute an intermediate composite like > $(\mathrm{Id} \otimes \mathrm{Sell})\circ (\mathrm{Id} \otimes \mathrm{Purchase}) \circ\ (\mathrm{Id} \otimes \check \Sigma)\circ(\cup \otimes \mathrm{Id})$ > and then compute the whole thing. This is what I expected people to do. I think the problem is that I haven't given enough puzzles where you have to take a co-design diagram and write it out in terms of composites and tensors of the basic building blocks together with caps, cups and identities. So, a good preliminary puzzle is: **Puzzle.** What co-design diagram corresponds to this feasibility relation: > > $(\mathrm{Id} \otimes \mathrm{Sell})\circ (\mathrm{Id} \otimes \mathrm{Purchase}) \circ\ (\mathrm{Id} \otimes \check \Sigma)\circ(\cup \otimes \mathrm{Id}) \quad ?$ (By the way, I changed your formula because we are reading tensor products from the top to the bottom: for example, \$$\mathrm{Id} \otimes \mathrm{Sell}\$$ means an identity wire on top of a \$$\mathrm{Sell} \$$ box! This is one of the \$$2^n\$$ arbitrary conventions in this game. 
• Options
9.

Question: which way is time 'flowing' in this string diagram? Is it right-to-left?

Also, an idea came up in my head in the past 5 minutes. Could we view Costs and Prices as being adjoint to each other?

Could we describe value theory in terms of adjoints?

Comment Source:Question: which way is time 'flowing' in this string diagram? Is it right-to-left? Also, an idea came up in my head in the past 5 minutes. Could we view **Costs** and **Prices** as being adjoint to each other? Could we describe value theory in terms of adjoints? 
• Options
10.

Yeah, right to left, though that means that the top part is flowing backwards in time, which makes it more a zero interest loan rather than a savings account.

Comment Source:Yeah, right to left, though that means that the top part is flowing backwards in time, which makes it more a zero interest loan rather than a savings account.
• Options
11.
edited August 2018

Well, buying something in order to sell it at either a greater price or enough to cover costs is called arbitrage.

So we rediscovered arbitraging, but in $$\mathbf{Bool}$$-profunctor form.

Comment Source:Well, buying something in order to sell it at either a greater price or enough to cover costs is called *arbitrage*. So we rediscovered arbitraging, but in \$$\mathbf{Bool}\$$-profunctor form.
• Options
12.
edited August 2018

Keith, I posted my comment above to try to explain how I got confused here. (I assumed no one else had answered as everyone was confused, so I thought I would try to express my confusion to encourage others.) I think I didn't express my confusion very well.

As Lou Reed said: "There is no time." This is what I found confusing. John asked us to make an intuitive guess first and I think that most people (including me!) would intuitively think of some process through time, with dollar bills travelling round the diagrams. However, the diagram is representing (I think!) a frozen, stable snapshot.

For a given pair (input, output) of values for the input and output of the big diagram, can you assign values to the inputs and outputs of the subcomponents which makes the whole thing feasible.

I look forward to hearing John's take on this.

Comment Source:Keith, I posted my comment above to try to explain how I got confused here. (I assumed no one else had answered as everyone was confused, so I thought I would try to express my confusion to encourage others.) I think I didn't express my confusion very well. As Lou Reed said: "There is no time." This is what I found confusing. John asked us to make an intuitive guess first and I think that most people (including me!) would intuitively think of some process through time, with dollar bills travelling round the diagrams. However, the diagram is representing (I think!) a frozen, stable snapshot. For a given pair (input, output) of values for the input and output of the big diagram, can you assign values to the inputs and outputs of the subcomponents which makes the whole thing feasible. I look forward to hearing John's take on this.
• Options
13.

Yes, that's usually my issue with feedback loops and traces. I mean, an intuitive thought that comes to mind is that somehow the output is affecting past through the 'backward flow' at the top.

However, there is no time-travel going on here, so 'backward flow' affecting the past must be off.

It was Bob Coecke that helped me realize that this 'backward flow' is a constraining factor.

The paper The Two Dualities of Computation: Negative and Fractional Types gives this more explicitly but using types. Though the basic idea is the same.

Comment Source:Yes, that's usually my issue with feedback loops and traces. I mean, an intuitive thought that comes to mind is that somehow the output is affecting past through the 'backward flow' at the top. However, there is no time-travel going on here, so 'backward flow' affecting the past must be off. It was Bob Coecke that helped me realize that this 'backward flow' is a *constraining* factor. The paper [The Two Dualities of Computation: Negative and Fractional Types](https://www.cs.indiana.edu/~sabry/papers/rational.pdf) gives this more explicitly but using types. Though the basic idea is the same.
• Options
14.

Yes. That is a good summary. (And is why you can define fractional types as constraints, but trying to define negative types as iteration fails.)

Comment Source:Yes. That is a good summary. (And is why you can define fractional types as constraints, but trying to define negative types as iteration fails.)
• Options
15.

Well, the paper describes 'Negative types' (or negative objects for us category theorists) as having 'a computational interpretation related to continuations: negative types denote values that backtrack to satisfy dependencies, or in other words act as debts that are satisfied by the backward flow of information.'

In fact, their use of the word 'debt' here may be more on point for our above example. The 'backflow' in the example is like a virtual debt.

Comment Source:Well, the paper describes 'Negative types' (or negative objects for us category theorists) as having 'a computational interpretation related to continuations: negative types denote values that backtrack to satisfy dependencies, or in other words act as debts that are satisfied by the backward flow of information.' In fact, their use of the word 'debt' here may be more on point for our above example. The 'backflow' in the example is like a virtual debt.
• Options
16.

OK, so the intuitive answer to puzzle 223 must surely be that for integers i,j, when j > 2, or when i is 0, the functor maps (i,j) to True, else False. Conceptually, I was tripped up by the same issue as others, than the analogy of a circuit falls short because circuits act over time. Instead, the feasibility relation needs to be evaluated with fixed values (the dynamic notion of feedback is somehow implicit in this, which is cool). E.g., if I have 2 dollars as input, and sum that with 10 dollars, I can buy 6 loaves of bread, sell them for 18 dollars, send 10 back, and output 8. So (8,2) is a pair in the characteristic set (so to speak) of the feasibility relation. As is (7,2), (8,3) etc, because this is a feasibility relation. Of course, I'm not actually answering the question yet, because the point is that the formalism actually should actually yield the intuitive answer I'm giving. Work in progress. Something about the op stuff is throwing me off.

Comment Source:OK, so the intuitive answer to puzzle 223 must surely be that for integers i,j, when j > 2, or when i is 0, the functor maps (i,j) to True, else False. Conceptually, I was tripped up by the same issue as others, than the analogy of a circuit falls short because circuits act over time. Instead, the feasibility relation needs to be evaluated with fixed values (the dynamic notion of feedback is somehow implicit in this, which is cool). E.g., if I have 2 dollars as input, and sum that with 10 dollars, I can buy 6 loaves of bread, sell them for 18 dollars, send 10 back, and output 8. So (8,2) is a pair in the characteristic set (so to speak) of the feasibility relation. As is (7,2), (8,3) etc, because this is a feasibility relation. Of course, I'm not actually answering the question yet, because the point is that the formalism actually should actually yield the intuitive answer I'm giving. Work in progress. Something about the op stuff is throwing me off.
• Options
17.

Reuben, why do you need $$j>2$$?

Comment Source:Reuben, why do you need \$$j>2\$$?
• Options
18.

Oops, I meant j >= 2

Comment Source:Oops, I meant j >= 2
• Options
19.

Okay, let me rephrase the question. Why do you need $$j\ge 2$$? :-)

Comment Source:Okay, let me rephrase the question. Why do you need \$$j\ge 2\$$? :-)
• Options
20.

Well, intuitively, if j is 1 or 0, then you can't get the process started by buying a loaf of bread. But yes, unclear how this relates to the maths: time to actually think this through properly.

Comment Source:Well, intuitively, if j is 1 or 0, then you can't get the process started by buying a loaf of bread. But yes, unclear how this relates to the maths: time to actually think this through properly.
• Options
21.

When you go to a store to buy something, do you think in terms of absolutes (if I have at least $2 then I can buy a loaf of bread), or do you think in terms of ratios (if I have at least$2x then I can buy x loafs of bread)?

Comment Source:When you go to a store to buy something, do you think in terms of absolutes (if I have at least $2 then I can buy a loaf of bread), or do you think in terms of ratios (if I have at least$2x then I can buy x loafs of bread)?
• Options
22.
edited August 2018

Here's a formula for this composite:

$$f = (\mathrm{Id} \otimes \check \Sigma)(\mathrm{Id} \otimes \mathrm{Purchase}) (\mathrm{Id} \otimes \mathrm{Sell})(\mathrm{Id} \otimes \hat\Sigma)$$ It has this type signature $$f: Z \otimes X \nrightarrow Z \otimes Y$$

$$f((z,x),(z',y)) = \begin{cases} \mathrm{true} & z+x \le 3 \lfloor \frac{z'+y}{2}\rfloor\\ \mathrm{false} & \end{cases}$$

Comment Source: Here's a formula for this composite: $f = (\mathrm{Id} \otimes \check \Sigma)(\mathrm{Id} \otimes \mathrm{Purchase}) (\mathrm{Id} \otimes \mathrm{Sell})(\mathrm{Id} \otimes \hat\Sigma)$ It has this type signature \$$f: Z \otimes X \nrightarrow Z \otimes Y \$$ $f((z,x),(z',y)) = \begin{cases} \mathrm{true} & z+x \le 3 \lfloor \frac{z'+y}{2}\rfloor\\\ \mathrm{false} & \end{cases}$ 
• Options
23.
edited August 2018

Scott, so it looks like you're calculating the diagram without the cup and the cap at the ends, right? In that case it has three natural number inputs and three natural number outputs, so should be a profunctor $$\mathbb{N}\otimes \mathbb{N}\otimes \mathbb{N}\nrightarrow \mathbb{N}\otimes \mathbb{N}\otimes \mathbb{N}$$; there's not $$X$$s or $$Y$$s here. I think you've forgotten the uninteresting strand at the top.

I believe this means you should have something like the following, where you need to fill in the extra condition!

$$f((w,z,x),(w',z',y)) = \begin{cases} \mathrm{true} & z+x \le 3 \lfloor \frac{z'+y}{2}\rfloor \quad\text{and}\quad\text{condition on } w, w'\\ \mathrm{false} & \end{cases}$$

Comment Source:Scott, so it looks like you're calculating the diagram without the cup and the cap at the ends, right? In that case it has three natural number inputs and three natural number outputs, so should be a profunctor \$$\mathbb{N}\otimes \mathbb{N}\otimes \mathbb{N}\nrightarrow \mathbb{N}\otimes \mathbb{N}\otimes \mathbb{N}\$$; there's not \$$X\$$s or \$$Y\$$s here. I think you've forgotten the uninteresting strand at the top. I believe this means you should have something like the following, where you need to fill in the extra condition! $f((w,z,x),(w',z',y)) = \begin{cases} \mathrm{true} & z+x \le 3 \lfloor \frac{z'+y}{2}\rfloor \quad\text{and}\quad\text{condition on } w, w'\\\ \mathrm{false} & \end{cases}$ 
• Options
24.

Reuben, you say in your comment #18 that you should consider fixed values. So there's not really a notion of 'getting the process started'. The process should be in a feasible state, but you don't know anything about the 'history' if that word even means anything in this context. (Provided I'm interpreting this correctly, of course!)

Comment Source:Reuben, you say in your comment #18 that you should consider fixed values. So there's not really a notion of 'getting the process started'. The process should be in a feasible state, but you don't know anything about the 'history' if that word even means anything in this context. (Provided I'm interpreting this correctly, of course!)
• Options
25.
edited August 2018

Another intuitive answer to puzzle 223: instead of John's $$(i,j)$$ let me use $$(D, I)$$ where $$D$$ is for dividend and $$I$$ is for initial investment. The first box says $$D + R \leq S$$ where $$R$$ is the re-investment (that loops around) and $$S$$ stands for total sales value. Let me assume that all bread is sold at the same unit price $$p$$, so $$S = p \cdot q^S$$ where $$q^S$$ is the quantity of bread sold; similarly, I assume all bread is bought at the same unit price $$w$$, so $$C = w \cdot q^B$$, where $$C$$ is total costs and $$q^B$$ is the quantity of bread bought, presumably with $$p > w$$ (hence $$p/w > 1$$). So the first box is now $$D + R \leq p \cdot q^S$$ and the second box is $$q^S \leq q^B \Leftrightarrow p \cdot q^S \leq p \cdot q^B$$. The third box says $$C = w \cdot q^B \leq R + I \Leftrightarrow p \cdot q^B \leq (p/w) \cdot (R+I)$$.

Putting all together, we get $$D + R \leq (p/w) \cdot (R+I) \Leftrightarrow D \leq (p/w) \cdot I + ((p/w)-1) \cdot R$$.

Now the question I have is: is $$R$$ a fixed parameter of the system (i.e., we are looking at the system after it has been operating for a while and we see that it reached a steady state with a given value of $$R$$) or a free variable (e.g., we are asking whether there is a state $$R$$ of the system for which a given pair $$(D, I)$$ is a feasible steady state)?

P.S. I have just noticed that John had added the assumptions (in my notation) $$p = 3, w = 2$$. So the final inequality is $$D \leq \frac{3}{2} \cdot I + \frac{1}{2} \cdot R$$.

P.P.S. I think I answered my own question above: by the definition of composition of relations, it is enough to find one value of $$R$$ that satisfies the inequality - and for any $$(D, I)$$ we can always find an $$R$$ that is large enough to satisfy the inequality!

Comment Source:Another intuitive answer to puzzle 223: instead of John's \$$(i,j)\$$ let me use \$$(D, I)\$$ where \$$D\$$ is for dividend and \$$I\$$ is for initial investment. The first box says \$$D + R \leq S\$$ where \$$R\$$ is the re-investment (that loops around) and \$$S\$$ stands for total sales value. Let me assume that all bread is sold at the same unit price \$$p\$$, so \$$S = p \cdot q^S \$$ where \$$q^S\$$ is the quantity of bread sold; similarly, I assume all bread is bought at the same unit price \$$w\$$, so \$$C = w \cdot q^B\$$, where \$$C\$$ is total costs and \$$q^B\$$ is the quantity of bread bought, presumably with \$$p > w\$$ (hence \$$p/w > 1\$$). So the first box is now \$$D + R \leq p \cdot q^S\$$ and the second box is \$$q^S \leq q^B \Leftrightarrow p \cdot q^S \leq p \cdot q^B\$$. The third box says \$$C = w \cdot q^B \leq R + I \Leftrightarrow p \cdot q^B \leq (p/w) \cdot (R+I)\$$. Putting all together, we get \$$D + R \leq (p/w) \cdot (R+I) \Leftrightarrow D \leq (p/w) \cdot I + ((p/w)-1) \cdot R\$$. Now the question I have is: is \$$R\$$ a fixed parameter of the system (i.e., we are looking at the system after it has been operating for a while and we see that it reached a steady state with a given value of \$$R\$$) or a free variable (e.g., we are asking whether there is a state \$$R\$$ of the system for which a given pair \$$(D, I)\$$ is a feasible steady state)? P.S. I have just noticed that John had added the assumptions (in my notation) \$$p = 3, w = 2\$$. So the final inequality is \$$D \leq \frac{3}{2} \cdot I + \frac{1}{2} \cdot R\$$. P.P.S. I think I answered my own question above: by the definition of composition of relations, it is enough to find one value of \$$R\$$ that satisfies the inequality - and for any \$$(D, I)\$$ we can always find an \$$R\$$ that is large enough to satisfy the inequality! 
• Options
26.

Simon wrote

, so it looks like you're calculating the diagram without the cup and the cap at the ends, right?

That's what I did... I forgot to remove the tensor identities. Also I got lazy about writing out natural numbers, hence the X, Y, Z. Since the left part of the tensored profunctors is the identity on an opposite poset (dual poset), the extra condition is that $$w \ge w'$$

$$f((w,z,x),(w',z',y)) = \begin{cases} \mathrm{true} & z+x \le 3 \lfloor \frac{z'+y}{2}\rfloor \ \text{and}\ w \ge w'\\ \mathrm{false} & \end{cases}$$

Comment Source:Simon wrote > , so it looks like you're calculating the diagram without the cup and the cap at the ends, right? That's what I did... I forgot to remove the tensor identities. Also I got lazy about writing out natural numbers, hence the X, Y, Z. Since the left part of the tensored profunctors is the identity on an opposite poset (dual poset), the extra condition is that \$$w \ge w'\$$ $f((w,z,x),(w',z',y)) = \begin{cases} \mathrm{true} & z+x \le 3 \lfloor \frac{z'+y}{2}\rfloor \ \text{and}\ w \ge w'\\\ \mathrm{false} & \end{cases}$ 
• Options
27.

Scott, great! So now you (or someone else) can put the cup and cap on. It is probably easier to do one at a time.

Comment Source:Scott, great! So now you (or someone else) can put the cup and cap on. It is probably easier to do one at a time.
• Options
28.

I would like to solve Puzzle 223 by introducing notation I am more familiar with, as a physicist. I will represent the feasability relations in Einstein notation. I will represent $$\mathrm{True}$$ and $$\mathrm{False}$$ by 1 and 0, respectively. Logical and becomes multiplication. Logical or becomes $$\mathrm{max}$$ (this is empolyed whenever the Einstein summation convention is invoked). Note that cap becomes insertion of the identity, and cup becomes trace/dual pairing (see, for example, Dr. Baez's Fall 2000 Quantum Gravity Seminar notes: Week 2, Track 1).

The big feasablility relation becomes: $(\cup_\circ\hat\Sigma\circ\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap_)^\mu_\nu=\delta_\sigma^\beta\hat\Sigma_\rho^{\mu\sigma}\mathrm{Sell}_\lambda^\rho\mathrm{Purchase}_\gamma^\lambda\check\Sigma_{\alpha\nu}^\gamma\delta_\beta^\alpha$. Where $\begin{matrix}\delta_\beta^\alpha=\begin{cases}1\,\,\mathrm{if}\,\alpha=\beta\\0\,\,\mathrm{otherwise}\end{cases}&\check\Sigma_{\alpha\nu}^\gamma=\begin{cases}1\,\,\mathrm{if}\,\gamma\leq\alpha+\nu\\0\,\,\mathrm{otherwise}\end{cases}&\mathrm{Purchase}_\gamma^\lambda=\begin{cases}1\,\,\mathrm{if}\,C\lambda\leq\gamma\\0\,\,\mathrm{otherwise}\end{cases}\end{matrix}$ $\begin{matrix}\mathrm{Sell}_\lambda^\rho=\begin{cases}1\,\,\mathrm{if}\,\rho\leq P\lambda\\0\,\,\mathrm{otherwise}\end{cases}&\hat\Sigma_\rho^{\mu\sigma}=\begin{cases}1\,\,\mathrm{if}\,\mu+\sigma\leq\rho\\0\,\,\mathrm{otherwise}\end{cases}\end{matrix}$, with $$P$$ being the price at which one sells a piece of bread ($$3$$ in our example), $$C$$ being the cost of buying a piece of bread ($$2$$ in our example), and all indicies having values in $$\mathbb{N}$$.

So that one has $(\mathrm{Purchase}\circ\check\Sigma\circ\cap_)_{\beta\nu}^\lambda=\begin{cases}1\,\,\mathrm{if}\,C\lambda\leq\beta+\nu\\0\,\,\mathrm{otherwise}\end{cases}$ $(\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap_)_{\beta\nu}^\rho=\begin{cases}1\,\,\mathrm{if}\,C\rho\leq P(\beta+\nu)\\0\,\,\mathrm{otherwise}\end{cases}$ $(\hat\Sigma\circ\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap_)_{\beta\nu}^{\mu\sigma}=\begin{cases}1\,\,\mathrm{if}\,C(\mu+\sigma)\leq P(\beta+\nu)\\0\,\,\mathrm{otherwise}\end{cases}$ $(\cup_\circ\hat\Sigma\circ\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap_)_{\beta\nu}^{\mu\beta}=\begin{cases}1\,\,\mathrm{if}\,C(\mu+\beta)\leq P(\beta+\nu)\\0\,\,\mathrm{otherwise}\end{cases}=\begin{cases}1\,\,\mathrm{if}\,C\mu+(C-P)\beta\leq P\nu\\0\,\,\mathrm{otherwise}\end{cases}$. The last expression splits into two cases. If $$0\leq C-P$$, then the inequality is least stringent if $$\beta=0$$ (in the sense that the most $$(\mu,\nu)$$-pairs are allowed). Otherwise, for fixed $$\mu$$ and $$\nu$$, there is always a large enough $$\beta$$ so that the inequality holds. In our example, $$C-P=2-3=-1<0$$, so the allowed $$(\mu,\nu)$$ pairs are all of $$\mathbb{N}\times\mathbb{N}$$. In conclusion, $(\cup_\circ\hat\Sigma\circ\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap_)^\mu_\nu=1$.

So, the big feasability relation is always $$\mathrm{True}$$ (for valid input values). This makes sense if one views the feasability relation as saying what possible stationary states the system can have. After an initial investment of at least $$C=2$$, and a transient period dependent on $$C-P$$ and $$\mu-\nu$$, any valid values of $$\mu$$ and $$\nu$$ can be reached by reinvesting the money earned enough times and/or getting rid of any extra (which is always allowed, for example, by overpaying for bread in $$\mathrm{Purchase}$$). Note that these are stationary states, and not necessarily equilibrium states, since money can flow into and/or out of the system. In particular, this feasability relation models an open system.

Suppose we want to have a closed system instead. One could make this system into a closed system by plugging its output into its input. The resulting feasability relation will be true, since the $$(0,0)$$ stationary state satisfies all of the required inequalities (if $$C-P<0$$ there are also other stationary states that will work).

Comment Source:I would like to solve **Puzzle 223** by introducing notation I am more familiar with, as a physicist. I will represent the feasability relations in [Einstein notation](https://en.wikipedia.org/wiki/Einstein_notation). I will represent \$$\mathrm{True}\$$ and \$$\mathrm{False}\$$ by 1 and 0, respectively. Logical **and** becomes multiplication. Logical **or** becomes \$$\mathrm{max}\$$ (this is empolyed whenever the Einstein summation convention is invoked). Note that cap becomes insertion of the identity, and cup becomes trace/dual pairing (see, for example, Dr. Baez's Fall 2000 Quantum Gravity Seminar notes: [Week 2, Track 1](http://math.ucr.edu/home/baez/qg-fall2000/qg2.1.html)). The big feasablility relation becomes: \$(\cup\_\\circ\hat\Sigma\circ\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap\_\)^\mu\_\nu=\delta\_\sigma^\beta\hat\Sigma\_\rho^{\mu\sigma}\mathrm{Sell}\_\lambda^\rho\mathrm{Purchase}\_\gamma^\lambda\check\Sigma\_{\alpha\nu}^\gamma\delta\_\beta^\alpha\$. Where \$\begin{matrix}\delta\_\beta^\alpha=\begin{cases}1\,\,\mathrm{if}\,\alpha=\beta\\\\0\,\,\mathrm{otherwise}\end{cases}&\check\Sigma\_{\alpha\nu}^\gamma=\begin{cases}1\,\,\mathrm{if}\,\gamma\leq\alpha+\nu\\\\0\,\,\mathrm{otherwise}\end{cases}&\mathrm{Purchase}\_\gamma^\lambda=\begin{cases}1\,\,\mathrm{if}\,C\lambda\leq\gamma\\\\0\,\,\mathrm{otherwise}\end{cases}\end{matrix}\$ \$\begin{matrix}\mathrm{Sell}\_\lambda^\rho=\begin{cases}1\,\,\mathrm{if}\,\rho\leq P\lambda\\\\0\,\,\mathrm{otherwise}\end{cases}&\hat\Sigma\_\rho^{\mu\sigma}=\begin{cases}1\,\,\mathrm{if}\,\mu+\sigma\leq\rho\\\\0\,\,\mathrm{otherwise}\end{cases}\end{matrix}\$, with \$$P\$$ being the price at which one sells a piece of bread (\$$\3\$$ in our example), \$$C\$$ being the cost of buying a piece of bread (\$$\2\$$ in our example), and all indicies having values in \$$\mathbb{N}\$$. So that one has \$(\mathrm{Purchase}\circ\check\Sigma\circ\cap\_\)\_{\beta\nu}^\lambda=\begin{cases}1\,\,\mathrm{if}\,C\lambda\leq\beta+\nu\\\\0\,\,\mathrm{otherwise}\end{cases}\$ \$(\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap\_\)\_{\beta\nu}^\rho=\begin{cases}1\,\,\mathrm{if}\,C\rho\leq P(\beta+\nu)\\\\0\,\,\mathrm{otherwise}\end{cases}\$ \$(\hat\Sigma\circ\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap\_\)\_{\beta\nu}^{\mu\sigma}=\begin{cases}1\,\,\mathrm{if}\,C(\mu+\sigma)\leq P(\beta+\nu)\\\\0\,\,\mathrm{otherwise}\end{cases}\$ \$(\cup\_\\circ\hat\Sigma\circ\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap\_\)\_{\beta\nu}^{\mu\beta}=\begin{cases}1\,\,\mathrm{if}\,C(\mu+\beta)\leq P(\beta+\nu)\\\\0\,\,\mathrm{otherwise}\end{cases}=\begin{cases}1\,\,\mathrm{if}\,C\mu+(C-P)\beta\leq P\nu\\\\0\,\,\mathrm{otherwise}\end{cases}\$. The last expression splits into two cases. If \$$0\leq C-P\$$, then the inequality is least stringent if \$$\beta=0\$$ (in the sense that the most \$$(\mu,\nu)\$$-pairs are allowed). Otherwise, for fixed \$$\mu\$$ and \$$\nu\$$, there is always a large enough \$$\beta\$$ so that the inequality holds. In our example, \$$C-P=\2-\3=-\1<0\$$, so the allowed \$$(\\mu,\\nu)\$$ pairs are all of \$$\mathbb{N}\times\mathbb{N}\$$. In conclusion, \$(\cup\_\\circ\hat\Sigma\circ\mathrm{Sell}\circ\mathrm{Purchase}\circ\check\Sigma\circ\cap\_\)^\mu\_\nu=1\$. So, the big feasability relation is always \$$\mathrm{True}\$$ (for valid input values). This makes sense if one views the feasability relation as saying what possible stationary states the system can have. After an initial investment of at least \$$C=\2\$$, and a transient period dependent on \$$C-P\$$ and \$$\mu-\nu\$$, any valid values of \$$\mu\$$ and \$$\nu\$$ can be reached by reinvesting the money earned enough times and/or getting rid of any extra (which is always allowed, for example, by overpaying for bread in \$$\mathrm{Purchase}\$$). Note that these are stationary states, and not necessarily equilibrium states, since money can flow into and/or out of the system. In particular, this feasability relation models an open system. Suppose we want to have a closed system instead. One could make this system into a closed system by plugging its output into its input. The resulting feasability relation will be true, since the \$$(0,0)\$$ stationary state satisfies all of the required inequalities (if \$$C-P<0\$$ there are also other stationary states that will work).
• Options
29.
edited August 2018

David wrote:

So, the big feasability relation is always $$\mathrm{True}$$ (for valid input values). This makes sense if one views the feasability relation as saying what possible stationary states the system can have.

This is what I ended up getting by working through the formulas.

It's worth noting a useful (and obvious) lemma which helps us work out compositions:

$$\forall n, n' \quad (\exists m : n \le m \wedge m \le n') \iff (n \le n')$$ So we have

$$\qquad \textrm{P}(j, k) = (2j \le k)$$

$$\qquad \textrm{S}(i, j) = (i \le 3j)$$

which gives us

$$\qquad \textrm{PS}(i, k) = (2i \le 3k)$$

Now compose with the sigmas

$$\qquad \check{\Sigma}\textrm{PS}\hat{\Sigma}((a, b), (a', b')) = (2(a+b) \le 3(a' + b'))$$

The identity arrow on the top is "op" so

$$\qquad (1_{\mathbb{N}^\text{op}}\otimes\check{\Sigma}\textrm{PS}\hat{\Sigma})((c, a, b), (c', a', b')) = (c \ge c')\wedge (2(a+b) \le 3(a' + b'))$$

Now stick on the cap $$\cap_{\mathbb{N}^\text{op}}\otimes 1_\mathbb{N}$$ and cup $$\cup_\mathbb{N}\otimes 1_\mathbb{N}$$ to get

$$\qquad (b, b') \mapsto \exists a, c, a', c' : (a \ge c)\wedge(c \ge c')\wedge(2(a+b) \le 3(a' + b'))\wedge(a' \le c')$$

This simplifies to

$$\qquad (b, b') \mapsto \exists a, a' : (a \ge a')\wedge(2(a+b) \le 3(a' + b'))$$

If we set $$a = a'$$ the expression on the right is

$$\qquad (2(a+b) \le 3(a + b')) = (2b \le a + 3b')$$

But we can find such an $$a$$ for any pair $$b, b'$$. So the composite is always true.

Comment Source:David wrote: > So, the big feasability relation is always \$$\mathrm{True}\$$ (for valid input values). This makes sense if one views the feasability relation as saying what possible stationary states the system can have. This is what I ended up getting by working through the formulas. It's worth noting a useful (and obvious) lemma which helps us work out compositions: $\forall n, n' \quad (\exists m : n \le m \wedge m \le n') \iff (n \le n')$ So we have \$$\qquad \textrm{P}(j, k) = (2j \le k)\$$ \$$\qquad \textrm{S}(i, j) = (i \le 3j)\$$ which gives us \$$\qquad \textrm{PS}(i, k) = (2i \le 3k)\$$ Now compose with the sigmas \$$\qquad \check{\Sigma}\textrm{PS}\hat{\Sigma}((a, b), (a', b')) = (2(a+b) \le 3(a' + b'))\$$ The identity arrow on the top is "op" so \$$\qquad (1_{\mathbb{N}^\text{op}}\otimes\check{\Sigma}\textrm{PS}\hat{\Sigma})((c, a, b), (c', a', b')) = (c \ge c')\wedge (2(a+b) \le 3(a' + b'))\$$ Now stick on the cap \$$\cap\_{\mathbb{N}^\text{op}}\otimes 1_\mathbb{N}\$$ and cup \$$\cup\_\mathbb{N}\otimes 1_\mathbb{N}\$$ to get \$$\qquad (b, b') \mapsto \exists a, c, a', c' : (a \ge c)\wedge(c \ge c')\wedge(2(a+b) \le 3(a' + b'))\wedge\(a' \le c')\$$ This simplifies to \$$\qquad (b, b') \mapsto \exists a, a' : (a \ge a')\wedge(2(a+b) \le 3(a' + b'))\$$ If we set \$$a = a'\$$ the expression on the right is \$$\qquad (2(a+b) \le 3(a + b')) = (2b \le a + 3b')\$$ But we can find such an \$$a\$$ for any pair \$$b, b'\$$. So the composite is always true. 
• Options
30.

Jolly good Anindya. Now, as I often say to my students, think about how your answer makes sense in the context of the original question.

You said

But we can find such an $$a$$ for any pair $$b, b'$$. So the composite is always true.

At this point it is probably sensible to explicitly give such an $$a$$. There are a couple of obvious ones. Then you can relate this back to an intuitive idea of what is going on in the diagram, e.g. why any pair of input and output is feasible.

Comment Source:Jolly good Anindya. Now, as I often say to my students, think about how your answer makes sense in the context of the original question. You said >But we can find such an \$$a\$$ for any pair \$$b, b'\$$. So the composite is always true. At this point it is probably sensible to explicitly give such an \$$a\$$. There are a couple of obvious ones. Then you can relate this back to an intuitive idea of what is going on in the diagram, e.g. why any pair of input and output is feasible.
• Options
31.
edited August 2018

hm well the smallest such $$a$$ is $$\text{max}(2b - 3b', 0)$$. and I suppose this represents the minimum revenue we need to recycle if we want to get at least $$b$$ out while putting at most $$b'$$ in.

eg we have $5 to put into the system, can we get$20 out the other end? yes, providing we have at least 2×20 – 3×5 = $25 already cycling round the system. in that case we have at least$30 to buy bread, which gives us at least 15 loaves to sell, which brings in $45+, so we can take$20 out and still have $25+ to reinvest. Comment Source:hm well the smallest such \$$a\$$ is \$$\text{max}(2b - 3b', 0)\$$. and I suppose this represents the minimum revenue we need to recycle if we want to get at least \$$b\$$ out while putting at most \$$b'\$$ in. eg we have$5 to put into the system, can we get $20 out the other end? yes, providing we have at least 2×20 – 3×5 =$25 already cycling round the system. in that case we have at least $30 to buy bread, which gives us at least 15 loaves to sell, which brings in$45+, so we can take $20 out and still have$25+ to reinvest.
• Options
32.
edited August 2018

Does $$\cup_\\circ\hat\Sigma\circ (\mathrm{Sell} \times id_{\^{op}}) \circ (\mathrm{Purchase}\times id_{\^{op}}) \circ\check\Sigma\circ\cap_\$$ give the same results as $$\check\Sigma\circ (\mathrm{Sell} \times id_)\circ (\mathrm{Purchase}\times id_)\circ\hat\Sigma$$?

The later equation seems more intuitive: when I buy something, I partition my money into two parts, one with enough to purchase whatever I want or need to buy, and the difference stays in my wallet.

Comment Source:Does \$$\cup\_\\\circ\hat\Sigma\circ (\mathrm{Sell} \times id\_{\\^{op}}) \circ (\mathrm{Purchase}\times id\_{\\^{op}}) \circ\check\Sigma\circ\cap\_\\\$$ give the same results as \$$\check\Sigma\circ (\mathrm{Sell} \times id\_\)\circ (\mathrm{Purchase}\times id\_\)\circ\hat\Sigma\$$? The later equation seems more intuitive: when I buy something, I partition my money into two parts, one with enough to purchase whatever I want or need to buy, and the difference stays in my wallet.
• Options
33.

$$(\check\Sigma\circ (\mathrm{Sell} \times id_)\circ (\mathrm{Purchase}\times id_)\circ\hat\Sigma)(\nu,\mu)=\check\Sigma\circ(\mathrm{Sell}\times id_\circ\mathrm{Purchase}\times id_)\circ\hat\Sigma(\nu,\mu)$$ leads to $$\hat\Sigma(\alpha,\beta,\nu)=\begin{cases}\mathrm{True}\,\,\mathrm{if}\,\alpha+\beta\leq\nu\\\mathrm{False}\,\,\mathrm{otherwise}\end{cases}$$, $$(\mathrm{Sell}\circ\mathrm{Purchase})(\sigma,\alpha)=\begin{cases}\mathrm{True}\,\,\mathrm{if}\,C\sigma\leq P\alpha\\\mathrm{False}\,\,\mathrm{otherwise}\end{cases}$$, so that $$(\mathrm{Sell}\times id_\circ\mathrm{Purchase}\times id_\circ\hat\Sigma)(\sigma,\tau,\nu)=\begin{cases}\mathrm{True}\,\,\mathrm{if}\,C\sigma+P\tau\leq P\nu\\\mathrm{False}\,\,\mathrm{otherwise}\end{cases}$$. If $$C\leq P$$, then $$(\check\Sigma\circ (\mathrm{Sell} \times id_)\circ (\mathrm{Purchase}\times id_)\circ\hat\Sigma)(\nu,\mu)=\begin{cases}\mathrm{True}\,\,\mathrm{if}\,C\mu\leq P\nu\\\mathrm{False}\,\,\mathrm{otherwise}\end{cases}$$.

This equation says that, if buying bread and then selling it is profitable, then one cannot end up with more money than by buying as much bread as possible and then selling it all. So, the two expressions do not give the same results. Intuitively, this is because cap and cup allow for reinvesting/recycling money, whereas here one only gets to choose how to split up the available money.

Comment Source:\$$(\check\Sigma\circ (\mathrm{Sell} \times id\_\)\circ (\mathrm{Purchase}\times id\_\)\circ\hat\Sigma)(\nu,\mu)=\check\Sigma\circ(\mathrm{Sell}\times id\_\\circ\mathrm{Purchase}\times id\_\)\circ\hat\Sigma(\nu,\mu)\$$ leads to \$$\hat\Sigma(\alpha,\beta,\nu)=\begin{cases}\mathrm{True}\,\,\mathrm{if}\,\alpha+\beta\leq\nu\\\\\mathrm{False}\,\,\mathrm{otherwise}\end{cases}\$$, \$$(\mathrm{Sell}\circ\mathrm{Purchase})(\sigma,\alpha)=\begin{cases}\mathrm{True}\,\,\mathrm{if}\,C\sigma\leq P\alpha\\\\\mathrm{False}\,\,\mathrm{otherwise}\end{cases}\$$, so that \$$(\mathrm{Sell}\times id\_\\circ\mathrm{Purchase}\times id\_\\circ\hat\Sigma)(\sigma,\tau,\nu)=\begin{cases}\mathrm{True}\,\,\mathrm{if}\,C\sigma+P\tau\leq P\nu\\\\\mathrm{False}\,\,\mathrm{otherwise}\end{cases}\$$. If \$$C\leq P\$$, then \$$(\check\Sigma\circ (\mathrm{Sell} \times id\_\)\circ (\mathrm{Purchase}\times id\_\)\circ\hat\Sigma)(\nu,\mu)=\begin{cases}\mathrm{True}\,\,\mathrm{if}\,C\mu\leq P\nu\\\\\mathrm{False}\,\,\mathrm{otherwise}\end{cases}\$$. This equation says that, if buying bread and then selling it is profitable, then one cannot end up with more money than by buying as much bread as possible and then selling it all. So, the two expressions do not give the same results. Intuitively, this is because cap and cup allow for reinvesting/recycling money, whereas here one only gets to choose how to split up the available money.
• Options
34.
edited August 2018

Simon wrote:

As Lou Reed said: "There is no time." This is what I found confusing. John asked us to make an intuitive guess first and I think that most people (including me!) would intuitively think of some process through time, with dollar bills travelling round the diagrams. However, the diagram is representing (I think!) a frozen, stable snapshot.

For a given pair (input, output) of values for the input and output of the big diagram, can you assign values to the inputs and outputs of the subcomponents which makes the whole thing feasible.

I look forward to hearing John's take on this.

Sorry for taking so long to reply! There was no time. Now, mysteriously, they've turned it back on. Yes, there's no time in this setup. Each wire is labelled with a variable - in my example, all these stand for numbers of dollars or loaves of bread. Each little box is a relation that say what's feasible and what's not for the variables labelling the wires that touch that box. We then compose these to see what's feasible for the whole diagram: For example, going from right to left, if $$1$$ dollar enters at right and $$5$$ dollars are looping back, $$\check{\sum}$$ adds them and any number $$\le  6$$ is feasible as a label for the wire touching the left of the $$\check{\sum}$$ box. This money then gets used to purchase bread. Bread costs $$2$$ a loaf so any number $$\le 3$$ is feasible as the number of loaves we buy. We can sell bread for $$3$$ a loaf so any number $$\le  9$$ is feasible for how much we make. Then we hit the $$\hat{\sum}$$ box. If for example we have $$9$$ coming in at right, we can have $$4$$ come out at left - our earnings - and $$5$$ loop back - our reinvestment.

So this is a feasible scenario: $$1$$ entering at right and $$4$$ leaving at left.

I don't want to give away the answer to the puzzle, so I won't figure out all feasible scenarios!

It would indeed be fun to include time in the scenario. We can do with feasibility relation too! We just need to use more complicated posets. We can make our variables all be functions of time and make our boxes stand for relations like "if you spend $$n$$ to purchase bread today, you can have up to $$n / 2$$ loaves of bread tomorrow".

Comment Source:Simon wrote: > As Lou Reed said: "There is no time." This is what I found confusing. John asked us to make an intuitive guess first and I think that most people (including me!) would intuitively think of some process through time, with dollar bills travelling round the diagrams. However, the diagram is representing (I think!) a frozen, stable snapshot. > For a given pair (input, output) of values for the input and output of the big diagram, can you assign values to the inputs and outputs of the subcomponents which makes the whole thing feasible. > I look forward to hearing John's take on this. Sorry for taking so long to reply! There was no time. Now, mysteriously, they've turned it back on. <img src = "http://math.ucr.edu/home/baez/emoticons/tongue2.gif"> Yes, there's no time in this setup. Each wire is labelled with a variable - in my example, all these stand for numbers of dollars or loaves of bread. Each little box is a relation that say what's feasible and what's not for the variables labelling the wires that touch that box. We then compose these to see what's feasible for the whole diagram: <center><img src = "http://math.ucr.edu/home/baez/mathematical/7_sketches/codesign_diagram_purchase_sell_feedback.png"></center> For example, going from right to left, if \$$\ 1 \$$ dollar enters at right and \$$\ 5\$$ dollars are looping back, \$$\check{\sum}\$$ adds them and any number \$$\le \ 6\$$ is feasible as a label for the wire touching the left of the \$$\check{\sum}\$$ box. This money then gets used to purchase bread. Bread costs \$$\ 2\$$ a loaf so any number \$$\le 3\$$ is feasible as the number of loaves we buy. We can sell bread for \$$\ 3\$$ a loaf so any number \$$\le \ 9\$$ is feasible for how much we make. Then we hit the \$$\hat{\sum}\$$ box. If for example we have \$$\ 9\$$ coming in at right, we can have \$$\ 4\$$ come out at left - our earnings - and \$$\ 5\$$ loop back - our reinvestment. So this is a feasible scenario: \$$\ 1\$$ entering at right and \$$\ 4\$$ leaving at left. I don't want to give away the answer to the puzzle, so I won't figure out _all_ feasible scenarios! It would indeed be fun to include time in the scenario. We can do with feasibility relation too! We just need to use more complicated posets. We can make our variables all be functions of time and make our boxes stand for relations like "if you spend \$$\ n \$$ to purchase bread today, you can have up to \$$n / 2\$$ loaves of bread tomorrow". 
• Options
35.
edited August 2018

Anindya said (in trying to find an $$a$$ such that $$2b \le a + 3b'$$)

hm well the smallest such $$a$$ is $$\text{max}(2b - 3b', 0)$$. and I suppose this represents the minimum revenue we need to recycle if we want to get at least $$b$$ out while putting at most $$b'$$ in.

As I said, there were a couple of obvious possibilities, the one I thought most obvious was $$2b$$ :-), as $$b'\ge 0$$. I grant you that it's not optimal, but it works, and that's all that matters: it makes things feasible.

In other words, whatever the input, you can guarantee to take $$b$$ out as long as you feedback $$2b$$, as this ensures that you can always buy $$b$$ loaves of bread, which allows you to take $$b$$ out and reinvest $$2b$$ dollars again...

Comment Source:Anindya said (in trying to find an \$$a\$$ such that \$$2b \le a + 3b'\$$) > hm well the smallest such \$$a\$$ is \$$\text{max}(2b - 3b', 0)\$$. and I suppose this represents the minimum revenue we need to recycle if we want to get at least \$$b\$$ out while putting at most \$$b'\$$ in. As I said, there were a couple of obvious possibilities, the one I thought most obvious was \$$2b\$$ :-), as \$$b'\ge 0\$$. I grant you that it's not optimal, but it works, and that's all that matters: it makes things feasible. In other words, whatever the input, you can guarantee to take \$$\ b\$$ out as long as you feedback \$$\ 2b\$$, as this ensures that you can always buy \$$b\$$ loaves of bread, which allows you to take \$$\b\$$ out and reinvest \$$\ 2b\$$ dollars again...
• Options
36.

John said

I don't want to give away the answer to the puzzle

I think we have the answer to the puzzle in the comments above.

Comment Source:John said > I don't want to give away the answer to the puzzle I think we have the answer to the puzzle in the comments above.
• Options
37.
edited August 2018

You know we can actually repair David's functional notation because currying is valid in the category of small V enriched Categories and V enriched functors, and by identifying subsets with their characteristic function, and mapping bool to 0,1 in V.

Actually if we then use the convention that an expression $$\phi (x)$$ with unbound variables $$x$$ means $${\phi(x)|x : T}$$ when T is obvious from context then cap is $\lambda \, \star \mapsto (x^{op}, x)$

i.e.

$\lambda \, (\star, a, b) \mapsto a=b^{op}$

And because we distinguish $$x : X$$ from $$x^{op}:X^{op}$$ and the V-functors are monotonic, the behavior on objects is enough to force equality with the identity.

Comment Source:You know we can actually repair David's functional notation because currying is valid in the category of small V enriched Categories and V enriched functors, and by identifying subsets with their characteristic function, and mapping bool to 0,1 in V. Actually if we then use the convention that an expression \$$\phi (x)\$$ with unbound variables \$$x\$$ means \$$\{\phi(x)|x : T\} \$$ when T is obvious from context then cap is \$\lambda \, \star \mapsto (x^{op}, x) \$ i.e. \$\lambda \, (\star, a, b) \mapsto a=b^{op}\$ And because we distinguish \$$x : X\$$ from \$$x^{op}:X^{op}\$$ and the V-functors are monotonic, the behavior on objects is enough to force equality with the identity.
• Options
38.
edited August 2018

Simon wrote:

I think we have the answer to the puzzle in the comments above.

True. The answer to Puzzle 223 is $$\texttt{true}$$.

More precisely: for any number of dollars 'flowing in at right' and any number of dollars 'flowing out at left', this feasibility relation: evaluates to $$\texttt{true}$$!

Comment Source:Simon wrote: > I think we have the answer to the puzzle in the comments above. True. The answer to Puzzle 223 is \$$\texttt{true}\$$. More precisely: for any number of dollars 'flowing in at right' and any number of dollars 'flowing out at left', this feasibility relation: <center><img src = "http://math.ucr.edu/home/baez/mathematical/7_sketches/codesign_diagram_purchase_sell_feedback.png"></center> evaluates to \$$\texttt{true}\$$! 
• Options
39.

We can we view the above Bool-profunctor as a description of whether or not a fixed-point property holds?

Comment Source:We can we view the above **Bool**-profunctor as a description of whether or not a fixed-point property holds?
• Options
40.

Keith - a $$\mathbf{Bool}$$-profunctor $$\Phi \colon \mathcal{X} \to \mathcal{X}$$ is a kind of relation from a preorder $$\mathcal{X}$$ to itself, namely a feasibility relation. But we can look at the set of elements of $$\mathcal{X}$$ that are related to themselves, and these will be 'fixed points' - not of a function, but of a relation!

Sorry to take forever to reply!

Comment Source:Keith - a \$$\mathbf{Bool}\$$-profunctor \$$\Phi \colon \mathcal{X} \to \mathcal{X}\$$ is a kind of _relation_ from a preorder \$$\mathcal{X}\$$ to itself, namely a feasibility relation. But we can look at the set of elements of \$$\mathcal{X}\$$ that are related to themselves, and these will be 'fixed points' - not of a function, but of a relation! Sorry to take forever to reply! 
• Options
41.

That's interesting.

Seeing as a $$\mathbf{Bool}$$-profunctor $$\Phi \colon \mathcal{X} \to \mathcal{X}$$ is also a functor $$\mathcal{X} \otimes \mathcal{X} \to \mathbf{Bool}$$, any fixed-point relation $$\Phi$$ can be composed with $$\neg : \mathbf{Bool} \to \mathbf{Bool}$$ to create a derangment $$\neg \Phi$$.

Derangements (permutations on a set without a fixed-point property) are interesting because they are a required ingredient in creating self-referential paradoxes, as Noson S. Yanofsky notes in 'A Universal Approach to Self-Referential Paradoxes, Incompleteness and Fixed Points' arxiv, though he doesn't use the term derangement in that paper.

So in theory, there is nothing stopping us from making a string diagram that describes a paradox like the Liar, or describes the Halting problem (showing that string diagrams are Turing-complete maybe?).

Comment Source:That's interesting. Seeing as a \$$\mathbf{Bool}\$$-profunctor \$$\Phi \colon \mathcal{X} \to \mathcal{X}\$$ is also a functor \$$\mathcal{X} \otimes \mathcal{X} \to \mathbf{Bool}\$$, any fixed-point relation \$$\Phi\$$ can be composed with \$$\neg : \mathbf{Bool} \to \mathbf{Bool}\$$ to create a [derangment](https://en.wikipedia.org/wiki/Derangement) \$$\neg \Phi\$$. Derangements (permutations on a set without a fixed-point property) are interesting because they are a required ingredient in creating self-referential paradoxes, as Noson S. Yanofsky notes in 'A Universal Approach to Self-Referential Paradoxes, Incompleteness and Fixed Points' [arxiv](https://arxiv.org/abs/math/0305282), though he doesn't use the term derangement in that paper. So in theory, there is nothing stopping us from making a string diagram that describes a paradox like the Liar, or describes the Halting problem (showing that string diagrams are Turing-complete maybe?).