TensorRocq: Enabling diagrammatic reasoning in Rocq
Pith reviewed 2026-05-10 04:55 UTC · model grok-4.3
The pith
Tools in Rocq convert symmetric monoidal category terms to hypergraphs with interfaces to support verified reasoning about string diagram deformations.
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
By converting syntactic representations of SMC terms into hypergraphs with interfaces while preserving tensor semantics, verified tools in Rocq support inferring term equivalence and rewriting modulo the allowed deformations of string diagrams.
What carries the argument
The conversion between syntactic SMC terms and hypergraphs with interfaces that preserves tensor semantics and captures diagram deformations.
If this is right
- Users can build simple SMC theories from generators and relations and carry out equational reasoning inside them.
- Tactics become usable inside existing verification projects that assign tensor semantics to SMCs.
- Equivalence proofs can ignore fine syntactic composition details and focus on connectivity.
- Rewriting steps are valid precisely when they correspond to allowed string diagram deformations.
Where Pith is reading between the lines
- The translation reduces the distance between informal diagrammatic arguments used on paper and fully formal proofs inside a proof assistant.
- The same hypergraph representation could serve as an intermediate form for diagrammatic reasoning in other categorical structures.
- Once equivalence checking is available, automated search for diagram simplifications or normal forms becomes feasible within Rocq.
Load-bearing premise
The conversion between syntactic SMC terms and hypergraphs with interfaces correctly preserves tensor semantics and fully captures all allowed deformations of string diagrams.
What would settle it
An SMC term pair where two diagrams are related by a permitted deformation yet their corresponding hypergraphs are not equivalent, or where the tensor interpretations of the term and hypergraph diverge.
Figures
read the original abstract
Symmetric monoidal categories (SMCs) are a common framework for reasoning about computation, focusing on the parallel and sequential compositionality of operations. String diagrams are a ubiquitous and powerful tool for reasoning about equations in SMCs, leveraging eliding the fine details of compositionality to focus on connectivity. However, when working with SMCs in a proof assistant, the rigid equational structure of composition occludes the essential connective information, longer proofs filled with uninformative syntactic manipulation. To address the gap between proof assistants and paper proof, we have developed verified tools for diagrammatic reasoning in Rocq, including inferring term equivalence and rewriting modulo the deformation of string diagrams. This is achieved by converting between syntactic representations of SMC terms and hypergraphs with interfaces, while preserving a common tensor semantics. We provide tools to develop simple SMC theories from generators and relations, and perform equational reasoning these systems. We also enable our tactics to be used in existing verification projects about SMCs which can be given semantics as tensor expressions.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The manuscript presents TensorRocq, a Rocq development providing verified tools for diagrammatic reasoning over symmetric monoidal categories. It converts syntactic SMC terms to hypergraphs with interfaces while preserving a common tensor semantics, thereby supporting inference of term equivalence and equational rewriting modulo string-diagram deformations. The library also supplies infrastructure for defining SMC theories from generators and relations and for integrating the tactics into existing verification projects that interpret terms as tensor expressions.
Significance. If the conversion is shown to be both sound and complete with respect to the tensor semantics for the full class of SMC-licensed deformations, the work would meaningfully reduce the syntactic overhead of equational proofs in proof assistants and make diagrammatic intuition directly usable inside Rocq. This could accelerate formal developments in areas that already employ SMCs (e.g., quantum protocols, concurrency, or categorical semantics) and encourage wider adoption of string-diagram techniques in machine-checked reasoning.
major comments (1)
- [Abstract] Abstract and the description of the conversion: the central claim that the tools correctly infer equivalence and support rewriting modulo all allowed deformations requires that hypergraph equivalence is both sound and complete with respect to SMC term equivalence under the tensor semantics. The manuscript asserts preservation of a common semantics but does not appear to contain an explicit machine-checked theorem establishing the if-and-only-if correspondence for the full set of topological rewrites licensed by the SMC axioms. Without such a completeness result, rewriting may miss valid equivalences or accept invalid ones.
minor comments (1)
- The abstract would benefit from a brief concrete example illustrating a non-trivial deformation that the hypergraph representation captures but that is cumbersome in pure syntactic rewriting.
Simulated Author's Rebuttal
We thank the referee for their thorough review and constructive feedback. The positive assessment of TensorRocq's potential impact is appreciated. Below we address the major comment point by point, providing the strongest honest defense of the manuscript while acknowledging where clarification is warranted.
read point-by-point responses
-
Referee: [Abstract] Abstract and the description of the conversion: the central claim that the tools correctly infer equivalence and support rewriting modulo all allowed deformations requires that hypergraph equivalence is both sound and complete with respect to SMC term equivalence under the tensor semantics. The manuscript asserts preservation of a common semantics but does not appear to contain an explicit machine-checked theorem establishing the if-and-only-if correspondence for the full set of topological rewrites licensed by the SMC axioms. Without such a completeness result, rewriting may miss valid equivalences or accept invalid ones.
Authors: We agree that soundness and completeness are central to the claims. The manuscript establishes that the term-to-hypergraph conversion preserves tensor semantics, which directly yields soundness: any equivalence inferred or used for rewriting via hypergraph deformation is valid under the common semantics, so invalid equivalences cannot be accepted. The hypergraph construction (with interfaces and hyperedges) is defined to encode precisely the connectivity and topological deformations licensed by the SMC axioms, ensuring that the supported rewrites align with string-diagram deformations. We acknowledge that the current text does not isolate a single machine-checked if-and-only-if theorem covering the full set of deformations. We will revise the manuscript to add an explicit soundness theorem statement (already implicit in the semantics preservation lemmas) together with a discussion of completeness grounded in the construction and the known correspondence between SMC axioms and string-diagram isotopy. This will be a partial revision that clarifies the claims without changing the core development. revision: partial
Circularity Check
No circularity: verified implementation defines and proves its own conversions
full rationale
The paper presents a Rocq development that defines syntactic-to-hypergraph conversions for SMC terms and claims semantic preservation. This is self-contained formal work: the representations are introduced, the conversion functions are implemented, and preservation is established inside the proof assistant rather than by reducing to prior fitted values, self-citations, or tautological redefinitions. No equations or steps in the abstract reduce a claimed result to its own inputs by construction, and the central contribution (tactics for diagrammatic reasoning) consists of new verified code rather than a renaming or imported uniqueness theorem.
Axiom & Free-Parameter Ledger
axioms (2)
- standard math Symmetric monoidal categories satisfy the standard associativity, commutativity, and unit laws for the tensor product.
- domain assumption String diagrams represent equations in SMCs via connectivity and continuous deformations.
Reference graph
Works this paper leans on
-
[1]
Journal of the ACM (JACM)69(2), 1–58 (2022)
Bonchi, F., Gadducci, F., Kissinger, A., Sobocinski, P., Zanasi, F.: String diagram rewrite theory i: Rewriting with frobenius structure. Journal of the ACM (JACM)69(2), 1–58 (2022)
work page 2022
-
[2]
Mathematical Structures in Computer Science32(4), 511–541 (2022)
Bonchi, F., Gadducci, F., Kissinger, A., Sobocinski, P., Zanasi, F.: String diagram rewrite theory ii: Rewriting with symmetric monoidal structure. Mathematical Structures in Computer Science32(4), 511–541 (2022)
work page 2022
-
[3]
Mathematical Structures in Computer Science32(7), 829–869 (2022)
Bonchi, F., Gadducci, F., Kissinger, A., Sobociński, P., Zanasi, F.: String diagram rewrite theory iii: Confluence with and without frobenius. Mathematical Structures in Computer Science32(7), 829–869 (2022)
work page 2022
-
[4]
An automated deductive verification framework for circuit-building quantum programs
Chareton, C., Bardin, S., Bobot, F., Perrelle, V., Valiron, B.: An automated deductive verification framework for circuit-building quantum programs. In: Yoshida, N. (ed.) Programming Languages and Systems, ESOP 2021. Lec- ture Notes in Computer Science, vol. 12648, pp. 148–177. Springer International Publishing, Cham (March 2021). https://doi.org/10.1007/...
-
[5]
New Journal of Physics 13(4), p
Coecke, B., Duncan, R.: Interacting quantum observables: categorical algebra and diagrammatics. New Journal of Physics13(4), 043016 (apr 2011). https://doi.org/10.1088/1367-2630/13/4/043016
-
[6]
Picturing Quantum Processes: A First Course in Quantum Theory and Diagrammatic Reasoning
Coecke, B., Kissinger, A.: Picturing Quantum Processes: A First Course in Quantum Theory and Diagrammatic Reasoning. Cambridge University Press (2017). https://doi.org/10.1017/9781316219317
-
[7]
In: Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming
Grégoire, B., Leroy, X.: A compiled implementation of strong reduction. In: Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming. p. 235–246. ICFP ’02, Association for Computing Machinery, New York, NY, USA (2002). https://doi.org/10.1145/581478.581501, https://doi.org/10.1145/581478.581501
-
[8]
Gregoire, B., Mahboubi, A.: Proving Equalities in a Commutative Ring Done Right in Coq. In: Hurd, J., Melham, T. (eds.) Lecture Notes in Computer Science. Lecture Notes in Computer Science, vol. 3603, pp. 98–113. Springer, Oxford, United Kingdom (Aug 2005). https://doi.org/10.1007/11541868_7, https://inria.hal.science/hal-00819484
-
[9]
Hietala, K., Rand, R., Hung, S.H., Li, L., Hicks, M.: Proving Quantum Programs Correct. In: Cohen, L., Kaliszyk, C. (eds.) 12th International Conference on Interactive Theorem Proving (ITP 2021). Leibniz International Proceedings in Informatics (LIPIcs), vol. 193, pp. 21:1–21:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl, Germany (2021)....
-
[10]
INQWIRE Developers: INQWIRE QuantumLib (1 2022), https://github.com/inQWIRE/QuantumLib
work page 2022
-
[11]
Kissinger, A.: Abstract Tensor Systems as Monoidal Categories, pp. 235–252. Springer Berlin Heidelberg, Berlin, Heidelberg (2014). https://doi.org/10.1007/978-3-642-54789-8_13, https://doi.org/10.1007/978-3-642-54789-8_13
-
[12]
https: //github.com/akissinger/chyp (2023)
Kissinger, A.: GitHub - akissinger/chyp: An interactive theorem prover for string diagrams — github.com. https: //github.com/akissinger/chyp (2023)
work page 2023
-
[13]
Krebbers, R., Jung, R.: Rocq-std++, https://gitlab.mpi-sws.org/iris/stdpp
-
[14]
Lehmann, A., Caldwell, B., Shah, B., Spencer, W., Rand, R.: Vyzx: Formal verification of a graphical quantum language (2026), https://arxiv.org/abs/2311.11571
work page internal anchor Pith review Pith/arXiv arXiv 2026
-
[15]
Mahboubi, A., Tassi, E.: Mathematical components. Online book (2021)
work page 2021
-
[16]
Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information: 10th Anniversary Edition. Cambridge University Press, Cambridge (December 2010). https://doi.org/10.1017/CBO9780511976667
-
[17]
arXiv preprint arXiv:2602.19806 (2026)
Pous, D.: String diagrams for monoidal categories, in rocq. arXiv preprint arXiv:2602.19806 (2026)
-
[18]
Selinger, P.: A survey of graphical languages for monoidal categories. In: New Structures for Physics, pp. 289–355. Springer Berlin Heidelberg (2010). https://doi.org/10.1007/978-3-642-12821-9_4
-
[19]
Shah, B., Spencer, W., Zielinski, L., Caldwell, B., Lehmann, A., Rand, R.: ViCAR: Visualizing Categories with Automated Rewriting in Coq. In: Johnson, M., Myers, D.J. (eds.) Proceedings Seventh International Conference on Applied Category Theory 2024, Oxford, United Kingdom, 17 - 21 June 2024. Electronic Proceedings in Theoretical Computer Science, vol. 4...
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.