Abstract 1 Introduction 2 Facts about 𝓜-adhesive categories and kernel pairs 3 Hypergraphical structures 4 Adding equivalences to hypergraphical structures 5 EGGs 6 Pros and cons of adhesive rewriting 7 Conclusions and further and related works References

EGGs Are Adhesive!

Roberto Biondo ORCID Department of Computer Science, University of Pisa, Pisa, Italy Davide Castelnovo ORCID Department of Computer Science, University of Pisa, Pisa, Italy Fabio Gadducci ORCID Department of Computer Science, University of Pisa, Pisa, Italy
Abstract

The use of rewriting-based visual formalisms is on the rise. In the formal methods community, this is due also to the introduction of adhesive categories, where most properties of classical approaches to graph transformation, such as those on parallelism and confluence, can be rephrased and proved in a general and uniform way. E-graphs (EGGs) are a formalism for program optimisation via an efficient implementation of equality saturation. In short, EGGs can be defined as (acyclic) term graphs with an additional notion of equivalence on nodes that is closed under the operators of the signature. Instead of replacing the components of a program, the optimisation step is performed by adding new components and linking them to the existing ones via an equivalence relation, until an optimal program is reached. This work describes EGGs via adhesive categories. Besides the benefits in itself of a formal presentation, which renders precise the properties of the data structure, the description of the addition of equivalent program components using standard graph transformation tools offers the advantages of the adhesive framework in modelling, for example, concurrent updates.

Keywords and phrases:
Hypergraphs, terms graphs, e-graphs, adhesive categories
Copyright and License:
[Uncaptioned image] © Roberto Biondo, Davide Castelnovo, and Fabio Gadducci; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Models of computation
; Theory of computation Semantics and reasoning
Related Version:
Full Version: https://arxiv.org/abs/2503.13678 [6]
Funding:
The research has been partially supported by the Italian MUR - Call PRIN 2022 - Project 20228KXFN2 “Spatio-Temporal Enhancement of Neural nets for Deeply Hierarchical Automatised Logic” (STENDHAL) and by the University of Pisa - Call PRA 2022 - Project 2022_99 “Formal Methods for the Healthcare Domain based on Spatial Information” (FM4HD).
Editors:
Corina Cîrstea and Alexander Knapp

1 Introduction

The introduction of adhesive categories marked a watershed moment for the algebraic approaches to the rewriting of graph-like structures [25, 17]. Until then, key results of the approaches on e.g. parallelism and confluence had to be proven over and over again for each different formalism at hand, despite the obvious similarity of the procedure. Adhesive categories provides such a disparate set of formalisms with a common abstract framework where many of these general results can be recast and uniformly proved once and for all. In short, following the double-pushout (DPO) approach to graph transformation [13, 17], a rule is given by two arrows l:KL and r:KR and its application requires a match m:LG: the rewriting step from G to H is then given by the diagram below, whose halves are pushouts.

Thus, L and R are the left- and right-hand side of the rule, respectively, while K witnesses those parts that must be present for the rule to be executed, yet that are not affected by the rule itself. Should a category be adhesive, and the arrows of the rules monomorphisms, the presence of a match ensures that if the pushout complement CG exists then it is unique, hence a rewriting step can be deterministically performed. The theory of -adhesivity [2, 22] extends the core framework, ensuring that if the arrows of the rules are in a suitable class of monomorphisms then the benefits of adhesivity can be recovered [15, 16]. If only the left-hand side belongs to , the theory is still under development, as witnessed e.g. by [3]. However, despite the elegance and effectiveness, proving that a given category satisfies the conditions for being -adhesive can be a daunting task. For this reason, sufficient criteria have been provided for the core framework, e.g. that every elementary topos is adhesive [24], as well as for the extended one of -adhesivity [11]. For some structures such as hypergraphs with equivalence in [4], the question of their -adhesivity has not yet been settled.

E-graphs (shortly, EGGs) are an up-and-coming formalism for program optimisation and synthesis via a compact representation and efficient implementation of equality saturation. Albeit a classical data structure [14], EGGs received new impulse after the seminal [31] and developed a thriving community, as witnessed by the official website [29]. The key idea of rewriting-based program optimisation is to perform the manipulation of a syntactical description of a program, replacing some of its components in such a way that the semantics is preserved while the computational costs of its actual execution are improved. Instead of directly removing sub-programs, EGGs just add the new components and link them to the older ones via the equivalence relation, until an optimal program is reached and extracted.

EGGs can be concisely defined as term graphs equipped with a notion of equivalence on nodes that is closed under the operators of a signature [14, Section 4.2]. In the presentation of term graphs via string diagrams [11], EGGs are (hyper)trees whose edges are labelled by operators and with the possibility of sharing subtrees, with an additional equivalence relation on nodes that is closed under composition. In plain words and using a toy example: if a and b are two constants such that ab, then f(a)f(b) for any unary operator f.

Building on the criterion developed in [11], this work proves that both hypergraphs with equivalence and EGGs form an -adhesive category for a suitable choice of . The advantages from this characterisation are two-fold. On the one side, we put the benefits per se of a formal presentation, making precise the properties of the data structure. On the other side, describing the optimisation steps via the DPO approach offers the tools for modelling their parallel and concurrent execution and for proving their confluence and termination.

Synopsis.

The paper has the following structure. In Section 2 we briefly recall the theory of -adhesive categories and of kernel pairs. In Section 3 we present the graphical structures of our interest, (labelled) hypergraphs and term graphs, and we provide a functorial characterisation, which allows for proving their adhesivity properties. This is expanded in Section 4 for proving the -adhesivity of hypergraphs and term graphs with equivalence and in Section 5 of their variants where equivalences are closed with respect to operator application, thus subsuming EGGs. In Section 6 we put the machinery at work, showing how the optimisation steps can be rephrased as the application of term graph rewriting rules. Finally, in Section 7 we draw our conclusions, hint at future endeavours and offer some brief remarks on related works. All the proofs can be found in the full version of the paper [6].

2 Facts about 𝓜-adhesive categories and kernel pairs

We open this background section by fixing some notation. Given a category X we do not distinguish notationally between X and its class of objects, so “XX” means that X is an object of X. We let 𝖬𝗈𝗋(X), 𝖬𝗈𝗇𝗈(X) and 𝖱𝖾𝗀(X) denote the class of all arrows, monos and regular monos of X, respectively. Given an object X, we denote by ?X the unique arrow from an initial object into X and by !X that unique arrow from X into a terminal one. We will also use the notation e:XY to denote that an arrow e:XY is a regular epi.

