DisCoPy is a Python toolkit for computing with monoidal categories. It comes with two flexible data structures for string diagrams: the first one for planar monoidal categories based on lists of layers, the second one for symmetric monoidal categories based on cospans of hypergraphs. Algorithms for functor application then allow to translate string diagrams into code for numerical computation, be it differentiable, probabilistic or quantum. This report gives an overview of the library and the new developments released in its version 1.0. In particular, we showcase the implementation of diagram equality for a large fragment of the hierarchy of graphical languages for monoidal categories, as well as a new syntax for defining string diagrams as Python functions.
翻译:DisCoPy是一个用于幺半范畴计算的Python工具包。它包含两种灵活的字符串图数据结构:第一种基于层列表实现平面幺半范畴,第二种基于超图余积实现对称幺半范畴。函子应用算法可将字符串图转换为数值计算代码,涵盖可微、概率及量子计算。本报告概述该库及其1.0版本的新功能,重点展示幺半范畴图形语言层次结构大片段的图相等性实现,以及将字符串图定义为Python函数的新语法。