We demonstrate how category theory provides specifications that can efficiently be implemented via imperative algorithms and apply this to the field of graph rewriting. By examples, we show how this paradigm of software development makes it easy to quickly write correct and performant code. We provide a modern implementation of graph rewriting techniques at the level of abstraction of finitely-presented C-sets and clarify the connections between C-sets and the typed graphs supported in existing rewriting software. We emphasize that our open-source library is extensible: by taking new categorical constructions (such as slice categories, structured cospans, and distributed graphs) and relating their limits and colimits to those of their underlying categories, users inherit efficient algorithms for pushout complements and (final) pullback complements. This allows one to perform double-, single-, and sesqui-pushout rewriting over a broad class of data structures.
翻译:我们展示了范畴论如何提供能够通过命令式算法高效实现的规范,并将其应用于图重写领域。通过举例,我们展示了这种软件开发范式使得快速编写符合正确性和性能的代码变得轻而易举。我们提供了一个现代的图重写技术实现,抽象层次为有限表示的 C-集合,并澄清了 C-集合与现有重写软件中支持的类型图之间的联系。我们强调我们的开源库是可扩展的:通过使用新的范畴构造(例如切片范畴、结构化余箭头和分布式图形),并将它们的极限和余极限与其基础范畴的极限和余极限相关联,用户可以继承有效的算法,用于推出互补和(最终的)回拉互补。这使得我们可以在广泛的数据结构类上执行双重、单向和 sesqui-pushout 重写。