\documentclass[12pt,titlepage]{article} \usepackage{amsmath} \usepackage{mathrsfs} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{mathtools} \usepackage{graphicx} \usepackage{color} \usepackage{ucs} \usepackage[utf8x]{inputenc} \usepackage{xparse} \usepackage{hyperref} %----Macros---------- % % Unresolved issues: % % \righttoleftarrow % \lefttorightarrow % % \color{} with HTML colorspec % \bgcolor % \array with options (without options, it's equivalent to the matrix environment) % Of the standard HTML named colors, white, black, red, green, blue and yellow % are predefined in the color package. Here are the rest. \definecolor{aqua}{rgb}{0, 1.0, 1.0} \definecolor{fuschia}{rgb}{1.0, 0, 1.0} \definecolor{gray}{rgb}{0.502, 0.502, 0.502} \definecolor{lime}{rgb}{0, 1.0, 0} \definecolor{maroon}{rgb}{0.502, 0, 0} \definecolor{navy}{rgb}{0, 0, 0.502} \definecolor{olive}{rgb}{0.502, 0.502, 0} \definecolor{purple}{rgb}{0.502, 0, 0.502} \definecolor{silver}{rgb}{0.753, 0.753, 0.753} \definecolor{teal}{rgb}{0, 0.502, 0.502} % Because of conflicts, \space and \mathop are converted to % \itexspace and \operatorname during preprocessing. % itex: \space{ht}{dp}{wd} % % Height and baseline depth measurements are in units of tenths of an ex while % the width is measured in tenths of an em. \makeatletter \newdimen\itex@wd% \newdimen\itex@dp% \newdimen\itex@thd% \def\itexspace#1#2#3{\itex@wd=#3em% \itex@wd=0.1\itex@wd% \itex@dp=#2ex% \itex@dp=0.1\itex@dp% \itex@thd=#1ex% \itex@thd=0.1\itex@thd% \advance\itex@thd\the\itex@dp% \makebox[\the\itex@wd]{\rule[-\the\itex@dp]{0cm}{\the\itex@thd}}} \makeatother % \tensor and \multiscript \makeatletter \newif\if@sup \newtoks\@sups \def\append@sup#1{\edef\act{\noexpand\@sups={\the\@sups #1}}\act}% \def\reset@sup{\@supfalse\@sups={}}% \def\mk@scripts#1#2{\if #2/ \if@sup ^{\the\@sups}\fi \else% \ifx #1_ \if@sup ^{\the\@sups}\reset@sup \fi {}_{#2}% \else \append@sup#2 \@suptrue \fi% \expandafter\mk@scripts\fi} \def\tensor#1#2{\reset@sup#1\mk@scripts#2_/} \def\multiscripts#1#2#3{\reset@sup{}\mk@scripts#1_/#2% \reset@sup\mk@scripts#3_/} \makeatother % \slash \makeatletter \newbox\slashbox \setbox\slashbox=\hbox{$/$} \def\itex@pslash#1{\setbox\@tempboxa=\hbox{$#1$} \@tempdima=0.5\wd\slashbox \advance\@tempdima 0.5\wd\@tempboxa \copy\slashbox \kern-\@tempdima \box\@tempboxa} \def\slash{\protect\itex@pslash} \makeatother % math-mode versions of \rlap, etc % from Alexander Perlis, "A complement to \smash, \llap, and lap" % http://math.arizona.edu/~aprl/publications/mathclap/ \def\clap#1{\hbox to 0pt{\hss#1\hss}} \def\mathllap{\mathpalette\mathllapinternal} \def\mathrlap{\mathpalette\mathrlapinternal} \def\mathclap{\mathpalette\mathclapinternal} \def\mathllapinternal#1#2{\llap{$\mathsurround=0pt#1{#2}$}} \def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}} \def\mathclapinternal#1#2{\clap{$\mathsurround=0pt#1{#2}$}} % Renames \sqrt as \oldsqrt and redefine root to result in \sqrt[#1]{#2} \let\oldroot\root \def\root#1#2{\oldroot #1 \of{#2}} \renewcommand{\sqrt}[2][]{\oldroot #1 \of{#2}} % Manually declare the txfonts symbolsC font \DeclareSymbolFont{symbolsC}{U}{txsyc}{m}{n} \SetSymbolFont{symbolsC}{bold}{U}{txsyc}{bx}{n} \DeclareFontSubstitution{U}{txsyc}{m}{n} % Manually declare the stmaryrd font \DeclareSymbolFont{stmry}{U}{stmry}{m}{n} \SetSymbolFont{stmry}{bold}{U}{stmry}{b}{n} % Manually declare the MnSymbolE font \DeclareFontFamily{OMX}{MnSymbolE}{} \DeclareSymbolFont{mnomx}{OMX}{MnSymbolE}{m}{n} \SetSymbolFont{mnomx}{bold}{OMX}{MnSymbolE}{b}{n} \DeclareFontShape{OMX}{MnSymbolE}{m}{n}{ <-6> MnSymbolE5 <6-7> MnSymbolE6 <7-8> MnSymbolE7 <8-9> MnSymbolE8 <9-10> MnSymbolE9 <10-12> MnSymbolE10 <12-> MnSymbolE12}{} % Declare specific arrows from txfonts without loading the full package \makeatletter \def\re@DeclareMathSymbol#1#2#3#4{% \let#1=\undefined \DeclareMathSymbol{#1}{#2}{#3}{#4}} \re@DeclareMathSymbol{\neArrow}{\mathrel}{symbolsC}{116} \re@DeclareMathSymbol{\neArr}{\mathrel}{symbolsC}{116} \re@DeclareMathSymbol{\seArrow}{\mathrel}{symbolsC}{117} \re@DeclareMathSymbol{\seArr}{\mathrel}{symbolsC}{117} \re@DeclareMathSymbol{\nwArrow}{\mathrel}{symbolsC}{118} \re@DeclareMathSymbol{\nwArr}{\mathrel}{symbolsC}{118} \re@DeclareMathSymbol{\swArrow}{\mathrel}{symbolsC}{119} \re@DeclareMathSymbol{\swArr}{\mathrel}{symbolsC}{119} \re@DeclareMathSymbol{\nequiv}{\mathrel}{symbolsC}{46} \re@DeclareMathSymbol{\Perp}{\mathrel}{symbolsC}{121} \re@DeclareMathSymbol{\Vbar}{\mathrel}{symbolsC}{121} \re@DeclareMathSymbol{\sslash}{\mathrel}{stmry}{12} \re@DeclareMathSymbol{\bigsqcap}{\mathop}{stmry}{"64} \re@DeclareMathSymbol{\biginterleave}{\mathop}{stmry}{"6} \re@DeclareMathSymbol{\invamp}{\mathrel}{symbolsC}{77} \re@DeclareMathSymbol{\parr}{\mathrel}{symbolsC}{77} \makeatother % \llangle, \rrangle, \lmoustache and \rmoustache from MnSymbolE \makeatletter \def\Decl@Mn@Delim#1#2#3#4{% \if\relax\noexpand#1% \let#1\undefined \fi \DeclareMathDelimiter{#1}{#2}{#3}{#4}{#3}{#4}} \def\Decl@Mn@Open#1#2#3{\Decl@Mn@Delim{#1}{\mathopen}{#2}{#3}} \def\Decl@Mn@Close#1#2#3{\Decl@Mn@Delim{#1}{\mathclose}{#2}{#3}} \Decl@Mn@Open{\llangle}{mnomx}{'164} \Decl@Mn@Close{\rrangle}{mnomx}{'171} \Decl@Mn@Open{\lmoustache}{mnomx}{'245} \Decl@Mn@Close{\rmoustache}{mnomx}{'244} \makeatother % Widecheck \makeatletter \DeclareRobustCommand\widecheck[1]{{\mathpalette\@widecheck{#1}}} \def\@widecheck#1#2{% \setbox\z@\hbox{\m@th$#1#2$}% \setbox\tw@\hbox{\m@th$#1% \widehat{% \vrule\@width\z@\@height\ht\z@ \vrule\@height\z@\@width\wd\z@}$}% \dp\tw@-\ht\z@ \@tempdima\ht\z@ \advance\@tempdima2\ht\tw@ \divide\@tempdima\thr@@ \setbox\tw@\hbox{% \raise\@tempdima\hbox{\scalebox{1}[-1]{\lower\@tempdima\box \tw@}}}% {\ooalign{\box\tw@ \cr \box\z@}}} \makeatother % \mathraisebox{voffset}[height][depth]{something} \makeatletter \NewDocumentCommand\mathraisebox{moom}{% \IfNoValueTF{#2}{\def\@temp##1##2{\raisebox{#1}{$\m@th##1##2$}}}{% \IfNoValueTF{#3}{\def\@temp##1##2{\raisebox{#1}[#2]{$\m@th##1##2$}}% }{\def\@temp##1##2{\raisebox{#1}[#2][#3]{$\m@th##1##2$}}}}% \mathpalette\@temp{#4}} \makeatletter % udots (taken from yhmath) \makeatletter \def\udots{\mathinner{\mkern2mu\raise\p@\hbox{.} \mkern2mu\raise4\p@\hbox{.}\mkern1mu \raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern1mu}} \makeatother %% Fix array \newcommand{\itexarray}[1]{\begin{matrix}#1\end{matrix}} %% \itexnum is a noop \newcommand{\itexnum}[1]{#1} %% Renaming existing commands \newcommand{\underoverset}[3]{\underset{#1}{\overset{#2}{#3}}} \newcommand{\widevec}{\overrightarrow} \newcommand{\darr}{\downarrow} \newcommand{\nearr}{\nearrow} \newcommand{\nwarr}{\nwarrow} \newcommand{\searr}{\searrow} \newcommand{\swarr}{\swarrow} \newcommand{\curvearrowbotright}{\curvearrowright} \newcommand{\uparr}{\uparrow} \newcommand{\downuparrow}{\updownarrow} \newcommand{\duparr}{\updownarrow} \newcommand{\updarr}{\updownarrow} \newcommand{\gt}{>} \newcommand{\lt}{<} \newcommand{\map}{\mapsto} \newcommand{\embedsin}{\hookrightarrow} \newcommand{\Alpha}{A} \newcommand{\Beta}{B} \newcommand{\Zeta}{Z} \newcommand{\Eta}{H} \newcommand{\Iota}{I} \newcommand{\Kappa}{K} \newcommand{\Mu}{M} \newcommand{\Nu}{N} \newcommand{\Rho}{P} \newcommand{\Tau}{T} \newcommand{\Upsi}{\Upsilon} \newcommand{\omicron}{o} \newcommand{\lang}{\langle} \newcommand{\rang}{\rangle} \newcommand{\Union}{\bigcup} \newcommand{\Intersection}{\bigcap} \newcommand{\Oplus}{\bigoplus} \newcommand{\Otimes}{\bigotimes} \newcommand{\Wedge}{\bigwedge} \newcommand{\Vee}{\bigvee} \newcommand{\coproduct}{\coprod} \newcommand{\product}{\prod} \newcommand{\closure}{\overline} \newcommand{\integral}{\int} \newcommand{\doubleintegral}{\iint} \newcommand{\tripleintegral}{\iiint} \newcommand{\quadrupleintegral}{\iiiint} \newcommand{\conint}{\oint} \newcommand{\contourintegral}{\oint} \newcommand{\infinity}{\infty} \newcommand{\bottom}{\bot} \newcommand{\minusb}{\boxminus} \newcommand{\plusb}{\boxplus} \newcommand{\timesb}{\boxtimes} \newcommand{\intersection}{\cap} \newcommand{\union}{\cup} \newcommand{\Del}{\nabla} \newcommand{\odash}{\circleddash} \newcommand{\negspace}{\!} \newcommand{\widebar}{\overline} \newcommand{\textsize}{\normalsize} \renewcommand{\scriptsize}{\scriptstyle} \newcommand{\scriptscriptsize}{\scriptscriptstyle} \newcommand{\mathfr}{\mathfrak} \newcommand{\statusline}[2]{#2} \newcommand{\tooltip}[2]{#2} \newcommand{\toggle}[2]{#2} % Theorem Environments \theoremstyle{plain} \newtheorem{theorem}{Theorem} \newtheorem{lemma}{Lemma} \newtheorem{prop}{Proposition} \newtheorem{cor}{Corollary} \newtheorem*{utheorem}{Theorem} \newtheorem*{ulemma}{Lemma} \newtheorem*{uprop}{Proposition} \newtheorem*{ucor}{Corollary} \theoremstyle{definition} \newtheorem{defn}{Definition} \newtheorem{example}{Example} \newtheorem*{udefn}{Definition} \newtheorem*{uexample}{Example} \theoremstyle{remark} \newtheorem{remark}{Remark} \newtheorem{note}{Note} \newtheorem*{uremark}{Remark} \newtheorem*{unote}{Note} %------------------------------------------------------------------- \begin{document} %------------------------------------------------------------------- \section*{categorical compositional distributional semantics} \hypertarget{idea}{}\subsection*{{Idea}}\label{idea} Categorical compositional distributional semantics, also known as \textbf{DisCoCat} for short, uses category theory to combine the benefits of two very different approaches to [[linguistics]]: [[categorial grammar]] and \href{https://en.wikipedia.org/wiki/Distributional_semantics}{distributional semantics}. Specifically, it uses the fact that [[pregroups]] and the category of finite-dimensional real [[vector space|vector spaces]] are both examples of [[rigid monoidal category|rigid monoidal categories]]. Semantics for [[pregroup grammars]] may then be given as a strong [[monoidal functor]], which allows sentence meanings to be computed from word meanings by linear algebra, compositionally on the grammatical structure of the sentence. DisCoCat was first introduced in \hyperlink{Coecke10}{Coecke, Sadrzadeh and Clark 2010}. There is a curious (if probably shallow) analogy between DisCoCat and [[topological quantum field theory]], in that both concern strong monoidal functors from a free ([[rigid monoidal category|rigid monoidal]] or [[compact closed category|compact closed]]) category to a category of vector spaces. \hypertarget{simple_example}{}\subsection*{{Simple example}}\label{simple_example} Consider a very simple fragment of English consisting of nouns and verbs. Write $n$ for the type of nouns, and $s$ for the type of sentences. Let $\mathcal{C}$ be the free pregroup generated by $n$ and $s$. In $\mathcal{C}$, a noun will be assigned the type $n$ and a reflexive verb will be assigned the type $n^{r} s n^{l}$, since it will produce a sentence if provided with nouns on the left and right. Now given nouns such as ``Alice'' and ``Bob'' and reflexive verbs such as ``loves'' and ``hates'', the grammaticality of a sentence such as ``Alice hates Bob'' is witnessed by the fact that \begin{displaymath} n n^{r} s n^{l} n \leq s \end{displaymath} in the free pregroup. A strong monoidal functor $F : \mathcal{C} \to FVect_{\mathbb{R}}$ is completely determined by where it sends the generators $n$ and $s$. The vector spaces $F (n)$ and $F (s)$ are called the \emph{noun space} and the \emph{sentence space}, and their choice is a matter of linguistic modelling. A common approach is to pick a large set $n$ of \emph{basis words}, say $n = 1000$ (or as many as your sparse matrix implementation can handle), and take $F (n) = \mathbb{R}^{1000}$. The choice of $F (s)$ is not well understood, but $F (s) = \mathbb{R}^{2}$ is a common choice, with the standard basis vectors interpreted as ``true'' and ``false''. Given a grammatical parsing such as $n n^{r} s n^{l} n \leq s$, we automatically get a linear map \begin{displaymath} F (n n^{r} s n^{l} n) : F (n) \otimes F (n) \otimes F (s) \otimes F (n) \otimes F (n) \to F (s) \end{displaymath} given by appropriate tensor contractions. The final ingredient we need are \emph{word vectors}. We need to pick vectors $[\![ Alice ]\!], [\![ Bob ]\!] \in F (n)$ and $[\![ loves ]\!] \in F (n) \otimes F (s) \otimes F (n)$. The choice of these vectors is also a matter for linguistics, but a common idea is to count how often Alice (for example) appears in a corpus (for example the full text of Wikipedia) close to each of the chosen basis words. Finally, we obtain a sentence-vector \begin{displaymath} F (n n^{r} s n^{l} n \leq s) ([\![ Alice ]\!] \otimes [\![ loves ]\!] \otimes [\![ Bob ]\!]) \in F (s) \end{displaymath} \hypertarget{relative_pronouns_and_frobenius_algebras}{}\subsection*{{Relative pronouns and Frobenius algebras}}\label{relative_pronouns_and_frobenius_algebras} \hypertarget{free_pregroups_vs_free_rigid_monoidal_categories}{}\subsection*{{Free pregroups vs free rigid monoidal categories}}\label{free_pregroups_vs_free_rigid_monoidal_categories} All earlier papers on DisCoCat use free pregroups for the grammar category, building on earlier work by [[Joachim Lambek]] on pregroup grammars. Unfortunately, in \hyperlink{Preller14}{Preller 2014, fact 1} it is proven that any strong monoidal functor from a free pregroup to $FVect$ is necessarily trivial, in the sense that it sends every generator to the monoidal unit. One should instead use a free [[rigid monoidal category]], a kind of [[categorification]]. Morphisms in the free autonomous category can be viewed as [[proof relevance|proof relevant]] grammatical reductions. They may be encoded as [[string diagrams]], see [[pregroup grammar]]. This allows a slightly more elegant reformulation of our basic example. Let $\mathcal{C}$ be the free autonomous category on the objects $n, s$ and the morphisms $Alice : 1 \to n$, $Bob : 1 \to n$ and $loves : 1 \to n^{r} s n^{l}$. Then a sentence such as ``Alice loves Bob'', together with its grammaticality, is witnessed by a morphism $f : 1 \to s$. Now the word-vectors $[\![ Alice ]\!] = F (Alice)$, $[\![ Bob ]\!] = F (Bob)$ and $[\![ loves ]\!] = F (loves)$ become part of the data defining $F : \mathcal{C} \to FVect$, and the resulting sentence vector is simply $F (f)$. \hypertarget{the_category_of_discocat_models}{}\subsection*{{The Category of DisCoCat Models}}\label{the_category_of_discocat_models} One criticism of DisCoCat is that a single model is unlikely to be complex enough to capture the intricacies of a natural language. A response to this criticism is that DisCoCat models should only model a given fragment of language with some level of detail. These models can then be combined or updated to represent more complex fragments of natural language. Indeed, in \emph{\href{https://arxiv.org/abs/1811.11041}{Translating and Evolving: Towards a Model of Language Change in DisCoCat}} the authors construct a category $DisCoCat$ of DisCoCat models where \begin{itemize}% \item objects are [[strong monoidal functors]] \begin{displaymath} F \colon (J,*) \to (FVect,\otimes) \end{displaymath} where $(J,*)$ is a category which is freely monoidal on some set of grammatical types. In practice $J$ might be freely equipped with an [[rigid monoidal category|rigid]] structure or a [[Frobenius algebra]] on each object. \item A morphism from a language model $F \colon J \to FVect$ to a language model $F' \colon J' \to FVect$ is a tuple $(j , \alpha)$ where $j$ is a [[monoidal functor]] $i \colon J \to J'$ and $\alpha \colon F \Rightarrow F' \circ j$ is a [[monoidal natural transformation]] filling the following triangle $\backslash$begin\{centre\} $\backslash$begin\{xymatrix\} J$\backslash$arr{\tt \symbol{94}}F $\backslash$ard\emph{j\& FVect $\backslash$ J' $\backslash$arur{\tt \symbol{94}}\{F'\}$\backslash$ \& $\backslash$end\{xymatrix\} $\backslash$end\{centre\} Morphisms in $DisCoCat$ are called translations because they represent ways of changing your semantic interpretations of grammatical types in a way which is coherent with a change in grammar.} \end{itemize} \hypertarget{the_product_space_representation}{}\subsubsection*{{The Product Space Representation}}\label{the_product_space_representation} In \href{https://arxiv.org/abs/1003.4394}{\emph{Mathematical foundations for a compositional distributional model of meaning}} a different description of a DisCoCat model was described. Let $J$ be a free [[autonomous category]] representing grammar and assume that you have an assignment $V_a$ of each grammatical type $a$ to a finite dimensional vector space. Then grammatical computations of meaning can be performed in the [[product category]] $J \times FVect$. Let $a_1 \cdot \ldots \cdot a_n$ be an object in $J$ and let $v \in V_{a_1} \otimes \ldots \otimes V_{a_n}$ be its semantic meaning. Then a grammatical reduction $f \colon a \to b$ built from the units and counits in $J$ can be paired with the corresponding structure maps in $FVect$. This pairing allows you to apply the structure maps corresponding to $f$ to the vector $v$ to get a new semantic meaning. In essence, this approach identifies an autonomous subcategory of $J \times FVect$ where meaning computations can occur. This product space representation can be related to monoidal functor perspective via the [[category of elements]]. Using the forgetful functor $i \colon FVect \to Set$ the product space of a language model $F \colon J \to FVect$ can be defined as the category of elements $\int i \circ F$. The product space representation is useful for equipping a language model with a specific set of words. If $W$ is a set of words then a map $W \to \int i \circ F$ describes an assignment of each word to a grammatical type and semantic meaning. \hypertarget{variations}{}\subsection*{{Variations}}\label{variations} DisCoCat is relatively easy to modify by replacing the semantic category $FVect$ with some other category with the appropriate structure. Examples include \begin{itemize}% \item [[relation|Relations]], which yields a semantics in [[regular logic]], closely related to [[cartesian bicategory|Cartesian bicategories]], see \hyperlink{Felice19}{Felice, Meichanetzidis and Toumi 2019} \item [[density matrix|Density matrices]] to model semantic ambiguity such as ``financial bank'' vs ``river bank'' \item Convex relations (i.e. [[relation|relations]] in the category of [[convex space|convex spaces]]) to model cognition (\hyperlink{Bolt16}{Bolt et al 2016}) \item [[game theory|Games]] to model dialogue (\hyperlink{Hedges18}{Hedges and Lewis 2018}) \end{itemize} \hypertarget{references}{}\section*{{References}}\label{references} \begin{itemize}% \item \href{https://golem.ph.utexas.edu/category/2018/02/linguistics_using_category_the.html}{Linguistics using category theory} on the n-category café \item \href{https://golem.ph.utexas.edu/category/2018/03/cognition_convexity_and_catego.html}{Cognition, convexity and category theory} on the n-category café \item \href{https://golem.ph.utexas.edu/category/2019/06/meeting_the_dialogue_challenge.html}{Meeting the Dialogue Challenge} on the n-category café \item [[Bob Coecke]], [[Mehrnoosh Sadrzadeh]] and [[Stephen Clark]], \emph{Mathematical foundations for a compositional distributional model of meaning}. Lambek Festschrift, special issue of Linguistic Analysis, 2010. (\href{https://arxiv.org/abs/1003.4394}{arXiv:1003.4394}) \item [[Anne Preller]], \emph{From logical to distributional methods}. QPL 2013. (\href{https://arxiv.org/abs/1412.8527}{arXiv:1412.8527}) \item [[Josef Bolt]], [[Bob Coecke]], [[Fabrizio Genovese]], [[Martha Lewis]], [[Daniel Marsden]] and [[Robin Piedeleu]], \emph{Interacting conceptual spaces I: Grammatical composition of concepts}, SLPCS 2016 (\href{https://arxiv.org/abs/1703.08314}{arXiv:1703.08314} \item [[Giovanni de Felice]], [[Konstantinos Meichanetzidis]] and [[Alexis Toumi]], \emph{Functorial Question Answering}, ACT 2019. (\href{https://arxiv.org/abs/1905.07408}{arXiv:1905.07408}]) \item [[Jules Hedges]] and [[Martha Lewis]], \emph{Towards functorial language-games}, CAPNS 2018. (\href{https://arxiv.org/abs/1807.07828}{arXiv:1807.07828}) \end{itemize} The category $DisCoCat$ and it's relationship to the product space representation is discussed in: \begin{itemize}% \item [[Tai-Danae Bradley]], [[Martha Lewis]], [[Jade Master]], and [[Brad Theilman]] \emph{Translating and Evolving: Towards a Model of Language Change in DisCoCat} \href{https://arxiv.org/abs/1811.11041}{arXiv:1811.11041} \end{itemize} [[!redirects DisCoCat]] \end{document}