Functorial aggregation

11/22/2021
by   David I. Spivak, et al.
0

Aggregating data in a database could also be called "integrating along fibers": given functions π E→ D and s E→ R, where (R,⊛) is a commutative monoid, we want a new function (⊛ s)_π that sends each d∈ D to the "sum" of all s(e) for which π(e)=d. The operation lives alongside querying – or more generally data migration – in typical database usage: one wants to know how much Canadians spent on cell phones in 2021, for example, and such requests typically require both aggregation and querying. But whereas querying has an elegant category-theoretic treatment in terms of parametric right adjoints between copresheaf categories, a categorical formulation of aggregation – especially one that lives alongside that for querying – appears to be completely absent from the literature. In this paper we show how both querying and aggregation fit into the "polynomial ecosystem". Starting with the category 𝐏𝐨𝐥𝐲 of polynomial functors in one variable, we review the relatively recent results of Ahman-Uustalu and Garner, which showed that the framed bicategory ℂ𝐚𝐭^♯ of comonads in 𝐏𝐨𝐥𝐲 is precisely the right setting for data migration: its objects are categories and its bicomodules are parametric right adjoints between their copresheaf categories. We then develop a great deal of theory, compressed for space reasons, including local monoidal closed structures, a coclosure to bicomodule composition, and an understanding of adjoints in ℂ𝐚𝐭^♯. Doing so allows us to derive interesting mathematical results, e.g. that the ordinary operation of transposing a span can be decomposed into the composite of two more primitive operations, and then finally to explain how aggregation arises, alongside querying, in ℂ𝐚𝐭^♯.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
12/08/2021

Quotients of span categories that are allegories and the representation of regular categories

We consider the ordinary category Span(C) of (isomorphism classes of) sp...
research
05/01/2020

Why FHilb is Not an Interesting (Co)Differential Category

Differential categories provide an axiomatization of the basics of diffe...
research
01/12/2023

Duoidally enriched Freyd categories

Freyd categories provide a semantics for first-order effectful programmi...
research
05/26/2023

Aggregating over Dominated Points by Sorting, Scanning, Zip and Flat Maps

Prefix aggregation operation (also called scan), and its particular case...
research
03/06/2023

Fixpoint operators for 2-categorical structures

Fixpoint operators are tools to reason on recursive programs and data ty...
research
04/17/2019

A 2-Categorical Study of Graded and Indexed Monads

In the study of computational effects, it is important to consider the n...
research
09/02/2022

Notions of parametricity as monoidal models for type theory

This article gives a solid theoretical grounding to the observation that...

Please sign up or login with your details

Forgot password? Click here to reset