Lambda the Ultimate - Category Theory
http://lambda-the-ultimate.org/taxonomy/term/22/0
enApplied Category Theory - The Emerging Science of Compositionality
http://lambda-the-ultimate.org/node/5581
<p >An enjoyable 25-minute introductory talk: <a href="https://www.youtube.com/watch?v=iwvl0tBJhoM">YOW! Lambda Jam 2019 - Ken Scambler - Applied Category Theory</a> (<a href="https://www.slideshare.net/kenbot/applied-category-theory-the-emerging-science-of-compositionality">slides</a>)</p>
<blockquote ><p >What do programming, quantum physics, chemistry, neuroscience, systems biology, natural language parsing, causality, network theory, game theory, dynamical systems and database theory have in common?</p>
<p >As functional programmers, we know how useful category theory can be for our work - or perhaps how abstruse and distant it can seem. What is less well known is that applying category theory to the real world is an exciting field of study that has really taken off in just the last few years. It turns out that we share something big with other fields and industries - we want to make big things out of little things without everything going to hell! The key is compositionality, the central idea of category theory.</p></blockquote>
<p >Previously: <a href="http://lambda-the-ultimate.org/node/5571">Seven Sketches in Compositionality: An Invitation to Applied Category Theory</a>.</p>
<p >(via <a href="https://twitter.com/puffnfresh">Brian McKenna</a>)</p>Category TheoryParadigmsSpotlightMon, 05 Aug 2019 14:08:02 +0000Seven Sketches in Compositionality: An Invitation to Applied Category Theory
http://lambda-the-ultimate.org/node/5571
<a href="http://xahlee.info/math/i/category_theory_brendan_fong_david_spivak_2018-03.pdf">Seven Sketches in Compositionality: An Invitation to Applied Category Theory</a>
<p >2018 by Brendan Fong and David I. Spivak</p>
<blockquote >
Category theory is becoming a central hub for all of pure mathematics. It is unmatched
in its ability to organize and layer abstractions, to find commonalities between structures of all sorts, and to facilitate communication between different mathematical
communities.
But it has also been branching out into science, informatics, and industry. We believe
that it has the potential to be a major cohesive force in the world, building rigorous
bridges between disparate worlds, both theoretical and practical. The motto at MIT is
mens et manus, Latin for mind and hand. We believe that category theory—and pure
math in general—has stayed in the realm of mind for too long; it is ripe to be brought
to hand.
</blockquote>
A very approachable but useful introduction to category theory. It avoids the Scylla and Charybdis of becoming incomprehensible after page 2 (as many academic texts do), and barely scratching the surface (as many popular texts do).Category TheoryTeaching & LearningSun, 28 Apr 2019 03:53:25 +0000Comprehending Ringads
http://lambda-the-ultimate.org/node/5525
<a href="http://www.cs.ox.ac.uk/jeremy.gibbons/publications/ringads.pdf">Comprehending Ringads</a>
<p >2016 by Jeremy Gibbons</p>
<blockquote >
Ringad comprehensions represent a convenient notation for expressing
database queries. The ringad structure alone does not provide
a good explanation or an efficient implementation of relational joins;
but by allowing heterogeneous comprehensions, involving both bag and
indexed table ringads, we show how to accommodate these too.
</blockquote>
Indexed/parametric/graded monads are the key (read the paper to understand the pun).Category TheorySemanticsType TheorySat, 05 May 2018 02:59:11 +0000Databases from finite categories
http://lambda-the-ultimate.org/node/5435
<p >Spivak and Kent (2011). <a href="https://arxiv.org/abs/1102.1889">Ologs: A categorical framework for knowledge representation</a>:</p>
<blockquote ><p >
In this paper we introduce the olog, or ontology log, a category-theoretic model for knowledge representation (KR). Grounded in formal mathematics, ologs can be rigorously formulated and cross-compared in ways that other KR models (such as semantic networks) cannot. An olog is similar to a relational database schema; in fact an olog can serve as a data repository if desired. Unlike database schemas, which are generally difficult to create or modify, ologs are designed to be user-friendly enough that authoring or reconfiguring an olog is a matter of course rather than a difficult chore. It is hoped that learning to author ologs is much simpler than learning a database definition language, despite their similarity. We describe ologs carefully and illustrate with many examples. As an application we show that any primitive recursive function can be described by an olog. We also show that ologs can be aligned or connected together into a larger network using functors. The various methods of information flow and institutions can then be used to integrate local and global world-views. We finish by providing several different avenues for future research.
</p></blockquote>
<p >Ologs are essentially RDFs extended to encompass commuting diagrams, so a visual little language. The paper talks about how database schema can automatically be extracted from ologs. </p>Category TheoryWed, 24 May 2017 06:43:15 +0000Philip Wadler: Category Theory for the Working Hacker
http://lambda-the-ultimate.org/node/5366
<p ><a href="https://www.infoq.com/presentations/category-theory-propositions-principle">Nothing you don't already know</a>, if you are inteo this sort of thing (and many if not most LtU-ers are), but a quick way to get the basic idea if you are not. Wadler has papers that explain Curry-Howard better, and the category theory content here is very basic -- but it's an easy listen that will give you the fundamental points if you still wonder what this category thing is all about. </p>
<p >To make this a bit more fun for those already in the know: what is totally missing from the talk (understandable given time constraints) is why this should interest the "working hacker". So how about pointing out a few cool uses/ideas that discerning hackers will appreciate? Go for it!</p>Category TheoryLambda CalculusSemanticsSun, 07 Aug 2016 17:26:26 +0000Cakes, Custard, and Category Theory
http://lambda-the-ultimate.org/node/5200
<p ><A href="http://www.eugeniacheng.com/">Eugenia Cheng</A>'s new popular coscience book is out, in the U.K. under the title <A href="http://www.amazon.co.uk/Cakes-Custard-Category Theory-understanding/dp/1781252874/ref=sr_1_1?ie=UTF8&qid=1422244697&sr=8-1&keywords=eugenia+cheng">Cakes, Custard and Category Theory: Easy recipes for understanding complex maths</A>, and in the U.S. under the title <A href="http://www.amazon.com/How-Bake-Pi-Exploration-Mathematics/dp/0465051715/ref=sr_1_1?ie=UTF8&qid=1419352340&sr=8-1keywords=eugenia+cheng">How to Bake Pi: An Edible Exploration of the Mathematics of Mathematics</A>:</p>
<blockquote ><p >
Most people imagine maths is something like a slow cooker: very useful, but pretty limited in what it can do. Maths, though, isn't just a tool for solving a specific problem - and it's definitely not something to be afraid of. Whether you're a maths glutton or have forgotten how long division works (or never really knew in the first place), the chances are you've missed what really makes maths exciting. Calling on a baker's dozen of entertaining, puzzling examples and mathematically illuminating culinary analogies - including chocolate brownies, iterated Battenberg cakes, sandwich sandwiches, Yorkshire puddings and Möbius bagels - brilliant young academic and mathematical crusader Eugenia Cheng is here to tell us why we should all love maths.</p>
<p >From simple numeracy to category theory ('the mathematics of mathematics'), Cheng takes us through the joys of the mathematical world. Packed with recipes, puzzles to surprise and delight even the innumerate, Cake, Custard & Category Theory will whet the appetite of maths whizzes and arithmophobes alike. (Not to mention aspiring cooks: did you know you can use that slow cooker to make clotted cream?) This is maths at its absolute tastiest.<br >
</BLOCKQUOTE></p>
<p >Cheng, one of <A href="https://www.youtube.com/user/TheCatsters">the Catsters</A>, gives a guided tour of mathematical thinking and research activities, and through the core philosophy underlying category theory. This is the kind of book you can give to your grandma and grandpa so they can boast to their friends what her grandchildren are doing (and bake you a nice dessert when you come and visit :) ). A pleasant weekend reading.</p>Category TheoryCritiquesFunGeneralSemanticsTheoryFri, 17 Jul 2015 16:47:21 +0000Conservation laws for free!
http://lambda-the-ultimate.org/node/5078
<p >In this year's <A href="http://popl.mpi-sws.org/2014/">POPL</A>, <A href="bentnib.org">Bob Atkey</A> made a splash by showing how to get <A href="http://bentnib.org/conservation-laws.pdf">from parametricity to conservation laws, via Noether's theorem</A>:</p>
<blockquote ><p >
Invariance is of paramount importance in programming languages and in physics. In programming languages, John Reynolds’ theory of relational parametricity demonstrates that parametric polymorphic programs are invariant under change of data representation, a property that yields “free” theorems about programs just from their types. In physics, Emmy Noether showed that if the action of a physical system is invariant under change of coordinates, then the physical system has a conserved quantity: a quantity that remains constant for all time. Knowledge of conserved quantities can reveal deep properties of physical systems. For example, the conservation of energy, which by Noether’s theorem is a consequence of a system’s invariance under time-shifting.</p>
<p > In this paper, we link Reynolds’ relational parametricity with Noether’s theorem for deriving conserved quantities. We propose an extension of System Fω with new kinds, types and term constants for writing programs that describe classical mechanical systems in terms of their Lagrangians. We show, by constructing a relationally parametric model of our extension of Fω, that relational parametricity is enough to satisfy the hypotheses of Noether’s theorem, and so to derive conserved quantities for free, directly from the polymorphic types of Lagrangians expressed in our system.
</p></blockquote>Category TheoryFunFunctionalLambda CalculusScientific ProgrammingSemanticsTheoryType TheoryTue, 28 Oct 2014 07:52:46 +0000Seemingly impossible programs
http://lambda-the-ultimate.org/node/5074
<p >In case this one went under the radar, at <A href="http://www.cse.psu.edu/popl/12/">POPL'12</A>, <A href="http://www.cs.bham.ac.uk/~mhe/">Martín Escardó</A> gave a tutorial on <A href="http://www.cs.bham.ac.uk/~mhe/.talks/popl2012/escardo-popl2012.pdf">seemingly impossible functional programs</A>:</p>
<blockquote ><p >
Programming language semantics is typically applied to<br >
prove compiler correctness and allow (manual or automatic) program<br >
verification. Certain kinds of semantics can also be applied to<br >
discover programs that one wouldn't have otherwise thought of. This is<br >
the case, in particular, for semantics that incorporate topological<br >
ingredients (limits, continuity, openness, compactness). For example,<br >
it turns out that some function types (X -> Y) with X infinite (but<br >
compact) do have decidable equality, contradicting perhaps popular<br >
belief, but certainly not (higher-type) computability theory. More<br >
generally, one can often check infinitely many cases in finite time.</p>
<p >I will show you such programs, run them fast in surprising instances,<br >
and introduce the theory behind their derivation and working. In<br >
particular, I will study a single (very high type) program that (i)<br >
optimally plays sequential games of unbounded length, (ii) implements<br >
the Tychonoff Theorem from topology (and builds finite-time search<br >
functions for infinite sets), (iii) realizes the double-negation shift<br >
from proof theory (and allows us to extract programs from classical<br >
proofs that use the axiom of countable choice). There will be several<br >
examples in the languages Haskell and Agda.
</p></blockquote>
<p >A <A href="http://math.andrej.com/2007/09/28/seemingly-impossible-functional-programs/">shorter version</A> (coded in Haskell) appears in Andrej Bauer's blog.</p>Category TheoryFunFunctionalParadigmsSemanticsTheoryWed, 22 Oct 2014 09:57:47 +0000Luca Cardelli Festschrift
http://lambda-the-ultimate.org/node/5044
<p >Earlier this week Microsoft Research Cambridge organised a <A href="http://research.microsoft.com/en-us/events/lucacardellifest/">Festschrift</A> for Luca Cardelli. The preface from the <A href="http://research.microsoft.com/pubs/226237/Luca-Cardelli-Fest-MSR-TR-2014-104.pdf">book</A>:</p>
<blockquote ><p >
Luca Cardelli has made exceptional contributions to the world of programming<br >
languages and beyond. Throughout his career, he has re-invented himself every<br >
decade or so, while continuing to make true innovations. His achievements span<br >
many areas: software; language design, including experimental languages;<br >
programming language foundations; and the interaction of programming languages<br >
and biology. These achievements form the basis of his lasting scientific leadership<br >
and his wide impact.<br >
...<br >
Luca is always asking "what is new", and is always looking to<br >
the future. Therefore, we have asked authors to produce short pieces that would<br >
indicate where they are today and where they are going. Some of the resulting<br >
pieces are short scientific papers, or abridged versions of longer papers; others are<br >
less technical, with thoughts on the past and ideas for the future. We hope that<br >
they will all interest Luca.
</p></blockquote>
<p >Hopefully the videos will be posted soon.</p>Category TheoryLambda CalculusMisc BooksSemanticsTheoryType TheoryFri, 12 Sep 2014 10:10:08 +0000Dependently-Typed Metaprogramming (in Agda)
http://lambda-the-ultimate.org/node/4804
<p ><A href="http://www.strictlypositive.org">Conor McBride</A> gave an 8-lecture summer course on <A href="http://www.cl.cam.ac.uk/~ok259/agda-course-13/">Dependently typed metaprogramming (in Agda)</A> at the <A href="http://www.cl.cam.ac.uk/">Cambridge University Computer Laboratory</A>:</p>
<blockquote ><p >
Dependently typed functional programming languages such as Agda are capable of expressing very precise types for data. When those data themselves encode types, we gain a powerful mechanism for abstracting generic operations over carefully circumscribed universes. This course will begin with a rapid depedently-typed programming primer in Agda, then explore techniques for and consequences of universe constructions. Of central importance are the â€œpattern functorsâ€ which determine the node structure of inductive and coinductive datatypes. We shall consider syntactic presentations of these functors (allowing operations as useful as symbolic differentiation), and relate them to the more uniform abstract notion of â€œcontainerâ€. We shall expose the double-life containers lead as â€œinteraction structuresâ€ describing systems of effects. Later, we step up to functors over universes, acquiring the power of inductive-recursive definitions, and we use that power to build universes of dependent types.
</p></blockquote>
<p >The <A href="https://github.com/pigworker/MetaprogAgda/blob/master/notes.pdf?raw=true">lecture notes</A>, <A href="https://github.com/pigworker/MetaprogAgda">code</A>, and <A href="http://www.youtube.com/playlist?list=PL_shDsyy0xhKhsBUaVXTJ2uJ78EGBpvQa">video captures</A> are available online. </p>
<p >As with his <A href="http://www.cl.cam.ac.uk/~ok259/agda-course/">previous course</A>, the notes contain many(!) mind expanding exploratory exercises, some of which quite challenging.</p>Category TheoryFunctionalLambda CalculusMeta-ProgrammingParadigmsSemanticsTeaching & LearningTheoryType TheoryFri, 30 Aug 2013 07:34:49 +0000Lightweight Monadic Programming in ML
http://lambda-the-ultimate.org/node/4321
<p ><a href="http://www.cs.umd.edu/~mwh/papers/swamy11monad.html">Lightweight Monadic Programming in ML</a></p>
<blockquote ><p >
Many useful programming constructions can be expressed as monads. Examples include probabilistic modeling, functional reactive programming, parsing, and information flow tracking, not to mention effectful functionality like state and I/O. In this paper, we present a type-based rewriting algorithm to make programming with arbitrary monads as easy as using ML's built-in support for state and I/O. Developers write programs using monadic values of type <i >M t</i> as if they were of type <i >t</i>, and our algorithm inserts the necessary binds, units, and monad-to-monad morphisms so that the program type checks. Our algorithm, based on Jones' qualified types, produces principal types. But principal types are sometimes problematic: the program's semantics could depend on the choice of instantiation when more than one instantiation is valid. In such situations we are able to simplify the types to remove any ambiguity but without adversely affecting typability; thus we can accept strictly more programs. Moreover, we have proved that this simplification is <i >efficient</i> (linear in the number of constraints) and <i >coherent</i>: while our algorithm induces a particular rewriting, all related rewritings will have the same semantics. We have implemented our approach for a core functional language and applied it successfully to simple examples from the domains listed above, which are used as illustrations throughout the paper.
</p></blockquote>
<p >This is an intriguing paper, with an implementation in about 2,000 lines of OCaml. I'm especially interested in its application to probabilistic computing, yielding a result related to Kiselyov and Shan's Hansei effort, but without requiring delimited continuations (not that there's anything wrong with delimited continuations). On a theoretical level, it's nice to see such a compelling example of what can be done once types are freed from the shackle of "describing how bits are laid out in memory" (another such compelling example, IMHO, is type-directed partial evaluation, but that's literally another story).</p>Category TheoryFunctionalImplementationSemanticsType TheoryThu, 28 Jul 2011 18:11:27 +0000Kleisli Arrows of Outrageous Fortune
http://lambda-the-ultimate.org/node/4273
<p ><a href="http://personal.cis.strath.ac.uk/~conor/Kleisli.pdf">Kleisli Arrows of Outrageous Fortune</a></p>
<blockquote ><p >
When we program to interact with a turbulent world, we are to some extent at its mercy. To achieve safety, we must ensure that programs act in accordance with what is known about the state of the world, as determined dynamically. Is there any hope to enforce safety policies for dynamic interaction by static typing? This paper answers with a cautious â€˜yesâ€™.</p>
<p >Monads provide a type discipline for effectful programming, mapping value types to computation types. If we index our types by data approximating the â€˜state of the worldâ€™, we refine our values to witnesses for some condition of the world. Ordinary monads for indexed types give a discipline for effectful programming contingent on state, modelling the whims of fortune in way that Atkeyâ€™s indexed monads for ordinary types do not (Atkey, 2009). Arrows in the corresponding Kleisli category represent computations which a reach a given postcondition from a given precondition: their types are just specifications in a Hoare logic!</p>
<p >By way of an elementary introduction to this approach, I present the example of a monad for interacting with a file handle which is either â€˜openâ€™ or â€˜closedâ€™, constructed from a command interface specfied Hoare-style. An attempt to open a file results in a state which is statically unpredictable but dynamically detectable. Well typed programs behave accordingly in either case. Haskellâ€™s dependent type system, as exposed by the Strathclyde Haskell Enhancement preprocessor, provides a suitable basis for this simple experiment.
</p></blockquote>
<p >I discovered this Googling around in an attempt to find some decent introductory material to Kleisli arrows. This isn't introductory, but it's a good resource. :-) The good introductory material I found was <a href="http://blog.downstairspeople.org/2010/06/14/a-brutal-introduction-to-arrows/">this</a>.</p>Category TheoryFunctionalType TheorySat, 14 May 2011 15:19:08 +0000A Lambda Calculus for Real Analysis
http://lambda-the-ultimate.org/node/3831
<p ><a href="http://paultaylor.eu/ASD/lamcra/">A Lambda Calculus for Real Analysis</a></p>
<blockquote ><p >
Abstract Stone Duality is a revolutionary paradigm for general topology that describes computable continuous functions directly, without using set theory, infinitary lattice theory or a prior theory of discrete computation. Every expression in the calculus denotes both a continuous function and a program, and the reasoning looks remarkably like a sanitised form of that in classical topology. This is an introduction to ASD for the general mathematician, with application to elementary real analysis.</p>
<p >This language is applied to the Intermediate Value Theorem: the solution of equations for continuous functions on the real line. As is well known from both numerical and constructive considerations, the equation cannot be solved if the function "hovers" near 0, whilst tangential solutions will never be found.</p>
<p >In ASD, both of these failures and the general method of finding solutions of the equation when they exist are explained by the new concept of overtness. The zeroes are captured, not as a set, but by higher-type modal operators. Unlike the Brouwer degree, these are defined and (Scott) continuous across singularities of a parametric equation.</p>
<p >Expressing topology in terms of continuous functions rather than sets of points leads to treatments of open and closed concepts that are very closely lattice- (or de Morgan-) dual, without the double negations that are found in intuitionistic approaches. In this, the dual of compactness is overtness. Whereas meets and joins in locale theory are asymmetrically finite and infinite, they have overt and compact indices in ASD.</p>
<p >Overtness replaces metrical properties such as total boundedness, and cardinality conditions such as having a countable dense subset. It is also related to locatedness in constructive analysis and recursive enumerability in recursion theory.
</p></blockquote>
<p >Paul Taylor is deadly serious about the intersection of logic, mathematics, and computation. I came across this after beating my head against <a href="http://www.amazon.com/Probability-Theory-Logic-Science-Vol/dp/0521592712/ref=sr_1_1?ie=UTF8&s=books&qid=1266357272&sr=8-1">Probability Theory: The Logic of Science</a> and <a href="http://axiomaticeconomics.com/">Axiomatic Theory of Economics</a> over the weekend, realizing that my math just wasn't up to the tasks, and doing a Google search for "constructive real analysis." "Real analysis" because it was obvious that that was what both of the aforementioned texts were relying on; "constructive" because I'd really like to develop proofs in Coq/extract working code from them. This paper was on the second page of results. Paul's name was familiar (and not just because I share it with him); he translated Jean-Yves Girard's regrettably out-of-print <a href="http://paultaylor.eu/stable/Proofs+Types">Proofs and Types</a> to English and maintains a very popular set of tools for typesetting <a href="http://paultaylor.eu/diagrams/">commutative diagrams</a> using LaTeX.</p>Category TheoryFunctionalLambda CalculusLogic/DeclarativeMeta-ProgrammingSemanticsType TheoryTue, 16 Feb 2010 22:00:42 +0000Simplicial Databases
http://lambda-the-ultimate.org/node/3761
<p ><a href="http://arxiv.org/abs/0904.2012">Simplicial Databases</a>, David I. Spivak. </p>
<blockquote ><p >In this paper, we define a category DB, called the category of simplicial databases, whose objects are databases and whose morphisms are data-preserving maps. Along the way we give a precise formulation of the category of relational databases, and prove that it is a full subcategory of DB. We also prove that limits and colimits always exist in DB and that they correspond to queries such as select, join, union, etc. One feature of our construction is that the schema of a simplicial database has a natural geometric structure: an underlying simplicial set. The geometry of a schema is a way of keeping track of relationships between distinct tables, and can be thought of as a system of foreign keys. The shape of a schema is generally intuitive (e.g. the schema for round-trip flights is a circle consisting of an edge from $A$ to $B$ and an edge from $B$ to $A$), and as such, may be useful for analyzing data. We give several applications of our approach, as well as possible advantages it has over the relational model. We also indicate some directions for further research.</p></blockquote>
<p >This is what happens when you try to take the existence of ORDER BY and COUNT in SQL seriously. :-) </p>
<p >If you're puzzled by how a geometric idea like simplexes could show up here, remember that the algebraic view of simplicial sets is as <a href="http://en.wikipedia.org/wiki/Presheaf_%28category_theory%29">presheaves</a> on the category of finite total orders and order-preserving maps. Every finite sequence gives rise to a total order on its set of positions, and tables have rows and columns as sequences!</p>Category TheoryTheoryFri, 08 Jan 2010 11:44:03 +0000An Innocent Model of Linear Logic
http://lambda-the-ultimate.org/node/3727
<p ><a href="http://www.pps.jussieu.fr/~mellies/papers/ag3-ctcs.pdf">An Innocent Model of Linear Logic</a> by Paul-André Melliès was <a href="/node/3716#comment-53086">referenced by Noam</a> in a <a href="/node/3716#comment-53069">serendipitious subthread</a> of the "Claiming Infinities" thread.</p>
<p >Here's the abstract:</p>
<blockquote ><p >
Since its early days, deterministic sequential game semantics has been limited to linear or polarized fragments of linear logic. Every attempt to extend the semantics to full propositional linear logic has bumped against the so-called Blass problem, which indicates (misleadingly) that a category of sequential games cannot be self-dual and cartesian at the same time. We circumvent this problem by considering (1) that sequential games are inherently positional; (2) that they admit internal positions as well as external positions. We construct in this way a sequential game model of propositional linear logic, which incorporates two variants of the innocent arena game model: the well-bracketed and the non well-bracketed ones.
</p></blockquote>
<p >The introduction goes on to refer to to André Joyal's "<i >Category Y with Conway games as objects, and winning strategies as morphisms, composed by sequential interaction</i>," and points out that "<i >it is a precursor of game semantics for proof theory and programming languages</i>," and is "<i >a self-dual category of sequential games</i>." The foreword mentions that the paper goes on to give "<i >a crash course on asynchronous games</i>" and then "<i >constructs a linear continuation monad equivalent to the identity functor, by allowing internal positions in our games, [which] circumvents the Blass problem and defines a model of linear logic</i>."</p>
<p >Jacques Carette called this paper mind-blowing. My mind-blow warning light already exploded. I'm posting this paper because I know a number of LtUers are interested in these topics, and this way I can buttonhole one of them the next time I see them and ask them to explain it to me. ;)</p>Category TheoryFri, 18 Dec 2009 03:23:36 +0000