A Diagrammatic Basis for Computer Programming
Pith reviewed 2026-05-17 01:05 UTC · model grok-4.3
The pith
Kleene-Cartesian rig categories let tape diagrams represent imperative programs and program logic graphically.
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
Kleene-Cartesian rig categories are rig categories where ⊗ forms a Cartesian bicategory while ⊕ forms a Kleene bicategory. The tape diagrams associated with such categories can conveniently deal with imperative programs and various program logic.
What carries the argument
Tape diagrams of Kleene-Cartesian rig categories, which use Cartesian bicategorical structure on ⊗ for branching and Kleene bicategorical structure on ⊕ for sequencing and fixed points.
If this is right
- Sequential composition and iteration in programs become diagrammatic composition and Kleene-star operations.
- State and assignment operations are expressed by the Cartesian structure on the tensor product.
- Assertions and program logics appear as additional arrows or relations within the same diagrams.
- Equational reasoning about program equivalence reduces to diagram rewriting.
Where Pith is reading between the lines
- The same diagrammatic language might extend to model probabilistic or quantum imperative programs by replacing the rig with a suitable semiring.
- Visual editors that manipulate these tape diagrams could serve as direct interfaces for writing and verifying low-level code.
- Connections to existing string-diagram calculi for concurrency suggest a route toward unified graphical semantics across programming paradigms.
Load-bearing premise
Adding Cartesian bicategory structure to the tensor and Kleene bicategory structure to the sum inside a rig category is enough for the resulting tape diagrams to model imperative programs and program logic.
What would settle it
An imperative program fragment or a Hoare-triple-style assertion whose intended behavior cannot be captured by any finite tape diagram in a Kleene-Cartesian rig category would refute the claim.
Figures
read the original abstract
Tape diagrams provide a convenient graphical notation for arrows of rig categories, i.e., categories equipped with two monoidal products, $\oplus$ and $\otimes$. In this work, we introduce Kleene-Cartesian rig categories, namely rig categories where $\otimes$ provides a Cartesian bicategory, while $\oplus$ a Kleene bicategory. We show that the associated tape diagrams can conveniently deal with imperative programs and various program logic.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper introduces Kleene-Cartesian rig categories, which equip rig categories with a Cartesian bicategory structure on the monoidal product ⊗ and a Kleene bicategory structure on ⊕. It claims that the associated tape diagrams then provide a convenient graphical notation for modeling and reasoning about imperative programs together with various program logics.
Significance. If the compatibility between the bicategory structures and the underlying rig operations can be established, the work would supply a diagrammatic calculus for imperative constructs such as iteration and branching. This could strengthen the connection between graphical calculi and program semantics, but the significance hinges on concrete demonstrations that the diagrams preserve the intended program behavior.
major comments (1)
- [Definition of Kleene-Cartesian rig categories (and the subsequent tape-diagram semantics)] The central claim rests on the assumption that no additional coherence conditions are required for the Kleene fixed-point operator and Cartesian projections to distribute properly over the rig multiplication. The manuscript should supply an explicit verification or counter-example check that the combined axioms yield sound encodings of loops and assignments; without this step the modeling claim remains unproven.
minor comments (1)
- [Abstract] The abstract would be clearer if it briefly indicated which imperative constructs (e.g., while-loops, assignments) are directly represented by which diagram operations.
Simulated Author's Rebuttal
We are grateful to the referee for their insightful comments on our paper. We believe our introduction of Kleene-Cartesian rig categories provides a robust framework for diagrammatic reasoning about imperative programs, and we clarify the points raised below.
read point-by-point responses
-
Referee: [Definition of Kleene-Cartesian rig categories (and the subsequent tape-diagram semantics)] The central claim rests on the assumption that no additional coherence conditions are required for the Kleene fixed-point operator and Cartesian projections to distribute properly over the rig multiplication. The manuscript should supply an explicit verification or counter-example check that the combined axioms yield sound encodings of loops and assignments; without this step the modeling claim remains unproven.
Authors: The referee correctly identifies that the soundness of the tape diagram semantics for loops and assignments relies on the proper interaction between the Kleene fixed-point and the Cartesian structure via the rig operations. However, we maintain that the existing axioms in the definition of Kleene-Cartesian rig categories already ensure this compatibility without requiring additional coherence conditions. The Kleene bicategory axioms for ⊕ include the necessary fixed-point properties that are natural with respect to the monoidal structure, and the Cartesian bicategory axioms for ⊗ provide the projections that distribute appropriately over the rig multiplication by the rig category definition. In Section 3 of the manuscript, we define these structures, and in Section 4, we illustrate their use in encoding programs, showing that the diagrams correctly model iteration and branching. To address the referee's request for explicit verification, we will include a dedicated paragraph or subsection in the revised manuscript that explicitly checks the coherence for the key cases of loop and assignment encodings. revision: yes
Circularity Check
No circularity: modeling follows directly from new Kleene-Cartesian rig category definitions
full rationale
The paper defines Kleene-Cartesian rig categories by equipping rig categories with a Cartesian bicategory structure on ⊗ and a Kleene bicategory structure on ⊕. It then claims that the associated tape diagrams can model imperative programs and program logic. This is a constructive forward step from the introduced axioms and diagrammatic syntax to the claimed applications. No equations or claims reduce by construction to prior fitted quantities, self-citations, or renamed inputs; the derivation chain remains self-contained against the paper's own definitions without load-bearing circular reductions.
Axiom & Free-Parameter Ledger
axioms (3)
- standard math Rig categories are equipped with two monoidal products ⊕ and ⊗.
- domain assumption ⊗ forms a Cartesian bicategory.
- domain assumption ⊕ forms a Kleene bicategory.
invented entities (1)
-
Kleene-Cartesian rig categories
no independent evidence
Reference graph
Works this paper leans on
-
[1]
Sufficient incorrectness logic: SIL and separation SIL, 2023.arXiv:2310.18156
[ABGL23] Flavio Ascari, Roberto Bruni, Roberta Gori, and Francesco Logozzo. Sufficient incorrectness logic: SIL and separation SIL, 2023.arXiv:2310.18156. [AK01] Allegra Angus and Dexter Kozen. Kleene algebra with tests and program schematology. Technical report, Cornell University,
-
[2]
Tape diagrams for monoidal monads
[BCGL25] Filippo Bonchi, Cipriano Junior Cioffo, Alessandro Di Giorgio, and Elena Di Lavore. Tape diagrams for monoidal monads. In Corina Cˆ ırstea and Alexander Knapp, editors,11th Conference on Algebra and Coalgebra in Computer Science, CALCO 2025, June 16-18, 2025, University of Strathclyde, UK, volume 342 ofLIPIcs, pages 11:1–11:24. Schloss Dagstuhl -...
work page 2025
-
[3]
URL:https://doi.org/10.4230/LIPIcs.CALCO.2025.11, doi:10.4230/ LIPICS.CALCO.2025.11. [BCH24] Chris Barrett, Daniel Castle, and Willem Heijltjes. The relational machine calculus. In Pawel Sobocinski, Ugo Dal Lago, and Javier Esparza, editors,Proceedings of the 39th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2024, Tallinn, Estonia, July 8-...
-
[4]
[BDGHS24] Filippo Bonchi, Alessandro Di Giorgio, Nathan Haydon, and Pawel Sobocinski
URL:https://arxiv.org/abs/2410.03561,arXiv:2410.03561. [BDGHS24] Filippo Bonchi, Alessandro Di Giorgio, Nathan Haydon, and Pawel Sobocinski. Diagrammatic algebra of first order logic. In Pawel Sobocinski, Ugo Dal Lago, and Javier Esparza, editors, Proceedings of the 39th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2024, Tallinn, Estonia, ...
-
[5]
doi:10.1145/3661814. 3662078. [BDGS23] Filippo Bonchi, Alessandro Di Giorgio, and Alessio Santamaria. Deconstructing the calcu- lus of relations with tape diagrams.Proceedings of the ACM on Programming Languages, 7(POPL):1864–1894,
-
[6]
Relational Connectors and Heterogeneous Simulations
[BGL25] Filippo Bonchi, Alessandro Di Giorgio, and Elena Di Lavore. A diagrammatic algebra for program logics. In Parosh Aziz Abdulla and Delia Kesner, editors,Foundations of Software Science and Computation Structures - 28th International Conference, FoSSaCS 2025, Held as Part of the International Joint Conferences on Theory and Practice of Software, ETA...
-
[7]
[BP14] Paul Brunet and Damien Pous. Kleene algebra with converse. InRelational and Algebraic Methods in Computer Science: 14th International Conference, RAMiCS 2014, Marienstatt, Germany, April 28–May 1,
work page 2014
-
[8]
Functorial Semantics for Relational Theories
43 [BPS17] Filippo Bonchi, Dusko Pavlovic, and Pawel Sobocinski. Functorial semantics for relational theories.arXiv preprint arXiv:1711.08699,
work page internal anchor Pith review Pith/arXiv arXiv
-
[9]
[BSS18] Filippo Bonchi, Jens Seeber, and Pawel Sobocinski. Graphical Conjunctive Queries. In Dan Ghica and Achim Jung, editors,27th EACSL Annual Conference on Computer Science Logic (CSL 2018), volume 119 ofLeibniz International Proceedings in Informatics (LIPIcs), pages 13:1–13:23, Dagstuhl, Germany,
work page 2018
-
[10]
doi: 10.4230/LIPIcs.CSL.2018.13
Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik. doi: 10.4230/LIPIcs.CSL.2018.13. [BSZ15] Filippo Bonchi, Pawel Sobocinski, and Fabio Zanasi. Full abstraction for signal flow graphs. ACM SIGPLAN Notices, 50(1):515–526,
-
[11]
Automatic inference of necessary preconditions
[CCFL13] Patrick Cousot, Radhia Cousot, Manuel F¨ ahndrich, and Francesco Logozzo. Automatic inference of necessary preconditions. In Roberto Giacobazzi, Josh Berdine, and Isabella Mastroeni, editors,Verification, Model Checking, and Abstract Interpretation, 14th International Conference, VMCAI 2013, Rome, Italy, January 20-22,
work page 2013
-
[12]
Springer, 2013.doi:10.1007/978-3-642-35873-9\_10
Proceedings, volume 7737 ofLecture Notes in Computer Science, pages 128–148. Springer, 2013.doi:10.1007/978-3-642-35873-9\_10. [CD11] Bob Coecke and Ross Duncan. Interacting quantum observables: categorical algebra and diagrammatics.New Journal of Physics, 13(4):043016,
-
[13]
Sheet diagrams for bimonoidal categories, 2020.arXiv:2010.13361
[CDH20] Cole Comfort, Antonin Delpeuch, and Jules Hedges. Sheet diagrams for bimonoidal categories, 2020.arXiv:2010.13361. [CG99] Andrea Corradini and Fabio Gadducci. An algebraic presentation of term graphs, via gs-monoidal categories.Applied Categorical Structures, 7(4):299–331,
-
[14]
arXiv:1701.07400,doi:10.4204/EPTCS.266.7. [CW87] Aurelio Carboni and R. F. C. Walters. Cartesian bicategories I.Journal of Pure and Applied Algebra, 49:11–32,
work page internal anchor Pith review Pith/arXiv arXiv doi:10.4204/eptcs.266.7
-
[15]
A presentation of the category of stochastic matrices
doi:10.1080/00927877608822127. [Fri09] Tobias Fritz. A presentation of the category of stochastic matrices.CoRR, abs/0902.2554,
work page internal anchor Pith review Pith/arXiv arXiv doi:10.1080/00927877608822127
-
[16]
String diagrams for regular logic (extended abstract)
[FS20] Brendan Fong and David Spivak. String diagrams for regular logic (extended abstract). In John Baez and Bob Coecke, editors,Applied Category Theory 2019, volume 323 ofElectronic Proceedings in Theoretical Computer Science, page 196–229. Open Publishing Association, Sep 2020.doi:10.4204/eptcs.323.14. [GJ16] Dan R. Ghica and Achim Jung. Categorical se...
-
[17]
[JCB17] Franciscus Rebro John C. Baez, Brandon Coya. Props in network theory.CoRR, abs/1707.08321,
work page internal anchor Pith review Pith/arXiv arXiv
-
[18]
URL:http://arxiv.org/abs/1707.08321,arXiv:1707.08321. [JS91] Andr´ e Joyal and Ross Street. The geometry of tensor calculus, I.Advances in Mathematics, 88(1):55–112, July 1991.doi:10.1016/0001-8708(91)90003-P. [JSV96a] Andr´ e Joyal, Ross Street, and Dominic Verity. Traced monoidal categories.Math Procs Cambridge Philosophical Society, 119(3):447–468, 4
work page internal anchor Pith review Pith/arXiv arXiv doi:10.1016/0001-8708(91)90003-p 1991
-
[19]
Springer.doi:10.1007/BFb0059555. [Law63] F. W. Lawvere.Functorial Semantics of Algebraic Theories. PhD thesis, Columbia University, New York, NY, USA,
-
[20]
Thirty-seven years of relational hoare logic: remarks on its principles and history
[Nau20] David A Naumann. Thirty-seven years of relational hoare logic: remarks on its principles and history. InLeveraging Applications of Formal Methods, Verification and Validation: Engineering Principles: 9th International Symposium on Leveraging Applications of Formal Methods, ISoLA 2020, Rhodes, Greece, October 20–30, 2020, Proceedings, Part II 9, pa...
work page 2020
-
[21]
On the positive calculus of relations with transitive closure
[Pou18] Damien Pous. On the positive calculus of relations with transitive closure. In Rolf Niedermeier and Brigitte Vall´ ee, editors,35th Symposium on Theoretical Aspects of Computer Science, STACS 2018, February 28 to March 3, 2018, Caen, France, volume 96 ofLIPIcs, pages 3:1–3:16. Schloss Dagstuhl - Leibniz-Zentrum f¨ ur Informatik, 2018.doi:10.4230/L...
-
[22]
doi:10.1017/S0960129597002375. [Pra76] Vaughan R Pratt. Semantical considerations on floyd-hoare logic. In17th Annual Symposium on Foundations of Computer Science (sfcs 1976), pages 109–121. IEEE,
-
[23]
[SD16] Marcelo Sousa and Isil Dillig
doi:10.46298/lmcs-19(1:13)2023. [SD16] Marcelo Sousa and Isil Dillig. Cartesian hoare logic for verifying k-safety properties. InProceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 57–69,
-
[24]
Quantum relational hoare logic.Proc
[Unr19] Dominique Unruh. Quantum relational hoare logic.Proc. ACM Program. Lang., 3(POPL), January 2019.doi:10.1145/3290346. [Win93] Glynn Winskel.The formal semantics of programming languages: an introduction. MIT press,
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.