Category Theory for All:
                                   a logician's perspective

                                        Valeria de Paiva


                                          NASSLLI2012

                                          June, 2012




Valeria de Paiva   (NASSLLI2012)                              June, 2012   1 / 113
Outline




Outline


1   Interested in Category Theory?



2   Categories, Functors and Natural Transformations



3   Adjunctions



4   Deductive Systems as Categories



5   A taste of Glue Semantics?...




Valeria de Paiva   (NASSLLI2012)                       June, 2012   2 / 113
Interested in Category Theory?




Introduction
Category theory is a relatively new branch of mathematics that keeps
appearing in texts of computational semantics, on the syntax-semantics
interface and even on material on pure syntax.
It also is very proeminent on the literature on Functional Programming, in
the theory of specications and even on some discussions on databases.
Thirdly it has become familiar in texts for physicists, especially the ones
interested in Quantum stu.

Category theory is simple, but requires an investment of time to get over
the initial barrier of language, hence it seems an ideal subject to be taught
at NASSLLI.




       There are two ways to do great mathematics. The rst way is to
       be smarter than everybody else. The second way is to be stupider
       than everybody else  but persistent.                Raoul Bott

Valeria de Paiva   (NASSLLI2012)                               June, 2012   3 / 113
Interested in Category Theory?




A little bit of personal history...


Some twenty years ago I nished my PhD thesis The Dialectica
Categories in Cambridge. My supervisor was Dr Martin Hyland.




Valeria de Paiva   (NASSLLI2012)                          June, 2012   4 / 113
Interested in Category Theory?




Dialectica categories come from Gödel's Dialectica
Interpretation




The interpretation is named after the Swiss journal Dialectica where it
appeared in a special volume dedicated to Paul Bernays 70th birthday in
1958.
I was originally trying to provide an internal categorical model of the
Dialectica Interpretation. The categories I came up with proved (also) to
be a model of Linear Logic...




Valeria de Paiva   (NASSLLI2012)                               June, 2012   5 / 113
Interested in Category Theory?




Dialectica categories are models of Linear Logic




Linear Logic (LL) introduced by Girard (1987): [...]linear logic comes from
a proof-theoretic analysis of usual logic.
LL the best of both worlds, the dualities of classical logic plus the
constructive content of proofs of intuitionistic logic.

Dialectica categories are a cool model of LL, still one of the best around...




Valeria de Paiva   (NASSLLI2012)                               June, 2012   6 / 113
Interested in Category Theory?




From Linear Logic to Semantics of Natural Language




Many linguists became interested in Linear Logic because it's a
resource-conscious logic.
I became interested in Linguistics because of Linear Logic and its
programme of proofs as rst class objects.




Valeria de Paiva   (NASSLLI2012)                             June, 2012   7 / 113
Interested in Category Theory?




From Linear Logic to Linear Functional Programming




I also became interested in Functional Programing because of Linear Logic
and its programme of proofs as rst class objects.




Valeria de Paiva   (NASSLLI2012)                           June, 2012   8 / 113
Interested in Category Theory?




Proofs as rst class objects?




Programme to elevate the status of proofs to rst class logical objects.
Instead of asking `when is a formula                      A   true', we ask `what is a proof of   A?'
Using Frege's distinction between sense and denotation:
proofs are the senses of logical formulas,
whose denotations might be truth values.

Sometimes I call this programme Proof Semantics.
sometimes I call it Categorical Proof Theory (because the semantics of proofs
are given in terms of natural constructions in Category Theory).


Valeria de Paiva   (NASSLLI2012)                                                    June, 2012    9 / 113
Interested in Category Theory?




The Challenges of Proof Semantics...




There is a problem with viewing proofs as logical objects:
We do not have direct access to proofs.
Only to syntactic representations of them, in the form of derivations in
some proof system (e.g. axiomatic, natural deduction or sequent calculus).

Syntactic derivations are awed means of accessing the underlying proof
objects. The syntax can introduce spurious dierences between derivations
that do not correspond to dierences in the underlying proofs; it can also
mask dierences that really are there.
Semantics of proofs is what categorical logic is about.
Our category theory will be directed towards proof semantics.
Valeria de Paiva   (NASSLLI2012)                             June, 2012    10 / 113
Interested in Category Theory?




Things I hope you know...


We will assume some familiarity with rst-order predicate calculus, a
rudimentary knowledge of the lambda-calculus and type theory, and a basic
idea of what logical inference is about.
If you have an intuitive understanding what the following means I think
you'll be ne.

       ∀x. man(x) → mortal(x), man(john)                                mortal(john)
       λx.see(x, john) (f red)                 ≡β         see(f red, john)

If you have done a basic course in abstract algebra, linear algebra or
groups, then you should be in really good shape.




Valeria de Paiva   (NASSLLI2012)                                              June, 2012   11 / 113
Interested in Category Theory?




What is Categorical Logic?




                   Traditionally mathematical logic divided into four areas:
proof theory
model theory,
recursion theory
and set theory.
A trend towards adding `Complexity' to the four basic areas.

Categorical logic means dierent things to dierent people.
In this course we will mean categorical `proof theory'.




Valeria de Paiva   (NASSLLI2012)                                     June, 2012   12 / 113
Interested in Category Theory?




What is Categorical Proof Theory?




Proof theory using categorical models instead of Sets-based models...
Logic could be rst-order, but it will be propositional only.
Classical logic poses some problems, discussed later on.
We deal with propositional intuitionistic logic IPL.

For this course this means that we need to consider three independent
connectives: conjunction (A                ∧ B ),   disjunction (A   ∨ B)   and implication
(A   → B ).
These are not interdenable, so some of the usual classical rules (e.g.
A → B ∼ ¬A ∨ B )
      =                        are not valid.


Valeria de Paiva   (NASSLLI2012)                                                June, 2012   13 / 113
Interested in Category Theory?




The quest for proofs...




Traditional proof theory, to the extent that it relies on models uses
algebraic structures such as Boolean algebras, Heyting algebras or Kripke
models of several styles.
These models lose one important dimension. In these models dierent
proofs are not represented at all.
Provability, the fact that              Γ   a collection of premisses      A1 , . . . , A k   entails   A,
is represented by the less or equal                ≤      relation in the model.
This does not give us a way of representing the proofs themselves. We only
know if a proof exists             Γ≤A      or not. All proofs are collapsed into the
existence of this relation.
Valeria de Paiva   (NASSLLI2012)                                                    June, 2012     14 / 113
Interested in Category Theory?




The quest for proofs...




By contrast in categorical proof theory we think and write a proof as


                                                  Γ →f A

where    f   is the reason why we can deduce               A   from   Γ,   a name for the proof
we are thinking of. Thus we can observe and name and compare dierent
derivations. Which means that we can see subtle dierences in the logics.




Valeria de Paiva   (NASSLLI2012)                                                 June, 2012   15 / 113
Interested in Category Theory?




Constructive perspective: not much of one...
This course is not about the deep philosophical questions of the foundations
of mathematics. We will side-step every philosophical issue that we can.
(It is not that these issues are not interesting. They are. It is just that I
don't think I can enlighten anyone much on them.)

Caveat emptor Whether you believe or not that there is a single logic that
is the correct one, applications (especially in CS) have provided us with
empirical evidence that there are several logical systems that are convenient
for use in specic contexts.
When studying these contexts and applications it pays to keep a
constructive viewpoint. If classical logic turns out to be necessary, we will
pragmatically use it and ag its use.
Commmitment to intuitionistic principles is a matter of pragmatic choice:
It is easier to be intuitionistic and then if need arises to become classic
than the other way round. Moreover it's safer: intuitionistic principles are
accepted by all...

Valeria de Paiva   (NASSLLI2012)                                June, 2012    16 / 113
Interested in Category Theory?




The real point of this course...




Valeria de Paiva   (NASSLLI2012)                          June, 2012   17 / 113
Interested in Category Theory?




Edwardian proofs for futuristic programs...




Valeria de Paiva   (NASSLLI2012)                          June, 2012   18 / 113
Interested in Category Theory?




Introductions to category theory?...

There are many. check out logic-forall for links.
S. Mac Lane, Categories for the Working Mathematician (1971, 1998)
J.-Y. Girard, Y. Lafont, P. Taylor, Proofs and Types (1989)
M. Barr, C. Wells, Category Theory for Computer Science (1995)
B.C. Pierce, Basic Category Theory for Computer Science (1991)
R. Blute P. Scott, Category Theory for Linear Logicians (2003)
F.W. Lawvere, S.H. Schanuel, Conceptual Mathematics (1997)
Abramsky,Tzevelekos, Introduction to Cats and Categorical Logic (2010)
S. Awodey, Category Theory, (2010).
H. Simmons, An Introduction to Category Theory, (2011)
V. de Paiva, Categorical Proof Theory and Linear Logic (1996)

Blog http://logic-forall.blogspot.com/




Valeria de Paiva   (NASSLLI2012)                              June, 2012   19 / 113
Interested in Category Theory?




More Introductions...


M. Johansson, Category Theory and Functional Programming, Stanford
FALL 2009, and St. Andrews 2012
also Chalmers discussion group:
G. Hutton, Introduction to Category Theory , Midlands Grad School, 2012
D. Verity, An Introduction to Category Theory - FP-Syd talk,
E. Cheng, The Catstars YouTube channel,
J. van Oosten, Basic Category Theory, 2002,
L. Maertens, Category Theory for Program Construction. ESSLLI (1995)
Benton, Bierman, Hyland and de Paiva, Term Assignment for Intuitionistic
Linear Logic, 1992.




Valeria de Paiva   (NASSLLI2012)                          June, 2012   20 / 113
Interested in Category Theory?




Elements of category theory...




Meant to imply that we will discuss and do exercises on some basic
concepts. necessary for categorical proof theory, in the restricted sense
above.
No promisses of completeness of building blocks...
Basic concepts we intend to cover:
   categories, functors, natural transformations
   products, pullbacks, equalizers, initial and terminal objects
   adjunctions and monoidal closure
   Yoneda Lemma
   (monads, algebras, coalgebras and comonads?)

Valeria de Paiva   (NASSLLI2012)                               June, 2012   21 / 113
Categories, Functors and Natural Transformations




Denition of a Category

A category         C   consists of a collection of objects        (A, B, . . .) and a collection
of morphisms (or maps) from                 A   to   B   (written asf : A → B ) satisfying
three easy conditions:

1. Given maps   f : A → B and g : B → C such that the codomain of f is
equal to the domain of   g , there is an operation of composition of
morphisms, which produces a map f ; g : A → C .
2. The composition operation is associative, ie. f ; (g; h) = (f ; g); h.
3. For each object A in the category we have an associated identity
morphism idA : A → A such that if f : A → B is any map in the category,
then idA ; f = f = f ; idB .

Note on `writing' composition: mathematicians usually write                     g◦f     for what
I mostly write as         f ; g.   Use whatever you like, and have a scratchpad nearby
to check it out...


Valeria de Paiva   (NASSLLI2012)                                               June, 2012   22 / 113
Categories, Functors and Natural Transformations




The Denition of Category




Valeria de Paiva   (NASSLLI2012)                        June, 2012   23 / 113
Categories, Functors and Natural Transformations




The Denition of Category




Valeria de Paiva   (NASSLLI2012)                        June, 2012   24 / 113
Categories, Functors and Natural Transformations




Examples of Categories




Valeria de Paiva   (NASSLLI2012)                        June, 2012   25 / 113
Categories, Functors and Natural Transformations




Examples of Categories




Valeria de Paiva   (NASSLLI2012)                        June, 2012   26 / 113
Categories, Functors and Natural Transformations




Examples of kinds of Categories




Valeria de Paiva   (NASSLLI2012)                        June, 2012   27 / 113
Categories, Functors and Natural Transformations




Examples of Categories




Valeria de Paiva   (NASSLLI2012)                        June, 2012   28 / 113
Categories, Functors and Natural Transformations




Examples of Categories


The category of          Sets      and usual functions is the paradigmatic example.
Maybe it's too intuitive.

A good example to show the dierence between morphisms and functions is
the category        Rel    of sets and relations.

Easy mathematical examples:
Groups and homomorphisms,
vector spaces and linear transformations,
monoids and monoid homomorphisms.
More complicated example: topological spaces and continuous maps.




Valeria de Paiva   (NASSLLI2012)                                        June, 2012   29 / 113
Categories, Functors and Natural Transformations




Examples of Categories: Monoids



A monoid       M      is a set with a `multiplication-like' operation and one identity,
say the element          e.   So   M = (M, ·, e)        where   ·: M × M → M    is such that

m1 · (m2 · m3 ) = (m1 · m2 ) · m3                and    m· e = m = e · m

Easy mathematical examples:
(N, +, 0)     integers under addition,
(R, ×, 1)     reals under multiplication
matrices under multiplication of matrices                 (Matn , ·, In )
strings over alphabet          {0, 1},    under     concatenation, (String, ·, λ).




Valeria de Paiva   (NASSLLI2012)                                              June, 2012   30 / 113
Categories, Functors and Natural Transformations




Two extreme examples




The empty category (writen as                   0),     which has no objects nor morphisms.
(Just a parallel concept to the empty set.)
The singleton category (written as                      1),   which has a single object and a
single morphism, which is the identity on the single object.




Valeria de Paiva   (NASSLLI2012)                                                 June, 2012   31 / 113
Categories, Functors and Natural Transformations




Why Categories?

Category theory (CT) is a convenient new language
It puts existing mathematical results into perspective
It gives an appreciation of the unity of modern mathematics

As a language, it oers economy of thought and expression
Reveals common ideas in (apparently) unrelated areas of mathematics
A single result proved in CT generates many results in dierent areas
Duality: for every categorical construct, there is a dual, reverse all the maps
Dicult problems in some areas of mathematics can be translated into
(easier) problems in other areas (e.g. by using functors, which map from
one category to another)
Makes precise some notions that were previously vague, e.g. universality,
naturality, etc




Valeria de Paiva   (NASSLLI2012)                               June, 2012   32 / 113
Categories, Functors and Natural Transformations




Why Categories?
Category theory is ideal for:
Reasoning about structure and the mappings that preserve structure
Abstracting away from details
Automation (constructive methods for many useful categorical structures)

Applications of Category theory in software engineering:
The category of algebraic specications: category theory used to represent
composition and renement
The category of temporal logic specications: category theory used to build
modular specications and decompose system properties across them
Automata theory: category theory oers a new way of comparing automata

Logic as a category: represent a logical system as a category, and construct
proofs using universal constructs in category theory (diagram chasing).
A category of logics: theorem provers in dierent logic systems can be
hooked together through institution morphisms
Functional Programming: type theory, programming language semantics...
Valeria de Paiva   (NASSLLI2012)                            June, 2012    33 / 113
Categories, Functors and Natural Transformations




Beware of paradoxes...

To avoid set theoretical paradoxes care must be taken.
Oversimplifying: small collections are sets, big collections are classes and
try not to pay much attention to the dierences between them.

Say   C   is a small category if both
the collection objects of            C   (written as       obj(C)   or   |C|)   and
the collection of maps between two objects HomC (A, B) (for all                              A, B
objects of      C)    are sets.
Say   C   is a locally small category if HomC (A, B) is a set for any two
objects     A   and    B   in the category.

We assume all the categories we discuss are at least locally small and that
the sets of morphisms              HomC (A, B)           are disjoint for distinct pairs of objects
A   and   B.       We also draw diagrams and say they commute to state
equations between morphisms.


Valeria de Paiva   (NASSLLI2012)                                                      June, 2012    34 / 113
Categories, Functors and Natural Transformations


 beginframe




Valeria de Paiva   (NASSLLI2012)                        June, 2012   35 / 113
Categories, Functors and Natural Transformations




Initial and Terminal Objects




Valeria de Paiva   (NASSLLI2012)                        June, 2012   35 / 113
Categories, Functors and Natural Transformations




Recap



1. Discussed the idea of categorical semantics:




Valeria de Paiva   (NASSLLI2012)                        June, 2012   36 / 113
Categories, Functors and Natural Transformations




Recap



1. Discussed the idea of categorical semantics:
want our to be able to distinguish dierent derivations of the same formula
from same assumptions;




Valeria de Paiva   (NASSLLI2012)                            June, 2012   36 / 113
Categories, Functors and Natural Transformations




Recap



1. Discussed the idea of categorical semantics:
want our to be able to distinguish dierent derivations of the same formula
from same assumptions;
2. want to use categorical morphisms as denotations of our proofs;




Valeria de Paiva   (NASSLLI2012)                            June, 2012   36 / 113
Categories, Functors and Natural Transformations




Recap



1. Discussed the idea of categorical semantics:
want our to be able to distinguish dierent derivations of the same formula
from same assumptions;
2. want to use categorical morphisms as denotations of our proofs;
3. want Curry-Howard triangles for other logics/other type
theories/other categories;




Valeria de Paiva   (NASSLLI2012)                            June, 2012   36 / 113
Categories, Functors and Natural Transformations




Recap



1. Discussed the idea of categorical semantics:
want our to be able to distinguish dierent derivations of the same formula
from same assumptions;
2. want to use categorical morphisms as denotations of our proofs;
3. want Curry-Howard triangles for other logics/other type
theories/other categories;
for now want to understand how original categorical Curry-Howard works




Valeria de Paiva   (NASSLLI2012)                            June, 2012   36 / 113
Categories, Functors and Natural Transformations




Recap



1. Discussed the idea of categorical semantics:
want our to be able to distinguish dierent derivations of the same formula
from same assumptions;
2. want to use categorical morphisms as denotations of our proofs;
3. want Curry-Howard triangles for other logics/other type
theories/other categories;
for now want to understand how original categorical Curry-Howard works
4. Saw the denition of a category and some examples




Valeria de Paiva   (NASSLLI2012)                            June, 2012   36 / 113
Categories, Functors and Natural Transformations




Repeating: a Category

A category         C   consists of a collection of objects             (A, B, . . .) and a collection
of morphisms (or maps/arrows) from                      A   to   B   (written as   f : A → B)
satisfying three easy conditions:

1. Given maps   f : A → B and g : B → C such that the codomain of f is
equal to the domain of   g , there is an operation of composition of
morphisms, which produces a map f ; g : A → C .
2. The composition operation is associative, ie. f ; (g; h) = (f ; g); h.
3. For each object A in the category we have an associated identity
morphism idA : A → A such that if f : A → B is any map in the category,
then idA ; f = f = f ; idB .

Note on `writing' composition: mathematicians usually write                          g◦f     for what
I mostly write as         f ; g.   Use whatever you like, and have a scratchpad nearby
to check it out...


Valeria de Paiva   (NASSLLI2012)                                                    June, 2012   37 / 113
Categories, Functors and Natural Transformations




Repeating: Examples



0. Category Set, plus few nite ones, plus `sets-with-structure' (universal
algebra)...

