draft
play

Draft Internal lenses as monad morphisms Bryce Clarke CoACT, - PowerPoint PPT Presentation

Draft Internal lenses as monad morphisms Bryce Clarke CoACT, Macquarie University, bryce.clarke1@students.mq.edu.au CT2019, July 12 Draft Outline Motivation Formal monads, functors, and cofunctors The 2-category of internal lenses Bonus:


  1. Draft Internal lenses as monad morphisms Bryce Clarke CoACT, Macquarie University, bryce.clarke1@students.mq.edu.au CT2019, July 12

  2. Draft Outline Motivation Formal monads, functors, and cofunctors The 2-category of internal lenses Bonus: Mealy morphisms and symmetric lenses 1 / 25

  3. Draft Motivation

  4. Draft What is a lens? • It depends on who you ask . . . • Lenses are a mathematical structure which aim to capture the notion of synchronisation between a pair of systems (e.g. databases). • Originally lenses were defined to precisely present synchronisation between a pair of sets, called state-based lenses. • However when generalising to categories, there are at least two useful ways to define lenses: split opfibrations 1 and (asymmetric) delta lenses 2 . • In this talk, I will show how delta lenses may be internalised to a category with pullbacks and motivated as a kind of monad morphism. • Link: Internal lenses as functors and cofunctors, Proceedings of ACT2019 . 1 Called “c-lenses” in: Johnson, Rosebrugh, Wood, Lenses, fibrations and universal translations (2012) 2 Diskin, Xiong, & Czarnecki, From State- to Delta-Based Bidirectional Model Transformations: the Asymmetric Case (2011) 2 / 25

  5. Draft Split opfibrations α a ′ A p ( a , β ) a k ( a ,β ) ∃ ! ∃ ! . . . . . . . . F . . . . β γ γ b ′ B F ( a ) b F ( α ) = γβ γβ A split opfibration is a functor F : A → B such that for all pairs ( a , β ) as shown, there is a morphism k ( a , β ): a → p ( a , β ) with F ( p ( a , β )) = b such that: 1. Fk ( a , β ) = β 2. The morphisms k ( a , β ) are opcartesian, satisfying the universal property illustrated above, thus defining a cleavage. 3. The cleavage respects identities and composition, thus defining a splitting. 3 / 25

  6. Draft Delta lenses α A p ( a , β ) a k ( a ,β ) ∃ ! . . . . . . F . . . β γ B F ( a ) b γβ A delta lens is a functor F : A → B such that for all pairs ( a , β ) as shown, there is a morphism k ( a , β ): a → p ( a , β ) with F ( p ( a , β )) = b such that: 1. Fk ( a , β ) = β 2. The morphisms k ( a , β ) are opcartesian, satisfying the universal property illustrated above, thus defining a cleavage. 3. The lifting k respects identities and composition. 4 / 25

  7. Draft Cofunctors (not contravariant functors!) α A p ( a , β ) a k ( a ,β ) ∃ ! . . . . . . . . . β γ B F ( a ) b γβ A cofunctor is an function F : A 0 → B 0 such that for all pairs ( a , β ) as shown, there is a morphism k ( a , β ): a → p ( a , β ) with F ( p ( a , β )) = b such that: 1. Fk ( a , β ) = β 2. The morphisms k ( a , β ) are opcartesian, satisfying the universal property illustrated above, thus defining a cleavage. 3. The lifting k respects identities and composition. 5 / 25

  8. Draft A brief history of cofunctors • First defined by Higgins & Mackenzie 3 as “comorphisms” between vector bundles, modules, Lie algebroids, and Lie pseudo-algebras. • Generalised by Aguiar 4 where “cofunctors” are between categories internal to a monoidal category with equalizers. • Rediscovered by Ahman & Uustalu 5 as directed container morphisms or “split pre-opcleavages”. • Considered recently in talks by Garner (groupoids and cofunctors) 6 , Cockett (internal partite categories and cofunctors) 7 and Par´ e (Retrocells, CT2019). 3 Duality for base-changing morphisms of vector bundles, modules, Lie algebroids and Poisson structures (1993) 4 Internal Categories and Quantum Groups (1997) 5 Directed Containers as Categories (2016) 6 Inner automorphisms of groupoids , Australian Category Seminar (13 March 2019) 7 Hyperconnections , Australian Category Seminar (20 March 2019) 6 / 25

  9. Draft Formal monads, functors, and cofunctors

  10. Draft A review of formal monads A monad 8 ( A , t ) in a 2-category K consists of an object A , a 1-cell t : A → A and 2-cells η : 1 A → t and µ : t 2 → t such that the following diagrams commute: t µ t η η t t 3 t 2 t 2 t t µ t µ µ 1 1 t t 2 t µ We may similarly define a monad in a bicategory by inserting the unitors and associator where appropriate. 8 Street, The Formal Theory of Monads (1972) and Lack, Street, The Formal Theory of Monads II (2002) 7 / 25

  11. Draft Example: Internal categories are monads in Span( E ) Let E be a category with pullbacks, and Span( E ) the bicategory of spans in E . A monad in Span( E ) consists of an object A 0 and a span, A 1 s 0 t 0 A 0 A 0 together with morphisms of spans, s 1 t 1 A 0 A 1 A 2 A 1 1 A 0 1 A 0 s 0 c t 0 i A 0 A 1 A 0 A 0 A 1 A 0 s 0 s 0 t 0 t 0 satisfying some conditions. This defines an internal category in E . 8 / 25

  12. Draft Lax and colax monad morphisms A lax monad morphism ( A , t ) → ( B , s ) consists of a 1-cell f : A → B and a 2-cell φ : sf → ft such that the following diagrams commute: s φ φ t f ssf sft ftt η f f η µ f f µ sf ft sf ft φ φ A colax monad morphism ( A , t ) → ( B , s ) consists of a 1-cell f : A → B and a 2-cell ψ : ft → sf such that the following diagrams commute: ψ t s ψ f ftt sft ssf f η η f f µ µ f ft sf ft sf ψ ψ 9 / 25

  13. Draft Internal functors as monad morphisms in Span( E ) • Since monads in Span( E ) are internal categories, we might expect that the monad morphisms give internal functors . . . but they do not (in general). • Internal functors are colax monad morphisms whose 1-cell is a left adjoint . • A left adjoint 1-cell in Span( E ) is a span whose left leg is an identity: A 0 1 A 0 f 0 A 0 B 0 • The corresponding 2-cell simplifies to a morphism f 1 : A 1 → B 1 satisfying: s 0 t 0 A 0 A 1 A 0 f 0 f 1 f 0 B 0 B 1 B 0 s 0 t 0 10 / 25

  14. Draft What are the lax monad morphisms in Span( E ) ? • Given that internal functors are important, we may also wish to consider the corresponding dual notion. • Internal cofunctors are lax monad morphisms whose 1-cell is a left adjoint. • The corresponding 2-cell for an internal cofunctor amounts to a morphism k 1 : A 0 × B 0 B 1 → A 1 making the diagram commmute: s 0 t 0 A 0 A 1 A 0 1 A 0 1 A 0 k 1 π 0 t 0 k 1 A 0 A 0 × B 0 B 1 A 0 � π 1 f 0 f 0 B 0 B 1 B 0 s 0 t 0 11 / 25

  15. Draft What is a cofunctor in Span( Set ) ? • A cofunctor Λ: B ⇋ A should be understood as a kind of lifting. k ( a ,β ) A a p ( a , β ) . . . . f k . . β B f ( a ) b • The codomain p ( a , β ) of the lift should satisfy f ( p ( a , β )) = b . • The lifting should respect both identities and composition. • Examples of cofunctors include: • Discrete opfibrations and split opfibrations; • Identity-on-objects functors, such as monoid and group homomorphisms; • State-based lenses and delta lenses (!) 12 / 25

  16. Draft Cofunctors as spans of functors • Every internal cofunctor may be represented as a span of internal functors, Λ F K B A where F is a discrete opfibration 9 and K is an identity-on-objects functor. • These functors appear immediately in the definition of an internal cofunctor: π 0 t 0 k 1 π 0 t 0 k 1 A 0 A 0 × B 0 B 1 A 0 A 0 A 0 × B 0 B 1 A 0 � 1 A 0 1 A 0 π 1 f 0 f 0 k 1 B 0 B 1 B 0 A 0 A 1 A 0 s 0 s 0 t 0 t 0 9 Also called an internal diagram , an internal E -valued functor , or an internal copresheaf . 13 / 25

  17. Draft Composition of cofunctors • Composing cofunctors is more difficult than composing functors; despite both arising from composition of the corresponding monad morphisms. • However when a cofunctor is represented as a span of functors, composition is just via pullback. Ω × B Λ � Ω Λ G J F K C B A • Every cofunctor may be factorised into a discrete opfibration part and an identity-on-objects functor part. 14 / 25

  18. Draft The 2 -category of internal lenses

  19. Draft Internal lenses as monad morphisms • An internal lens is a lax monad morphism ( A , t ) → ( B , t ) whose 1-cell f : A → B is a left adjoint and whose 2-cell φ : sf ⇄ ft is a section . • An internal lens is a functor ( f 0 , f 1 ) and a cofunctor ( f 0 , k 1 ) satisfying: A 0 × B 0 B 1 k 1 π 1 A 1 B 1 f 1 • An internal lens is a commuting diagram of internal functors, Λ K F A B F where F is a discrete opfibration and K is an identity-on-objects functor. 15 / 25

  20. Draft Examples of internal lenses • A delta lens is exactly an internal lens in Set . • A state-based lens consisting of functions, g : S → V p : S × V → S is a delta lens between codiscrete categories, where: k 1 = � π 0 , p � : S × V → S × S • A delta lens between monoids is exactly a retraction. • A discrete opfibration is an internal lens in Set where k 1 is an isomorphism. • A split opfibration is an internal lens in Cat between double categories of squares, where k 1 is a left-adjoint right-inverse functor between categories: k 1 A 2 ( F ↓ B ) 1 ⊣ 16 / 25

  21. Draft Natural transformations between (co)functors A natural transformation between A natural transformation between internal cofunctors Λ , Ω: B ⇋ A is given internal functors F , G : A → B is given by a morphism τ : A 0 → A 1 such that: by a morphism σ : A 0 → B 1 such that: f 0 A 0 B 0 A 0 1 A 0 h 0 g 0 τ g 0 f 0 σ A 0 A 1 A 0 B 0 B 1 B 0 s 0 t 0 s 0 t 0 Actually just given by a diagram: Represented by the diagram: Λ F F K A B σ B A H τ G J G Ω 17 / 25

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend