IMPORTANT NOTE: THESE NOTES ARE STILL UNDER DEVELOPMENT. PLEASE WAIT UNTIL AFTER THE LECTURE WITH HANDING ANYTHING IN, OR TREATING THE NOTES AS READY TO READ.
Cartesian Closed Categories and typed lambda-calculus
A category is said to have pairwise products if for any objects , there is a product object .
A category is said to have pairwise coproducts if for any objects , there is a coproduct object .
Recall when we talked about internal homs in Lecture 2. We can now define what we mean, formally, by the concept:
Definition An object in a category is an internal hom object or an exponential object or if it comes equipped with an arrow , called the evaluation arrow, such that for any other arrow , there is a unique arrow such that the composite
The idea here is that with something in an exponential object, and something in the source of the arrows we imagine live inside the exponential, we can produce the evaluation of the arrow at the source to produce something in the target. Using global elements, this reasoning comes through in a more natural manner: given and we can produce the global element . Furthermore, we can always produce something in the exponential whenever we have something that looks as if it should be there.
And with this we can define
Definition A category is a Cartesian Closed Category or a CCC if:
- has a terminal object
- Each pair of objects has a product and projections , .
- For every pair of objects, there is an exponential object with an evaluation map .
Note that the exponential as described here is exactly what we need in order to discuss the Haskell concept of multi-parameter functions. If we consider the type of a binary function in Haskell:
binFunction :: a -> a -> a
This function really lives in the Haskell type
a -> (a -> a), and thus is an element in the repeated exponential object . Evaluating once gives us a single-parameter function, the first parameter consumed by the first evaluation, and we can evaluate a second time, feeding in the second parameter to get an end result from the function.
On the other hand, we can feed in both values at once, and get
binFunction' :: (a,a) -> a
which lives in the exponential object .
These are genuinely different objects, but they seem to do the same thing: consume two distinct values to produce a third value. The resolution of the difference lies, again, in a recognition from Set theory: there is an isomorphism
which we can use as inspiration for an isomorphism valid in Cartesian Closed Categories.
As it turns out, this is exactly what we need for -calculus. Any typed -calculus gives rise to a CCC in a natural manner, and any CCC has an internal language which satisfies, by the axioms for the CCC, all requirements to be a typed -calculus.
More importantly, by stating -calculus in terms of a CCC instead of in terms of terms and rewriting rules is that you can escape worrying about variable clashes, alpha reductions and composability - the categorical translation ignores, at least superficially, the variables, reduces terms with morphisms that have equality built in, and provides associative composition for free.
At this point, I'd reccomend reading more on Wikipedia  and , as well as in Lambek & Scott: Introduction to Higher Order Categorical Logic. The book by Lambek & Scott goes into great depth on these issues, but may be less than friendly to a novice.
Limits and colimits
- Generalizing these constructions
- Diagram and universal object mapping to (from) the diagram
- Express product/coproduct as limit/colimit
- Issues with Haskell
- No dependent types
- No compiler-enforced equational conditions
- Can be simulated but not enforced, e.g. using QuickCheck.
Useful limits and colimits
- Kernels, cokernels, images, coimages
- connect to linear algebra: null spaces et.c.
Pushout and pullback squares
- Computer science applications
- Prove that currying/uncurrying are isomorphisms in a CCC. Hint: the map is a map .