2.1 𝓜-adhesivity

The key property of -adhesive categories is the Van Kampen condition [8, 23, 25], and for defining it we need some notions. Let X be a category. A subclass 𝒜 of 𝖬𝗈𝗋(X) is said to be

  • stable under pushouts (pullbacks) if for every pushout (pullback) square as the one below, if m𝒜 (n𝒜) then n𝒜 (m𝒜);

  • closed under composition if h,k𝒜 implies hk𝒜 whenever h and k are composable;

  • closed under decomposition, or left-cancellable, if whenever g and gf belong to 𝒜, then f𝒜.

Definition 2.1.

Let 𝒜𝖬𝗈𝗋(X) be a class of arrows in a category X and consider the cube below.

We say that the bottom square is an 𝒜-Van Kampen square if

  1. 1.

    it is a pushout square;

  2. 2.

    whenever the cube above has pullbacks as back and left faces and the vertical arrows belong to 𝒜, then its top face is a pushout if and only if the front and right faces are pullbacks.

Pushout squares that enjoy only the “if” half of item (2) above are called 𝒜-stable. A 𝖬𝗈𝗋(X)-Van Kampen square is called Van Kampen and a 𝖬𝗈𝗋(X)-stable square stable.

We can now define -adhesive categories.

Definition 2.2 ([2, 15, 16, 25, 22]).

Let X be a category and a subclass of 𝖬𝗈𝗇𝗈(X) including all isos, closed under composition, decomposition, and stable under pullbacks and pushouts. The category X is said to be -adhesive if

  1. 1.

    it has -pullbacks, i.e. pullbacks along arrows of ;

  2. 2.

    it has -pushouts, i.e. pushouts along arrows of ;

  3. 3.

    -pushouts are -Van Kampen squares.

A category X is said to be strictly -adhesive if -pushouts are Van Kampen. We write m:XY to denote that an arrow m:XY belongs to .

 Remark 2.3.

Our notion of -adhesive category corresponds to what in [17] is called weak adhesive HLR category, while a strict -adhesive categories corresponds to adhesive HLR ones. Finally, adhesivity and quasiadhesivity [25, 18] coincide with strict 𝖬𝗈𝗇𝗈(X)-adhesivity and strict 𝖱𝖾𝗀(X)-adhesivity, respectively.

-adhesivity is well-behaved with respect to the construction of (co-)slice and functor categories [26], as well with respect to subcategories, as shown by the following properties, taken from [17, Thm. 4.15], [25, Prop. 3.5] and [11, Thm. 2.12].

Proposition 2.4.

Let X be an (strict) -adhesive category. Then the following hold

  1. 1.

    if Y is an (strict) 𝒩-adhesive category, L:YA a functor preserving 𝒩-pushouts and R:XA one preserving -pullbacks, then LR is (strictly) 𝒩-adhesive, where

    𝒩:={(h,k)𝖬𝗈𝗋(LR)h𝒩,k}
  2. 2.

    for every object X the categories X/X and X/X are, respectively, (strictly) /X-adhesive and (strictly) X/-adhesive, where

    /X:={m𝖬𝗈𝗋(X/X)m}X/:={m𝖬𝗈𝗋(X/X)m}
  3. 3.

    for every small category Y, the category XY of functors YX is (strictly) Y-adhesive, where Y:={η𝖬𝗈𝗋(XY)ηY for every YY};

  4. 4.

    if Y is a full subcategory of X closed under pullbacks and -pushouts, then Y is (strictly) 𝒩-adhesive for every class of arrows 𝒩 of Y contained in that is stable under pullbacks and pushouts, contains all isos, and is closed under composition and decomposition.

We briefly list some examples of -adhesive categories.

Example 2.5.

𝐒𝐞𝐭 is adhesive, and, more generally, every topos is adhesive [24]. By the closure properties above, every presheaf [𝐗,𝐒𝐞𝐭] is adhesive, thus the category 𝐆𝐫𝐚𝐩𝐡=[EV,𝐒𝐞𝐭] is adhesive where EV is the two objects category with two morphisms s,t:EV. Similarly, various categories of hypergraphs can be shown to be adhesive, such as term graphs and hierarchical graphs [11]. Note that the category 𝐬𝐆𝐫𝐚𝐩𝐡𝐬 of simple graphs, i.e. graphs without parallel edges, is 𝖱𝖾𝗀(𝐬𝐆𝐫𝐚𝐩𝐡𝐬)-adhesive [5] but not quasiadhesive.

We can state some useful properties of -adhesive category (see, for instance, [17, Thm. 4.26] or [2, Fact 2.6]).

Proposition 2.6.

Let X be an -adhesive category. Then the following hold

  1. 1.

    every -pushout square is also a pullback;

  2. 2.

    every arrow in is a regular mono.

2.2 Some properties of kernel pairs and regular epimorphisms

In this section we recall the definition and some properties of kernel pairs.

Definition 2.7.

A kernel pair for an arrow f:AB is an object Kf together with two arrows πf1,πf2:KfA, denoted as (Kf,πf1,πf2), such that the square below is a pullback.

 Remark 2.8.

If (Kf,πf1,πf2) is a a kernel pair for f:XY and a product of X with itself exists, then the canonical arrow πf1,πf2:KfX×X is a mono.

 Remark 2.9.

An arrow m:MX is a mono if and only if it admits (M,𝗂𝖽M,𝗂𝖽M) as a kernel pair.

The previous remarks allow us to prove the following result.

Proposition 2.10.

Let f:XY be an arrow and m:YZ a mono. If (Kf,πf1,πf2) is a kernel pair for f:XY, then it is also a kernel pair for mf.

Regular epis are particular well-behaved with respect to their kernel pairs.

Proposition 2.11.

Let e:XY be a regular epi in a category X with a kernel pair (Ke,πe1,πe2). Then, e is the coequalizer of πe1 and πe2.

We conclude this section exploring some properties of kernel pairs in an -adhesive category. The results below are simple, yet they appear to be original.

Lemma 2.12.

Let f:XY and g:ZW be arrows admitting kernel pairs and suppose that the solid part of the four squares below is given. If the leftmost square is commutative, then there is a unique arrow kh:KfKg making the other three commutative.