1.any partially-ordered set              (P, ≤)   can be seen as a category, a morphism
exists between         p, q   in   P   just when   p ≤ q,   ie. either a single or no morphism
between objects.




Valeria de Paiva   (NASSLLI2012)                                              June, 2012   38 / 113
Categories, Functors and Natural Transformations




Repeating: Examples



0. Category Set, plus few nite ones, plus `sets-with-structure' (universal
algebra)...

1.any partially-ordered set              (P, ≤)   can be seen as a category, a morphism
exists between         p, q   in   P   just when   p ≤ q,   ie. either a single or no morphism
between objects.

how do we show this satises conditions for category?
2. category of monoids                 (M, ·, e) and monoid homormorphisms,        ie maps
f :M →M              such that         f (m · n) = f (m) · f (n) and f (e) = e .




Valeria de Paiva   (NASSLLI2012)                                              June, 2012   38 / 113
Categories, Functors and Natural Transformations




Two extreme examples of categories




The empty category (writen as                   0),     which has no objects nor morphisms.
(Just a parallel concept to the empty set.)


The singleton category (written as                      1),   which has a single object and a
single morphism,




Valeria de Paiva   (NASSLLI2012)                                                 June, 2012   39 / 113
Categories, Functors and Natural Transformations




Two extreme examples of categories




The empty category (writen as                   0),     which has no objects nor morphisms.
(Just a parallel concept to the empty set.)


The singleton category (written as                      1),   which has a single object and a
single morphism, which is the identity on the single object.




Valeria de Paiva   (NASSLLI2012)                                                 June, 2012   39 / 113
Categories, Functors and Natural Transformations




The opposite category Cop



Given any category           C     we can formally invert all its morphisms, to construct
the category        Cop .
Why would you do this?

Actually will be extremely useful to deal with e.g. logical implication.
But for the time being, it's a simple way of seeing that morphisms do not
have to be function-based.
Fork on the road: structures inside categories vs. structures relating cats




Valeria de Paiva   (NASSLLI2012)                                         June, 2012   40 / 113
Categories, Functors and Natural Transformations




Products of Categories




Given categories         C and D we consider a new category whose objects are
pairs of objects        (C, D), C in C and D in D and morphisms are pairs of
morphisms          (f, g), f : C → C , g : D → D . This builds the category
C × D.




Valeria de Paiva   (NASSLLI2012)                                 June, 2012   41 / 113
Categories, Functors and Natural Transformations




Products of Categories




Given categories         C and D we consider a new category whose objects are
pairs of objects        (C, D), C in C and D in D and morphisms are pairs of
morphisms          (f, g), f : C → C , g : D → D . This builds the category
C × D.
Does the operation of taking products of categories has a unity?




Valeria de Paiva   (NASSLLI2012)                                 June, 2012   41 / 113
Categories, Functors and Natural Transformations




Slice Categories


This construction is a bit more involved. Given a category                   C   and an object
A   of   C,   the slice category over          A, C/A     is a category whose objects are
morphisms of the form         C → A.
A morphism from            C → A to C → A               is a morphism in   C, f : C → C     such
that the following triangle commutes:


                                                        f -
                                           C               C



                                            ?
                                           A



Valeria de Paiva   (NASSLLI2012)                                               June, 2012   42 / 113
Categories, Functors and Natural Transformations




A menagerie of Categories




Valeria de Paiva   (NASSLLI2012)                        June, 2012   43 / 113
Categories, Functors and Natural Transformations




Functors




We have been stressing that more than objects it is the way that objects
relate to each that matters in category theory. The same is true of
categories themselves.
Hence the old Eilenberg-MacLane joke that categories were only invented
so that they could talk about functors. And functors were only invented to
talk about natural transformations. and yes talk about the natural
transformations was what the algebraic geometers wanted to do all along.
So we need maps of categories, the natural way of relating categories.
Which structure should they preserve?



Valeria de Paiva   (NASSLLI2012)                            June, 2012   44 / 113
Categories, Functors and Natural Transformations




Functors




We have been stressing that more than objects it is the way that objects
relate to each that matters in category theory. The same is true of
categories themselves.
Hence the old Eilenberg-MacLane joke that categories were only invented
so that they could talk about functors. And functors were only invented to
talk about natural transformations. and yes talk about the natural
transformations was what the algebraic geometers wanted to do all along.
So we need maps of categories, the natural way of relating categories.
Which structure should they preserve?

Composition and identities, of course.
Valeria de Paiva   (NASSLLI2012)                            June, 2012   44 / 113
Categories, Functors and Natural Transformations




Functors




Given categories         C   and   D,  F : C → D consists
                                        a functor           of an assignment
of objects of C to objects to D such that if f : A → B is   a morphism in    C
then F (f ) : F (A) → F (B) is a morphism in D and
1. F preserves composition, F (f ; g) = F (f ); F (g) and
2. F preserves identities, F (idA ) = idF (A)




Valeria de Paiva   (NASSLLI2012)                             June, 2012   45 / 113
Categories, Functors and Natural Transformations




Functors




Valeria de Paiva   (NASSLLI2012)                        June, 2012   46 / 113
Categories, Functors and Natural Transformations




Examples of Functors

The trivial example is the identity functor on any category               C.
1. A functor between posets is simply an order-preserving function.
(they are called monotonic or monotone functions..)
2. Forgetful functors simply forget the mathematical structure present. For
example, the functor           U : Mon → Sets           simply forgets the monoid structure
and returns the set that is the carrier of the monoid.
Similarly for       U : Group → Sets,             the functor that forgets the group
structure.
3. More interesting are the free functors, that create free structure on bare
sets. For example,          FreeMon : Sets → Mon              creates free monoids.




Valeria de Paiva   (NASSLLI2012)                                            June, 2012   47 / 113
Categories, Functors and Natural Transformations




Examples of Functors

The trivial example is the identity functor on any category               C.
1. A functor between posets is simply an order-preserving function.
(they are called monotonic or monotone functions..)
2. Forgetful functors simply forget the mathematical structure present. For
example, the functor           U : Mon → Sets           simply forgets the monoid structure
and returns the set that is the carrier of the monoid.
Similarly for       U : Group → Sets,             the functor that forgets the group
structure.
3. More interesting are the free functors, that create free structure on bare
sets. For example,          FreeMon : Sets → Mon              creates free monoids.

Can you guess what the free monoid functor                   FreeMon    does to a set
A = {a, b, c}        ?




Valeria de Paiva   (NASSLLI2012)                                            June, 2012   47 / 113
Categories, Functors and Natural Transformations




More Slice Categories
Given a map   f: A→B                 in   C   we have a functor   Σf : C/A → C/B .
For   g : C/A → C/A
                                                         g -
                                            C                C




                                                  
                                              ?
                                              A




Valeria de Paiva   (NASSLLI2012)                                           June, 2012   48 / 113
Categories, Functors and Natural Transformations




More Slice Categories
Given a map   f: A→B                 in   C   we have a functor   Σf : C/A → C/B .
For   g : C/A → C/A
                                                         g -
                                            C                C




                                                  
                                              ?
                                              A
Σf    acts as
                                                         g -
                                            C                C
                                                           -


                                              ?               ?
                                              A            - B

Valeria de Paiva   (NASSLLI2012)                                           June, 2012   48 / 113
Categories, Functors and Natural Transformations




More Examples of Functors
From Hutton's notes, http://www.cs.nott.ac.uk/ gmh/cat.html.
1. The powerset functor,      P : Set → Set, P(A) is the set of all subsets of
A,   for example if   A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.
2. The     List : Set → Set functor. On objects ListA is the set dened by the
grammar
                                   ListA ::= Nil | ConsA(ListA)
On maps, if         f: A→B         is a function then   List(f ) : List(A) → List(B)   is
the function dened by the equations:




Valeria de Paiva   (NASSLLI2012)                                          June, 2012   49 / 113
Categories, Functors and Natural Transformations




More Examples of Functors
From Hutton's notes, http://www.cs.nott.ac.uk/ gmh/cat.html.
1. The powerset functor,      P : Set → Set, P(A) is the set of all subsets of
A,   for example if   A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.
2. The     List : Set → Set functor. On objects ListA is the set dened by the
grammar
                                   ListA ::= Nil | ConsA(ListA)
On maps, if         f: A→B         is a function then   List(f ) : List(A) → List(B)   is
the function dened by the equations:

                                          List f (Nil) = Nil




Valeria de Paiva   (NASSLLI2012)                                          June, 2012   49 / 113
Categories, Functors and Natural Transformations




More Examples of Functors
From Hutton's notes, http://www.cs.nott.ac.uk/ gmh/cat.html.
1. The powerset functor,      P : Set → Set, P(A) is the set of all subsets of
A,   for example if   A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.
2. The     List : Set → Set functor. On objects ListA is the set dened by the
grammar
                                   ListA ::= Nil | ConsA(ListA)
On maps, if         f: A→B         is a function then   List(f ) : List(A) → List(B)   is
the function dened by the equations:

                                          List f (Nil) = Nil

                       List f (Cons x xs) = Cons(f (x))(List f xs))




Valeria de Paiva   (NASSLLI2012)                                          June, 2012   49 / 113
Categories, Functors and Natural Transformations




More Examples of Functors
From Hutton's notes, http://www.cs.nott.ac.uk/ gmh/cat.html.
1. The powerset functor,      P : Set → Set, P(A) is the set of all subsets of
A,   for example if   A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.
2. The     List : Set → Set functor. On objects ListA is the set dened by the
grammar
                                   ListA ::= Nil | ConsA(ListA)
On maps, if         f: A→B         is a function then       List(f ) : List(A) → List(B)      is
the function dened by the equations:

                                          List f (Nil) = Nil

                       List f (Cons x xs) = Cons(f (x))(List f xs))

Preservation of composition and identities proved by induction.
3. Can you do the functor              Tree :   Set     → Set   such that   TreeA   is the set of
binary trees whose leaves are elements of the set                    A?
Valeria de Paiva   (NASSLLI2012)                                                June, 2012    49 / 113
Categories, Functors and Natural Transformations




Recap:


1. Discussed categories. what are they?




Valeria de Paiva   (NASSLLI2012)                        June, 2012   50 / 113
Categories, Functors and Natural Transformations




Recap:


1. Discussed categories. what are they? collection of objects, collection of
maps such that maps compose (associatively) and there are identities for
each object
f ; (g; h) = (f ; g); h
f (idA ) = idf (A)
2. talked about some examples e.g. monoids and monoid morphisms




Valeria de Paiva   (NASSLLI2012)                             June, 2012   50 / 113
Categories, Functors and Natural Transformations




Recap:


1. Discussed categories. what are they? collection of objects, collection of
maps such that maps compose (associatively) and there are identities for
each object
f ; (g; h) = (f ; g); h
f (idA ) = idf (A)
2. talked about some examples e.g. monoids and monoid morphisms
can you remember two examples of monoids?
slice category where objects are already morphisms..
product category C × D.
3. dened functor F : C → D need to map objects to objects           and maps to
maps. need to satisfy F (f ; g) = F (f ); F (g) F (idA ) = idF (A)




Valeria de Paiva   (NASSLLI2012)                                June, 2012   50 / 113
Categories, Functors and Natural Transformations




Recap:


1. Discussed categories. what are they? collection of objects, collection of
maps such that maps compose (associatively) and there are identities for
each object
f ; (g; h) = (f ; g); h
f (idA ) = idf (A)
2. talked about some examples e.g. monoids and monoid morphisms
can you remember two examples of monoids?
slice category where objects are already morphisms..
product category C × D.
3. dened functor F : C → D need to map objects to objects           and maps to
maps. need to satisfy F (f ; g) = F (f ); F (g) F (idA ) = idF (A)   where are
these compositions?




Valeria de Paiva   (NASSLLI2012)                                June, 2012   50 / 113
Categories, Functors and Natural Transformations




Two more examples of Categories: I. Labelled Graphs




Can you describe the category of `labelled graphs' ? what are the objects?




Valeria de Paiva   (NASSLLI2012)                            June, 2012   51 / 113
Categories, Functors and Natural Transformations




Labelled Graphs


Morphisms/arrows/maps from one labelled graph to another?




