You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.
Very basic question: I have a lens (S,T) -> (A,B) and I'm depicting it as a comb. So the inside of the comb has a A wire on the left, and a B wire on the right. now suppose I have a function f:A -> B. I'd like to put this function inside the comb, that is, I'd like to use it to connect the A and the B wires. Is this possible using profunctor optics? I saw I can lift functions to getters and setters but I don't know if this helps me to achieve what I want :confused:
yes it is! Hom is always a tambara module
EDIT: ...as long as you're considering your category with the same action on both sides of the Hom
So I dn't need getters or anything?
I can just pick my favourite function and stick it in?
yup!
Great!
Thanks :D
oh, but do note
the result of the diagram will then itself be a morphism of the original category, rather than an optic or something
Absolutely, that's precisely what I need :D
The problem was that I was keeping to compose combs ad infinitum, but in the end a fucntion is exactly what I needed
So I have a f: A -> B that represents my "initial policy" and I keep plugging it into lenses, and so on and so on updating the policy
Also, am I wrong or I can view a function A -> B as a lens (A,B) -> (*, *) ?
That is, I see f as a "trivial" comb with no inner wires whatsoever
umm
my initial impulse was that that was correct, but something sounds slightly off about it when i think about another kind of optic i use, so now i'm trying to resolve that—one sec
wait, what is * there
some kind of terminal object or what
The terminal object, yes
kk
So I'd have:
view: , hence something useless
update: , hence any function
And then, at least in the case of lenses, composing a lens (X,Y) -> (A,B) with this effectively "closes" the comb
oh sorry i was taking so long to reply—it's definitely true that for lenses we have A → B ~ (A, B) → (1, 1)
but something definitely seems wrong about that when you generalize to other kinds of optics...
or... maybe not... uh
Well other optics seem to be combs with different shapes
So probably if you compose that with something else you just maim your original shape in other abhorrent ways
ok no yeah so im pretty sure this hinges on lenses being cartesian
but with linear lenses, for example, you can still insert a morphism into a comb
the morphism itself just doesnt count as an optic of the kind you describe
Ok. So is there a "general" way to close combs?
This actually entails another question: Are all optics combs of some sort?
NO WAIT hold on im thinking about a thing
ugh sorry
ok actually if we have a morphism A → B that does give a linear lens (A, B) → (I, I), where I is the tensor unit rather than the terminal object
makes sense :)
Yes, that seems reasonable
Which actually means that everything your comb can do is multiply that function by a scalar
where a scalar is any morphism
anyway yes i think it's fair to say that optics are combs in general
you plug tambara module heteromorphisms into them if you want to close them
sarahzrf said:
you plug tambara module heteromorphisms into them if you want to close them
That's a scary name :D
;)
how much do you know about profunctors
I know that Hom is a profunctor. Then three years ago Neil Ghani explained ends and coends to me in a superclear way, it was amazing. But I forgot everything.
Long story short assume you are speaking with a potato.
:potato:
Yes, that's me
:(
don't be so hard on yourself
anyway
What, being a potato is amazing. And as a bonus I taste great when fried!
:D
Nice, the fact that functions are the same as optics is one of the magic tricks behind how open games work... happy to see this fact getting some love
a profunctor C ⇸ D is a functor D^op × C → Set, or maybe a functor C^op × D → Set, depending on your convention
the former one does look backward, but it also makes it so that C ⇸ D is the same as C → PSh(D) if you flip the args and curry
Yup
im more used to the former convention, but ill use the latter one for now i guess
Both are fine for me
so a good way to think about profunctors is that a profunctor P : C ⇸ D gives a notion of "heteromorphism" from objects of C to objects of D
given A in C and B in D, think of P(A, B) as a kind of hom-set
Yes, that's what you use to do profunctor collage too
i thought i was talking to a potato
I am! But I've been explained many things many times, so I have a shaky memory where every time you say something I may incorrectly recall something else
kk
Potato + random oracle maybe
Anyway, I'm following up to now
so i'll write f : A ~> B to mean f ∈ P(A, B)
Ok
It's literally like a hom but now hom is a P
then, the action of P on morphisms gives "composition" of heteromorphisms with real morphisms
and functoriality tells you that this is still associative and unital
Yes. So in the trivial case of hom this is pre- and post- composing, but for profunctors it may be anything as long as it's compositional
however, note that it doesn't give you composition of heteromorphisms with each other, even if that were well-typed cuz u had an endoprofunctor
anyway this generalizes both presheaves and copresheaves
a presheaf is a profunctor C ⇸ 1 in the convention i just picked
sarahzrf said:
however, note that it doesn't give you composition of heteromorphisms with each other, even if that were well-typed cuz u had an endoprofunctor
I didn't notice that
Yes
so:
(and now im just giving you the optics crash course ;) )
given a monoidal category M, an action of M on some other category C is a strong monoidal functor M → End(C)
a category equipped with an action of M is an M-actegory (not a typo)
Okz
so, fix some monoidal M. we'll think of it as a category whose objects are "contexts" to extend objects of other categories by
so an M-actegory is a category whose objects can be enlarged by being placed into a context drawn from M
if we have a profunctor P : C ⇸ D between M-actegories C and D
So for each object C every element of m is giving me an "update" on C
i dunno about an "update" as much as an "extension"—"update" sounds to me like it'd be a morphism
So wait, who are the objects of End(C)? Morphisms C -> C for some C?
oh!! sorry!!!
End(C) is the category of endofunctors on C, monoidal under composition
so this is a direct categorification of monoid actions on sets
Oh, ok, the same one where monads live
gr8
yup
in fact, lax monoidal functors turn monoids into monoids, so if you have a monoid object in M, you get a monad on any M-actegory :)
cool
now, if X is an object of M and A is an object of the M-actegory (C, F), i'll write X . A to denote F(X)(A)
F is the functor M -> End(C)?
yeah
Ok
so, if we have M-actegories C and D, and a profunctor C ⇸ D
to equip P as a Tambara module is to give a way of lifting its heteromorphisms thru context extension
that is, whenever we have f : A ~> B, we need to be able to get f' : X . A ~> X . B
That's a very fancy way to say "monoidal products don't have to get in the way" :D
and this needs to be subject to a whole boatload of diagrams
well, monoidal product is only one very particular case of an actegory :)
True
Action is probably the right word
but yes, I get what you are saying
:)
so then there's a key result which says
So tambara means exactly that I can lift stupid morphisms to context-aware morphisms
something like that?
it's a kind of structure you can add to the profunctor
Well they are well behaved wrt the action, so
Oh, it's a structure
so there's more than one way to do it
ok
welllllll, it's kind of like a functor's morphism mapping
in the sense that it's technically structure, but there's usually really one obvious way to do it
Yea, ok
and plenty of mappings of objects have no morphism mapping that will work, so "being functorial" is also sort of a property
many profunctors cannot be equipped as tambara modules
Ok
but anyway so
[one of] the key result[s] is
well, first: given M-actegories C and D, we have a general definition of a category of optics whose objects are pairs (S ∈ C, T ∈ D) in terms of coends
and then:
Yes, I remember that definition :D
[one of] the key result[s] is: optics (S, T) → (A, B) are equivalent to transformations P(A, B) → P(S, T), natural in P, which ranges over Tambara modules C ⇸ D
i.e.: an optic is something that can take context-liftable heteromorphisms A ~> B and lift them to ones S ~> T
Oh!
Is this the profunctor representation theorem in https://arxiv.org/pdf/2001.07488.pdf?
yup!
Great, so that theorem is exactly saying to me that I can close combs?
exactly!
well, one direction is saying that you can close combs with heteromorphisms of any tambara module
the other direction is saying that if you have a comb which you can close with heteromorphisms of any tambara module, that's an optic
Yup. So all my headaches were due to the fact that I was working with the frong side of the theorem
Cool :D
:thumbs_up:
Well, this was immensely helpful
Thank you very much :D
:heart: :heart: :heart:
no problem!
this is an explanation i've been rehearsing lol
it's basically the amped-up version of what's going into my talk
(in there im gonna talk about preordered monoids & stuff rather than monoidal categories, since everything im doing is depleted)
Well, on behalf of the people(?) of the potato nation I say thank you
you may also find it helpful to know that uh
Tambara modules form the 1-cells of a bicategory Tamb whose objects are M-actegories
this is the M-equivariant version of the bicategory Prof
It's not immediately useful for me, but I'll try to not forget it in case I'll need it :D
and Hom is the identity in Tamb just like it is in Prof
it's always a tambara module C ⇸ C
anyway here's a quick example of an action which you might find plausible that isn't just plain ⊗
given a monoidal category C, let M be C × C, but put a monoidal structure on it by setting (A, B) ⊗ (A', B') = (A ⊗ A', B' ⊗ B)
(this is actually a vast generalization of an example i use in my talk :wink:)
(where the monoidal category in question is... the discrete monoidal category of strings)
so here acting on something with a context can put something before it and after it
which you can't do with just acting on the left, if your ⊗ is not braided
uh, right, and let the action of M on C be given by (X, Y) . A = X ⊗ A ⊗ Y
I'll be at your talk :D
^_^
hope you like program verification lol
No, I hate it but I work with this stuff, so...
hah
Fabrizio Genovese said:
Potato + random oracle maybe
GLaDOS!?
sarahzrf said:
(and now im just giving you the optics crash course ;) )
I was hoping the discussion would go this way, I hope this gives me the opportunity to ask some much more basic questions myself, like... what's a lens? And what's an optic? I've now read the nLab pages, but I want to hear what you would tell someone if they asked you about these things in person :wink:
Morgan Rogers said:
sarahzrf said:
(and now im just giving you the optics crash course ;) )
I was hoping the discussion would go this way, I hope this gives me the opportunity to ask some much more basic questions myself, like... what's a lens? And what's an optic? I've now read the nLab pages, but I want to hear what you would tell someone if they asked you about these things in person :wink:
i would probably give the same lecture i just did above :mischievous:
I was hoping you could give me a little more insight into optics than the nLab's spiel, though:
Optics are constructions used in computer science as bidirectional data accessors. They include lenses and prisms, used to access, respectively, components of product data types and components of coproduct data types.
If there's no further insight to be had (is it just a cool name for typification of universal morphisms to limits/colimits?) then never mind
i mean, the lecture i gave above involved considerably more than that...
Your lecture contains plenty of information, but as someone who didn't know any of the concepts beyond what a profunctor is beforehand, I'm trying to say "your lecture made this subject sound cool, but what is it about?" For example, what is the motivation for studying optics, and why is the representation theorem that was mentioned [one of] the key result[s]?
This is #learning: basic questions, after all, I'm not just being facetious!
functional programming, database views and schemas: bidirectional data accessors, used to lift transformations of small things to transformations of bigger things the small things are inside
supervised learning (brendan fong): https://arxiv.org/abs/1903.03671
compositional game theory (jules hedges): https://arxiv.org/search/cs?searchtype=author&query=Hedges%2C+J
note learners and open games are lenses, not optics in general (unless someone would like to correct me on that)
I'd like to correct you on that
Open games are not lenses. The other way round is true, but that's not conceptually very interesting (open games are indexed families of lenses plus a bit more, so a lens is an open game via a singleton family). Open learners turn out to be symmetric lenses which is an existing thing that turns out to be more or less spans of ordinary lenses (but with a slightly different composition). That trick fails for open games though
Also open games (and probably also open learners) can be easily generalised from lenses to optics. I now take that as the basic definition because it's so useful
In any case, the real motivation for studying optics is as bidirectional transformations of data. The other applications very much come out of nowhere. I wrote an extremely revisionist history here: https://julesh.com/2018/08/16/lenses-for-philosophers/
those applications came out of category ether, but are now their own sources of motivation for people who may not be as interested in database schema transformation
Morgan Rogers said:
Your lecture contains plenty of information, but as someone who didn't know any of the concepts beyond what a profunctor is beforehand, I'm trying to say "your lecture made this subject sound cool, but what is it about?" For example, what is the motivation for studying optics, and why is the representation theorem that was mentioned [one of] the key result[s]?
This is #learning: basic questions, after all, I'm not just being facetious!
right, sorry!
i'll post more l8r, rn i have split attention
o i see jules has already covered it actually :>
Yep, I'm referring to bayesian open games, and yep, it hasn't been written up for open learners