Moreover, the following hold

  1. 1.

    if h is a mono then kh is a mono;

  2. 2.

    if the leftmost square is a pullback then the central two are pullbacks;

  3. 3.

    if h is mono and the leftmost square is a pullback then the rightmost is a pullback.

The previous result allows us to deduce the following lemma in an -adhesive context.

Proposition 2.13.

Let X be a strict -adhesive category with all pullbacks, and suppose that in the cube below the top face is an -pushout and all the vertical faces are pullbacks. Then the right square is a pushout.

Focusing on 𝐒𝐞𝐭, we can prove a sharper result.

Lemma 2.14.

Suppose that in 𝐒𝐞𝐭 the commuting cube in the diagram below on the left is given, whose top face is a pushout, the left and bottom faces are pullbacks, and n:BD is an injection. Then the following hold

  1. 1.

    the right face of the cube is a pullback;

  2. 2.

    the right square, made by the kernel pairs of the vertical arrows, is a pushout.

3 Hypergraphical structures

In this section we briefly recall the notion of hypergraph. In order to do so, a pivotal role is played by the Kleene star monad ():𝐒𝐞𝐭𝐒𝐞𝐭, also known as list monad, sending a set to the free monoid on it [28, 30]. We recall some of its proprieties.

Proposition 3.1.

Let X be a set and n. Then the following facts hold

  1. 1.

    there are arrows vn:XnX such that (X,{vn}n) is a coproduct;

  2. 2.

    for every arrow f:XY, f:XY is the coproduct of the family {fn}n;

  3. 3.

    () preserves all connected limits [9], in particular it preserves pullbacks and equalizers.

 Remark 3.2.

Preservation of pullbacks implies that () sends monos to monos.

 Remark 3.3.

Notice that 1 can be canonically identified with , thus for every set X the arrow !X:X1 induces a length function 𝗅𝗀X:X, which sends a word to its length.

3.1 The category of hypergraphs

We open this section with the definition of hypergraphs and we show how to label them with an algebraic signature.

Definition 3.4.

An hypergraph is a 4-uple 𝒢:=(E𝒢,V𝒢,s𝒢,t𝒢) made by two sets E𝒢 and V𝒢, called respectively the sets of hyperedges and nodes, plus a pair of source and target arrows s𝒢,t𝒢:E𝒢V𝒢.

A hypergraph morphism (E𝒢,V𝒢,s𝒢,t𝒢)(E,V,s,t) is a pair (h,k) of functions h:E𝒢E, k:V𝒢V such that the diagrams below are commutative.

We define Hyp to be the resulting category.

Let 𝗉𝗋𝗈𝖽 be the functor 𝐒𝐞𝐭𝐒𝐞𝐭 sending X to the product X×X. We can use it to present Hyp as a comma category.

Proposition 3.5.

Hyp is isomorphic to 𝗂𝖽𝐒𝐞𝐭𝗉𝗋𝗈𝖽

Note that by hypothesis () preserves pullbacks, while 𝗉𝗋𝗈𝖽 is continuous by definition, hence by Proposition 3.5 and the characterisation of monos in comma categories we can deduce the following result.

Corollary 3.6.

A morphism (h,k) is a mono in Hyp if and only if both its components are injective functions.

Applying Proposition 2.4 we also get the next corollary (cfr. [17, Fact 4.17]).

Corollary 3.7.

Hyp is an adhesive category.

Again Proposition 3.5 allows us to deduce immediately the following.

Proposition 3.8.

The forgetful functor UHyp which sends a hypergraph 𝒢 to its set of nodes has a left adjoint ΔHyp.

Example 3.9.

Since the initial object of Set is the empty set, ΔHyp(X) is the hypergraph which has X as set of nodes, as set of hyperedges, and ?X as source and target function.

Example 3.10.

We represent hypergraphs visually: dots denote nodes and boxes hyperedges. Should we be interested in their identity, we put a name near the corresponding dot or box. Sources and targets are represented by lines between dots and squares: the lines from the sources of a hyperedge comes from the left of the box, while the lines to the targets exit from the right of the box. Let us look at the picture below. It represent a hypergraph 𝒢 with sets V𝒢={v1,v2,v3,v4} and E𝒢={h1,h2,h3,h4} of nodes and edges, respectively, such that h1,h2 have no source and h3,h4 a pair of nodes

 Remark 3.11.

It is worth to point out, as first noted in [7], that Hyp is equivalent to a category of presheaves. Indeed, consider the category H in which the set of objects is given by (×){} and arrows are given by the identities 𝗂𝖽k,l, 𝗂𝖽 and exactly k+l arrows fi:(k,l), where i ranges from 0 to k+l1. The functors H𝐒𝐞𝐭 corresponds exactly to hypergraphs: nodes correspond to the image of while the set of hyperedges with source of length k and target of length l corresponds to the image of (k,l) (see [11]).

In particular, Remark 3.11 entails the following result.

Proposition 3.12.

Hyp has all limits and colimits.

3.1.1 Labelling hypergraph with an algebraic signature

Our interest for hypergraphs stems from their use as a graphical representation of algebraic terms. We thus need a way to label hyperedges with symbols taken from a signature.

Definition 3.13.

An algebraic signature Σ is a pair (OΣ,𝖺𝗋Σ) given by a set of operations OΣ and an arity function 𝖺𝗋Σ:OΣ. We define the hypergraph 𝒢Σ associated with Σ taking OΣ as set of hyperedges, 1 as set of nodes, so that 1 is , 𝖺𝗋Σ as the source function and γ1, which always picks the element 1, as target function. The category HypΣ of algebraically labelled hypergraphs is the slice category Hyp/𝒢Σ.

Example 3.14.

Let Σ=(OΣ,𝖺𝗋Σ) be the signature with OΣ=A{,/}, where n stands for any natural number and a for any element in A, both sets of constants, and 𝖺𝗋Σ()=𝖺𝗋Σ(/)=2. Then the hypergraph 𝒢Σ is depicted as the picture below.

Proposition 2.4 gives us immediately an adhesivity result for HypΣ and a characterisation of monos in it.

Proposition 3.15.

Let Σ be an algebraic signature. Then the following hold

  1. 1.

    an arrow (h,k) in HypΣ is a mono if and only if h and k are injective;

  2. 2.

    HypΣ is an adhesive category.

 Remark 3.16.

Let =(E,V,s,t) be a hypergraph, by definition we know that UHyp(𝒢Σ) is the terminal object 1, so an arrow 𝒢Σ, is determined by a function h:EOΣ making the two squares below commutative (cfr. Remark 3.3).

