discopy

Computes and manipulates string diagrams in monoidal categories with Python backends and rendering.

60|13|Updated Dec 22, 2025
One-click install
npx skills add https://github.com/plurigrid/asi --skill discopy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: discopy
Source: https://github.com/plurigrid/asi/tree/main/skills/discopy
Command: npx skills add https://github.com/plurigrid/asi --skill discopy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

DisCoPy provides a Python library to compute with string diagrams for monoidal categories, along with operads, quantum circuits, and tensor networks.

Core Features & Use Cases

  • Categorical framework: Ty, Ob, Box, Arrow, Diagram.
  • Operads and colored operads: CFG, free operads, and algebras.
  • Quantum computing & QNLP: Circuits, gates, ZX-calculus, and DisCoCat mappings.

Quick Start

Just run: just discopy-demo

Frequently Asked Questions about discopy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compute and visualize string diagrams for monoidal categories?

DisCoPy computes string diagrams in monoidal categories through a complete class hierarchy (Category, Ob, Arrow, Box, Diagram) with composition operators (then, tensor, dagger) and graphical rendering. It supports operads, colored types, and external integrations like pytket and PennyLane for backends including NumPy, JAX, and PyTorch.

Can I use DisCoPy to build and simulate quantum circuits?

Yes. DisCoPy provides quantum circuit construction, gate definitions, ZX-calculus support, and simulation capabilities. It integrates with pytket and PennyLane backends, enabling circuit composition, visualization, and execution across NumPy, JAX, and PyTorch compute frameworks.

What's the best way to work with tensor networks and operads in Python?

DisCoPy implements operads, colored operads, free operads, and algebras alongside tensor network construction through its monoidal category framework. Use its composition operators and external backends to manipulate, visualize, and compute over operadic and tensor structures.

Does DisCoPy support quantum natural language processing workflows?

Yes. DisCoPy supports QNLP through DisCoCat mappings that bridge categorical linguistics and quantum circuits. You can build, compose, and visualize quantum NLP diagrams with ZX-calculus and simulate them using integrated backends.

Can I integrate DisCoPy with existing quantum and tensor libraries?

DisCoPy integrates with pytket for quantum compilation, PennyLane for variational circuits, and PyZX for ZX-calculus. It supports NumPy, JAX, and PyTorch backends, allowing seamless composition with existing quantum and tensor workflows.

What are the limitations when working with large-scale tensor networks in DisCoPy?

DisCoPy's performance depends on backend choice (NumPy, JAX, PyTorch) and diagram complexity. For production-scale tensor networks, performance tuning and backend selection become critical; verification against external libraries like PyZX or pytket is recommended for validation.