container combinatorics monads and more
play

Container combinatorics: Monads and more Tarmo Uustalu, Tallinn - PowerPoint PPT Presentation

Container combinatorics: Monads and more Tarmo Uustalu, Tallinn University of Technology SYCO 1, Birmingham, 2021 September 2018 Containers? Containers (Abbott, Altenkirch, Ghani; cf polynomials, Gambino, Hyland, Kock) are an elegant


  1. Container combinatorics: Monads and more Tarmo Uustalu, Tallinn University of Technology SYCO 1, Birmingham, 20–21 September 2018

  2. Containers? Containers (Abbott, Altenkirch, Ghani; cf polynomials, Gambino, Hyland, Kock) are an elegant “syntax” in terms of shapes and positions for a wide class of set functors. In particular, they are good for enumerative combinatorics, for enumerating structures of a given type on a functor. Prior work: Directed containers (Ahman, Chapman, Uustalu) as containers with additional structure denoting comonads. This talk: Further specializations of containers corresponding to monads, lax monoidal functors (aka idioms) and more.

  3. Containers A container is given by a set S (of shapes) and a S -indexed family P of sets (of positions in each shape) A container ( S , P ) interprets into a set functor � S , P � c = F where F X = Σ s : S . P s → X F f = λ ( s , v ) . ( s , f ◦ v )

  4. Lists container Let S = N P s = [0 .. s ) The container ( S , P ) represents the list datatype, as � S , P � c X = Σ s : N . [0 .. s ) → X ∼ = List X .

  5. Container morphisms A container morphism between ( S , P ) and ( S ′ , P ′ ) is given by operations t : S → S ′ (the shape map) and q : Π s : S . P ′ ( t s ) → P s (the position map) A container morphism ( t , q ) between ( S , P ) and ( S ′ , P ′ ) interprets into a natural transformation � t , q � c = τ between � S , P � c and � S ′ , P ′ � c where τ X : � S , P � c X → � S ′ , P ′ � c X (Σ s : S . P s → X ) → (Σ s ′ : S ′ . P ′ s ′ → X ) τ ( s , v ) = ( t s , v ◦ q s )

  6. Some lists container endomorphisms Let S = N , P s = [0 .. s ) as before. We can define a container endomorphism ( t , q ) on ( S , P ) for example by t s = s q s p = s − p This denotes the list reversal function. But setting t s = s + s q s p = p mod s we get a representation of the list self-append function.

  7. The category of containers Identity on ( S , P ) is (id S , λ s . id P s ). Composition of ( t , q ) : ( S , P ) → ( S ′ , P ′ ) and ( t ′ , q ′ ) : ( S ′ , P ′ ) → ( S ′′ , P ′′ ) is ( t ′ ◦ t , λ s . q s ◦ q ′ t s ). Containers form a category Cont . � − � c makes a fully-faithful functor from Cont to [ Set , Set ].

  8. Two monoidal structures The identity container is Id c = (1 , λ ∗ . 1). Composition of ( S , P ) and ( S ′ , P ′ ) is ( S , P ) · c ( S ′ , P ′ ) = (Σ s : S . P s → S ′ , λ ( s , v ) . Σ p : P s . P ′ ( v p )). ( Cont , Id c , · c ) is a monoidal category and � − � c a monoidal functor to ([ Set , Set ] , Id , · ). Day convolution of ( S , P ) and ( S ′ , P ′ ) is ( S , P ) � c ( S ′ , P ′ ) = ( S × S ′ , λ ( s , s ′ ) . P s × P ′ s ). ( Cont , Id c , � c ) is a symmetric monoidal category and � − � c a symmetric monoidal functor to ([ Set , Set ] , Id , � ). For any ( S , P ), ( S ′ , P ′ ), there is a container morphism from ( S , P ) � c ( S ′ , P ′ ) → ( S , P ) · c ( S ′ , P ′ ). This makes Id Cont a lax monoidal functor from ( Cont , Id c , · c ) to ( Cont , Id c , � c ).

  9. Mnd-containers Call an mnd-container a container ( S , P ) with operations e : S • : Π s : S . ( P s → S ) → S q 0 : Π s : S . Π v : P s → S . P ( s • v ) → P s q 1 : Π s : S . Π v : P s → S . Π p : P ( s • v ) . P ( v ( v � s p )) where we write q 0 s v p as v � s p and q 1 s v p as p � v s satisfying s = s • ( λ . e) e • ( λ . s ) = s ( s • v ) • ( λ p ′′ . w ( v � s p ′′ ) ( p ′′ � v s )) = s • ( λ p ′ . v p ′ • w p ′ ) and . . .

  10. Mnd-containers ctd . . . and p = ( λ . e) � s p p � λ . s e = p v � s (( λ p ′′ . w ( v � s p ′′ ) ( p ′′ � v s )) � s • v p ) = ( λ p ′ . v p ′ • w p ′ ) � s p (( λ p ′′ . w ( v � s p ′′ ) ( p ′′ � v s )) � s • v p ) � v s = let u p ′ ← v p ′ • w p ′ in w ( u � s p ) � v ( u � s p ) ( p � u s ) p � λ p ′′ . w ( v � s p ′′ ) ( p ′′ � v s ) ( s • v ) = let u p ′ ← v p ′ • w p ′ in ( p � u s ) � w ( u � s p ) v ( u � s p )

  11. Mnd-containers ctd An mnd-container ( S , P , e , • , � , � ) interprets into a monad � S , P , e , • , � , �� mc = ( T , η, µ ) where T = � S , P � c η X : X → T X X → Σ s : S . P s → X η x = (e , λ . x ) µ X : T ( T X ) → T X (Σ s : S . P s → Σ s ′ : S . P s ′ → X ) → (Σ s : S . P s → X ) µ ( s , v ) = let ( v 0 p , v 1 p ) ← v p in ( s • v 0 , λ p . v 1 ( v 0 � s p ) ( p � v 0 s ))

  12. � � � � The category of mnd-containers Mnd-containers form a category MCont , with identities and composition inherited from Cont . Mnd-container interpretation � − � mc makes a fully-faithful functor between MCont and Monad ( Set ). MCont U ( Cont , Id c , · c ) Cont ∼ = Monoid ( Cont , Id c , · c ) � − � mc � − � c f . f . f . f . Monad ( Set ) U � [ Set , Set ] ([ Set , Set ] , Id , · ) ∼ = Monoid ([ Set , Set ] , Id , · )

  13. Exception container Let S = 1 + E for some set E and P (inl ∗ ) = 1, P (inr ) = 0. Then T X = � � inl ∗ �→ 1 → X ∼ Σ s : 1 + E . case s of = X + E . inr �→ 0 If, in a hypotetical mnd-container structure on ( S , P ), e = inr e 0 for some e 0 : E , then P e = 0 and therefore inl ∗ = e • ( λ . inl ∗ ) = e • ( λ . inr e 0 ) = inr e 0 , which is absurd. If e = inl ∗ , then necessarily inl ∗ • v = e • ( λ ∗ . v ∗ ) = v ∗ and inr e • v = inr e • ( λ . e) = inr e . This choice of e and • satisfies the conditions of an mnd-container. So there is exactly one mnd-container structure on ( S , P ) and exactly one monad structure on T .

  14. Lists container Let S = N , P s = [0 .. s ). Then T X = Σ s : N . [0 .. s ) → X ∼ = List X . The following is an mnd-container structure: e = 1 s • v = � p :[0 .. s ) v p p ′ :[0 .. p 0 ) v p ′ ≤ p v � s p = greatest p 0 : [0 .. s ) st � p � v s = p − � p ′ :[0 .. v � s p ) v p ′ The corresponding monad structure is η X x = [ x ], µ X xss = concat xss . But these are not the only mnd-container structure on ( S , P ) and not the only monad structure on T .

  15. Mnd-containers as generalized operads The (standard) lists mnd-container generalizes for non-symmetric operads. Given an operad, i.e., a set O (of operations) and functions # : O → N (fixing the arities) and id : O (the identity) and ◦ : Π o : O . (# o → O ) → O (composition) satisfying # id = 1 and # ( o ◦ v ) = � i :[0 , # o ) # ( v i ) and a number of further equations. We can take S = O , P o = [0 .. # o ), e = id, s • v = s ◦ v and � , � as in the lists mnd-container. The lists mnd-container corresponds to the operad Assoc with exactly one operation of every arity. General mnd-containers are like operads, but arities may be infinite, identification of the arguments of an operation is nominal, and the arguments of a composition may be used non-linearly by the operations involved (as specified by � , � ).

  16. Mnd-containers as lax (1 , Σ)-universes Altenkirch, Pinyo have observed that an mnd-container defines a “lax” (1 , Σ)-universe. S is the set of “(codes for) types”, P s is the “denotation” of s , e is the type 1, • is the Σ-type former, � , � are projections from denotations of Σ-types The laxity is that 1 need not really denote the singleton set and Σ-types need not really denote dependent products, we only have functions P e → 1 and P ( s • v ) → Σ p : P s . P ( v p ), not isomorphisms.

  17. Lmf-containers Call an lmf-container a container ( S , P ) with operations e : S • : S → S → S q 0 : Π s : S . Π s ′ : S . P ( s • s ′ ) → P s q 1 : Π s : S . Π s ′ : S . P ( s • s ′ ) → P s ′ where we write q 0 s s ′ p as s ′ � s p and q 1 s s ′ p as p � s ′ s satisfying e • s = s s = s • e ( s • s ′ ) • s ′′ = s • ( s ′ • s ′′ ) e � s p = p p � s e = p s ′ � s ( s ′′ � s • s ′ p ) = ( s ′ • s ′′ ) � s p ( s ′′ � s • s ′ p ) � s ′ s = s ′′ � s ′ ( p � s ′ • s ′′ s ) p � s ′′ ( s • s ′ ) = ( p � s ′ • s ′′ s ) � s ′′ s ′

  18. Lmf-containers ctd An lmf-container ( S , P , e , • , � , � ) interprets into a lax monoidal functor � S , P , e , • , � , �� lc = ( F , m 0 , m) where F = � S , P � c m 0 : 1 → T 1 1 → (Σ s : S . P s → 1) m 0 ∗ = (e , λ . ∗ ) m X , Y : T X × T Y → T ( X × Y ) (Σ s : S . P s → X ) × (Σ s : S . P s → Y ) → (Σ s : S . P s → X × Y ) m X , Y (( s , v ) , ( s ′ , v ′ )) = ( s • s ′ , λ p . ( v ( s ′ � s p ) , v ′ ( p � s ′ s )))

  19. � � � � The category of lmf-containers Lmf-containers form a category LCont , with identities and composition inherited from Cont . � − � lc is a fully-faithful functor between LCont and LMF ( Set ). LCont U ( Cont , Id c , � c ) Cont ∼ = Monoid ( Cont , Id c , � c ) � − � c � − � lc f . f . f . f . LMF ( Set ) U � [ Set , Set ] ([ Set , Set ] , Id , � ) ∼ = Monoid ([ Set , Set ] , Id , � )

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