Now, consider a coprojection vn:VnV. By the second diagram above entails that t factors via the inclusion v1:VV of words of length 1, i.e. all hyperedges must have a single target vertex, that is t=v1τ for some τ:EV.

HypΣ has a forgetful functor UΣ:HypΣX which sends (h,k):𝒢Σ to UHyp(). Now, since UHyp(𝒢Σ)=1 for every set X we can define ΔΣ(X):ΔHyp(X)𝒢Σ as (?OΣ,!X). It is straightforward to see that in this way we get a left adjoint to UΣ.

Proposition 3.17.

UΣ has a left adjoint ΔΣ.

We extend our graphical notation of hypergraphs to labeled ones putting the label of an hyperedge h inside its corresponding square.

Example 3.18.

Consider again Σ the signature of Example 3.14, then the hypergraph 𝒢 of Example 3.10 can be labeled by a morphism (l,!V𝒢):𝒢𝒢Σ that is characterised by the image of the edges. If l(h1)=a, l(h2)=2, l(h3)=, and l(h4)=/, we represent it visually by putting the labels of the edges in 𝒢Σ inside the boxes representing the edges of 𝒢.

3.2 Term Graphs

Term graphs have been adopted as a convenient way to represent terms over a signature with an explicit sharing of sub-terms, and as such have been a convenient tool for an efficient implementation of term rewriting [27]. We elaborate here on the presentation given in [11].

Definition 3.19.

Given an algebraic signature Σ, we say that a labelled hypergraph (l,!V𝒢):𝒢𝒢Σ is a term graph if t𝒢 is a mono. We define TGΣ to be the full subcategory of HypΣ given by term graphs and denote by IΣ the inclusion. Restricting UΣ:HypΣSet we get a forgetful functor UTGΣ:TGΣSet.

 Remark 3.20.

By Remark 3.16, we know that if 𝒢 is a term graph then t𝒢=v1τ𝒢, where v1 is the coprojection of V𝒢 into V𝒢. Notice that since t𝒢 is a mono then τ𝒢 is a mono.

Example 3.21.

The labelled hypergraph of Example 3.18 is a term graph.

We now examine some properties of TGΣ, in order to study its adhesivity properties. We begin noticing that, for every set X, ΔΣ(X) has no hyperedges and so is a term graph. This yields at once the following.

Proposition 3.22.

The forgetful functor UTGΣ has a left adjoint ΔTGΣ.

We can list some other categorical properties of TGΣ (see [11, Sec. 5]).

Proposition 3.23.

Let Σ be an algebraic signature. Then the following hold

  1. 1.

    if (i,j):𝒢 is a mono from (l,!V𝒢):𝒢𝒢Σ to (l,!V):𝒢Σ in HypΣ and the latter is in TGΣ, then also the former is in TGΣ

  2. 2.

    TGΣ has equalizers, binary products and pullbacks and they are created by IΣ.

 Remark 3.24.

TGΣ in general does not have terminal objects. Since UTGΣ preserves limits, if a terminal object exists it must have the singleton as set of nodes, therefore the set of hyperedges must be empty or a singleton. Hence, for a counterexample, it suffices to take a signature with two operations a and b, both of arity 0. TGΣ is not an adhesive category, either. In particular, as noted in e.g. [11], it does not have pushouts along all monos.

Definition 3.25.

Let (l,!V𝒢):𝒢𝒢Σ be a term graph. A input node is an element of V𝒢 not in the image of τ𝒢. A morphism (f,g) between (l,!V𝒢):𝒢𝒢Σ and (l,!V):𝒢Σ in TGΣ, is said to preserve input nodes if g sends input nodes to input nodes.

Preservation of input nodes characterizes regular monos in TGΣ.

Proposition 3.26.

Let (i,j) be a mono between two term graphs (l,!V𝒢):𝒢𝒢Σ and (l,!V):𝒢Σ. Then it is a regular mono if and only if it preserves the input nodes.

This characterization, in turn, provides us with the following result [11, 10].

Lemma 3.27.

Consider three term graphs (l0,!V𝒢):𝒢𝒢Σ, (l1,!V):𝒢Σ and (l2,!V𝒦):𝒦𝒢Σ. Given (f1,g1):(l0,!V𝒢)(l1,!V), (f2,g2):(l0,!V𝒢)(l2,!V𝒦), if (f1,g1) is a regular mono, then its pushout (p,!V𝒫):𝒫𝒢Σ in HypΣ along (f2,g2) is a term graph.

Propositions 2.4 and 3.15, Proposition 3.26 and Lemma 3.27 allow us to recover the following result, previously proved by direct computation in [12, Thm. 4.2] (see also [11, Cor. 5.15] for the details of the argument presented here).

Corollary 3.28.

The category TGΣ is quasiadhesive.

4 Adding equivalences to hypergraphical structures

The use of hypergraphs equipped with an equivalence relation over their nodes has been argued as a convenient way to express concurrency in the DPO approach to rewriting [4]. This section presents the framework by means of adhesive categories, including also its version for term graphs, as a stepping stone towards an analogous characterisation for e-graphs.

4.1 Hypergraphs with equivalence

Let us start with the case of general hypergraphs. These were introduced in [4], even if no general consideration about their structure as a category was proved, and adhesivity, which is the main focus here, was yet to be presented to the world.

Definition 4.1.

A hypergraph with equivalence 𝒢=(E𝒢,V𝒢,Q𝒢,s𝒢,t𝒢,q𝒢) is a 6-tuple such that 𝒢=(E𝒢,V𝒢,s𝒢,t𝒢) is a hypergraph, Q𝒢 is a set and q𝒢:V𝒢Q𝒢 is a surjection called quotient map. A morphism h:𝒢 is a triple (hE,hV,hQ) such that the following diagrams commute

The category of hypergraphs with equivalence and their morphisms is denoted EqHyp.

 Remark 4.2.

Notice that in 𝐒𝐞𝐭 the classes of surjections, epis and regular epis coincide.

 Remark 4.3.

Morphisms of hypergraphs with equivalences are uniquely determined by the first two components. That is, if h1=(hE,hV,f) and h2=(hE,hV,g) are two morphisms 𝒢, then we have fq𝒢=qhV=gq𝒢. Since q𝒢 is epi, we obtain f=g.