Valeria de Paiva   (NASSLLI2012)                        June, 2012   52 / 113
Categories, Functors and Natural Transformations




Labelled Graphs


Morphisms/arrows/maps from one labelled graph to another?




Valeria de Paiva   (NASSLLI2012)                        June, 2012   52 / 113
Categories, Functors and Natural Transformations




Maps of Labelled Graphs




Valeria de Paiva   (NASSLLI2012)                        June, 2012   53 / 113
Categories, Functors and Natural Transformations




Second Example: Automata




remember these?




Valeria de Paiva   (NASSLLI2012)                        June, 2012   54 / 113
Categories, Functors and Natural Transformations




Second Example: Automata from Goguen's Manifesto




Valeria de Paiva   (NASSLLI2012)                        June, 2012   55 / 113
Categories, Functors and Natural Transformations




More Examples of Functors


Back to the powerset functor,  P : Set → Set, P(A) is the set of all                   subsets
of A, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.
if B = {a, b, c} then
P(B) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}.
You can also consider only nite subsets of a set            Pf in (A),   which makes
more sense if the set is innite.

The power set functorP         : Set → Set maps each set to its power set and
each function         f : X → Y to the map which sends U ⊆ X to its image
f (U ) ⊆ Y .        One can also consider the contravariant power set functor
which sends          f :X→Y         to the map which sends   V ⊆Y    to its inverse
              −1
image     f        (V ) ⊆ X .



Valeria de Paiva   (NASSLLI2012)                                          June, 2012     56 / 113
Categories, Functors and Natural Transformations




More Examples of Functors

The    List :   Set   → Set    functor. On objects      ListA   is the set dened by the
grammar
                                   ListA ::= Nil | ConsA(ListA)
On maps, if         f: A→B         is a function then   List(f ) : List(A) → List(B)     is
the function dened by the equations:




Valeria de Paiva   (NASSLLI2012)                                            June, 2012   57 / 113
Categories, Functors and Natural Transformations




More Examples of Functors

The    List :   Set   → Set    functor. On objects      ListA   is the set dened by the
grammar
                                   ListA ::= Nil | ConsA(ListA)
On maps, if         f: A→B         is a function then   List(f ) : List(A) → List(B)     is
the function dened by the equations:


                                          List f (Nil) = Nil




Valeria de Paiva   (NASSLLI2012)                                            June, 2012   57 / 113
Categories, Functors and Natural Transformations




More Examples of Functors

The    List :   Set   → Set    functor. On objects      ListA   is the set dened by the
grammar
                                   ListA ::= Nil | ConsA(ListA)
On maps, if         f: A→B         is a function then   List(f ) : List(A) → List(B)     is
the function dened by the equations:


                                          List f (Nil) = Nil


                       List f (Cons x xs) = Cons(f (x))(List f xs))




Valeria de Paiva   (NASSLLI2012)                                            June, 2012   57 / 113
Categories, Functors and Natural Transformations




More Examples of Functors

The    List :   Set   → Set    functor. On objects         ListA   is the set dened by the
grammar
                                   ListA ::= Nil | ConsA(ListA)
On maps, if         f: A→B         is a function then       List(f ) : List(A) → List(B)      is
the function dened by the equations:


                                          List f (Nil) = Nil


                       List f (Cons x xs) = Cons(f (x))(List f xs))


Preservation of composition and identities proved by induction.
3. Can you do the functor              Tree :   Set     → Set   such that   TreeA   is the set of
binary trees whose leaves are elements of the set                    A?

Valeria de Paiva   (NASSLLI2012)                                                June, 2012    57 / 113
Categories, Functors and Natural Transformations




Back to math: Hom Functors

Pick a category C and an object             A in it. Then HomC (A, −) is a functor
from    C   to   Set,   where      HomC (A, −) the collection of all morphisms of C
with source       A.




        F is
A functor               represented by an object        A   if   F   is naturally isomorphic to
HomC (A, −).

Valeria de Paiva   (NASSLLI2012)                                                 June, 2012   58 / 113
Categories, Functors and Natural Transformations




More Hom Functors




Pick a category C and an object                 A   in it. Look at HomC (−, A) is a functor
from    C   to   Set,   where HomC (−, A) is the collection of all morphisms of           C
with codomain           A.




Valeria de Paiva   (NASSLLI2012)                                            June, 2012   59 / 113
Categories, Functors and Natural Transformations




Functors: more notation



A functor of the form              H : C × D → E,          where the domain is a product
category, is called a bi-functor.
Projections from a product category                     π1,2 : A × B → A   are bi-functors.
                                         op
A functor of the form              F: C       → D,      whose domain is the opposite of a
given category, is called a contravariant functor.

Example of non-functor that looks like one: the centre of a group (the
center    Z(G) of a group G, is dened as the subgroup consisting of all
elements    g ∈ G such that for all elements h ∈ H the equality gh = hg
holds).




Valeria de Paiva   (NASSLLI2012)                                               June, 2012     60 / 113
Categories, Functors and Natural Transformations




Functors are ubiquitous?

Graham says:




The wikipedia says: For functors as a synonym of function objects in
computer programming to pass function pointers along with its state, see
function object. For the use of the functor morphism presented here in
functional programming see also the fmap function of Haskell's Functor
class. Functor is also used to name functions in Prolog. For functors in
linguistics, see Function word.


Valeria de Paiva   (NASSLLI2012)                            June, 2012   61 / 113
Categories, Functors and Natural Transformations




Natural Transformations
Given functors F : C → D and G : C → D, a natural transformation
α : F → G consists of morphisms αA : F (A) → G(A) such that, for any A
in C and for any f : A → B in C we have:


                                                        αA-
                                        F (A)                 G(A)

                                    F (f )                      G(f )
                                             ?               ?
                                        F (B)            - G(B)
                                                        αB

do easy case and mention
http://blog.sigfpe.com/2008/05/you-could-have-dened-natural.html
`Starting with the idea of a function that doesn't `peek inside' its
arguments, we're led inexorably to the idea of substitutability of arguments
and from there to a categorical denition of a natural transformation.'
Valeria de Paiva   (NASSLLI2012)                                        June, 2012   62 / 113
Categories, Functors and Natural Transformations




... prettier picture from Edsko de Vries, thanks!




Valeria de Paiva   (NASSLLI2012)                        June, 2012   63 / 113
Categories, Functors and Natural Transformations




Examples of Natural Transformations

Reversing lists. If        A   is a set, then      revA : List → List   is a function dened
by:
                                             revA (Nil) = Nil
                        revA (Cons x xs) = revA (xs) · (Consx Nil)
To show this is natural must show

                                                    revA
                                         ListA         -   ListA

                                     Listf                    Listf
                                             ?                ?
                                         ListB           - ListB
                                                    revB


Valeria de Paiva   (NASSLLI2012)                                               June, 2012   64 / 113
Categories, Functors and Natural Transformations




Constructions in Categories: Products

A category         C                             A and B in C, there
                       has binary products, if given objects
exists an objectA × B and morphisms π1 : A × B → A and
p2 : A × B → B of C such that if P is another object of C equipped with
morphisms p1 : P → A and p2 : P → B , then there's a unique map
u : P → A × B such that the triangles below commute.

                                                        P




                                                                p2
                                        p1


                                                        u



                                                                     -
                                    




                                      π1                    ?   π2 -
                                   A              A×B               B




Valeria de Paiva   (NASSLLI2012)                                         June, 2012   65 / 113
Categories, Functors and Natural Transformations




Constructions in Categories: Pullbacks

A category         C                      f : X → Z and g : Y → Z in C,
                       has pullbacks, if given maps
there exists an object P equipped with morphisms p1 : P → X and
p2 : P → Y of C such that if Q is another object of C equipped with
morphisms q1 : Q → X and q2 : Q → Y , then there's a unique map
u : Q → P such that the `triangles' below commute.




Valeria de Paiva   (NASSLLI2012)                        June, 2012   66 / 113
Categories, Functors and Natural Transformations




Constructions in Categories: Equalizers


A category         C   has equalizers, if given maps        f: A→B     and  g : A → B in
C,   there exists an object          E   equipped with a morphism      e : E → A of C
such that if       E    is another object of        C   equipped with a morphism
e : E → A,          then there's a unique map            e: E → E   such that the triangle
below commutes.




Valeria de Paiva   (NASSLLI2012)                                             June, 2012   67 / 113
Categories, Functors and Natural Transformations




Recap...




Valeria de Paiva   (NASSLLI2012)                        June, 2012   68 / 113
Categories, Functors and Natural Transformations




Recap...

Got up our ladder: categories, functors and natural transformations.
Cats have objects and maps, identity morphism for each object, satisfying
composition and identity law.
Functors transform cats into other cats,F                  : C → D have a component      for
objects a component for maps, st                  F (f ; g) = F (f ); F (g) (covariant
functor) and         F (idC ) = idF C .
constructions relating cats: opposite or dual cat, products, extra examples
like slice cat and Hom-functor. constructions inside a cat: initial/terminal
object, products (coproducts), pullbacks (push-outs), equalizers
(co-equalizers).
Not worrying about size considerations (set-theoretic paradoxes) can build:
1. category of small categories where morphisms are functors between cats.
2. Cat of functors between two given cats                 F un(C, D)   where objects are
functors and morphisms are natural transformations.



Valeria de Paiva   (NASSLLI2012)                                            June, 2012   68 / 113
Categories, Functors and Natural Transformations




Recap...


A nat transformation           α: F → G          between functors           F   and   G   both from C
to D is a collection of morphisms in D                       αC   one for each object       C of the
category C satisfying a nice square, for each morphism in C                               f: C →C :

                                                        αC-
                                        F (C)                     G(C)

                                    F (f )                          G(f )
                                             ?               ?
                                        F (C )           - G(C )
                                                        αC
only example reverse between lists in Set...




Valeria de Paiva   (NASSLLI2012)                                                          June, 2012   69 / 113
Categories, Functors and Natural Transformations




Trivial example: identity natural transformation

α − idC : F → F .
how does it go?




Valeria de Paiva   (NASSLLI2012)                        June, 2012   70 / 113
Categories, Functors and Natural Transformations




Trivial example: identity natural transformation

α − idC : F → F .
how does it go?
A nat transformation           α: F → G          between functors     F   and   G   both from C
to C is a collection of morphisms in C                  αC   one for each object    C of the
category satisfying a nice square, for each morphism in C                       f: C →C :

                                                 α − idC
                                      F (C)            -      F (C)

                                   F (f )                        F (f )
                                            ?                 ?
                                      F (C )             - F (C )
                                                 α − idC


Valeria de Paiva   (NASSLLI2012)                                                    June, 2012   70 / 113
Adjunctions




Adjunctions?



Given functors          F:   C   →D    and   G : D → C, we say that F is left-adjoint to
G   (or that       G   is right-adjoint to    F ) F G if there is a natural bijection

                                 HomD (F C, D)         ∼ HomC (C, GD)
                                                       =

for each pair of objects           C   in C and    D    in D.

Many people prefer to think of them as Galois connections.




Valeria de Paiva   (NASSLLI2012)                                          June, 2012   71 / 113
Adjunctions




Galois connections...

Let   (A, ≤)       and   (B, ≤)    be two partially ordered sets. A Galois connection
between these posets consists of two monotone functions:                            F: A→B         and
G : B → A,          such that for all   a   in   A    andb in   B,   we have


                               F (a) ≤ b    if and only if      a ≤ G(b)
In this situation,F is called the lower adjoint of                   G   and   G   is called the
upper adjoint of         F.
Several names in the literature, wikipedia has a good selection.
Originally from Galois' work on groups.
Check out Peter Smith's carefully written The Galois Connection between
Syntax and Semantics.
Abstract Algebraic Logic. Abstract interpretation. Concept analysis,
some Information Flow...



Valeria de Paiva   (NASSLLI2012)                                                     June, 2012    72 / 113
Adjunctions




Examples of Adjunctions




Free monoids again... Cartesian Closedness (monoidal closedness)




Valeria de Paiva   (NASSLLI2012)                          June, 2012   73 / 113
Adjunctions




Free monoids?


Recall the functor          Free :   Set   → Mon.
On an set          A   it produces the free monoid. i.e sequences of elements from
A,   'multiplied' by concatenation,              (A∗ , [], concat).
On an set B it produces              the free monoid (sequences of elements from   B)
(B ∗ , [], concat).




Valeria de Paiva   (NASSLLI2012)                                      June, 2012   74 / 113
Adjunctions




Free monoids?


Recall the functor          Free :   Set   → Mon.
On an set          A   it produces the free monoid. i.e sequences of elements from
A,   'multiplied' by concatenation,              (A∗ , [], concat).
On an set B it produces              the free monoid (sequences of elements from   B)
(B ∗ , [], concat).
remind me, what's the rest of the functor?




Valeria de Paiva   (NASSLLI2012)                                      June, 2012   74 / 113
Adjunctions




Free monoids?


Recall the functor          Free :    Set   → Mon.
On an set          A   it produces the free monoid. i.e sequences of elements from
A,   'multiplied' by concatenation,               (A∗ , [], concat).
On an set B it produces              the free monoid (sequences of elements from            B)
(B ∗ , [], concat).
remind me, what's the rest of the functor?
On a map           f: A→B          the action of     Free, f ∗   is simply doing the function    f
in each of the elements of             A.
Recall also the `boring' forgetful functor  U : Mon → Set. Given any
monoid   (M, ·, e) it returns simply M . Given a monoid morphism
h : (M, ·, e) → (M , ·, e ), return simply the function h.



Valeria de Paiva   (NASSLLI2012)                                               June, 2012   74 / 113
Adjunctions




Free monoids?

Now let us look at the denition of adjunction: Two functors                F, G   going in
opposite directions st


                               HomD (F C, D)       ∼ HomC (C, GD)
                                                   =
where    ∼
         =    means there is a bijection that is natural in     C   and   D.




Valeria de Paiva   (NASSLLI2012)                                          June, 2012   75 / 113
Adjunctions




Free monoids?

Now let us look at the denition of adjunction: Two functors                    F, G   going in
opposite directions st


                               HomD (F C, D)          ∼ HomC (C, GD)
                                                      =
where    ∼
         =    means there is a bijection that is natural in         C   and   D.
We do have functors going between categories                  Mon   and Set in opposite
directions.
U : Mon → Set            and   Free :   Set   → Mon
Do we have ....


                         HomSet (U M, A)       ∼ HomMon (M, FreeA)
                                               =
More than 20 dierent denitions of adjunction...




Valeria de Paiva   (NASSLLI2012)                                              June, 2012   75 / 113
Adjunctions




Free monoids?
Simmons says:There is a lot going on with adjunctions and you will
probably get confused more than once. Don't worry....


universal property: a morphism     η : A → U (FreeA) such that whenever M
is a monoid, and      g : A → U (M ) a function, then there is a unique monoid
morphism       h : Free(A) → M such that U (h) · η = g .

                                        A           - UM
                                                     -



                                          ?
                                   U (Free(A))
Go and read it at your own pace. for intuition think the free monoid is the
monoid built on the generators, the elements of the original set. you can
always embedd the original set into the set that is the forgotten monoid..
Valeria de Paiva   (NASSLLI2012)                               June, 2012   76 / 113
Adjunctions




An über familiar adjunction...


                           HomSet (A × B, C) ∼ HomSet (A, C B )
                                             =
So   f: A×B →C                                 f : A → CB.
                             is bijectively related to
