[论文解读] Profunctor optics and traversals
本文提出了一种基于普罗丰托尔的统一框架,用于光学(包括遍历),利用塔姆巴拉模和余端演算。它将遍历表示为形状-内容余代数,通过Pastro-Street余代数建立普罗丰托尔表示定理,并表明光学组合需要引入清晰光学等精细概念,以忠实地建模Haskell的语义。
Optics are bidirectional accessors of data structures; they provide a powerful abstraction of many common data transformations. This abstraction is compositional thanks to a representation in terms of profunctors endowed with an algebraic structure called Tambara module. There exists a general definition of optic in terms of coends that, after some elementary application of the Yoneda lemma, particularizes in each one of the basic optics. Traversals used to be the exception; we show an elementary derivation of traversals and discuss some other new derivations for optics. We relate our characterization of traversals to the previous ones showing that the coalgebras of a comonad that represents and split into shape and contents are traversable functors. The representation of optics in terms of profunctors has many different proofs in the literature; we discuss two ways of proving it, generalizing both to the case of mixed optics for an arbitrary action. Categories of optics can be seen as Eilenberg-Moore categories for a monad described by Pastro and Street. This gives us two different approaches to composition between profunctor optics of different families: using distributive laws between the monads defining them, and using coproducts of monads. The second one is the one implicitly used in Haskell programming; but we show that a refinement of the notion of optic is required in order to model it faithfully. We provide experimental implementations of a library of optics in Haskell and partial Agda formalizations of the profunctor representation theorem.
研究动机与目标
- 提供一种基于普罗丰托尔和塔姆巴拉模的组合式、代数式光学框架。
- 通过形状-内容余代数将遍历表示为余代数,将其与可遍历函子联系起来。
- 利用余端演算和Yoneda引理,形式化普罗丰托尔表示定理。
- 通过引入清晰光学和单子的余积,解决光学组合中的模块化问题。
- 通过实验性Haskell库和部分Agda形式化,实现并验证该理论。
提出的方法
- 使用余端演算和Yoneda引理,从一般余端定义推导出光学的标准形式。
- 将光学表示为带有塔姆巴拉模结构的普罗丰托尔,以编码作用相容性。
- 应用Pastro-Street构造,定义一个余代数,其代数对应于遍历。
- 将遍历刻画为形状-内容余代数,其线性与单位性由余代数公理由其自然生成。
- 引入清晰光学以细化组合,通过单子的余积实现对Haskell中光学的忠实建模。
- 使用Kan扩张和右伴随,建立可遍历函子与余自由构造之间的伴随关系。
实验结果
研究问题
- RQ1如何使用余端演算,从一般光学定义系统地推导出遍历?
- RQ2遍历作为余代数的范畴刻画是什么?它与可遍历函子有何关系?
- RQ3如何通过分配律或单子的余积,实现不同家族光学的组合?
- RQ4为忠实建模函数式编程语言(如Haskell)中的组合,光学概念需要何种细化?
- RQ5普罗丰托尔表示定理能否推广到具有任意张量作用的混合光学?
主要发现
- 遍历被刻画为形状-内容余代数,其线性与单位性由余代数公理自然导出。
- 通过Pastro-Street余代数证明了普罗丰托尔表示定理,表明光学对应于带有塔姆巴拉模结构的普罗丰托尔。
- 光学范畴作为单子的Eilenberg-Moore范畴而出现,为组合提供了范畴论基础。
- 引入清晰光学作为细化,以忠实建模组合,特别是在单子余积的语境下。
- 在Agda中形式化了余自由遍历构造,表明$KH$是$H$的余自由遍历,通过右Kan扩张实现。
- 建立了伴随关系$\mathbf{Trv}(T, KH) \cong [\mathbf{Sets}, \mathbf{Sets}]({\cal U}T, H)$,证明$KH$为余自由。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。