Forgetting the quotient part yields a functor T:EqHypHyp sending a hypergraph with equivalence (E𝒢,V𝒢,C𝒢,s𝒢,t𝒢,q𝒢) to (E𝒢,V𝒢,s𝒢,t𝒢). We now explore some of its properties to deduce information on the structure of EqHyp.

Proposition 4.4.

Consider the forgetful functor T:EqHypHyp. Then the following hold

  1. 1.

    T is faithful;

  2. 2.

    T has a left adjoint;

  3. 3.

    T has a right adjoint.

Corollary 4.5.

The functor T preserves limits and colimits.

From the previous results we get the following characterization of monos in EqHyp.

Corollary 4.6.

An arrow (hE,hV,hQ):𝒢 in EqHyp is a mono if and only if (hE,hV) is a mono in Hyp.

Now, we can consider the forgetful functor U𝖾𝗊:EqHyp𝐒𝐞𝐭 obtained by composing T and UHyp. By Proposition 3.8 and the second point of Proposition 4.4 we get the following.

Corollary 4.7.

U𝖾𝗊 has a left adjoint Δ𝖾𝗊:𝐒𝐞𝐭EqHyp.

Notice that there is another functor K:EqHyp𝐒𝐞𝐭 sending (E,V,Q,s,t,q) to Q, and a morphism (hE,hV,hQ) to hQ. We exploit it to compute limits and colimits in EqHyp.

Lemma 4.8.

Consider a diagram F:DEqHyp and let (ED,VD,QD,sD,tD,qD) be the image of an object D. Then the following hold

  1. 1.

    F has a colimit, which is preserved by K;

  2. 2.

    consider a cone (L,{lD}DD) limiting for KF and let ((E,V),{(πED,πVD)}DD) be one for TF, then F has a limit (E,V,Q,s,t,q) and there is a mono m:QL such that the diagram below commutes for every DD.

Corollary 4.9.

An arrow (hE,hV,hQ):𝒢 in EqHyp is a regular mono if and only if all its components are injective functions.

We have now all the ingredients to study the adhesivity properties of EqHyp. As a first step we need to introduce a class of monos.

Definition 4.10.

We define 𝖯𝖻 as the class of regular monos (hE,hV,hQ):𝒢 in EqHyp such that the square below is a pullback

Now, we show that 𝖯𝖻 is a suitable class for adhesivity.

Lemma 4.11.

The class 𝖯𝖻 contains all isomorphisms, it is closed under composition, decomposition and it is stable under pullbacks and pushouts.

Finally, we show the key lemma for 𝖯𝖻-adhesivity of EqHyp.

Lemma 4.12.

In EqHyp, 𝖯𝖻-pushouts are stable.

Example 4.13.

It is noteworthy to show that pushouts along regular monos are not stable. Consider e.g. the cube below: the vertices are just graphs without edges, and in the graphs themselves the equivalence classes are denoted by encircling nodes with a dotted line. All the arrows are regular monos. It is immediate to see that the bottom face is a pushout and the side faces are pullbacks. Unfortunately, the top face fails to be a pushout.

Having proved stability of 𝖯𝖻-pushouts, we now turn to prove that they are Van Kampen with respect to regular monos.

Lemma 4.14.

In EqHyp, pushouts along arrows in 𝖯𝖻 are 𝖱𝖾𝗀(EqHyp)-Van Kampen.

Corollary 4.15.

EqHyp is 𝖯𝖻-adhesive.

4.2 Term graphs with equivalence

We are now going to generalize the work done in the previous section equipping term graphs with equivalence relation. First of all we need a notion of labelling for EqHyp.

Definition 4.16.

Let Σ be an algebraic signature and 𝒢Σ the hypergraph associated to it. A labelled hypergraph with equivalence is a pair (,l) where is an object of EqHyp and l a morphism T()𝒢Σ of Hyp. A morphism of labelled hypergraphs with equivalence between (,l) and (,l) is an arrow h: such that l=lT(h).

We denote the resulting category by EqHypΣ.

Let (,l) be an object of EqHypΣ: since T has a right adjoint R by Proposition 4.4, l:T()𝒢Σ corresponds to the arrow (l,!Q):R(𝒢Σ). It is immediate to see that this correspondence extends to an equivalence with the slice over R(𝒢Σ).

Proposition 4.17.

EqHypΣ is equivalent to EqHyp/R(𝒢Σ).

Let VΣ:EqHypΣEqHyp be the functor forgetting the labelling and 𝖯𝖻Σ the class of morphisms in EqHypΣ whose image in EqHyp is in 𝖯𝖻. From Lemma 4.8, the second point of Propositions 2.4 and 4.15, we can deduce the following.

Proposition 4.18.

Consider the forgetful functor VΣ:EqHypΣEqHyp. Then the following hold

  1. 1.

    EqHypΣ has all colimits and all connected limits, which are created by VΣ;

  2. 2.

    EqHypΣ is 𝖯𝖻Σ-adhesive.

Using Corollaries 4.6 and 4.9 we immediately get the following result.

Corollary 4.19.

Let h=(hE,hV,hQ) be an arrow in EqHypΣ. Then the following hold

  1. 1.

    h is mono if and only if hE and hV are injective;

  2. 2.

    h is a regular mono if and only if hE, hV and hQ are injective.

We can now easily define term graphs with equivalence.

Definition 4.20.

Let Σ be an algebraic signature. An object (,l) of EqHypΣ is a term graph with equivalence if l:T()𝒢Σ is a term graph. We denote by EqTGΣ the full subcategory of EqHypΣ so defined and by JΣ the corresponding inclusion functor.

 Remark 4.21.

Let TΣ:EqHypΣHypΣ the forgetful functor lifting T:EqHypHyp. Notice that, by definition, (,l) is in EqTGΣ amounts to say that (T(),l) is in TGΣ. Thus there exists a functor SΣ as in the diagram below.

 Remark 4.22.

Notice that, by Corollary 4.5 and Proposition 4.18, the functor TΣ preserves all connected limits and all colimits.

The previous remark allows us to prove an analog of Proposition 3.23.

Proposition 4.23.

EqTGΣ has equalizers, binary products and pullbacks and they are created by JΣ.

Let now 𝒯 be the class of morphism in EqTGΣ whose image through JΣ is in 𝖯𝖻Σ and whose image through SΣ is a regular mono in TGΣ. By Propositions 3.26 and 4.19, we have that a morphism (hE,hV,hQ):(𝒢,l)(,l) is in 𝒯 if and only if all of its components are injections and the square below is a pullback.

