# Category Theory Demonstrations

This is an interactive page, with buttons you press to get examples of basic constructions in category theory.

To run the demonstrations, press one of the buttons in the form below these instructions. If it has input fields above it, you can type sets or functions into them, as explained below. Pressing the button will send a request to my Web server, which will send back a copy of this page with a link in green at the top pointing to your results. Clicking on this link will display these in a new browser window, or (depending on your browser) a new browser tab. If the demonstration's input checking detects an error — such as a badly-formed set or function, an incompatibility between sets and functions, or a bug or server problem — it will report it in red.

The demonstrations do not use Java or JavaScript, and so should work in any browser. If they don't, then either I'm updating them, or the server machine is overloaded, so do please try again.

The demonstrations generate diagrams as well as text, and I'm happy for you to save and use these. However, to save space on the server machine, I store images, as well as results pages, as scratch files which soon get deleted. So if you see something you like, copy it immediately, because it will vanish. You may redistribute it freely, but do please acknowledge me and these demonstrations.

To enter a set into an input field, type either `random` (the field's default value, which generates a set or function at random), or `randomne` (which generates a non-empty set at random), or elements separated by space or comma. Leave the field empty for the empty set. Elements must start with a letter, which can optionally be followed by one or more letters or digits. To enter a function, do the same, but type two elements separated by a minus sign: for example, `a-b,c-d` is the function that maps a to b and c to d. Extra spaces are allowed anywhere. Here are some examples:

• `random`: generates a set or function at random.
• `randomne`: generates a non-empty set at random.
• `a,b,c` or `a b c` or `a, b , c`: the set {a,b,c}.
• `a-A,b-b2,c-x` or `a-A b-b2 c-x` or ```a-A, b-b2 , c-x```: the function {a↦A,b↦b2,c↦x}.
• : the empty set or function.

Note that the demonstration handles random sets crudely. If, for example, you ask for a pullback where all three sets are random, the example-generator may make one of them empty. If this set is the target of a function from a non-empty set, no such function can exist, and a later stage of consistency checking will report this as an error. Resubmitting the page will (probably) generate different random sets.

If you can, please donate. This project has never been funded, so I maintain it and pay for the server out of my own resources. Donations would make it possible to speed up the code, to improve the diagrams and layout, and to add new examples, including new categories.

There is a guestbook. Please use it if you want to make comments, suggest ideas for improvement or funding, report bugs, or just let me know people are still using my program.

 Given the set X= and the set Y= and the function f:X→Y= and the function g:X→Y= Given the set X=and the set Y= and the function f:X→Y= and the function g:X→Y= Given the set A= and the set B= Given the set A= and the set B= Given the set A= and the set B= The output ends with a little fancy to show that it's not the objects that are important, but their relation to other objects. Given the set A= and the set B= Given the set u= and the set v= and the set w= and the function f:v→u= and the function g:w→u= Given the set u= and the set v= and the set w= and the function f:u→v= and the function g:u→w= The output includes instructions for building your own exponential object. This demo still isn't working, because of a Prolog compatibility problem or bug. But there's some sample output here.

## Acknowledgements

Some algorithms are translations of those by Dave Rydeheard and Rod Burstall in their book Computational Category Theory.

The algorithms are coded in Jan Wielemaker's free open-source SWI-Prolog. The script around them is in PHP.

The site is hosted at Mythic Beasts.

Colours in some demonstrations' explanations of function compositions are chosen by Cynthia Brewer's Color Brewer interactive colour generator.

The diagrams are drawn using the free open-source GraphViz, and Chris Mungall's GraphViz wrapper for SWI-Prolog.

For bug reports, implementation advice, suggestions for improvement, as well as general complimentary niceness, thanks to Mike Stay, Peter Selinger, Christopher Townsend, Steve Vickers, Miles Gould, David Ellerman, Omar Ahmad, Greg Meredith, Ronnie Brown, John Baez (here), Urs Schreiber (here), Jamie Vicary, and everyone who replied to this n-Category Café thread about Graphical Category Theory Demonstrations.

Jocelyn Ireson-Paine
1 June 2021