definition example theorem program
The pushout of a Span is its Colimit: an object with maps , (and ) making the square commute, such that for any with commuting there is a unique with , . ” is the Coproduct of and but with the image of in equalized by fiat with the image of in .”
Sources: Kittenlab Lecture 9 (“Pushouts”, union-find implementation), 15 (composition of cospans by pushout, well-definedness up to iso); 7 Sketches §6.2.3 (Definition 6.13, Examples 6.14–6.18, Exercises 6.15, 6.17), §1.4.2 (pushing out a surjection); DaoFP §9.5 (colimits); CTfS §2.6.2 (Definition 2.6.2.1, Examples 2.6.2.2–2.6.2.3, Exercises 2.6.2.4–2.6.2.7, Lemma 2.6.2.8), Examples 4.5.3.28–4.5.3.29
In (Kittenlab)
where is the Equivalence Relation generated by for all . The universal property holds because “by the commutation property, all elements of each equivalence class have to go to the same element of “. Implementation: put and side by side in a union-find on elements, union! the pairs , and read off roots. The same works for graphs and any C-Set: glue vertices and edges separately — “take two graphs, take their coproduct, and glue some of their edges and vertices together according to maps out of a third graph”.
Gluing and equating (Category Theory for Scientists)
“If one wishes to take two things and glue them together, with as the glue and and as the two things to be glued, the union is the pushout .” Examples: ; “a cell in the torso or arm” glues the torso and the arm along the shoulder so shoulder cells are not double-counted; pushing “a college course” out along “a mathematics course an utterance of too hard” makes all math courses one and the same thing — “the power to equate different things can be exercised with pushouts” (CTfS Example 2.6.2.3); collapsing the boundary circle of a disk gives a sphere (CTfS Example 4.5.3.29). With the pushout is the coproduct, and pushing out the two projections of a relation gives modulo the equivalence relation generated by (CTfS Exercise 2.6.2.7).
As a representable
Let be the category . The pushout of is a representing object for : a natural transformation is three morphisms, and naturality is exactly the commuting square; feeding the identity of the representing object into the isomorphism gives the cocone , and naturality gives the factorization property (Kittenlab Lecture 9). Since isomorphic diagrams have isomorphic representing objects, pushouts are well defined on isomorphism classes of spans — used to show that composition of cospans is well defined (Lecture 15).
Uses
- Composition in the cospan category and in hypergraph categories / decorated cospans (7 Sketches Chapter 6: gluing circuits along shared terminals); open graphs.
- Pushing forward a Partition along a function (7 Sketches §1.4.2).
- Any finite colimit is built from coproducts and pushouts / coequalizers (7 Sketches §6.2.4). Dual: Pullback.
In compilers and databases
Graph rewriting is two pushouts: a pushout complement deletes the matched pattern and an ordinary pushout glues in the replacement (Double-Pushout Rewriting).
Docs: FinSets · Limits & colimits · C-set morphisms · ACSets API · Graphs — Kittenlab Lecture 9
# Kittenlab Lecture 9: pushout of finite sets via union-find
struct UnionFind; parent::Vector{Int}; UnionFind(n) = new(collect(1:n)); end
find_root(uf, i) = uf.parent[i] == i ? i : find_root(uf, uf.parent[i])
union!(uf, i, j) = (uf.parent[find_root(uf, j)] = find_root(uf, i))
function pushout_sets(f::Vector{Int}, g::Vector{Int}, n::Int, m::Int) # f: Z → {1..n}, g: Z → {1..m}
po = UnionFind(n + m)
for z in eachindex(f); union!(po, f[z], n + g[z]); end
roots = unique!([find_root(po, i) for i in 1:(n + m)])
(Set(roots), Dict(i => find_root(po, i) for i in 1:n), Dict(j => find_root(po, n + j) for j in 1:m))
end
pushout_sets([1, 2], [1, 1], 3, 2) # glue x1~y1, x2~y1: three classesCatlab version (run in a fresh Julia session — Catlab exports its own compose, id, FinFunction, …):
# Catlab
using Catlab
f = FinFunction([1, 2], 3); g = FinFunction([1, 1], 2)
P = pushout(f, g); apex(P), legs(P)
# graphs: glue two path graphs at an endpoint
G = path_graph(Graph, 3)
pt = @acset Graph begin V = 1 end
a = ACSetTransformation(pt, G; V = [3]); b = ACSetTransformation(pt, G; V = [1])
apex(pushout(a, b)) # a path graph on 5 vertices#check CategoryTheory.Limits.pushout -- pushout f g with pushout.inl, pushout.inr, pushout.desc
#check CategoryTheory.Limits.pushout.condition
#check CategoryTheory.Limits.Types.pushoutCocone -- a quotient of the sum-- pushout of finite sets: disjoint union modulo generated equivalence (see Colimit for a generic version)
-- gluing two lists at their endpoints:
gluePaths :: [a] -> [a] -> [a]
gluePaths xs ys = xs ++ tail ys -- identifies last xs with head ys