# Completeness proof: categories with finite products

The flow graphs we consider in this paper are finite directed edge-labelled, node-labelled graphs where the incoming and outgoing edges to each node are ordered, and each edge has exactly one start node, but multiple finish nodes. We impose a type discipline to ensure that the edge and node labels match. These graphs are the same as Hasegawa's sharing graphs.

A single-coloured flow graph G over a signature V is:

- A finite set of edges (ranged over by E, F).

- A finite set of nodes (ranged over by N).

- For each edge, a label sort, written E : X.

- For each node, a label constructor, written N : c.

- A list of incoming edges and a list of outgoing edges, written G : E F.

- For each node, a list of incoming edges and a list of outgoing edges, written N : E F.

- If N : E F, N : c and c : X Y, then E : X and F : Y.

- Each edge occurs exactly once either as an incoming edge of the graph, or an outgoing edge of a node.

Such graphs can be drawn with incoming edges on the left and outgoing edges on the right:
Note that we insist that each edge has a unique source, but not a unique target. This allows edges to fork or terminate (but not the mirror-image graphs):
We can define the following operations on graphs (and below we shall show that they satisfy the equations necessary to be a category with finite products):

Identity: |
| Composition: |
Tensor: |
Symmetry: |
Diagonal: |
Terminal: |

A morphism F between flow graphs G and G is:

- A map from the edges of G to the edges of G.

- A map from the nodes of G to the nodes of G.

- The maps respect labels, incoming edges and outgoing edges.

Most of the axioms for a category with finite products are sound for flow graphs up to graph isomorphism, but the naturality conditions are not graph isomorphisms:

Naturality of diagonal: |  |  |
Terminal is natural: |  |  |

To find a graph model of finite products, we cannot consider graphs up to graph isomorphism. This is a familiar problem from concurrency theory, where graph isomorphism of labelled transition systems is too fine an equivalence, and so bisimulation, developed by Milner is used. We can adapt bisimulation to flow graphs, and below we show that the finite product axiomatization is sound and complete for flow graphs up to bisimulation.

A relation R between flow graphs G and G is:

- A relation between the edges of G to the edges of G.

- A relation between the nodes of G to the nodes of G.

- The relations respect labels, incoming edges and outgoing edges:

  - if E R E and E : X then E : X,

  - if N R N and N : c then N : c,

  - if G : E F and G : E F then E R E and F R F, and

  - if N : E F in G, N : E F in G and N R N then E R E and F R F.

  together with the symmetric conditions.

Note that (up to isomorphism) this definition is the same as requiring R to form a jointly monic span G R G in the category of flow graphs.

A relation R between flow graphs G and G is a simulation iff:

- Whenever E is the nth outgoing edge of N in G and E R E then E is the nth outgoing edge of N in G and N R N.

- R is a function on incoming edges of G (that is for any incoming edge E of G there is precisely one edge E of G such that E R E).

A relation R between flow graphs G and G is a bisimulation iff R and R-1 are simulations.

G and G are bisimilar (written G G) iff there is a bisimulation between them.

Note that any graph isomorphism is a simulation, and so isomorphic graphs are bisimilar. The converse is not true, since:

We are going to construct a category of graphs viewed up to bisimulation: in order for this definition to be valid, we require all of the categorical operations on graphs to respect bisimulation. Note that this is the reason for the (otherwise somewhat unnatural) second clause in the definition of simulation:

- R is a function on input edges (that is for any input edge E of G there is precisely one edge E of G such that E R E).

Without this clause, any relation between nodeless graphs would be a bisimulation, and in particular we could construct a bisimulation:
R
but:
Since we have included the second clause in the definition of simulation, we have that nodeless graphs are bisimilar only when they are isomorphic, and so this counterexample fails.

Proposition (Bisimulation is a congruence). Bisimulation is a congruence wrt the graph operations.

Proof.

A category with finite products is over a signature iff:

- For each sort X there is an object [[X]].

- For each constructor c : X1...Xm Y1...Yn
  there is a morphism [[c]] : [[X1]] [[Xm]] [[Y1]] [[Yn]].

Acyclic flow graphs over a given signature V form a category Graph(V) over V where:

- Objects are vectors of sorts X.

- Morphisms from X to Y are acyclic graphs G : E F such that E : X and F : Y, viewed up to bisimulation.

Proposition (Flow graphs form a category with finite products). Graph(V) is a strict cartesian category over V.

Proof. We have already defined the required operations, but we need to show they satisfy the axioms for a cartesian category. For this, we construct a bisimulation for each of the axioms.

Since flow graphs over V form a cartesian category over V, there is a unique morphism [[_]] from the free cartesian category over V into Graph(V). We can define this syntactically as the term algebra (with the type system and axiomatization given for cartesian categories) Term(V):

f,g | ::= | idX |
| | | f ; g |
| | | f g |
| | | symmX Y |
| | | copyX |
| | | discardX |
| | | c |

If terms can be proved equal using the axioms for a cartesian category we shall write f = g.

We would like to show soundness and completeness for this axiomatization, that is f = g iff [[f]] [[g]]. As is usual for such results, soundness is immediate, but completeness requires a normal form result. Most of the rest of this section is taken up by showing the required normalization results.

Proposition (Soundness). If f = g then [[f]] [[g]].

Proof. Follows immediately from the fact that Graph(V) is a cartesian category.

Proposition (Expressivity). For any graph G, there is a term f such that [[f]] G.

Proof. Proved by induction on the number of outgoing edges of G.

A shuffle (ranged over by s) is any term not including constructors c. A permutation (ranged over by p) is any shuffle not including copy or discard.

Proposition (Completeness for shuffles). If [[s1]] [[s2]] then s1 = s2.

Proof.

A term is in normal form (ranged over by n) iff it is of the form:

n | ::= |

Proposition (Normalization). For any f we can find normal g such that f = g.

Proof. First show by induction on syntax that for any normal f1 and f2, we can find normal g such that f1 f2 = g.

Then show by induction on syntax that for any normal f and shuffle s, we can find normal g such that f;s = g.

Then show by induction on syntax that for any normal f1 and f2, we can find normal g such that f1;f2 = g.

Finally show by induction on syntax that for any f, we can find normal g such that f = g.

Define p_inv to be the permutation:

id_inv = id
(p ; q)_inv = q_inv ; p_inv
(p q)_inv = p_inv q_inv
symm_inv = symm

Proposition (Permutations are isos). For any p, p;p_inv = id and p_inv;p = id.

Proof. An induction on p.

Proposition (Cancellation of permutations). For any:

we can find h such that:
=

Proof. Let h be: f;p_inv. Then use soundness and p being an iso to show the required properties.

Proposition (Cancellation of nodes). For any:

we can find h such that:
=

Proof.

Proposition (Completeness). If [[f]] [[g]] then f = g.

Proof. Find the normal form equal to g, and then cancel permutations and nodes iteratively, finishing with a use of completeness for shuffles, to prove f = g.

Proposition (Initiality). Graph(V) is the initial cartesian category over V.

Proof. By construction, Term(V) is the initial cartesian category over V. Since Term(V) is expressive, we have a map term : Graph(V) Term(V) with the property that [[term(G)]] G. By soundness and completeness, this map is an isomorphism in the category of categories with finite products over V, and so Graph(V) is the initial cartesian category over V.

Previous | Next