This is trivial currying of functions, if your f has 2 arguments a and b, you
can transform it into a function f of a single argument a that returns a
function taking b's to c's, right?
Schoennkel (1920s) the rst (?) to notice its importance for combinators .
Now can we do it in a generic category C?
We have products. Need to internalize the notion of maps in C from                       B   to
C.
In Set is easy, the set of functions from X to Y may be denoted                   X→Y        or
    X
Y       .
As a special case, the power set of a set               X    may be identied with the set
of all functions from         X    to   {0, 1},   denoted   2X .

Valeria de Paiva   (NASSLLI2012)                                            June, 2012   77 / 113
Adjunctions




An über familiar adjunction...

Consider the functor          − × B : Set → Set,   where   B   is a xed object of Set.
On object      A     we   have A × B ,
on object      A     we   have A × B .




Valeria de Paiva   (NASSLLI2012)                                        June, 2012   78 / 113
Adjunctions




An über familiar adjunction...

Consider the functor          − × B : Set → Set,       where   B   is a xed object of Set.
On object      A     we   have A × B ,
on object      A     we   have A × B .
what's the morphism component?
On a map           f: A→A          we simply product with the identity on     B.
Now consider the functor              (−)B :
                                      → Set.   Set
                          B
On object D , D   is the set of all maps B → D .
On object D it is the set of all maps B → D .
and on a morphism, f : D → D
it's the usual, composition.
Now, if we formally plug in these two functors into our denition of
adjunction, what happens?




Valeria de Paiva   (NASSLLI2012)                                            June, 2012   78 / 113
Adjunctions




An über familiar adjunction...


Look at:


                               HomD (F C, D)         ∼ HomC (C, GD)
                                                     =
where    F =−×B             and    G = (−)B




Valeria de Paiva   (NASSLLI2012)                                      June, 2012   79 / 113
Adjunctions




An über familiar adjunction...


Look at:


                               HomD (F C, D)       ∼ HomC (C, GD)
                                                   =
where    F =−×B             and G = (−)B
applying to objects          C and D we have:

          HomSet (C       × B, D) ∼ HomSet (C, DB ) ∼ HomSet (C, B → D)
                                  =                 =

which corresponds to our trivial operation on of currying functions...
So I want to conclude that in a generic category C with products, I have an
adjunction between functors          −×B       and    (−)B .



Valeria de Paiva   (NASSLLI2012)                                    June, 2012   79 / 113
Adjunctions




An über familiar adjunction...


ok, I'm cheating. I didn't tell you how to construct the functor           (−)B     in
other categories. We know we can do it in Set, but what about anywhere
else?

I can give a proper denition of       (−)B      if I work hard on limits, the general
notion of which we saw 3 instances: products, pullbacks and equalizers.
then the adjunction is obvious.

or I can give you the adjunction saying you've used it a billion times before
and say, go get your general denition of internalizing functions from the
adjunction. Ie dene function spaces as the functor that makes the
adjunction work, like many books do.
A bit like riding a bike, if you start you can keep your balance...




Valeria de Paiva   (NASSLLI2012)                                       June, 2012    80 / 113
Adjunctions




Cartesian Closed Categories...


A category C is called a cartesian closed category (CCC) if it has products
and if for each object             X   of C, the product functor     −×X:   C   →C       has a
                                             X
right adjoint, written as              (−)       . That is we have


                             HomC (A         × X, B) ∼ HomC (A, B X )
                                                     =

A minor modication, not insisting on real cartesian products, produces
the denition of symmetric monoidal closed category.


                           HomC (A       ⊗ X, B) ∼ HomC (A, [X, B]C )
                                                 =




Valeria de Paiva   (NASSLLI2012)                                            June, 2012      81 / 113
Adjunctions




Have you seen this adjunction before?...




If you squint a little and make        ×   the same as   ∧   and   →   logical implication
and think of maps in the category as proofs, you can read


                          HomC (A   × X, B) ∼ HomC (A, X → B)
                                            =
as any proof of         A∧X →B       corresponds bijectively to a proof of
A → X → B,             which is a form of the Deduction Theorem in logic.




Valeria de Paiva   (NASSLLI2012)                                           June, 2012   82 / 113
Deductive Systems as Categories


Lambek introduced the idea of using Gentzen methods in category theory
and linguistics in the Sixties.
A deductive system is simply a labelled graph whose objects are formulas
and whose edges are labelled sequents. There are special identity arrows
and some special rules for creating new sequents outof the old ones. Given
a graph     G




Valeria de Paiva   (NASSLLI2012)                            June, 2012   83 / 113
Deductive Systems as Categories




What are the Deductive Systems trying to do?...




Valeria de Paiva   (NASSLLI2012)                         June, 2012   83 / 113
Deductive Systems as Categories




How do sequents relate to categories?...


Basic idea: a formula corresponds to an object in a suitable category
We assign to each sequent               Γ     A   a map in the suitable category C from
the interpretation of          Γ   to the interpretation of     A.   (But we don't bother to
show the dierence between                A   formula and   A   object in the category...)
Clearly the interpretation must be compositional: we get the interpretation
of   Γ = A1 , . . . , A n    from the interpretations of the components           Ai .
What is the less contraining construction we can do in a category that will
interpret the context          Γ?
People will worry about commutativity, associativity of commas.
If I am talking about intuitionistic logic, where conjunction is commutative
and associative, cartesian product would be ne, but a commutative tensor
product     ⊗      is ne too.




Valeria de Paiva   (NASSLLI2012)                                              June, 2012   84 / 113
Deductive Systems as Categories




How do sequents relate to categories?...

Tensor products? Well, I mentioned categorical products and their universal
property. It turns out that universality is not really required to model
contexts.
So we can do simply with a product-like functor          ⊗:   C   × C → C,   which is
associative, commutative and has an identity, usually written as             I.
Categorical products are unique up to iso, so if you have products, that's it.
(up to iso).
But tensor products are not unique, you can have several, this corresponds
to several kinds of conjunction in your logic.
A category with an associated tensor product and unit is called a monoidal
category. A category with an associated categorical product and terminal
object is called a cartesian category.
Monoidal categories are very fashionable, as they seem more exible for
modelling phenomena. (glossing over issues with coherence).



Valeria de Paiva   (NASSLLI2012)                                      June, 2012   85 / 113
Deductive Systems as Categories




How do sequents relate to categories? ...



Adding terms/morphisms to a suitable version of sequent calculus rules we
get a full interpretation of the suimply typed lambda-calculus in categories.
This allows us to think of proofs as                 λ-terms   or of morphisms in the
category build up from identities and the constructors we allowed.
Are we there yet?




Valeria de Paiva   (NASSLLI2012)                                              June, 2012   86 / 113
Deductive Systems as Categories




How do sequents relate to categories? ...



Adding terms/morphisms to a suitable version of sequent calculus rules we
get a full interpretation of the suimply typed lambda-calculus in categories.
This allows us to think of proofs as                 λ-terms   or of morphisms in the
category build up from identities and the constructors we allowed.
Are we there yet?
No, must prove it works.
Must prove we have triangle...




Valeria de Paiva   (NASSLLI2012)                                              June, 2012   86 / 113
Deductive Systems as Categories




Valeria de Paiva   (NASSLLI2012)                         June, 2012   87 / 113
Deductive Systems as Categories




Old picture




Valeria de Paiva   (NASSLLI2012)                         June, 2012   88 / 113
Deductive Systems as Categories




Problems?..




We can add terms to Natural Deduction (Curry-Howard correspondence).

But need sequent formulation provably equivalent to Natural Deduction.

(there is a problem with associating categorical constructions to sequent
calculus rules without ND, the proof equalities don't work without extra
constraints, Herbelin.)
We will discuss this tomorrow.




Valeria de Paiva   (NASSLLI2012)                            June, 2012   89 / 113
Deductive Systems as Categories




Recap..



So I goofed, should've dened:
An object C in a category D is an internal hom object or an exponential
object [A → B] or B A if it comes equipped with an arrow
ev : [A → B] × A → B , called the evaluation arrow, such that for any
other arrow f : C × A → B , there is a unique arrow λf : C → [A → B]
such that the composite
C × A →λf ×1A [A → B] × A →ev B
is f .
but yes, the bike metaphor is still valid...




Valeria de Paiva   (NASSLLI2012)                          June, 2012   90 / 113
Deductive Systems as Categories




Traditional Curry-Howard reloaded..




Valeria de Paiva   (NASSLLI2012)                         June, 2012   91 / 113
Deductive Systems as Categories




Traditional Curry-Howard reloaded..




But 88 pages in Gallier to prove ND equivalent to sequent calculus...
Once you have it:

Valeria de Paiva   (NASSLLI2012)                            June, 2012   92 / 113
Deductive Systems as Categories




Traditional Curry-Howard reloaded..




Valeria de Paiva   (NASSLLI2012)                         June, 2012   93 / 113
Deductive Systems as Categories




Categorical Curry-Howard reloaded..




Valeria de Paiva   (NASSLLI2012)                         June, 2012   94 / 113
Deductive Systems as Categories




Categorical Curry-Howard reloaded..




Valeria de Paiva   (NASSLLI2012)                         June, 2012   95 / 113
Deductive Systems as Categories




Traditional Curry-Howard reloaded..




Valeria de Paiva   (NASSLLI2012)                         June, 2012   96 / 113
Deductive Systems as Categories




Traditional Curry-Howard reloaded..


What can we prove?
Few more (traditional denitions)
A signature is a collection of basic types (Nat, Bool, Char, ...) and typed
functional symbols (add, succ,..., etc).
Consider a basic signature that contains at least basic types                     1, 0   and basic
operators      ×    for conjunctions,       +    for disjunctions and   →     for logical
implication.
Take a cartesian closed category C with products, coproducts and function
spaces.
An interpretation            I   for signature   Σ   in C ( a   Σ-structure   in C) is specied
by giving an object of C for each type in                 Σ     and a map in C for each
function symbol          f   in   Σ.



Valeria de Paiva   (NASSLLI2012)                                                  June, 2012   97 / 113
Deductive Systems as Categories




Traditional Curry-Howard reloaded..



Considering terms in context, for any interpretation of          Σ   in C there exists a
standard inductive denition of the interpretation of terms in context,
induced by the interpretation of                Σ.
Consider equations in context. Say an equation in            EqΣ   holds for an
interpretation        I   if the interpretations of the terms in context are equal
morphims in the category.
Say an interpretation is a model of a set of equations if it satises all the
equations in the set.
Finally can state:




Valeria de Paiva   (NASSLLI2012)                                        June, 2012   98 / 113
Deductive Systems as Categories




Categorical Curry-Howard reloaded..


Soundness Theorem[Categorical Modelling of IPL]
Let C be a cartesian closed category with coproducts and let              I be a model
of   EqΣ    in C. Then       I   satises any equation derivable from   Eqσ using
equational logic.




Valeria de Paiva   (NASSLLI2012)                                         June, 2012   99 / 113
Deductive Systems as Categories




Categorical Curry-Howard reloaded..


Soundness Theorem[Categorical Modelling of IPL]
Let C be a cartesian closed category with coproducts and let               I be a model
of   EqΣ    in C. Then        I   satises any equation derivable from   EqΣ using
equational logic.

Completeness Theorem[Categorical Modelling of IPL]
For all signatures        Σ   there exists a cartesian closed category with coproducts
C and an interpretation of the calculus in this category such that:
If   Γ   t:A       and   Γ    s : A are derivable, then t and s are interpreted as the
same morphism only if            t = s is provable from the equations above using
typed equational logic.




Valeria de Paiva   (NASSLLI2012)                                         June, 2012   100 / 113
Deductive Systems as Categories




Wadler's Take




Valeria de Paiva   (NASSLLI2012)                         June, 2012   101 / 113
A taste of Glue Semantics?...




Glue semantics in 5 min
Thanks for slides, Dick!




Glue semantics is a theory of the syntax-semantics interface that uses
linear logic for meaning composition.
Distinguish two separate logics in semantic interpretation
     1. Meaning logic: target logical representation
     2. Glue logic: logical specication of how chunks of meaning are assembled

In principle, Glue uses any of several grammar formalisms/any of the
mainstream semantics. In practice Glue started for LFG, with a vanilla
Montague-style logic for meanings.




Valeria de Paiva   (NASSLLI2012)                               June, 2012   102 / 113
A taste of Glue Semantics?...




Linguistic applications of linear logic


    1. Categorial and type-logical grammar (Moortgat, vanBenthem):
