[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-657604-105":59,"doc-detail-657604-en":130},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","discopy-the-hierarchy-of-graphical-languages-in-python","DisCoPy: the Hierarchy of Graphical Languages in Python","","DisCoPy is a Python toolkit for computing with monoidal categories, offering two flexible string-diagram data structures for planar and symmetric monoidal settings. It provides algorithms to compose, rewrite, draw, and check diagram equality, and monoidal functors to evaluate diagrams as executable code. The report overviews the library and the v1.0 release, including a diagram-equality implementation across a major hierarchy fragment and a new Python-function syntax for defining string diagrams.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":40,"@type":76,"position":81},"https://docshare.wps.com/document/research-report/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/discopy-the-hierarchy-of-graphical-languages-in-python/657604/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/discopy-the-hierarchy-of-graphical-languages-in-python/657604.png","ImageObject",300,407,{"name":92,"@type":93},"lilac","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-10-30","2026-10-26",true,{"@type":102,"interactionType":103,"userInteractionCount":24},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What is DisCoPy used for?","Question",{"text":112,"@type":113},"DisCoPy is used to compute with monoidal categories by representing string diagrams, composing and rewriting them, and checking equality. It also evaluates diagrams via monoidal functors into executable numerical or computational code.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How does DisCoPy represent string diagrams?",{"text":117,"@type":113},"DisCoPy includes two data structures for string diagrams: one for planar monoidal categories using layered lists, and another for symmetric monoidal categories using cospans of hypergraphs. Diagram objects are built using point-free syntax or standard Python function syntax.",{"name":119,"@type":110,"acceptedAnswer":120},"What are major changes introduced in version 1.0?",{"text":121,"@type":113},"Version 1.0 refactors the library to simplify architecture and increase modularity. Diagram becomes a subclass of Arrow so identity and composition are defined once, and Matrix/Tensor become generic types parameterized by their data type.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},657604,1793056405,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":39,"category_name":40,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":24,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":144,"read_time":145},3985747861865,"https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0","arXiv :2311 . 10608v1 [math .CT] 17 Nov 2023  \nDisCoPy: the Hierarchy of Graphical Languages in Python  \nAlexis Toumi Richie Yeung Boldizs´ar Po´or Giovanni de Felice  \nQuantinuum – Quantum Compositional Intelligence  \n17 Beaumont street, OX1 2NA Oxford, UK  \n[firstname@discopy.org](firstname@discopy.org)  \nDisCoPy is a Python toolkit for computing with monoidal categories. It comes with two 􀀃exible data structures for string diagrams: the 􀀂rst 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, beit 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 de􀀂ning string diagrams as Python functions.  \nExtended Abstract  \nString diagrams are an intuitive yet formal graphical language which has been reinvented multiple times in the context of philosophical logic [30], circuit design [23] and spin networks [31] . More recently, string diagrams have known a new wave of applications including quantum computing [10], linguistics [9], Bayesian inference [11], chemical reaction networks [4], databases [7], game theory [19] and machine learning [16] . Created in order to foster the development of such applications, DisCoPy is a software package that provides 1) string diagrams as a data structure together with algorithms for composing, rewriting, drawing and checking equality between them, 2) monoidal functors for evaluating string diagrams as code, be it for a quantum circuit, a probabilistic program or a neural network.  \nDisCoPy is free software, it comes with an extensive documentation and demonstration notebooks.1 The library is already the topic of two tool papers [13, 40] aimed at applied category theorists and quantum computer scientists, respectively. It is also documented by the PhD theses of the last and 􀀂rst authors of this report. The former [12] develops a category-theoretic framework for natural language processing while the latter [39] applies this framework to quantum natural language processing, an application which has now grown into its own library: lambeq [26] . More recently, DisCoPyro [35] applied our toolkit to probabilistic generative modeling.  \nDisCoPy aims at becoming the fundamental package for all the applications of string diagrams. The use of Python for applied category theory is motivated by two main reasons. First, Python has become the programming language of reference for machine learning and quantum computing, two killer applications of category theory. Second, Python is a programming language of choice for students and beginners. We believe that DisCoPy can help both applied category theorists pick up programming skills and Python programmers pick up category theory concepts. In particular, the library makes extensive use of the factory method pattern [18, p. 87] which allows users to easily de􀀂ne their own custom categories. So what is DisCoPy? In a nutshell, it is a domain speci􀀂c language (DSL) for morphisms in (pre)monoidal categories. Its main data structure is Diagram, an implementation of the arrows of the free premonoidal category generated by the class Ob as objects and the class Box as arrows. These can be  \n1[https://docs.discopy.org](https://docs.discopy.org)  \nSubmitted to: ACT 2023  \n© A. Toumi, R. Yeung, B. Po´or & G. de Felice This work is licensed under the  \nCreative Commons Attribution License.  \n2 DisCoPy: the Hierarchy of Graphical Languages in Python  \nconstructed either using a point-free syntax with composition (>>) and tensor (@) as in Figure 7 or with the standard syntax for Python functions as demonstrated in Fi","cbCait01p6EWPdSp","https://ap.wps.com/l/cbCait01p6EWPdSp","pdf",207800,14,"English","# Extended Abstract\n## String diagrams and applications\n## Core software components and algorithms\n## Functor evaluation and numerical interfaces\n## Grammar, quantum interfaces, and differentiation\n## v1.0 refactor and new hierarchy support","[{\"question\":\"What is DisCoPy used for?\",\"answer\":\"DisCoPy is used to compute with monoidal categories by representing string diagrams, composing and rewriting them, and checking equality. It also evaluates diagrams via monoidal functors into executable numerical or computational code.\"},{\"question\":\"How does DisCoPy represent string diagrams?\",\"answer\":\"DisCoPy includes two data structures for string diagrams: one for planar monoidal categories using layered lists, and another for symmetric monoidal categories using cospans of hypergraphs. Diagram objects are built using point-free syntax or standard Python function syntax.\"},{\"question\":\"What are major changes introduced in version 1.0?\",\"answer\":\"Version 1.0 refactors the library to simplify architecture and increase modularity. Diagram becomes a subclass of Arrow so identity and composition are defined once, and Matrix/Tensor become generic types parameterized by their data type.\"}]","DisCoPy: the Hierarchy of Graphical Languages in Python | PDF",1792984607,35]