In particular, by Corollary 3.28 and Lemma 4.12, 𝒯 contains all isomorphisms, is closed under composition and decomposition and stable under pushout and pullbacks.

The following proposition is now an easy corollary of Lemma 3.27, Proposition 4.18, and Remark 4.21.

Proposition 4.24.

EqTGΣ has all 𝒯-pushouts, which are created by JΣ.

Corollary 4.25.

EqTGΣ is 𝒯-adhesive.

5 EGGs

The previous section proved some adhesivity property for the categories EqHyp and EqTGΣ. We extend these results to encompass equivalence classes which are closed under the target arrow, i.e. under operator composition for term graphs, thus precisely capturing EGGs.

5.1 E-hypergraphs

We start introducing the notion of e-hypergraphs, hypergraphs equipped with an equivalence relation that is closed under the target arrow: in other words, whenever the relation identifies the source of two hyperedges, it identifies their targets too.

Definition 5.1.

Let 𝒢=(E,V,Q,s,t,q) be a hypergraph with equivalence and (S,π1,π2) a kernel pair for qs. We will say that 𝒢 is an e-hypergraph if qtπ1=qtπ2.

We will denote by 𝖾-EqHyp the full subcategory of EqHyp whose objects are e-hypergraphs, and by I:𝖾-EqHypEqHyp the associated inclusion functor.

Example 5.2.

Consider the hypergraph 𝒢 of Example 3.10 and consider as quotient the identity 𝗂𝖽V𝒢:V𝒢:𝒢. Then the kernel pair of 𝗂𝖽V𝒢s concide with the kernel pair of s, which is empty. Thus 𝒢 is, trivially, an e-hypergraph

A first result that we need is that limits in 𝖾-EqHyp are computed as in EqHyp.

Lemma 5.3.

𝖾-EqHyp has all limits and I creates them.

Corollary 5.4.

If an arrow h:𝒢 in 𝖾-EqHyp is a regular mono in 𝖾-EqHyp then I(h) is a regular mono in Hyp.

We can now turn to pushouts.

Lemma 5.5.

Suppose that the square below is a pushout in EqHyp and that m is a mono in 𝖯𝖻. If 𝒢1, 𝒢2 and 𝒢3 are e-hypergraphs, then 𝒫 is is an e-hypergraph.

Let now 𝖾𝖯𝖻 be the class of arrows in 𝖾-EqHyp that are sent to 𝖯𝖻 by I. By definition and Lemma 4.11 we have that such class is closed under composition and decomposition, it contains all isomorphisms and it is stable under pullbacks. Using Lemmas 4.11 and 5.5 we can further deduce that it is stable under pushouts. Then Propositions 2.4 and 4.15 yield the following.

Corollary 5.6.

𝖾-EqHyp is 𝖾𝖯𝖻-adhesive.

5.2 E-term graphs, a.k.a. EGGs

We now turn our attention to the labelled context.

Definition 5.7.

We say that an object (,l) of EqHypΣ is a labelled e-hypergraph if is an e-hypergraph. We define the category 𝖾-EqHypΣ as the full subcategory of EqHypΣ given by labelled e-hypergraphs. We denote by ZΣ the corresponding inclusion functor .

To prove some adhesivity property of 𝖾-EqHypΣ, we begin with the following elementary, yet useful observation.

 Remark 5.8.

Given a signature Σ=(OΣ,𝖺𝗋Σ), the hypergraph R(𝒢Σ)=(OΣ,1,1,𝖺𝗋Σ,γ1,𝗂𝖽1) is an object of 𝖾-EqHyp. Indeed, under the identification of 1 with , the kernel (S,π1,π2) of 𝗂𝖽𝖺𝗋Σ, is given by S:={(o1,o2)OΣ×OΣ𝖺𝗋Σ(o1)=𝖺𝗋Σ(o2)} equipped with the two projections. On the other hand, both 𝗂𝖽γ1π1 and 𝗂𝖽γ1π2 are the function OΣ constant in 1.

Remark 5.8 now implies at once the following result.

Proposition 5.9.

Let Σ be an algebraic signature. Then the following hold

  1. 1.

    𝖾-EqHypΣ is equivalent to 𝖾-EqHyp/R(𝒢Σ);

  2. 2.

    there exists a functor WΣ:𝖾-EqHypΣ𝖾-EqHyp forgetting the labeling which creates all colimits, pullbacks and equalizers.

Let 𝖾𝖯𝖻Σ be the class of morphisms in 𝖾-EqHypΣ whose image in 𝖾-EqHyp lies in 𝖾𝖯𝖻. Notice that 𝖾𝖯𝖻Σ is also the class of arrows whose image through ZΣ is in 𝖯𝖻Σ. By Proposition 2.4 we get the following result.

Corollary 5.10.

𝖾-EqHypΣ is 𝖾𝖯𝖻Σ-adhesive.

We turn now to term graphs with equivalence.

Definition 5.11.

Given a signature Σ, we say that an object (,l) of EqTGΣ is an e-term graph if is an e-hypergraph. We define the category 𝐄𝐆𝐆 as the full subcategory of EqTGΣ given by e-term graphs and denote by KΣ the corresponding inclusion.

 Remark 5.12.

By definition we also have an inclusion functor YΣ:𝐄𝐆𝐆𝖾-EqHypΣ.

 Remark 5.13.

Now that we have put all the structures of this work in place, it is worthwhile to give a visual map of all the categories that we have discussed/introduced and of the relationships between them. We will use the curved arrows to denote full and faithful inclusions.

We can now prove our last three results.

Proposition 5.14.

𝐄𝐆𝐆 has equalizers, binary products and pullbacks and they are created by KΣ.

Let now 𝒯Σ be the class of morphisms of 𝐄𝐆𝐆 which are sent by KΣ to the class 𝒯. Then Lemmas 5.5 and 4.24 allow us to deduce the following result.

Proposition 5.15.

𝐄𝐆𝐆 has 𝒯Σ-pushouts, which are created by KΣ.

Reasoning as in the previous sections, Propositions 5.14 and 5.15 now give us the following.

Corollary 5.16.

𝐄𝐆𝐆 is 𝒯Σ-adhesive.

6 Pros and cons of adhesive rewriting

The previous sections have shown how hypergraphs and term graphs with equivalence can be described as suitable -adhesive categories. The same fact holds for their sub-categories where the equivalence is closed with respect to operator composition, and this allows to model EGGs, as originally presented in [31].