including parsing categorial grammars (Morrill, Hepple) and
compositional semantics of categorial grammars (Morrill, Carpenter)
    2. `Glue semantics' (a version of categorial semantics without an
associated categorial grammar?) (Dalrymple, Lamping  Gupta))
    3. Resource-based reformulations of other grammatical theories
Minimalism (Retore,Stabler)
Lexical Functional Grammar (Saraswat,Muskens)
Tree Adjoining Grammar (Abrusci)
    4. Also AI issues such as the frame problem (White) or planning
(Dixon) with linguistic relevance




Valeria de Paiva   (NASSLLI2012)                            June, 2012   103 / 113
A taste of Glue Semantics?...




Curry-Howard Isomorphism (CHI)



CHI = Pairing of proof rules with operations on proof terms
    But doesn't work for all logics, or proof systems

Denes interesting identity criteria for proofs
    Syntactically distinct derivations corresponding to same proof

Intimate relation between logic and type-theory.
Varied applications, e.g.
     Proofs as programs

     Semantic construction for natural language




Valeria de Paiva   (NASSLLI2012)                                 June, 2012   104 / 113
A taste of Glue Semantics?...




Example: Input to Semantic Interpretation



Lexicon

 Word Meaning                          Glue
 John        john                      ↑          where   ↑= g
 Fred        fred                      ↑          where   ↑= h
 saw         λy.λx. see(x, y)          ↑ .OBJ −◦ (↑ .SU BJ −◦ ↑)
                                            where ↑= f , f.OBJ = h, f.SU BJ = g
Constituents       g, h, f :   semantic resources, consuming  producing meanings




Valeria de Paiva   (NASSLLI2012)                                       June, 2012   105 / 113
A taste of Glue Semantics?...




Lexical Premises: Their nature

                                                     saw
                         aλy.λx. see(x, y)                :    bh   −◦ (g −◦ f )

                          cMeaning Term                        dGlue Formula
                                                              (Propositional LL)


Atomic propositions (f, g, h):
•   Correspond to syntactic constituents found in parsing
•   Denote resources used in semantic interpretation
    (Match production  consumption of constituent meanings)
Meaning terms:
•   Expressions in some chosen meaning language
•   Language must support abstraction and application
•   . . . but otherwise relatively free choice


Valeria de Paiva   (NASSLLI2012)                                                   June, 2012   106 / 113
A taste of Glue Semantics?...




Cutting and Pasting 1...




Valeria de Paiva   (NASSLLI2012)                          June, 2012   107 / 113
A taste of Glue Semantics?...




The Form of Glue Derivations



                                                Γ         M:f
where
• Γ is set of lexical premises (instantiated by parse)
• f is (LL atom corresponding to) sentential constituent
• M is meaning term produced by derivation
(Semantic) Ambiguity

Often (many) alternative derivations                      Γ   Mi : f
each producing a dierent meaning term                        Mi for f
Need to nd all alternative derivations (eciently!)




Valeria de Paiva   (NASSLLI2012)                                         June, 2012   108 / 113
A taste of Glue Semantics?...




Alternative Derivations: Modier Scope



Consider phrase  alleged criminal from London
 λx. criminal(x)                           :    f
 λP. alleged(P )                           :    f −◦ f
 λP λx. from(l, x) ∧ P (x)                 :    f −◦ f
Two derivations, resulting in:

1.   λx. from(l, x) ∧ alleged(criminal)(x) : f
2.   alleged(λx. from(l, x) ∧ criminal(x)) : f




Valeria de Paiva   (NASSLLI2012)                          June, 2012   109 / 113
A taste of Glue Semantics?...




Independence of Glue and Meaning


                     Original Glue (93)                     Curry-Howard Glue (97)
                   mixes meanings  glue                    separates meanings  glue
                      gjohn                                         john : g
                      hf red                                        f red : h
       ∀y. hy −◦ ∀x. (gx −◦ f see(x, y))                  λyλx. see(x, y) : h −◦ (g −◦ f )

Some meaning separation rules:
   • [[∀M. (rM −◦ ϕ)]]m = λM. [[ϕ]]m
   • [[rM]]m = M
Some expressions can't be separated: gjohn −◦ f sleep(john)
     Avoid these: derivations dependent on meanings,

         and higher order unication needed to match meanings

Curry-Howard: good for understanding derivations
Original: good for understanding premises



Valeria de Paiva   (NASSLLI2012)                                              June, 2012   110 / 113
A taste of Glue Semantics?...




Skeletons and modiers?




Valeria de Paiva   (NASSLLI2012)                          June, 2012   111 / 113
A taste of Glue Semantics?...




Glue Sales Pitch


       Linguistically powerful  exible approach
       Interesting analyses of scope, control (Asudeh), event-based semantics
       (Fry), intensional verbs (Dalrymple), context dependence,
       coordination.
       But many other phenomena still to do

       Grammar  semantics engineering
       Applicable to grammars besides LFG based ones
       Steep learning curve for writing lexical entries
       But turns out to allow plentiful re-use of lingware

       Can be implemented eciently




Valeria de Paiva   (NASSLLI2012)                               June, 2012   112 / 113
A taste of Glue Semantics?...




Conclusions

We missed Ulrik but managed to muddle through some basic denitions of
category theory.
Covered categories, functors, natural transformations and some examples.
Also discussed adjunctions and two of their easier examples: free monoids
and cartesian closedness.
We discussed an extended version of CurryHoward to relates logics, not
only to type theory, but also to categories and structures inside those
categories. Here's a graphic reminder of the main point.




As an novel and kind of unique application we mentione Glue Semantics
very briey.



Valeria de Paiva   (NASSLLI2012)                             June, 2012   113 / 113

Category Theory for All (NASSLLI 2012)

  • 1.
    Category Theory forAll: a logician's perspective Valeria de Paiva NASSLLI2012 June, 2012 Valeria de Paiva (NASSLLI2012) June, 2012 1 / 113
  • 2.
    Outline Outline 1 Interested in Category Theory? 2 Categories, Functors and Natural Transformations 3 Adjunctions 4 Deductive Systems as Categories 5 A taste of Glue Semantics?... Valeria de Paiva (NASSLLI2012) June, 2012 2 / 113
  • 3.
    Interested in CategoryTheory? Introduction Category theory is a relatively new branch of mathematics that keeps appearing in texts of computational semantics, on the syntax-semantics interface and even on material on pure syntax. It also is very proeminent on the literature on Functional Programming, in the theory of specications and even on some discussions on databases. Thirdly it has become familiar in texts for physicists, especially the ones interested in Quantum stu. Category theory is simple, but requires an investment of time to get over the initial barrier of language, hence it seems an ideal subject to be taught at NASSLLI. There are two ways to do great mathematics. The rst way is to be smarter than everybody else. The second way is to be stupider than everybody else but persistent. Raoul Bott Valeria de Paiva (NASSLLI2012) June, 2012 3 / 113
  • 4.
    Interested in CategoryTheory? A little bit of personal history... Some twenty years ago I nished my PhD thesis The Dialectica Categories in Cambridge. My supervisor was Dr Martin Hyland. Valeria de Paiva (NASSLLI2012) June, 2012 4 / 113
  • 5.
    Interested in CategoryTheory? Dialectica categories come from Gödel's Dialectica Interpretation The interpretation is named after the Swiss journal Dialectica where it appeared in a special volume dedicated to Paul Bernays 70th birthday in 1958. I was originally trying to provide an internal categorical model of the Dialectica Interpretation. The categories I came up with proved (also) to be a model of Linear Logic... Valeria de Paiva (NASSLLI2012) June, 2012 5 / 113
  • 6.
    Interested in CategoryTheory? Dialectica categories are models of Linear Logic Linear Logic (LL) introduced by Girard (1987): [...]linear logic comes from a proof-theoretic analysis of usual logic. LL the best of both worlds, the dualities of classical logic plus the constructive content of proofs of intuitionistic logic. Dialectica categories are a cool model of LL, still one of the best around... Valeria de Paiva (NASSLLI2012) June, 2012 6 / 113
  • 7.
    Interested in CategoryTheory? From Linear Logic to Semantics of Natural Language Many linguists became interested in Linear Logic because it's a resource-conscious logic. I became interested in Linguistics because of Linear Logic and its programme of proofs as rst class objects. Valeria de Paiva (NASSLLI2012) June, 2012 7 / 113
  • 8.
    Interested in CategoryTheory? From Linear Logic to Linear Functional Programming I also became interested in Functional Programing because of Linear Logic and its programme of proofs as rst class objects. Valeria de Paiva (NASSLLI2012) June, 2012 8 / 113
  • 9.
    Interested in CategoryTheory? Proofs as rst class objects? Programme to elevate the status of proofs to rst class logical objects. Instead of asking `when is a formula A true', we ask `what is a proof of A?' Using Frege's distinction between sense and denotation: proofs are the senses of logical formulas, whose denotations might be truth values. Sometimes I call this programme Proof Semantics. sometimes I call it Categorical Proof Theory (because the semantics of proofs are given in terms of natural constructions in Category Theory). Valeria de Paiva (NASSLLI2012) June, 2012 9 / 113
  • 10.
    Interested in CategoryTheory? The Challenges of Proof Semantics... There is a problem with viewing proofs as logical objects: We do not have direct access to proofs. Only to syntactic representations of them, in the form of derivations in some proof system (e.g. axiomatic, natural deduction or sequent calculus). Syntactic derivations are awed means of accessing the underlying proof objects. The syntax can introduce spurious dierences between derivations that do not correspond to dierences in the underlying proofs; it can also mask dierences that really are there. Semantics of proofs is what categorical logic is about. Our category theory will be directed towards proof semantics. Valeria de Paiva (NASSLLI2012) June, 2012 10 / 113
  • 11.
    Interested in CategoryTheory? Things I hope you know... We will assume some familiarity with rst-order predicate calculus, a rudimentary knowledge of the lambda-calculus and type theory, and a basic idea of what logical inference is about. If you have an intuitive understanding what the following means I think you'll be ne. ∀x. man(x) → mortal(x), man(john) mortal(john) λx.see(x, john) (f red) ≡β see(f red, john) If you have done a basic course in abstract algebra, linear algebra or groups, then you should be in really good shape. Valeria de Paiva (NASSLLI2012) June, 2012 11 / 113
  • 12.
    Interested in CategoryTheory? What is Categorical Logic? Traditionally mathematical logic divided into four areas: proof theory model theory, recursion theory and set theory. A trend towards adding `Complexity' to the four basic areas. Categorical logic means dierent things to dierent people. In this course we will mean categorical `proof theory'. Valeria de Paiva (NASSLLI2012) June, 2012 12 / 113
  • 13.
    Interested in CategoryTheory? What is Categorical Proof Theory? Proof theory using categorical models instead of Sets-based models... Logic could be rst-order, but it will be propositional only. Classical logic poses some problems, discussed later on. We deal with propositional intuitionistic logic IPL. For this course this means that we need to consider three independent connectives: conjunction (A ∧ B ), disjunction (A ∨ B) and implication (A → B ). These are not interdenable, so some of the usual classical rules (e.g. A → B ∼ ¬A ∨ B ) = are not valid. Valeria de Paiva (NASSLLI2012) June, 2012 13 / 113
  • 14.
    Interested in CategoryTheory? The quest for proofs... Traditional proof theory, to the extent that it relies on models uses algebraic structures such as Boolean algebras, Heyting algebras or Kripke models of several styles. These models lose one important dimension. In these models dierent proofs are not represented at all. Provability, the fact that Γ a collection of premisses A1 , . . . , A k entails A, is represented by the less or equal ≤ relation in the model. This does not give us a way of representing the proofs themselves. We only know if a proof exists Γ≤A or not. All proofs are collapsed into the existence of this relation. Valeria de Paiva (NASSLLI2012) June, 2012 14 / 113
  • 15.
    Interested in CategoryTheory? The quest for proofs... By contrast in categorical proof theory we think and write a proof as Γ →f A where f is the reason why we can deduce A from Γ, a name for the proof we are thinking of. Thus we can observe and name and compare dierent derivations. Which means that we can see subtle dierences in the logics. Valeria de Paiva (NASSLLI2012) June, 2012 15 / 113
  • 16.
    Interested in CategoryTheory? Constructive perspective: not much of one... This course is not about the deep philosophical questions of the foundations of mathematics. We will side-step every philosophical issue that we can. (It is not that these issues are not interesting. They are. It is just that I don't think I can enlighten anyone much on them.) Caveat emptor Whether you believe or not that there is a single logic that is the correct one, applications (especially in CS) have provided us with empirical evidence that there are several logical systems that are convenient for use in specic contexts. When studying these contexts and applications it pays to keep a constructive viewpoint. If classical logic turns out to be necessary, we will pragmatically use it and ag its use. Commmitment to intuitionistic principles is a matter of pragmatic choice: It is easier to be intuitionistic and then if need arises to become classic than the other way round. Moreover it's safer: intuitionistic principles are accepted by all... Valeria de Paiva (NASSLLI2012) June, 2012 16 / 113
  • 17.
    Interested in CategoryTheory? The real point of this course... Valeria de Paiva (NASSLLI2012) June, 2012 17 / 113
  • 18.
    Interested in CategoryTheory? Edwardian proofs for futuristic programs... Valeria de Paiva (NASSLLI2012) June, 2012 18 / 113
  • 19.
    Interested in CategoryTheory? Introductions to category theory?... There are many. check out logic-forall for links. S. Mac Lane, Categories for the Working Mathematician (1971, 1998) J.-Y. Girard, Y. Lafont, P. Taylor, Proofs and Types (1989) M. Barr, C. Wells, Category Theory for Computer Science (1995) B.C. Pierce, Basic Category Theory for Computer Science (1991) R. Blute P. Scott, Category Theory for Linear Logicians (2003) F.W. Lawvere, S.H. Schanuel, Conceptual Mathematics (1997) Abramsky,Tzevelekos, Introduction to Cats and Categorical Logic (2010) S. Awodey, Category Theory, (2010). H. Simmons, An Introduction to Category Theory, (2011) V. de Paiva, Categorical Proof Theory and Linear Logic (1996) Blog http://logic-forall.blogspot.com/ Valeria de Paiva (NASSLLI2012) June, 2012 19 / 113
  • 20.
    Interested in CategoryTheory? More Introductions... M. Johansson, Category Theory and Functional Programming, Stanford FALL 2009, and St. Andrews 2012 also Chalmers discussion group: G. Hutton, Introduction to Category Theory , Midlands Grad School, 2012 D. Verity, An Introduction to Category Theory - FP-Syd talk, E. Cheng, The Catstars YouTube channel, J. van Oosten, Basic Category Theory, 2002, L. Maertens, Category Theory for Program Construction. ESSLLI (1995) Benton, Bierman, Hyland and de Paiva, Term Assignment for Intuitionistic Linear Logic, 1992. Valeria de Paiva (NASSLLI2012) June, 2012 20 / 113
  • 21.
    Interested in CategoryTheory? Elements of category theory... Meant to imply that we will discuss and do exercises on some basic concepts. necessary for categorical proof theory, in the restricted sense above. No promisses of completeness of building blocks... Basic concepts we intend to cover: categories, functors, natural transformations products, pullbacks, equalizers, initial and terminal objects adjunctions and monoidal closure Yoneda Lemma (monads, algebras, coalgebras and comonads?) Valeria de Paiva (NASSLLI2012) June, 2012 21 / 113
  • 22.
    Categories, Functors andNatural Transformations Denition of a Category A category C consists of a collection of objects (A, B, . . .) and a collection of morphisms (or maps) from A to B (written asf : A → B ) satisfying three easy conditions: 1. Given maps f : A → B and g : B → C such that the codomain of f is equal to the domain of g , there is an operation of composition of morphisms, which produces a map f ; g : A → C . 2. The composition operation is associative, ie. f ; (g; h) = (f ; g); h. 3. For each object A in the category we have an associated identity morphism idA : A → A such that if f : A → B is any map in the category, then idA ; f = f = f ; idB . Note on `writing' composition: mathematicians usually write g◦f for what I mostly write as f ; g. Use whatever you like, and have a scratchpad nearby to check it out... Valeria de Paiva (NASSLLI2012) June, 2012 22 / 113
  • 23.
    Categories, Functors andNatural Transformations The Denition of Category Valeria de Paiva (NASSLLI2012) June, 2012 23 / 113
  • 24.
    Categories, Functors andNatural Transformations The Denition of Category Valeria de Paiva (NASSLLI2012) June, 2012 24 / 113
  • 25.
    Categories, Functors andNatural Transformations Examples of Categories Valeria de Paiva (NASSLLI2012) June, 2012 25 / 113
  • 26.
    Categories, Functors andNatural Transformations Examples of Categories Valeria de Paiva (NASSLLI2012) June, 2012 26 / 113
  • 27.
    Categories, Functors andNatural Transformations Examples of kinds of Categories Valeria de Paiva (NASSLLI2012) June, 2012 27 / 113
  • 28.
    Categories, Functors andNatural Transformations Examples of Categories Valeria de Paiva (NASSLLI2012) June, 2012 28 / 113
  • 29.
    Categories, Functors andNatural Transformations Examples of Categories The category of Sets and usual functions is the paradigmatic example. Maybe it's too intuitive. A good example to show the dierence between morphisms and functions is the category Rel of sets and relations. Easy mathematical examples: Groups and homomorphisms, vector spaces and linear transformations, monoids and monoid homomorphisms. More complicated example: topological spaces and continuous maps. Valeria de Paiva (NASSLLI2012) June, 2012 29 / 113
  • 30.
    Categories, Functors andNatural Transformations Examples of Categories: Monoids A monoid M is a set with a `multiplication-like' operation and one identity, say the element e. So M = (M, ·, e) where ·: M × M → M is such that m1 · (m2 · m3 ) = (m1 · m2 ) · m3 and m· e = m = e · m Easy mathematical examples: (N, +, 0) integers under addition, (R, ×, 1) reals under multiplication matrices under multiplication of matrices (Matn , ·, In ) strings over alphabet {0, 1}, under concatenation, (String, ·, λ). Valeria de Paiva (NASSLLI2012) June, 2012 30 / 113
  • 31.
    Categories, Functors andNatural Transformations Two extreme examples The empty category (writen as 0), which has no objects nor morphisms. (Just a parallel concept to the empty set.) The singleton category (written as 1), which has a single object and a single morphism, which is the identity on the single object. Valeria de Paiva (NASSLLI2012) June, 2012 31 / 113
  • 32.
    Categories, Functors andNatural Transformations Why Categories? Category theory (CT) is a convenient new language It puts existing mathematical results into perspective It gives an appreciation of the unity of modern mathematics As a language, it oers economy of thought and expression Reveals common ideas in (apparently) unrelated areas of mathematics A single result proved in CT generates many results in dierent areas Duality: for every categorical construct, there is a dual, reverse all the maps Dicult problems in some areas of mathematics can be translated into (easier) problems in other areas (e.g. by using functors, which map from one category to another) Makes precise some notions that were previously vague, e.g. universality, naturality, etc Valeria de Paiva (NASSLLI2012) June, 2012 32 / 113
  • 33.
    Categories, Functors andNatural Transformations Why Categories? Category theory is ideal for: Reasoning about structure and the mappings that preserve structure Abstracting away from details Automation (constructive methods for many useful categorical structures) Applications of Category theory in software engineering: The category of algebraic specications: category theory used to represent composition and renement The category of temporal logic specications: category theory used to build modular specications and decompose system properties across them Automata theory: category theory oers a new way of comparing automata Logic as a category: represent a logical system as a category, and construct proofs using universal constructs in category theory (diagram chasing). A category of logics: theorem provers in dierent logic systems can be hooked together through institution morphisms Functional Programming: type theory, programming language semantics... Valeria de Paiva (NASSLLI2012) June, 2012 33 / 113
  • 34.
    Categories, Functors andNatural Transformations Beware of paradoxes... To avoid set theoretical paradoxes care must be taken. Oversimplifying: small collections are sets, big collections are classes and try not to pay much attention to the dierences between them. Say C is a small category if both the collection objects of C (written as obj(C) or |C|) and the collection of maps between two objects HomC (A, B) (for all A, B objects of C) are sets. Say C is a locally small category if HomC (A, B) is a set for any two objects A and B in the category. We assume all the categories we discuss are at least locally small and that the sets of morphisms HomC (A, B) are disjoint for distinct pairs of objects A and B. We also draw diagrams and say they commute to state equations between morphisms. Valeria de Paiva (NASSLLI2012) June, 2012 34 / 113
  • 35.
    Categories, Functors andNatural Transformations beginframe Valeria de Paiva (NASSLLI2012) June, 2012 35 / 113
  • 36.
    Categories, Functors andNatural Transformations Initial and Terminal Objects Valeria de Paiva (NASSLLI2012) June, 2012 35 / 113
  • 37.
    Categories, Functors andNatural Transformations Recap 1. Discussed the idea of categorical semantics: Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
  • 38.
    Categories, Functors andNatural Transformations Recap 1. Discussed the idea of categorical semantics: want our to be able to distinguish dierent derivations of the same formula from same assumptions; Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
  • 39.
    Categories, Functors andNatural Transformations Recap 1. Discussed the idea of categorical semantics: want our to be able to distinguish dierent derivations of the same formula from same assumptions; 2. want to use categorical morphisms as denotations of our proofs; Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
  • 40.
    Categories, Functors andNatural Transformations Recap 1. Discussed the idea of categorical semantics: want our to be able to distinguish dierent derivations of the same formula from same assumptions; 2. want to use categorical morphisms as denotations of our proofs; 3. want Curry-Howard triangles for other logics/other type theories/other categories; Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
  • 41.
    Categories, Functors andNatural Transformations Recap 1. Discussed the idea of categorical semantics: want our to be able to distinguish dierent derivations of the same formula from same assumptions; 2. want to use categorical morphisms as denotations of our proofs; 3. want Curry-Howard triangles for other logics/other type theories/other categories; for now want to understand how original categorical Curry-Howard works Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
  • 42.
    Categories, Functors andNatural Transformations Recap 1. Discussed the idea of categorical semantics: want our to be able to distinguish dierent derivations of the same formula from same assumptions; 2. want to use categorical morphisms as denotations of our proofs; 3. want Curry-Howard triangles for other logics/other type theories/other categories; for now want to understand how original categorical Curry-Howard works 4. Saw the denition of a category and some examples Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
  • 43.
    Categories, Functors andNatural Transformations Repeating: a Category A category C consists of a collection of objects (A, B, . . .) and a collection of morphisms (or maps/arrows) from A to B (written as f : A → B) satisfying three easy conditions: 1. Given maps f : A → B and g : B → C such that the codomain of f is equal to the domain of g , there is an operation of composition of morphisms, which produces a map f ; g : A → C . 2. The composition operation is associative, ie. f ; (g; h) = (f ; g); h. 3. For each object A in the category we have an associated identity morphism idA : A → A such that if f : A → B is any map in the category, then idA ; f = f = f ; idB . Note on `writing' composition: mathematicians usually write g◦f for what I mostly write as f ; g. Use whatever you like, and have a scratchpad nearby to check it out... Valeria de Paiva (NASSLLI2012) June, 2012 37 / 113
  • 44.
    Categories, Functors andNatural Transformations Repeating: Examples 0. Category Set, plus few nite ones, plus `sets-with-structure' (universal algebra)... 1.any partially-ordered set (P, ≤) can be seen as a category, a morphism exists between p, q in P just when p ≤ q, ie. either a single or no morphism between objects. Valeria de Paiva (NASSLLI2012) June, 2012 38 / 113
  • 45.
    Categories, Functors andNatural Transformations Repeating: Examples 0. Category Set, plus few nite ones, plus `sets-with-structure' (universal algebra)... 1.any partially-ordered set (P, ≤) can be seen as a category, a morphism exists between p, q in P just when p ≤ q, ie. either a single or no morphism between objects. how do we show this satises conditions for category? 2. category of monoids (M, ·, e) and monoid homormorphisms, ie maps f :M →M such that f (m · n) = f (m) · f (n) and f (e) = e . Valeria de Paiva (NASSLLI2012) June, 2012 38 / 113
  • 46.
    Categories, Functors andNatural Transformations Two extreme examples of categories The empty category (writen as 0), which has no objects nor morphisms. (Just a parallel concept to the empty set.) The singleton category (written as 1), which has a single object and a single morphism, Valeria de Paiva (NASSLLI2012) June, 2012 39 / 113
  • 47.
    Categories, Functors andNatural Transformations Two extreme examples of categories The empty category (writen as 0), which has no objects nor morphisms. (Just a parallel concept to the empty set.) The singleton category (written as 1), which has a single object and a single morphism, which is the identity on the single object. Valeria de Paiva (NASSLLI2012) June, 2012 39 / 113
  • 48.
    Categories, Functors andNatural Transformations The opposite category Cop Given any category C we can formally invert all its morphisms, to construct the category Cop . Why would you do this? Actually will be extremely useful to deal with e.g. logical implication. But for the time being, it's a simple way of seeing that morphisms do not have to be function-based. Fork on the road: structures inside categories vs. structures relating cats Valeria de Paiva (NASSLLI2012) June, 2012 40 / 113
  • 49.
    Categories, Functors andNatural Transformations Products of Categories Given categories C and D we consider a new category whose objects are pairs of objects (C, D), C in C and D in D and morphisms are pairs of morphisms (f, g), f : C → C , g : D → D . This builds the category C × D. Valeria de Paiva (NASSLLI2012) June, 2012 41 / 113
  • 50.
    Categories, Functors andNatural Transformations Products of Categories Given categories C and D we consider a new category whose objects are pairs of objects (C, D), C in C and D in D and morphisms are pairs of morphisms (f, g), f : C → C , g : D → D . This builds the category C × D. Does the operation of taking products of categories has a unity? Valeria de Paiva (NASSLLI2012) June, 2012 41 / 113
  • 51.
    Categories, Functors andNatural Transformations Slice Categories This construction is a bit more involved. Given a category C and an object A of C, the slice category over A, C/A is a category whose objects are morphisms of the form C → A. A morphism from C → A to C → A is a morphism in C, f : C → C such that the following triangle commutes: f - C C ? A Valeria de Paiva (NASSLLI2012) June, 2012 42 / 113
  • 52.
    Categories, Functors andNatural Transformations A menagerie of Categories Valeria de Paiva (NASSLLI2012) June, 2012 43 / 113
  • 53.
    Categories, Functors andNatural Transformations Functors We have been stressing that more than objects it is the way that objects relate to each that matters in category theory. The same is true of categories themselves. Hence the old Eilenberg-MacLane joke that categories were only invented so that they could talk about functors. And functors were only invented to talk about natural transformations. and yes talk about the natural transformations was what the algebraic geometers wanted to do all along. So we need maps of categories, the natural way of relating categories. Which structure should they preserve? Valeria de Paiva (NASSLLI2012) June, 2012 44 / 113
  • 54.
    Categories, Functors andNatural Transformations Functors We have been stressing that more than objects it is the way that objects relate to each that matters in category theory. The same is true of categories themselves. Hence the old Eilenberg-MacLane joke that categories were only invented so that they could talk about functors. And functors were only invented to talk about natural transformations. and yes talk about the natural transformations was what the algebraic geometers wanted to do all along. So we need maps of categories, the natural way of relating categories. Which structure should they preserve? Composition and identities, of course. Valeria de Paiva (NASSLLI2012) June, 2012 44 / 113
  • 55.
    Categories, Functors andNatural Transformations Functors Given categories C and D, F : C → D consists a functor of an assignment of objects of C to objects to D such that if f : A → B is a morphism in C then F (f ) : F (A) → F (B) is a morphism in D and 1. F preserves composition, F (f ; g) = F (f ); F (g) and 2. F preserves identities, F (idA ) = idF (A) Valeria de Paiva (NASSLLI2012) June, 2012 45 / 113
  • 56.
    Categories, Functors andNatural Transformations Functors Valeria de Paiva (NASSLLI2012) June, 2012 46 / 113
  • 57.
    Categories, Functors andNatural Transformations Examples of Functors The trivial example is the identity functor on any category C. 1. A functor between posets is simply an order-preserving function. (they are called monotonic or monotone functions..) 2. Forgetful functors simply forget the mathematical structure present. For example, the functor U : Mon → Sets simply forgets the monoid structure and returns the set that is the carrier of the monoid. Similarly for U : Group → Sets, the functor that forgets the group structure. 3. More interesting are the free functors, that create free structure on bare sets. For example, FreeMon : Sets → Mon creates free monoids. Valeria de Paiva (NASSLLI2012) June, 2012 47 / 113
  • 58.
    Categories, Functors andNatural Transformations Examples of Functors The trivial example is the identity functor on any category C. 1. A functor between posets is simply an order-preserving function. (they are called monotonic or monotone functions..) 2. Forgetful functors simply forget the mathematical structure present. For example, the functor U : Mon → Sets simply forgets the monoid structure and returns the set that is the carrier of the monoid. Similarly for U : Group → Sets, the functor that forgets the group structure. 3. More interesting are the free functors, that create free structure on bare sets. For example, FreeMon : Sets → Mon creates free monoids. Can you guess what the free monoid functor FreeMon does to a set A = {a, b, c} ? Valeria de Paiva (NASSLLI2012) June, 2012 47 / 113
  • 59.
    Categories, Functors andNatural Transformations More Slice Categories Given a map f: A→B in C we have a functor Σf : C/A → C/B . For g : C/A → C/A g - C C ? A Valeria de Paiva (NASSLLI2012) June, 2012 48 / 113
  • 60.
    Categories, Functors andNatural Transformations More Slice Categories Given a map f: A→B in C we have a functor Σf : C/A → C/B . For g : C/A → C/A g - C C ? A Σf acts as g - C C - ? ? A - B Valeria de Paiva (NASSLLI2012) June, 2012 48 / 113
  • 61.
    Categories, Functors andNatural Transformations More Examples of Functors From Hutton's notes, http://www.cs.nott.ac.uk/ gmh/cat.html. 1. The powerset functor, P : Set → Set, P(A) is the set of all subsets of A, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}. 2. The List : Set → Set functor. On objects ListA is the set dened by the grammar ListA ::= Nil | ConsA(ListA) On maps, if f: A→B is a function then List(f ) : List(A) → List(B) is the function dened by the equations: Valeria de Paiva (NASSLLI2012) June, 2012 49 / 113
  • 62.
    Categories, Functors andNatural Transformations More Examples of Functors From Hutton's notes, http://www.cs.nott.ac.uk/ gmh/cat.html. 1. The powerset functor, P : Set → Set, P(A) is the set of all subsets of A, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}. 2. The List : Set → Set functor. On objects ListA is the set dened by the grammar ListA ::= Nil | ConsA(ListA) On maps, if f: A→B is a function then List(f ) : List(A) → List(B) is the function dened by the equations: List f (Nil) = Nil Valeria de Paiva (NASSLLI2012) June, 2012 49 / 113
  • 63.
    Categories, Functors andNatural Transformations More Examples of Functors From Hutton's notes, http://www.cs.nott.ac.uk/ gmh/cat.html. 1. The powerset functor, P : Set → Set, P(A) is the set of all subsets of A, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}. 2. The List : Set → Set functor. On objects ListA is the set dened by the grammar ListA ::= Nil | ConsA(ListA) On maps, if f: A→B is a function then List(f ) : List(A) → List(B) is the function dened by the equations: List f (Nil) = Nil List f (Cons x xs) = Cons(f (x))(List f xs)) Valeria de Paiva (NASSLLI2012) June, 2012 49 / 113
  • 64.
    Categories, Functors andNatural Transformations More Examples of Functors From Hutton's notes, http://www.cs.nott.ac.uk/ gmh/cat.html. 1. The powerset functor, P : Set → Set, P(A) is the set of all subsets of A, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}. 2. The List : Set → Set functor. On objects ListA is the set dened by the grammar ListA ::= Nil | ConsA(ListA) On maps, if f: A→B is a function then List(f ) : List(A) → List(B) is the function dened by the equations: List f (Nil) = Nil List f (Cons x xs) = Cons(f (x))(List f xs)) Preservation of composition and identities proved by induction. 3. Can you do the functor Tree : Set → Set such that TreeA is the set of binary trees whose leaves are elements of the set A? Valeria de Paiva (NASSLLI2012) June, 2012 49 / 113
  • 65.
    Categories, Functors andNatural Transformations Recap: 1. Discussed categories. what are they? Valeria de Paiva (NASSLLI2012) June, 2012 50 / 113
  • 66.
    Categories, Functors andNatural Transformations Recap: 1. Discussed categories. what are they? collection of objects, collection of maps such that maps compose (associatively) and there are identities for each object f ; (g; h) = (f ; g); h f (idA ) = idf (A) 2. talked about some examples e.g. monoids and monoid morphisms Valeria de Paiva (NASSLLI2012) June, 2012 50 / 113
  • 67.
    Categories, Functors andNatural Transformations Recap: 1. Discussed categories. what are they? collection of objects, collection of maps such that maps compose (associatively) and there are identities for each object f ; (g; h) = (f ; g); h f (idA ) = idf (A) 2. talked about some examples e.g. monoids and monoid morphisms can you remember two examples of monoids? slice category where objects are already morphisms.. product category C × D. 3. dened functor F : C → D need to map objects to objects and maps to maps. need to satisfy F (f ; g) = F (f ); F (g) F (idA ) = idF (A) Valeria de Paiva (NASSLLI2012) June, 2012 50 / 113
  • 68.
    Categories, Functors andNatural Transformations Recap: 1. Discussed categories. what are they? collection of objects, collection of maps such that maps compose (associatively) and there are identities for each object f ; (g; h) = (f ; g); h f (idA ) = idf (A) 2. talked about some examples e.g. monoids and monoid morphisms can you remember two examples of monoids? slice category where objects are already morphisms.. product category C × D. 3. dened functor F : C → D need to map objects to objects and maps to maps. need to satisfy F (f ; g) = F (f ); F (g) F (idA ) = idF (A) where are these compositions? Valeria de Paiva (NASSLLI2012) June, 2012 50 / 113
  • 69.
    Categories, Functors andNatural Transformations Two more examples of Categories: I. Labelled Graphs Can you describe the category of `labelled graphs' ? what are the objects? Valeria de Paiva (NASSLLI2012) June, 2012 51 / 113
  • 70.
    Categories, Functors andNatural Transformations Labelled Graphs Morphisms/arrows/maps from one labelled graph to another? Valeria de Paiva (NASSLLI2012) June, 2012 52 / 113
  • 71.
    Categories, Functors andNatural Transformations Labelled Graphs Morphisms/arrows/maps from one labelled graph to another? Valeria de Paiva (NASSLLI2012) June, 2012 52 / 113
  • 72.
    Categories, Functors andNatural Transformations Maps of Labelled Graphs Valeria de Paiva (NASSLLI2012) June, 2012 53 / 113
  • 73.
    Categories, Functors andNatural Transformations Second Example: Automata remember these? Valeria de Paiva (NASSLLI2012) June, 2012 54 / 113
  • 74.
    Categories, Functors andNatural Transformations Second Example: Automata from Goguen's Manifesto Valeria de Paiva (NASSLLI2012) June, 2012 55 / 113
  • 75.
    Categories, Functors andNatural Transformations More Examples of Functors Back to the powerset functor, P : Set → Set, P(A) is the set of all subsets of A, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}. if B = {a, b, c} then P(B) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}. You can also consider only nite subsets of a set Pf in (A), which makes more sense if the set is innite. The power set functorP : Set → Set maps each set to its power set and each function f : X → Y to the map which sends U ⊆ X to its image f (U ) ⊆ Y . One can also consider the contravariant power set functor which sends f :X→Y to the map which sends V ⊆Y to its inverse −1 image f (V ) ⊆ X . Valeria de Paiva (NASSLLI2012) June, 2012 56 / 113
  • 76.
    Categories, Functors andNatural Transformations More Examples of Functors The List : Set → Set functor. On objects ListA is the set dened by the grammar ListA ::= Nil | ConsA(ListA) On maps, if f: A→B is a function then List(f ) : List(A) → List(B) is the function dened by the equations: Valeria de Paiva (NASSLLI2012) June, 2012 57 / 113
  • 77.
    Categories, Functors andNatural Transformations More Examples of Functors The List : Set → Set functor. On objects ListA is the set dened by the grammar ListA ::= Nil | ConsA(ListA) On maps, if f: A→B is a function then List(f ) : List(A) → List(B) is the function dened by the equations: List f (Nil) = Nil Valeria de Paiva (NASSLLI2012) June, 2012 57 / 113
  • 78.
    Categories, Functors andNatural Transformations More Examples of Functors The List : Set → Set functor. On objects ListA is the set dened by the grammar ListA ::= Nil | ConsA(ListA) On maps, if f: A→B is a function then List(f ) : List(A) → List(B) is the function dened by the equations: List f (Nil) = Nil List f (Cons x xs) = Cons(f (x))(List f xs)) Valeria de Paiva (NASSLLI2012) June, 2012 57 / 113
  • 79.
    Categories, Functors andNatural Transformations More Examples of Functors The List : Set → Set functor. On objects ListA is the set dened by the grammar ListA ::= Nil | ConsA(ListA) On maps, if f: A→B is a function then List(f ) : List(A) → List(B) is the function dened by the equations: List f (Nil) = Nil List f (Cons x xs) = Cons(f (x))(List f xs)) Preservation of composition and identities proved by induction. 3. Can you do the functor Tree : Set → Set such that TreeA is the set of binary trees whose leaves are elements of the set A? Valeria de Paiva (NASSLLI2012) June, 2012 57 / 113
  • 80.
    Categories, Functors andNatural Transformations Back to math: Hom Functors Pick a category C and an object A in it. Then HomC (A, −) is a functor from C to Set, where HomC (A, −) the collection of all morphisms of C with source A. F is A functor represented by an object A if F is naturally isomorphic to HomC (A, −). Valeria de Paiva (NASSLLI2012) June, 2012 58 / 113
  • 81.
    Categories, Functors andNatural Transformations More Hom Functors Pick a category C and an object A in it. Look at HomC (−, A) is a functor from C to Set, where HomC (−, A) is the collection of all morphisms of C with codomain A. Valeria de Paiva (NASSLLI2012) June, 2012 59 / 113
  • 82.
    Categories, Functors andNatural Transformations Functors: more notation A functor of the form H : C × D → E, where the domain is a product category, is called a bi-functor. Projections from a product category π1,2 : A × B → A are bi-functors. op A functor of the form F: C → D, whose domain is the opposite of a given category, is called a contravariant functor. Example of non-functor that looks like one: the centre of a group (the center Z(G) of a group G, is dened as the subgroup consisting of all elements g ∈ G such that for all elements h ∈ H the equality gh = hg holds). Valeria de Paiva (NASSLLI2012) June, 2012 60 / 113
  • 83.
    Categories, Functors andNatural Transformations Functors are ubiquitous? Graham says: The wikipedia says: For functors as a synonym of function objects in computer programming to pass function pointers along with its state, see function object. For the use of the functor morphism presented here in functional programming see also the fmap function of Haskell's Functor class. Functor is also used to name functions in Prolog. For functors in linguistics, see Function word. Valeria de Paiva (NASSLLI2012) June, 2012 61 / 113
  • 84.
    Categories, Functors andNatural Transformations Natural Transformations Given functors F : C → D and G : C → D, a natural transformation α : F → G consists of morphisms αA : F (A) → G(A) such that, for any A in C and for any f : A → B in C we have: αA- F (A) G(A) F (f ) G(f ) ? ? F (B) - G(B) αB do easy case and mention http://blog.sigfpe.com/2008/05/you-could-have-dened-natural.html `Starting with the idea of a function that doesn't `peek inside' its arguments, we're led inexorably to the idea of substitutability of arguments and from there to a categorical denition of a natural transformation.' Valeria de Paiva (NASSLLI2012) June, 2012 62 / 113
  • 85.
    Categories, Functors andNatural Transformations ... prettier picture from Edsko de Vries, thanks! Valeria de Paiva (NASSLLI2012) June, 2012 63 / 113
  • 86.
    Categories, Functors andNatural Transformations Examples of Natural Transformations Reversing lists. If A is a set, then revA : List → List is a function dened by: revA (Nil) = Nil revA (Cons x xs) = revA (xs) · (Consx Nil) To show this is natural must show revA ListA - ListA Listf Listf ? ? ListB - ListB revB Valeria de Paiva (NASSLLI2012) June, 2012 64 / 113
  • 87.
    Categories, Functors andNatural Transformations Constructions in Categories: Products A category C A and B in C, there has binary products, if given objects exists an objectA × B and morphisms π1 : A × B → A and p2 : A × B → B of C such that if P is another object of C equipped with morphisms p1 : P → A and p2 : P → B , then there's a unique map u : P → A × B such that the triangles below commute. P p2 p1 u - π1 ? π2 - A A×B B Valeria de Paiva (NASSLLI2012) June, 2012 65 / 113
  • 88.
    Categories, Functors andNatural Transformations Constructions in Categories: Pullbacks A category C f : X → Z and g : Y → Z in C, has pullbacks, if given maps there exists an object P equipped with morphisms p1 : P → X and p2 : P → Y of C such that if Q is another object of C equipped with morphisms q1 : Q → X and q2 : Q → Y , then there's a unique map u : Q → P such that the `triangles' below commute. Valeria de Paiva (NASSLLI2012) June, 2012 66 / 113
  • 89.
    Categories, Functors andNatural Transformations Constructions in Categories: Equalizers A category C has equalizers, if given maps f: A→B and g : A → B in C, there exists an object E equipped with a morphism e : E → A of C such that if E is another object of C equipped with a morphism e : E → A, then there's a unique map e: E → E such that the triangle below commutes. Valeria de Paiva (NASSLLI2012) June, 2012 67 / 113
  • 90.
    Categories, Functors andNatural Transformations Recap... Valeria de Paiva (NASSLLI2012) June, 2012 68 / 113
  • 91.
    Categories, Functors andNatural Transformations Recap... Got up our ladder: categories, functors and natural transformations. Cats have objects and maps, identity morphism for each object, satisfying composition and identity law. Functors transform cats into other cats,F : C → D have a component for objects a component for maps, st F (f ; g) = F (f ); F (g) (covariant functor) and F (idC ) = idF C . constructions relating cats: opposite or dual cat, products, extra examples like slice cat and Hom-functor. constructions inside a cat: initial/terminal object, products (coproducts), pullbacks (push-outs), equalizers (co-equalizers). Not worrying about size considerations (set-theoretic paradoxes) can build: 1. category of small categories where morphisms are functors between cats. 2. Cat of functors between two given cats F un(C, D) where objects are functors and morphisms are natural transformations. Valeria de Paiva (NASSLLI2012) June, 2012 68 / 113
  • 92.
    Categories, Functors andNatural Transformations Recap... A nat transformation α: F → G between functors F and G both from C to D is a collection of morphisms in D αC one for each object C of the category C satisfying a nice square, for each morphism in C f: C →C : αC- F (C) G(C) F (f ) G(f ) ? ? F (C ) - G(C ) αC only example reverse between lists in Set... Valeria de Paiva (NASSLLI2012) June, 2012 69 / 113
  • 93.
    Categories, Functors andNatural Transformations Trivial example: identity natural transformation α − idC : F → F . how does it go? Valeria de Paiva (NASSLLI2012) June, 2012 70 / 113
  • 94.
    Categories, Functors andNatural Transformations Trivial example: identity natural transformation α − idC : F → F . how does it go? A nat transformation α: F → G between functors F and G both from C to C is a collection of morphisms in C αC one for each object C of the category satisfying a nice square, for each morphism in C f: C →C : α − idC F (C) - F (C) F (f ) F (f ) ? ? F (C ) - F (C ) α − idC Valeria de Paiva (NASSLLI2012) June, 2012 70 / 113
  • 95.
    Adjunctions Adjunctions? Given functors F: C →D and G : D → C, we say that F is left-adjoint to G (or that G is right-adjoint to F ) F G if there is a natural bijection HomD (F C, D) ∼ HomC (C, GD) = for each pair of objects C in C and D in D. Many people prefer to think of them as Galois connections. Valeria de Paiva (NASSLLI2012) June, 2012 71 / 113
  • 96.
    Adjunctions Galois connections... Let (A, ≤) and (B, ≤) be two partially ordered sets. A Galois connection between these posets consists of two monotone functions: F: A→B and G : B → A, such that for all a in A andb in B, we have F (a) ≤ b if and only if a ≤ G(b) In this situation,F is called the lower adjoint of G and G is called the upper adjoint of F. Several names in the literature, wikipedia has a good selection. Originally from Galois' work on groups. Check out Peter Smith's carefully written The Galois Connection between Syntax and Semantics. Abstract Algebraic Logic. Abstract interpretation. Concept analysis, some Information Flow... Valeria de Paiva (NASSLLI2012) June, 2012 72 / 113
  • 97.
    Adjunctions Examples of Adjunctions Freemonoids again... Cartesian Closedness (monoidal closedness) Valeria de Paiva (NASSLLI2012) June, 2012 73 / 113
  • 98.
    Adjunctions Free monoids? Recall thefunctor Free : Set → Mon. On an set A it produces the free monoid. i.e sequences of elements from A, 'multiplied' by concatenation, (A∗ , [], concat). On an set B it produces the free monoid (sequences of elements from B) (B ∗ , [], concat). Valeria de Paiva (NASSLLI2012) June, 2012 74 / 113
  • 99.
    Adjunctions Free monoids? Recall thefunctor Free : Set → Mon. On an set A it produces the free monoid. i.e sequences of elements from A, 'multiplied' by concatenation, (A∗ , [], concat). On an set B it produces the free monoid (sequences of elements from B) (B ∗ , [], concat). remind me, what's the rest of the functor? Valeria de Paiva (NASSLLI2012) June, 2012 74 / 113
  • 100.
    Adjunctions Free monoids? Recall thefunctor Free : Set → Mon. On an set A it produces the free monoid. i.e sequences of elements from A, 'multiplied' by concatenation, (A∗ , [], concat). On an set B it produces the free monoid (sequences of elements from B) (B ∗ , [], concat). remind me, what's the rest of the functor? On a map f: A→B the action of Free, f ∗ is simply doing the function f in each of the elements of A. Recall also the `boring' forgetful functor U : Mon → Set. Given any monoid (M, ·, e) it returns simply M . Given a monoid morphism h : (M, ·, e) → (M , ·, e ), return simply the function h. Valeria de Paiva (NASSLLI2012) June, 2012 74 / 113
  • 101.
    Adjunctions Free monoids? Now letus look at the denition of adjunction: Two functors F, G going in opposite directions st HomD (F C, D) ∼ HomC (C, GD) = where ∼ = means there is a bijection that is natural in C and D. Valeria de Paiva (NASSLLI2012) June, 2012 75 / 113
  • 102.
    Adjunctions Free monoids? Now letus look at the denition of adjunction: Two functors F, G going in opposite directions st HomD (F C, D) ∼ HomC (C, GD) = where ∼ = means there is a bijection that is natural in C and D. We do have functors going between categories Mon and Set in opposite directions. U : Mon → Set and Free : Set → Mon Do we have .... HomSet (U M, A) ∼ HomMon (M, FreeA) = More than 20 dierent denitions of adjunction... Valeria de Paiva (NASSLLI2012) June, 2012 75 / 113
  • 103.
    Adjunctions Free monoids? Simmons says:Thereis a lot going on with adjunctions and you will probably get confused more than once. Don't worry.... universal property: a morphism η : A → U (FreeA) such that whenever M is a monoid, and g : A → U (M ) a function, then there is a unique monoid morphism h : Free(A) → M such that U (h) · η = g . A - UM - ? U (Free(A)) Go and read it at your own pace. for intuition think the free monoid is the monoid built on the generators, the elements of the original set. you can always embedd the original set into the set that is the forgotten monoid.. Valeria de Paiva (NASSLLI2012) June, 2012 76 / 113
  • 104.
    Adjunctions An über familiaradjunction... HomSet (A × B, C) ∼ HomSet (A, C B ) = So f: A×B →C f : A → CB. is bijectively related to This is trivial currying of functions, if your f has 2 arguments a and b, you can transform it into a function f of a single argument a that returns a function taking b's to c's, right? Schoennkel (1920s) the rst (?) to notice its importance for combinators . Now can we do it in a generic category C? We have products. Need to internalize the notion of maps in C from B to C. In Set is easy, the set of functions from X to Y may be denoted X→Y or X Y . As a special case, the power set of a set X may be identied with the set of all functions from X to {0, 1}, denoted 2X . Valeria de Paiva (NASSLLI2012) June, 2012 77 / 113
  • 105.
    Adjunctions An über familiaradjunction... Consider the functor − × B : Set → Set, where B is a xed object of Set. On object A we have A × B , on object A we have A × B . Valeria de Paiva (NASSLLI2012) June, 2012 78 / 113
  • 106.
    Adjunctions An über familiaradjunction... Consider the functor − × B : Set → Set, where B is a xed object of Set. On object A we have A × B , on object A we have A × B . what's the morphism component? On a map f: A→A we simply product with the identity on B. Now consider the functor (−)B : → Set. Set B On object D , D is the set of all maps B → D . On object D it is the set of all maps B → D . and on a morphism, f : D → D it's the usual, composition. Now, if we formally plug in these two functors into our denition of adjunction, what happens? Valeria de Paiva (NASSLLI2012) June, 2012 78 / 113
  • 107.
    Adjunctions An über familiaradjunction... Look at: HomD (F C, D) ∼ HomC (C, GD) = where F =−×B and G = (−)B Valeria de Paiva (NASSLLI2012) June, 2012 79 / 113
  • 108.
    Adjunctions An über familiaradjunction... Look at: HomD (F C, D) ∼ HomC (C, GD) = where F =−×B and G = (−)B applying to objects C and D we have: HomSet (C × B, D) ∼ HomSet (C, DB ) ∼ HomSet (C, B → D) = = which corresponds to our trivial operation on of currying functions... So I want to conclude that in a generic category C with products, I have an adjunction between functors −×B and (−)B . Valeria de Paiva (NASSLLI2012) June, 2012 79 / 113
  • 109.
    Adjunctions An über familiaradjunction... ok, I'm cheating. I didn't tell you how to construct the functor (−)B in other categories. We know we can do it in Set, but what about anywhere else? I can give a proper denition of (−)B if I work hard on limits, the general notion of which we saw 3 instances: products, pullbacks and equalizers. then the adjunction is obvious. or I can give you the adjunction saying you've used it a billion times before and say, go get your general denition of internalizing functions from the adjunction. Ie dene function spaces as the functor that makes the adjunction work, like many books do. A bit like riding a bike, if you start you can keep your balance... Valeria de Paiva (NASSLLI2012) June, 2012 80 / 113
  • 110.
    Adjunctions Cartesian Closed Categories... Acategory C is called a cartesian closed category (CCC) if it has products and if for each object X of C, the product functor −×X: C →C has a X right adjoint, written as (−) . That is we have HomC (A × X, B) ∼ HomC (A, B X ) = A minor modication, not insisting on real cartesian products, produces the denition of symmetric monoidal closed category. HomC (A ⊗ X, B) ∼ HomC (A, [X, B]C ) = Valeria de Paiva (NASSLLI2012) June, 2012 81 / 113
  • 111.
    Adjunctions Have you seenthis adjunction before?... If you squint a little and make × the same as ∧ and → logical implication and think of maps in the category as proofs, you can read HomC (A × X, B) ∼ HomC (A, X → B) = as any proof of A∧X →B corresponds bijectively to a proof of A → X → B, which is a form of the Deduction Theorem in logic. Valeria de Paiva (NASSLLI2012) June, 2012 82 / 113
  • 112.
    Deductive Systems asCategories Lambek introduced the idea of using Gentzen methods in category theory and linguistics in the Sixties. A deductive system is simply a labelled graph whose objects are formulas and whose edges are labelled sequents. There are special identity arrows and some special rules for creating new sequents outof the old ones. Given a graph G Valeria de Paiva (NASSLLI2012) June, 2012 83 / 113
  • 113.
    Deductive Systems asCategories What are the Deductive Systems trying to do?... Valeria de Paiva (NASSLLI2012) June, 2012 83 / 113
  • 114.
    Deductive Systems asCategories How do sequents relate to categories?... Basic idea: a formula corresponds to an object in a suitable category We assign to each sequent Γ A a map in the suitable category C from the interpretation of Γ to the interpretation of A. (But we don't bother to show the dierence between A formula and A object in the category...) Clearly the interpretation must be compositional: we get the interpretation of Γ = A1 , . . . , A n from the interpretations of the components Ai . What is the less contraining construction we can do in a category that will interpret the context Γ? People will worry about commutativity, associativity of commas. If I am talking about intuitionistic logic, where conjunction is commutative and associative, cartesian product would be ne, but a commutative tensor product ⊗ is ne too. Valeria de Paiva (NASSLLI2012) June, 2012 84 / 113
  • 115.
    Deductive Systems asCategories How do sequents relate to categories?... Tensor products? Well, I mentioned categorical products and their universal property. It turns out that universality is not really required to model contexts. So we can do simply with a product-like functor ⊗: C × C → C, which is associative, commutative and has an identity, usually written as I. Categorical products are unique up to iso, so if you have products, that's it. (up to iso). But tensor products are not unique, you can have several, this corresponds to several kinds of conjunction in your logic. A category with an associated tensor product and unit is called a monoidal category. A category with an associated categorical product and terminal object is called a cartesian category. Monoidal categories are very fashionable, as they seem more exible for modelling phenomena. (glossing over issues with coherence). Valeria de Paiva (NASSLLI2012) June, 2012 85 / 113
  • 116.
    Deductive Systems asCategories How do sequents relate to categories? ... Adding terms/morphisms to a suitable version of sequent calculus rules we get a full interpretation of the suimply typed lambda-calculus in categories. This allows us to think of proofs as λ-terms or of morphisms in the category build up from identities and the constructors we allowed. Are we there yet? Valeria de Paiva (NASSLLI2012) June, 2012 86 / 113
  • 117.
    Deductive Systems asCategories How do sequents relate to categories? ... Adding terms/morphisms to a suitable version of sequent calculus rules we get a full interpretation of the suimply typed lambda-calculus in categories. This allows us to think of proofs as λ-terms or of morphisms in the category build up from identities and the constructors we allowed. Are we there yet? No, must prove it works. Must prove we have triangle... Valeria de Paiva (NASSLLI2012) June, 2012 86 / 113
  • 118.
    Deductive Systems asCategories Valeria de Paiva (NASSLLI2012) June, 2012 87 / 113
  • 119.
    Deductive Systems asCategories Old picture Valeria de Paiva (NASSLLI2012) June, 2012 88 / 113
  • 120.
    Deductive Systems asCategories Problems?.. We can add terms to Natural Deduction (Curry-Howard correspondence). But need sequent formulation provably equivalent to Natural Deduction. (there is a problem with associating categorical constructions to sequent calculus rules without ND, the proof equalities don't work without extra constraints, Herbelin.) We will discuss this tomorrow. Valeria de Paiva (NASSLLI2012) June, 2012 89 / 113
  • 121.
    Deductive Systems asCategories Recap.. So I goofed, should've dened: An object C in a category D is an internal hom object or an exponential object [A → B] or B A if it comes equipped with an arrow ev : [A → B] × A → B , called the evaluation arrow, such that for any other arrow f : C × A → B , there is a unique arrow λf : C → [A → B] such that the composite C × A →λf ×1A [A → B] × A →ev B is f . but yes, the bike metaphor is still valid... Valeria de Paiva (NASSLLI2012) June, 2012 90 / 113
  • 122.
    Deductive Systems asCategories Traditional Curry-Howard reloaded.. Valeria de Paiva (NASSLLI2012) June, 2012 91 / 113
  • 123.
    Deductive Systems asCategories Traditional Curry-Howard reloaded.. But 88 pages in Gallier to prove ND equivalent to sequent calculus... Once you have it: Valeria de Paiva (NASSLLI2012) June, 2012 92 / 113
  • 124.
    Deductive Systems asCategories Traditional Curry-Howard reloaded.. Valeria de Paiva (NASSLLI2012) June, 2012 93 / 113
  • 125.
    Deductive Systems asCategories Categorical Curry-Howard reloaded.. Valeria de Paiva (NASSLLI2012) June, 2012 94 / 113
  • 126.
    Deductive Systems asCategories Categorical Curry-Howard reloaded.. Valeria de Paiva (NASSLLI2012) June, 2012 95 / 113
  • 127.
    Deductive Systems asCategories Traditional Curry-Howard reloaded.. Valeria de Paiva (NASSLLI2012) June, 2012 96 / 113
  • 128.
    Deductive Systems asCategories Traditional Curry-Howard reloaded.. What can we prove? Few more (traditional denitions) A signature is a collection of basic types (Nat, Bool, Char, ...) and typed functional symbols (add, succ,..., etc). Consider a basic signature that contains at least basic types 1, 0 and basic operators × for conjunctions, + for disjunctions and → for logical implication. Take a cartesian closed category C with products, coproducts and function spaces. An interpretation I for signature Σ in C ( a Σ-structure in C) is specied by giving an object of C for each type in Σ and a map in C for each function symbol f in Σ. Valeria de Paiva (NASSLLI2012) June, 2012 97 / 113
  • 129.
    Deductive Systems asCategories Traditional Curry-Howard reloaded.. Considering terms in context, for any interpretation of Σ in C there exists a standard inductive denition of the interpretation of terms in context, induced by the interpretation of Σ. Consider equations in context. Say an equation in EqΣ holds for an interpretation I if the interpretations of the terms in context are equal morphims in the category. Say an interpretation is a model of a set of equations if it satises all the equations in the set. Finally can state: Valeria de Paiva (NASSLLI2012) June, 2012 98 / 113
  • 130.
    Deductive Systems asCategories Categorical Curry-Howard reloaded.. Soundness Theorem[Categorical Modelling of IPL] Let C be a cartesian closed category with coproducts and let I be a model of EqΣ in C. Then I satises any equation derivable from Eqσ using equational logic. Valeria de Paiva (NASSLLI2012) June, 2012 99 / 113
  • 131.
    Deductive Systems asCategories Categorical Curry-Howard reloaded.. Soundness Theorem[Categorical Modelling of IPL] Let C be a cartesian closed category with coproducts and let I be a model of EqΣ in C. Then I satises any equation derivable from EqΣ using equational logic. Completeness Theorem[Categorical Modelling of IPL] For all signatures Σ there exists a cartesian closed category with coproducts C and an interpretation of the calculus in this category such that: If Γ t:A and Γ s : A are derivable, then t and s are interpreted as the same morphism only if t = s is provable from the equations above using typed equational logic. Valeria de Paiva (NASSLLI2012) June, 2012 100 / 113
  • 132.
    Deductive Systems asCategories Wadler's Take Valeria de Paiva (NASSLLI2012) June, 2012 101 / 113
  • 133.
    A taste ofGlue Semantics?... Glue semantics in 5 min Thanks for slides, Dick! Glue semantics is a theory of the syntax-semantics interface that uses linear logic for meaning composition. Distinguish two separate logics in semantic interpretation 1. Meaning logic: target logical representation 2. Glue logic: logical specication of how chunks of meaning are assembled In principle, Glue uses any of several grammar formalisms/any of the mainstream semantics. In practice Glue started for LFG, with a vanilla Montague-style logic for meanings. Valeria de Paiva (NASSLLI2012) June, 2012 102 / 113
  • 134.
    A taste ofGlue Semantics?... Linguistic applications of linear logic 1. Categorial and type-logical grammar (Moortgat, vanBenthem): including parsing categorial grammars (Morrill, Hepple) and compositional semantics of categorial grammars (Morrill, Carpenter) 2. `Glue semantics' (a version of categorial semantics without an associated categorial grammar?) (Dalrymple, Lamping Gupta)) 3. Resource-based reformulations of other grammatical theories Minimalism (Retore,Stabler) Lexical Functional Grammar (Saraswat,Muskens) Tree Adjoining Grammar (Abrusci) 4. Also AI issues such as the frame problem (White) or planning (Dixon) with linguistic relevance Valeria de Paiva (NASSLLI2012) June, 2012 103 / 113
  • 135.
    A taste ofGlue Semantics?... Curry-Howard Isomorphism (CHI) CHI = Pairing of proof rules with operations on proof terms But doesn't work for all logics, or proof systems Denes interesting identity criteria for proofs Syntactically distinct derivations corresponding to same proof Intimate relation between logic and type-theory. Varied applications, e.g. Proofs as programs Semantic construction for natural language Valeria de Paiva (NASSLLI2012) June, 2012 104 / 113
  • 136.
    A taste ofGlue Semantics?... Example: Input to Semantic Interpretation Lexicon Word Meaning Glue John john ↑ where ↑= g Fred fred ↑ where ↑= h saw λy.λx. see(x, y) ↑ .OBJ −◦ (↑ .SU BJ −◦ ↑) where ↑= f , f.OBJ = h, f.SU BJ = g Constituents g, h, f : semantic resources, consuming producing meanings Valeria de Paiva (NASSLLI2012) June, 2012 105 / 113
  • 137.
    A taste ofGlue Semantics?... Lexical Premises: Their nature saw aλy.λx. see(x, y) : bh −◦ (g −◦ f ) cMeaning Term dGlue Formula (Propositional LL) Atomic propositions (f, g, h): • Correspond to syntactic constituents found in parsing • Denote resources used in semantic interpretation (Match production consumption of constituent meanings) Meaning terms: • Expressions in some chosen meaning language • Language must support abstraction and application • . . . but otherwise relatively free choice Valeria de Paiva (NASSLLI2012) June, 2012 106 / 113
  • 138.
    A taste ofGlue Semantics?... Cutting and Pasting 1... Valeria de Paiva (NASSLLI2012) June, 2012 107 / 113
  • 139.
    A taste ofGlue Semantics?... The Form of Glue Derivations Γ M:f where • Γ is set of lexical premises (instantiated by parse) • f is (LL atom corresponding to) sentential constituent • M is meaning term produced by derivation (Semantic) Ambiguity Often (many) alternative derivations Γ Mi : f each producing a dierent meaning term Mi for f Need to nd all alternative derivations (eciently!) Valeria de Paiva (NASSLLI2012) June, 2012 108 / 113
  • 140.
    A taste ofGlue Semantics?... Alternative Derivations: Modier Scope Consider phrase alleged criminal from London λx. criminal(x) : f λP. alleged(P ) : f −◦ f λP λx. from(l, x) ∧ P (x) : f −◦ f Two derivations, resulting in: 1. λx. from(l, x) ∧ alleged(criminal)(x) : f 2. alleged(λx. from(l, x) ∧ criminal(x)) : f Valeria de Paiva (NASSLLI2012) June, 2012 109 / 113
  • 141.
    A taste ofGlue Semantics?... Independence of Glue and Meaning Original Glue (93) Curry-Howard Glue (97) mixes meanings glue separates meanings glue gjohn john : g hf red f red : h ∀y. hy −◦ ∀x. (gx −◦ f see(x, y)) λyλx. see(x, y) : h −◦ (g −◦ f ) Some meaning separation rules: • [[∀M. (rM −◦ ϕ)]]m = λM. [[ϕ]]m • [[rM]]m = M Some expressions can't be separated: gjohn −◦ f sleep(john) Avoid these: derivations dependent on meanings, and higher order unication needed to match meanings Curry-Howard: good for understanding derivations Original: good for understanding premises Valeria de Paiva (NASSLLI2012) June, 2012 110 / 113
  • 142.
    A taste ofGlue Semantics?... Skeletons and modiers? Valeria de Paiva (NASSLLI2012) June, 2012 111 / 113
  • 143.
    A taste ofGlue Semantics?... Glue Sales Pitch Linguistically powerful exible approach Interesting analyses of scope, control (Asudeh), event-based semantics (Fry), intensional verbs (Dalrymple), context dependence, coordination. But many other phenomena still to do Grammar semantics engineering Applicable to grammars besides LFG based ones Steep learning curve for writing lexical entries But turns out to allow plentiful re-use of lingware Can be implemented eciently Valeria de Paiva (NASSLLI2012) June, 2012 112 / 113
  • 144.
    A taste ofGlue Semantics?... Conclusions We missed Ulrik but managed to muddle through some basic denitions of category theory. Covered categories, functors, natural transformations and some examples. Also discussed adjunctions and two of their easier examples: free monoids and cartesian closedness. We discussed an extended version of CurryHoward to relates logics, not only to type theory, but also to categories and structures inside those categories. Here's a graphic reminder of the main point. As an novel and kind of unique application we mentione Glue Semantics very briey. Valeria de Paiva (NASSLLI2012) June, 2012 113 / 113