Spans, Relations, Graphs

January 24, 2024 — Brad Venner

Why knowledge graphs

Been thinking about knowledge graphs for the past couple weeks. My interest was sparked by further research into “cognitive language agents”, an attempt to unify large language models with previous AI research into “cognitive architectures”. But I’m also interested in the more practical problem of extracting citations and links from “ingested” documents in Attar, and since citation graphs are common, this seemed like the natural data structure.

Working, declarative, procedural memory

Categorical models of production rules, i.e. procedural memory

Property graphs vs “knowledge graphs”

Spans and relations

Algebraic rewriting

Computational Category-Theoretic Rewriting [@brown:2023:computational], or algebraic rewriting, as it is called in the Wikipedia page and in the Algebraic Julia software collection. This paper discusses the conditions for a pushout complement to be present in a category. These do not exist in every C-set

$A \rightarrow B \rightarrow C$ has a pushout complement when $A \rightarrow B$ is monic. This is the same condition used in the similar paper on categorical-theoretic production rules [@aguinaldo:2023:categorical]

Models for modality

Modality is a key concept in Peirce’s gamma graphs, and

Sowa develops a model for modality that includes nested graph models. In Sowa’s conceptual graphs, a context is a box and graphs can refer to these contexts.

Modality in category

Diagrammatic Algebra of First Order Logic

Was thinking about modality above and decided to look for the paper that updated Peirce’s existential graphs, given the importance that Sowa gives to “context boxes”. Thanks to Semantic Scholar, it turns out that there is a successor paper entitled Diagrammatic Algebra of First Order Logic [@bonchi_2024_diagrammatic]. This is an extremely impressive paper. It naturally assumes Patterson’s knowledge representation paper while extending it to a full first-order system. In addition, the consistent diagrammatic syntax has an elegant simplicity for such a complex subject, and the paper is relatively easy to read.

In addition to the potential to extend this work to modality (not an obvious next step yet), two obvious related fields. The first is the clear family resemblance to Schulman’s “affine logic” paper. The co-cartesian structure has a resemblance to the negative form discussed by Shulman as an “apartness” relationship. The second is the extension from a bicategory to a double category framework. Spans and cospans have already been developed as cartesian and co-cartesian double categories. The latter step might help link logic to the “categorical systems” literature more explicitly. Shulman hypothesized the ability to move from (co)cartesian bicategories to (co)cartesian double categories.

Relation to cognitive language agents

I started looking at cognitive language agents due to the CoALA paper and the proposed Mycor|rhiza architecture. As described by The decision cycle at the center of the architecture uses both a large language model and a declarative/procedural memory. This latter frame was traditionally implemented by semantic networks (later branded as “knowledge graphs” by Google). Declarative memory was instituted by a graph, and procedural memory by graph rewriting. Sumers