multicategories of multiary lenses
play

Multicategories of multiary lenses Bob Rosebrugh (with Mike - PowerPoint PPT Presentation

Multicategories of multiary lenses Bob Rosebrugh (with Mike Johnson) Department of Mathematics and Computer Science Mount Allison University FMCS 2019-06-02 Backgound Bidirectional Transformations (BX) are n = 2 case, well studied commonly


  1. Multicategories of multiary lenses Bob Rosebrugh (with Mike Johnson) Department of Mathematics and Computer Science Mount Allison University FMCS 2019-06-02

  2. Backgound Bidirectional Transformations (BX) are n = 2 case, well studied commonly modelled using symmetric and asymmetric lenses ◮ Assume synchronization data specifying when an X state and a Y state are consistent ◮ A lens L : X ← → Y models a (BX) and it includes: ◮ synchronizing data (encoded in various ways) and has ◮ consistency restoration or re-synchronization operator(s) for state changes ◮ Symmetric case: Consistent models with two-way re-synchronization, for example for database interoperation ◮ Asymmetric case: One-way synchronization/restoration with global/local states, for example database view updating 2

  3. Outline ◮ Multidirectional transformations as n -ary lenses ◮ first generalize (binary) symmetric lenses – more propagations ◮ also generalize spans of asymmetric lenses – to wide spans ◮ introduce “amendments” in both cases ◮ Resulting multiary lenses compose via wide spans ◮ A multicategory of multiary lenses ensues 3

  4. Multidirectional Transformations An ( n -ary) multimodel space M = (( A i ) i ≤ n , R ) has ◮ A i a category ◮ objects model states A 1 , A 2 , . . . ; arrows: state updates ◮ R is synchronization data specifying consistent model states A Multidirectional Transformation (MX) has: ◮ a multimodel space M ◮ consistency restoration or re-synchronization operators after a model state changes (update) Generalizing lenses provides models of two types (below): ◮ n -ary symmetric lens ◮ (wide) span of asymmetric lenses 4

  5. n-ary Symmetric Lenses Let M a multimodel space, A i categories, R = ( R , δ ) is a function � | A 1 | × . . . × | A n | (call R elements corrs ) δ = ( δ i ) : R An n -ary symmetric lens (Diskin-Konig-Lawford) M = ( M , p) has: ◮ Multimodel space M ◮ Consistency restoration operators p = (p i ) i ≤ n ◮ Given corr R and update u i from A i = δ i ( R ) in A i ... ◮ p i gives updates of A j = δ j ( R ) target tuple consistent For an example, think of database interoperation 5

  6. � � n -ary Symmetric Lenses Suppose states ( A j ) j ≤ n synchronized by corr R , A i � ❥❥❥❥❥❥❥❥❥❥❥ R R R ❨ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❨ ❏ ❨ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❨ ❨ ❨ ❨ ❨ A 1 · · · A j · · · 6

  7. � � n -ary Symmetric Lenses Suppose states ( A j ) j synchronized by corr R , then given an update u i from state A i to target A ′ i A i � ❥❥❥❥❥❥❥❥❥❥❥ R R R ❨ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❨ ❏ ❨ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❨ ❨ ❨ ❨ ❨ A i A 1 · · · A j · · · u i � A ′ i 7

  8. ✤ ✤ � ✤ ✤ � ✤ ✤ � ✤ ✤ � n -ary Symmetric Lenses Suppose states ( A j ) j synchronized by corr R , then given an update from state A i to target A ′ i the lens propagates updates u ′ j of A j ’s (and A ′ i ) targets A ′′ j A i � ❥❥❥❥❥❥❥❥❥❥❥ R R R ❨ ❨ ❨ ❏ ❨ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❨ ❏ ❨ ❨ ❨ ❨ ❨ ❨ ❨ A i A 1 A 1 · · · A j A j · · · u i � p i � j =p R u ′ u ′ ij ( u i ) A ′ A ′ 1 i i u ′ i � A ′′ A ′′ A ′′ i 1 j 8

  9. � ✤ � ✤ ✤ ✤ ✤ ✤ � ✤ � � ✤ � n -ary Symmetric Lenses Suppose states ( A j ) j synchronized by corr R , then given an update from state A i to target A ′ i the lens propagates updates of A j ’s (and A ′ i ) to targets A ′′ j and , re-synchronization data R ′ on ( A ′′ j ) j . A i � ❥❥❥❥❥❥❥❥❥❥❥ R R R ❨ ❨ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❨ ❨ ❨ ❨ ❨ ❨ A i A 1 A 1 · · · A j A j · · · u i � p i � j =p R u ′ u ′ ij ( u i ) A ′ A ′ 1 i i u ′ i � A ′′ A ′′ A ′′ A ′′ A ′′ A ′′ · · · · · · i � ❚ ❚ ❚ ❚ ❚ ❚ R ′ ❡ i 1 1 j j ❡ ❡ t ❡ ❡ ❡ ❡ t ❡ R ′ R ′ ❡ ❡ 9

  10. n -ary Symmetric Lenses A small example with A 1 = NA = set 2 , A 2 = AC = set 2 ; R = { ( X , X ′ ) | X 1 = X ′ 0 } Formal notation for the propagation operation p i R ′ = p R u ′ j = p R u ′ i = p R i ( u i ) ij ( u i ) j � = i ii ( u i ) Call p R ii ( u i ) the amendment (update) of u i Amendment may arise (be necessary) if, for example, no corr synchronizes A ′ i with other model states. Update u i is R-closed when p R ii ( u i ) = id A i (trivial amendment) Lens L is closed if it is R -closed for all R and u i 10

  11. Well-behaved lenses An n -ary symmetric lens M = ( M , p) is well-behaved if satisfies: ◮ (Stable): Identities propagate to identities: p R ij ( id A i ) = id A j 1 ≤ j ≤ n and p R i ( id A i ) = R ◮ (Refl2): Amended updates propagate like the unamended: p R ij (p R ii ( u i ) u i ) = p R ij ( u i ) for j � = i , ◮ (Refl3): Amended updates are closed: p R ii ( u i ) u i is R -closed 11

  12. Asymmetric Amendment Lenses ◮ Asymmetric lenses arose as strategy for the database View Update Problem. ◮ First were set based, then algebraic, and categorical ◮ As delta lenses, spans represent (binary) symmetric lenses ◮ Amendments a recent addition (D-K-L), paralleling n -ary symmetric lens 12

  13. Asymmetric Amendment Lenses An aa-lens L = ( A , B , g , p ) has ◮ categories A , B the base and view model spaces � B a functor called the get ◮ g : A ◮ p = { p A | A ∈ A } family of operations delivering � B ′ for any view state update v : g ( A ) � A ′′ the putback of v ◮ p A b ( v ) : A � B ′′ the amendment of v ◮ p A a ( v ) : B ′ also satisfying B ′′ = g ( A ′′ ) � B ′ is closed if its amendment is identity View update v : g ( A ) L a closed aa-lens if all view updates are closed Small examples with A = set 3 ; B = set 2 . . . 13

  14. � � � � Asymmetric Amendment Lenses The aa-lenses compose: For L = ( A , B , g , p ), L ′ = ( B , C , h , q ) the composite is L ′ L = ( A , C , hg , r ) where b ( q g ( A ) � C ′ , define r A b ( w ) = p A for w : hg ( A ) ( w )) b a ( q g ( A ) a ( w ) = h ( v ) · q g ( A ) for v = p A ( w )), define r A ( w ) a b as in: b ( q g ( A ) p A ( w )) b A A A A ” A ” A ” q g ( A ) ( w ) � B ′ v b B ′ B ′ g ( A ) g ( A ) g ( A ) g ( A ) g ( A ) B ” B ” B ” B ” B ” � C ′ C ′ C ′′ C ′′ C ′′ C ′′′ C ′′′ C ′′′ hg ( A ) hg ( A ) hg ( A ) w q g ( A ) h ( v ) ( w ) a 14

  15. Well-Behaved aa-Lenses aa-lens is L = ( A , B , g , p ) is well-behaved if it is: ◮ (Stable) Identities putback to identities ◮ (Refl0) B ′ = g ( X ) for X ∈ A implies p A a ( v ) = id B ′ (if B ′ is a g image, then no amendment) ◮ (Refl2) putback of the amended update same as unamended p A b ( p A a ( v ) v ) = p A b ( v ) ◮ (PutGet) the get of a putback is the amended update Stable, Refl0 and PutGet compose, as does closed, but not Refl2, and it turns out that. . . Convenient category spg-lens has arrows those aa-lenses satisfying Stable and PutGet properties. 15

  16. � spg Lens Spans and n -ary Symmetric Lenses Two Constructions: First, from n -wide span L of spg-lens (domains S ) to n -ary symmetric M L : � ❥❥❥❥❥❥❥❥❥❥❥ S S S ❨ ❨ ( g j , p j ) ( g i , p i ) ❨ ❏ ❨ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ❨ ❏ ❨ ( g 1 , p 1 ) � ❨ ❨ ❨ ❨ ❨ ❨ ❨ A i A 1 · · · A j · · · Let M L = ( M , p) where M = (( A i ) , R ) and ◮ R = | S | (objects of S ), δ i ( S ) = g i ( S ) � A ′ ◮ Define propagation p i for u i : g i ( S ) i by ◮ the j’th put of u i is the j’th get of the i’th put: p S ij ( u i ) = g j ( p S i , b ( u i )) ◮ the M L amendment of u i is its L i amendment Note that M L is stable, closed if the L i are 16

  17. � � � � � spg Lens Spans and n -ary Symmetric Lenses Next, from n -ary symmetric M to n -wide span L M of spg-lens: With M = ( M , p) and M = (( A i ) , R ) Objects of the head S of L M are the corr set R � δ i ( R ′ ) } Arrows S ( R , R ′ ) = { ( u i ) i ≤ n | u i : δ i ( R ) A 1 � ❥❥❥❥❥❥❥❥❥❥❥ R ⑧ R R ❨ ❨ ❨ ❨ ❨ ❨ ❨ ❨ ❨ ❨ ⑧ ❨ ❨ � ⑧ ❨ ❨ ❨ ❨ ❨ ❨ ❨ A 1 A 2 A 2 · · · A n A n · · · u 1 u 2 u n A ′ A ′ A ′ A ′ A ′ A ′ · · · · · · 1 � ❚❚❚❚❚❚❚❚❚❚❚ R ′ 1 2 � ❄ 2 ❡ ❡ n n ❡ ❡ ❡ ❡ ❡ ❡ ❄ ❡ ❡ ❡ ❡ ❡ ❡ ❡ ❡ ❡ R ′ R ′ ❡ ❡ 17

  18. spg Lens Spans and n -ary Symmetric Lenses For the lens ( L M ) i ◮ Define g i ( R ) = δ i ( R ) on objects, similarly on arrows � A ′ ◮ For u i : g i ( R ) i the put is ( p R p R i , b ( u i )) j = ij ( u i ) j � = i ( p R p R i , b ( u i )) i = ii ( u i ) u i and the put amendment is that for p i The two constructions are not mutually inverse, and in any case wide spans of spg lenses and n -ary symmetric lenses with same behaviour should be made equivalent . 18

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