Meinte Boersma – A category-theoretic view of models

How to describe category theory? Meinte explains it as follows: capture essential complexity and separate it from incidental one. This allows you to leave out unnecessary details until you need them. The definitions: 2014-04-10 13.20.49 An example: The category of Set. The objects here are sets, the arrows are functions from natural numbers (like squaring) and composition is function composition. An more intricate example: Relationships: 2014-04-10 13.25.17   A final example are graphs, where arrows are mappings of nodes and edges that respect source and target arrows. And now for some real examples which can be encountered in the wild. HTML, for instance, where objects are HTMLelements, arrows are JavaScript invocations that take and return HTMLelements. If you want to compare categories with each other, we need a Functor, this is like a generalization of functions, that maps elements of one category (objects, arrows and identities) to another. Examples: the powerset Set -> Set or a printing function Cat -> Graph A more real example is a wrapping function: 2014-04-10 13.32.43 So, the question on everyone’s lips: Why category theory for MDE? To try and answer the typical questions that keep being discussed at Code Generation: what is a model? What would be the category of models?

We start with a naive approach

Model = (directed) graphs with (general) mappings and then retrofit it. Note that this definition is not equal to the category of graphs, because the models restrictions are looser.

2014-04-10 13.39.54

With this category, we could consider model transformations, type checkers and queries are arrows. But, there is still a lot of uncharted territory here for us to explore like duality, natural transformations, adjointness.

Leave a Reply

Your email address will not be published. Required fields are marked *