🤖 AI Summary
This paper addresses the formal modeling of imperative programs and program logic. We propose a graphical semantic framework based on rig categories. Our method introduces Kleene–Cartesian rig categories, where the tensor product ⊗ models Cartesian structure (capturing sequential composition and tuple formation), while the monoidal sum ⊕ models Kleene structure (encoding nondeterministic choice and iteration); tape diagrams serve as intuitive graphical representations of morphisms in this category. This framework unifies the algebraic features of Cartesian and Kleene bicategories, providing a foundation that simultaneously ensures algebraic rigor and visual intelligibility for program structure. Experimental evaluation demonstrates that our approach significantly enhances graphical reasoning capabilities and formal verification efficiency for imperative programs—particularly in the joint modeling of loops, conditional branches, and assertion logic.
📝 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.