Sharing.

Terms are trees, thus different term graphs may represent the same term, up-to the sharing of sub-terms. Consider e.g. a constant a and a binary operator /: the term a/a admits a few different representations as a term graph with equivalence, as shown below

The left-most and the right-most images represent just ordinary term graphs, the middle one is a term graph with equivalence. As such, they are all objects of EqTGΣ. However, note that the right-most image is not an object of 𝐄𝐆𝐆: constants have no input, and nodes that are targets of edges with the same label and whose source is the empty word must be equivalent and possibly coincide, as in the middle and in the left-most image, respectively.

In general, for (acyclic) term graphs, a maximally and a minimally shared representation exist, and for our toy example are the left-most and the right-most diagram above, respectively: it is a standard result for term graph rewriting, see e.g. [1]. These two representations can be interpreted as the final and the initial object of a suitable comma category. respectively. The same properties carry on for term graphs with equivalence and for EGGs. However, while in the former case the two representations are the same of those for ordinary term graphs, in the latter case the minimally shared representation is now the middle diagram.

Rewriting.

The theory of -adhesivity ensures that if the rules are spans of arrows in , then we can lift the standard properties of the DPO approach that hold in the category of graphs. However, as we recalled in the introduction, instead of removing sub-terms, the EGG approach chooses to just add new terms and link them to the older ones via the equivalence relation [14]. So, the corresponding DPO rules are spans LLR, where the first component is the identity, thus in 𝖯𝖻Σ, while the second component may not belong to 𝖯𝖻Σ.

Consider e.g. an EGG rule such x/x1, from the introductory example in [31]. Variables in a term graph are represented as nodes that do not occur among the targets of an edge, thus the rule can be modelled as the DPO rule below, concisely given by the arrow LR

In this case L is the minimally shared EGG corresponding to the term x/x, thus the rule could be applied to the two EGGs depicted above with a match that is injective on equivalence classes. In general, if the term graph underlying the EGG to whom the DPO rule is applied is acyclic, the same property holds for the EGG obtained as the result of the rule application. The right-hand side is a regular mono, though, hence it is not an arrow in 𝖯𝖻Σ. The asymmetry between left-hand and right-hand sides falls in the current research about left-linear rules for adhesive categories, as pursued e.g. in [3].

Application conditions.

As argued above, the DPO rules that are suitable for the EGG approach have identities as left-hand side, thus they belong to any choice of . However, this would allow for the repeated application of the same rule, hence the possibility to keep on performing the same rewriting step. This is forbidden by using rules with negative application conditions, given as the usual span LKR plus an additional arrow n:LN, such that a match m:LG is admissible if it cannot be factorised through n [21]. For EGGs and rules LLR, it suffices to choose n as the right-hand side itself. The theory of -adhesivity carries on for rules with negative application conditions, see [15, 16].

7 Conclusions and further and related works

The aim of our paper was to extend the theory of -adhesive categories in order to include EGGs, a formalism for program optimisation. To do so, we revisited the notions of hyper-graphs and term graphs with equivalence, proving that they are -adhesive categories, and we extended these results in order to prove the same property for EGGs as term graphs with equivalence satisfying a suitable closure constraint. Summing up, we proved that EGGs are objects of an -adhesive category 𝐄𝐆𝐆 and that optimisation steps are obtained via DPO rules (possibly with negative application conditions) whose left-hand side is in , and that allows for exploiting the properties of the -adhesive framework.

Future works.

Our result on 𝐄𝐆𝐆 opens a few threads of research. The first is to check how the -adhesivity of EGGs can be pushed to model their rewriting via the double-pushout (DPO) approach. We have seen that the rules adopted in the literature of EGGs appears to be spans whose left-hand side is an identity and right-hand side is a regular mono (possibly with negative application conditions), and as such they fit the mould of rewriting on left-linear rewriting in -adhesive categories. However, it still needs to be shown how parallelism and causality, the key features for DPO rewriting on -adhesive categories, can be exploited in the context of implementing the EGGs updates. Moreover, extensions of the EGGs formalism could be suggested by the adhesive machinery we developed. In fact, most of the results presented here for hypergraphs can be generalised to hierarchical hypergraphs, that is, hypergraphs with a hierarchy (a partial order) among edges [20, 11]. The additional structure is useful for modelling properties such as encapsulation and sandboxing, and it seems worthwhile to check the expressiveness and applications of hierarchical EGGS.

Related works.

Despite the interest they have ben raising as an efficient data structure, we are not aware of any attempt to provide an algebraic characterisation of EGGs, the only exception being [19]. We leave for future work an in-depth comparison among the two proposals, which appear to be related yet quite different. In fact, for both proposals the key intuition is to use string diagrams to represent term graphs. We adopted a more down-to-earth approach by equipping concretely the nodes of a term graph with an equivalence relation, thus directly corresponding to the original presentation [14], at the same time extending and generalising it [4] in the contemporary jargon of adhesive categories. The route chosen in [19] is to consider term graphs as arrows of a symmetric monoidal category, and equipping them with an enrichment over semi-lattices, the resulting formalism being reminiscent of hierarchical hypergraphs. Thus, the solution in [19] is more general than ours since it can be lifted to term graphs defined over categories other than 𝐒𝐞𝐭. At the same time, we both consider the DPO approach for rewriting, even if only our solution guarantees that the resulting category is actually -adhesive, thus allowing to exploit all the features of the framework as they hold for DPO graph transformation.

