Hot take: optics are better abstraction than lenses, in *all* use cases. Why? They make explicit all the things you're implicitly thinking about anyway when using lenses. I think they are really important in shaping how we think about bidirectional maps. A short thread. 👇 1/9

Optics make explicit 1) the internal state (residual) and 2) the fact that you need to have the base category either be Cartesian, or at the very least have the "get" maps be comonoid homomorphisms. Let's look at the state/residual.
2/9
In lenses, this state is always the same as the input and is implicit. This can be seen by repackaging the get map from get: X → Y to Δₓ;(get×X):X e→ Y×X. Now our new get map (in addition to computing the output) passes through the input. This is good for a few reasons. 3/9
First, this pleasantly symmetric with the put:X×Y'→X'. But also, this new map is now exactly the "left" map of an optic too. (It turns out put was all along the "right" map). This tells us that the passed-through input is actually the state we're remembering. 4/9
But most importantly, this formulation is now explicit in the use of the copy map Δₓ:X → X×X, which you might have not realized is needed if you were just thinking about the standard get-put formulation. Furthermore, when you were composing lenses, ... 5/9
the formulation of the composite of the put maps was always much more complex than get maps. But now it's obvious why you needed to do that: you were juggling the internal state/residual around, because it had to agree with the input. 6/9
But you don't need to do that with optics (and that's the whole idea): you can *choose* the internal state you want.
With lenses you're using a specific state anyway, but you aren't given the conceptual tools to talk about it.
But let's stop here and see what we've done. 7/9
Observe that we didn't really "add" any complexity so far. All we've done is distilled what was already there and gave it a name. That's the whole idea behind of a lot of category theory. 8/9
Now, we still have to pack up this new construction and be precise in its definition. That's exactly what the coend in the optic definition does. It might even look scary, but it turns out the coend is saying some incredibly natural things. But that's for some other time. 9/9
References:
Optics: https://t.co/nWBhDR0Hut
Generalized Lens Categories: https://t.co/C0gB06B9DE
Also, this perspective was first shared with me here: https://t.co/ThvRcV2j3t
Also, I should add a caveat that I'm not necessarily talking about *mixed* optics. These seem like a complex beast that I don't yet understand fully.

More from Health

You gotta think about this one carefully!

Imagine you go to the doctor and get tested for a rare disease (only 1 in 10,000 people get it.)

The test is 99% effective in detecting both sick and healthy people.

Your test comes back positive.

Are you really sick? Explain below 👇

The most complete answer from every reply so far is from Dr. Lena. Thanks for taking the time and going through


You can get the answer using Bayes' theorem, but let's try to come up with it in a different —maybe more intuitive— way.

👇


Here is what we know:

- Out of 10,000 people, 1 is sick
- Out of 100 sick people, 99 test positive
- Out of 100 healthy people, 99 test negative

Assuming 1 million people take the test (including you):

- 100 of them are sick
- 999,900 of them are healthy

👇

Let's now test both groups, starting with the 100 people sick:

▫️ 99 of them will be diagnosed (correctly) as sick (99%)

▫️ 1 of them is going to be diagnosed (incorrectly) as healthy (1%)

👇
No-regret #hydrogen:
Charting early steps for H₂ infrastructure in Europe.

👉Summary of conclusions of a new study by @AgoraEW @AFRY_global @Ma_Deutsch @gnievchenko (1/17)
https://t.co/YA50FA57Em


The idea behind this study is that future hydrogen demand is highly uncertain and we don’t want to spend tens of billions of euros to repurpose a network which won’t be needed. For instance, hydrogen in ground transport is a hotly debated topic
https://t.co/RlnqDYVzpr (2/17)

Similar things can be said about heat. 40% of today’s industrial natural gas use in the EU goes to heat below 100°C and therefore is within range of electric heat pumps – whose performance factors far exceed 100%. (3/17)


Even for higher temperatures, a range of power-to-heat (PtH) options can be more energy-efficient than hydrogen and should be considered first. Available PtH technologies can cover all temperature levels needed in industrial production (e.g. electric arc furnace: 3500°C). (4/17)


In our view, hydrogen use for feedstock and chemical reactions is the only inescapable source of industrial hydrogen demand in Europe that does not lend itself to electrification. Examples include ammonia, steel, and petrochemical industries. (5/17)

You May Also Like