References

  • [1] Zena M. Ariola, Jan Willem Klop, and Detlef Plump. Bisimilarity in term graph rewriting. Information and Computation, 156(1-2):2–24, 2000. doi:10.1006/INCO.1999.2824.
  • [2] Guilherme Grochau Azzi, Andrea Corradini, and Leila Ribeiro. On the essence and initiality of conflicts in -adhesive transformation systems. Journal of Logical and Algebraic Methods in Programming, 109:100482, 2019. doi:10.1016/J.JLAMP.2019.100482.
  • [3] Paolo Baldan, Davide Castelnovo, Andrea Corradini, and Fabio Gadducci. Left-linear rewriting in adhesive categories. In Rupak Majumdar and Alexandra Silva, editors, CONCUR 2024, volume 311 of LIPIcs, pages 11:1–11:24. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPICS.CONCUR.2024.11.
  • [4] Paolo Baldan, Fabio Gadducci, and Ugo Montanari. Concurrent rewriting for graphs with equivalences. In Christel Baier and Holger Hermanns, editors, CONCUR 2006, volume 4137 of LNCS, pages 279–294. Springer, 2006. doi:10.1007/11817949_19.
  • [5] Nicolas Behr, Russ Harmer, and Jean Krivine. Fundamentals of compositional rewriting theory. Journal of Logical and Algebraic Methods in Programming, 135:100893, 2023. doi:10.1016/J.JLAMP.2023.100893.
  • [6] Roberto Biondo, Davide Castelnovo, and Fabio Gadducci. EGGs are adhesive! CoRR, abs/2503.13678, 2025. doi:10.48550/arXiv.2503.13678.
  • [7] F. Bonchi, F. Gadducci, A. Kissinger, P. Sobociński, and F. Zanasi. String diagram rewrite theory I: Rewriting with Frobenius structure. Journal of the ACM, 69(2):1–58, 2022. doi:10.1145/3502719.
  • [8] Ronald Brown and George Janelidze. Van Kampen theorems for categories of covering morphisms in lextensive categories. Journal of Pure and Applied Algebra, 119(3):255–263, 1997.
  • [9] Aurelio Carboni and Peter Johnstone. Connected limits, familial representability and Artin glueing. Mathematical Structures in Computer Science, 5(4):441–459, 1995. doi:10.1017/S0960129500001183.
  • [10] D. Castelnovo. Fuzzy algebraic theories and ,𝒩-adhesive categories. PhD thesis, University of Udine, 2023.
  • [11] Davide Castelnovo, Fabio Gadducci, and Marino Miculan. A simple criterion for ,𝒩-adhesivity. Theoretical Computer Science, 982:114280, 2024.
  • [12] Andrea Corradini and Fabio Gadducci. On term graphs as an adhesive category. In Maribel Fernández, editor, TERMGRAPH 2004, volume 127(5) of ENTCS, pages 43–56. Elsevier, 2004. doi:10.1016/J.ENTCS.2005.02.014.
  • [13] Andrea Corradini, Ugo Montanari, Francesca Rossi, Hartmut Ehrig, Reiko Heckel, and Michael Löwe. Algebraic approaches to graph transformation - part I: basic concepts and double pushout approach. In Grzegorz Rozenberg, editor, Handbook of Graph Grammars and Computing by Graph Transformations, Volume 1: Foundations, pages 163–246. World Scientific, 1997.
  • [14] David Detlefs, Greg Nelson, and James B. Saxe. Simplify: a theorem prover for program checking. Journal of the ACM, 52(3):365–473, 2005. doi:10.1145/1066100.1066102.
  • [15] H. Ehrig, U. Golas, A. Habel, L. Lambers, and F. Orejas. -adhesive transformation systems with nested application conditions. Part 2: Embedding, critical pairs and local confluence. Fundamenta Informaticae, 118(1-2):35–63, 2012. doi:10.3233/FI-2012-705.
  • [16] H. Ehrig, U. Golas, A. Habel, L. Lambers, and F. Orejas. -adhesive transformation systems with nested application conditions. Part 1: Parallelism, concurrency and amalgamation. Mathematical Structures in Computer Science, 24(4):240406, 2014. doi:10.1017/S0960129512000357.
  • [17] Harmut Ehrig, Karsten Ehrig, Ulrike Prange, and Gabriele Taentzer. Fundamentals of Algebraic Graph Transformation. Springer, 2006. doi:10.1007/3-540-31188-2.
  • [18] R. Garner and S. Lack. On the axioms for adhesive and quasiadhesive categories. Theory and Applications of Categories, 27(3):27–46, 2012.
  • [19] Dan R. Ghica, Chris Barrett, and Aleksei Tiurin. Equivalence hypergraphs: E-graphs for monoidal theories. CoRR, abs/2406.15882, 2024. doi:10.48550/arXiv.2406.15882.
  • [20] Dan R. Ghica and Fabio Zanasi. Hierarchical string diagrams and applications. CoRR, abs/2305.18945, 2023. doi:10.48550/arXiv.2305.18945.
  • [21] Annegret Habel, Reiko Heckel, and Gabriele Taentzer. Graph grammars with negative application conditions. Fundamenta Informaticae, 26(3/4):287–313, 1996. doi:10.3233/FI-1996-263404.
  • [22] T. Heindel. A category theoretical approach to the concurrent semantics of rewriting. PhD thesis, Universität Duisburg–Essen, 2009.
  • [23] Peter T. Johnstone, Stephen Lack, and Pawel Sobocinski. Quasitoposes, quasiadhesive categories and Artin glueing. In Till Mossakowski, Ugo Montanari, and Magne Haveraaen, editors, CALCO 2007, volume 4624 of LNCS, pages 312–326. Springer, 2007. doi:10.1007/978-3-540-73859-6_21.
  • [24] Stephen Lack and Pawel Sobocinski. Toposes are adhesive. In Andrea Corradini, Hartmut Ehrig, Ugo Montanari, Leila Ribeiro, and Grzegorz Rozenberg, editors, ICGT 2006, volume 4178 of LNCS, pages 184–198. Springer, 2006. doi:10.1007/11841883_14.
  • [25] Sthephen Lack and Pawel Sobociński. Adhesive and quasiadhesive categories. RAIRO-Theoretical Informatics and Applications, 39(3):511–545, 2005. doi:10.1051/ITA:2005028.
  • [26] Saunders Mac Lane. Categories for the working mathematician. Springer, 2013.
  • [27] D. Plump. Term graph rewriting. In H. Ehrig, G. Engels, H-J Kreowski, and G. Rozenberg, editors, Handbook of Graph Grammars and Computing by Graph Transformation, Volume 2: Applications, Languages and Tools, pages 3–61. World Scientific, 1999.
  • [28] J. Sakarovitch. Elements of automata theory. Cambridge University Press, 2009.
  • [29] VV.AA. egg: e-graphs good. https://egraphs-good.github.io/.
  • [30] Philip Wadler. Monads for functional programming. In Johan Jeuring and Erik Meijer, editors, Advanced Functional Programming, volume 925 of LNCS, pages 24–52. Springer, 1995. doi:10.1007/3-540-59451-5_2.
  • [31] Max Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt, Zachary Tatlock, and Pavel Panchekha. egg: Fast and extensible equality saturation. In POPL 2021, volume 5 of PACMPL, pages 1–29. ACM, 2021. doi:10.1145/3434304.