{"id":1643,"date":"2012-01-03T09:44:37","date_gmt":"2012-01-03T14:44:37","guid":{"rendered":"http:\/\/scientopia.org\/blogs\/goodmath\/?p=1643"},"modified":"2012-01-03T09:44:37","modified_gmt":"2012-01-03T14:44:37","slug":"categorical-computation-characterized-by-closed-cartesian-categories","status":"publish","type":"post","link":"http:\/\/www.goodmath.org\/blog\/2012\/01\/03\/categorical-computation-characterized-by-closed-cartesian-categories\/","title":{"rendered":"Categorical Computation Characterized By Closed Cartesian Categories"},"content":{"rendered":"<p> One of my favorite categorical structures is a thing called a <em>closed cartesian category<\/em>, or CCC for short. Since I&#8217;m a computer scientist\/software engineer, it&#8217;s a natural: CCCs are, basically, the categorical structure of lambda calculus &#8211; and thus, effectively, a categorical model of computation. However, before we can talk about the CCCs, we need &#8211; what else? &#8211; more definitions.<\/p>\n<h3>Cartesian Categories<\/h3>\n<p> A <em>cartesian category<\/em> <img src='http:\/\/l.wordpress.com\/latex.php?latex=C&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='C' style='vertical-align:1%' class='tex' alt='C' \/> (note <em>not<\/em> cartesian <em>closed<\/em> category) is a category:<\/p>\n<ol>\n<li> With a terminal object <img src='http:\/\/l.wordpress.com\/latex.php?latex=t&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='t' style='vertical-align:1%' class='tex' alt='t' \/>, and<\/li>\n<li> <img src='http:\/\/l.wordpress.com\/latex.php?latex=forall%20a%2C%20b%20in%20Obj%28C%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='forall a, b in Obj(C)' style='vertical-align:1%' class='tex' alt='forall a, b in Obj(C)' \/>, the objects and arrows of the categorical product <img src='http:\/\/l.wordpress.com\/latex.php?latex=a%20times%20b%20in%20C&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='a times b in C' style='vertical-align:1%' class='tex' alt='a times b in C' \/>.<\/li>\n<\/ol>\n<p> So, a cartesian category is a category closed with respect to product. Many of the common categories are cartesian:  the category of  sets, and the category of enumerable sets,  And of course, the meaning of the categorical product in set? Cartesian product of sets.<\/p>\n<h3>Categorical Exponentials<\/h3>\n<p> To get from cartesian categories to cartesian <em>closed<\/em> categories, we also need to define categorical <em>exponentials<\/em>. Like categorical product, the value of a categorical exponential is not <em>required<\/em> to included in a category. The exponential is a complicated definition, and it&#8217;s a bit hard to really get your head around, but it&#8217;s well worth the effort. If categorical products are the categorical generalization of set products, then the categorical exponential is the categorical version of a function space. It gives us the ability to talk about structures that are the generalized version of &#8220;all functions from A to B&#8221;.<\/p>\n<p> Given two objects x and y from a category C, their <em>categorical exponential<\/em> x<sup>y<\/sup>, if it exists in the category, is defined by a set of values:<\/p>\n<ul>\n<li> An object <img src='http:\/\/l.wordpress.com\/latex.php?latex=x%5Ey&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='x^y' style='vertical-align:1%' class='tex' alt='x^y' \/>,<\/li>\n<li> An arrow <img src='http:\/\/l.wordpress.com\/latex.php?latex=mbox%7Beval%7D_%7By%2Cx%7D%3A%20x%5Ey%20times%20y%20rightarrow%20x&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='mbox{eval}_{y,x}: x^y times y rightarrow x' style='vertical-align:1%' class='tex' alt='mbox{eval}_{y,x}: x^y times y rightarrow x' \/>, called an <em>evaluation map<\/em>.<\/li>\n<li> <img src='http:\/\/l.wordpress.com\/latex.php?latex=forall%20z%20in%20Obj%28C%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='forall z in Obj(C)' style='vertical-align:1%' class='tex' alt='forall z in Obj(C)' \/>, an operation <img src='http:\/\/l.wordpress.com\/latex.php?latex=Lambda_C%3A%20%28z%20times%20y%20rightarrow%20x%29%20rightarrow%20%28z%20rightarrow%20x%5Ey%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='Lambda_C: (z times y rightarrow x) rightarrow (z rightarrow x^y)' style='vertical-align:1%' class='tex' alt='Lambda_C: (z times y rightarrow x) rightarrow (z rightarrow x^y)' \/>. (That is, an operation mapping from arrows to arrows.)<\/li>\n<\/ul>\n<p> These values must have the following properties:<\/p>\n<ol>\n<li><img src='http:\/\/l.wordpress.com\/latex.php?latex=forall%20f%20%3A%20z%20times%20y%20rightarrow%20x%2C%20g%20%3A%20z%20rightarrow%20x%5Ey&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='forall f : z times y rightarrow x, g : z rightarrow x^y' style='vertical-align:1%' class='tex' alt='forall f : z times y rightarrow x, g : z rightarrow x^y' \/>:\n<ul>\n<li> <img src='http:\/\/l.wordpress.com\/latex.php?latex=mbox%7Bval%7D_%7By%2Cx%7D%20circ%20%28Lambda_C%28f%29times%201_y%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='mbox{val}_{y,x} circ (Lambda_C(f)times 1_y)' style='vertical-align:1%' class='tex' alt='mbox{val}_{y,x} circ (Lambda_C(f)times 1_y)' \/><\/li>\n<li> <img src='http:\/\/l.wordpress.com\/latex.php?latex=forall%20f%20%3A%20z%20times%20y%20rightarrow%20x%2C%20g%20%3A%20z%20rightarrow%20x%5Ey%3A%20Lambda_C%28mbox%7Beval%7D_%7By%2Cx%7D%20circ%20%28z%20times%201_y%29%20%3D%20z&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='forall f : z times y rightarrow x, g : z rightarrow x^y: Lambda_C(mbox{eval}_{y,x} circ (z times 1_y) = z' style='vertical-align:1%' class='tex' alt='forall f : z times y rightarrow x, g : z rightarrow x^y: Lambda_C(mbox{eval}_{y,x} circ (z times 1_y) = z' \/><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>To make that a bit easier to understand, let&#8217;s turn it into a diagram.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"exponent.jpg\" src=\"https:\/\/i0.wp.com\/scientopia.org\/img-archive\/goodmath\/img_9.jpg?resize=155%2C157\" width=\"155\" height=\"157\" \/><\/p>\n<p> As I alluded to earlier, you can also think of it as a generalization of a function space.<img src='http:\/\/l.wordpress.com\/latex.php?latex=x%5Ey&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='x^y' style='vertical-align:1%' class='tex' alt='x^y' \/> is the set of all functions from y to x.  The evaluation map is simple description in categorical terms of an operation that applies a function from a to b (an arrow) to a value from a, resulting in an a value from b.<\/p>\n<p> So what does the categorical exponential mean? I think it&#8217;s easiest to explain in terms of sets and functions first, and then just step it back to the more general case of objects and arrows.<\/p>\n<p> If X and Y are sets, then <img src='http:\/\/l.wordpress.com\/latex.php?latex=X%5EY&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='X^Y' style='vertical-align:1%' class='tex' alt='X^Y' \/> is the set of functions from Y to X.<\/p>\n<p> Now, look at the diagram:<\/p>\n<ol>\n<li> The top part says, basically, that <img src='http:\/\/l.wordpress.com\/latex.php?latex=g&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='g' style='vertical-align:1%' class='tex' alt='g' \/> is a function from  <img src='http:\/\/l.wordpress.com\/latex.php?latex=Z&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='Z' style='vertical-align:1%' class='tex' alt='Z' \/> to to <img src='http:\/\/l.wordpress.com\/latex.php?latex=X%5EY&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='X^Y' style='vertical-align:1%' class='tex' alt='X^Y' \/>: so <img src='http:\/\/l.wordpress.com\/latex.php?latex=g&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='g' style='vertical-align:1%' class='tex' alt='g' \/> takes a member of <img src='http:\/\/l.wordpress.com\/latex.php?latex=Z&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='Z' style='vertical-align:1%' class='tex' alt='Z' \/>, and uses it to select a function from <img src='http:\/\/l.wordpress.com\/latex.php?latex=Y&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='Y' style='vertical-align:1%' class='tex' alt='Y' \/> to <img src='http:\/\/l.wordpress.com\/latex.php?latex=X&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='X' style='vertical-align:1%' class='tex' alt='X' \/>.<\/li>\n<li> The vertical arrow says:\n<ol>\n<li> given the pair <img src='http:\/\/l.wordpress.com\/latex.php?latex=%28z%2Cy%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='(z,y)' style='vertical-align:1%' class='tex' alt='(z,y)' \/>, <img src='http:\/\/l.wordpress.com\/latex.php?latex=f%28z%2Cy%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='f(z,y)' style='vertical-align:1%' class='tex' alt='f(z,y)' \/> maps <img src='http:\/\/l.wordpress.com\/latex.php?latex=%28z%2Cy%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='(z,y)' style='vertical-align:1%' class='tex' alt='(z,y)' \/> to a value in <img src='http:\/\/l.wordpress.com\/latex.php?latex=X&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='X' style='vertical-align:1%' class='tex' alt='X' \/>.<\/li>\n<li>given a pair <img src='http:\/\/l.wordpress.com\/latex.php?latex=%28z%2Cy%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='(z,y)' style='vertical-align:1%' class='tex' alt='(z,y)' \/>, we&#8217;re going through a function. It&#8217;s almost like currying:\n<ol>\n<li> The vertical arrow going down is basically taking <img src='http:\/\/l.wordpress.com\/latex.php?latex=g%28z%2Cy%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='g(z,y)' style='vertical-align:1%' class='tex' alt='g(z,y)' \/>, and currying it to <img src='http:\/\/l.wordpress.com\/latex.php?latex=g%28z%29%28y%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='g(z)(y)' style='vertical-align:1%' class='tex' alt='g(z)(y)' \/>.<\/li>\n<li> Per the top part of the diagram, <img src='http:\/\/l.wordpress.com\/latex.php?latex=g%28z%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='g(z)' style='vertical-align:1%' class='tex' alt='g(z)' \/> selects a function from <img src='http:\/\/l.wordpress.com\/latex.php?latex=y&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='y' style='vertical-align:1%' class='tex' alt='y' \/> to <img src='http:\/\/l.wordpress.com\/latex.php?latex=x&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='x' style='vertical-align:1%' class='tex' alt='x' \/>. (That is, a member of <img src='http:\/\/l.wordpress.com\/latex.php?latex=X%5EY&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='X^Y' style='vertical-align:1%' class='tex' alt='X^Y' \/>.)<\/li>\n<li> So, at the end of the vertical arrow, we have a pair <img src='http:\/\/l.wordpress.com\/latex.php?latex=%28g%28z%29%2C%20y%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='(g(z), y)' style='vertical-align:1%' class='tex' alt='(g(z), y)' \/>.<\/li>\n<\/ol>\n<\/li>\n<li> The &#8220;eval&#8221; arrow maps from the pair of a function and a value to the result of applying the function to the value.<\/li>\n<\/ol>\n<h3>Cartesian Closed Categories<\/h3>\n<p> Now &#8211; the abstraction step is actually kind of easy: all we&#8217;re doing is saying that there is a <em>structure<\/em> of mappings from object to object here. This particular structure has the essential properties of what it means to apply a function to a value. The internal values and precise meanings of the arrows connecting the values can end up being different things, but no matter what, it will come down to something very much like function application.<\/p>\n<p> With exponentials and products, we can finally say what the cartesian closed categories (CCCs).  A <em>Cartesian closed category<\/em> is a category that is closed with respect to both products and exponentials.<\/p>\n<p> Why do we care? Well, the CCCs are in a pretty deep sense equivalent to the simply typed lambda calculus. That means that the CCCs are deeply tied to the fundamental nature of computation. The <em>structure<\/em> of the CCCs &#8211; with its closure WRT product and exponential &#8211; is an expression of the basic capability of an effective computing system. So next, we&#8217;ll take a look at a couple of examples of what we can do with the CCCs as a categorical model of computation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of my favorite categorical structures is a thing called a closed cartesian category, or CCC for short. Since I&#8217;m a computer scientist\/software engineer, it&#8217;s a natural: CCCs are, basically, the categorical structure of lambda calculus &#8211; and thus, effectively, a categorical model of computation. However, before we can talk about the CCCs, we need [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[76,32],"tags":[122,132],"class_list":["post-1643","post","type-post","status-publish","format-standard","hentry","category-category-theory","category-lambda-calculus","tag-category-theory-2","tag-computation-2"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4lzZS-qv","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/1643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/comments?post=1643"}],"version-history":[{"count":0,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/1643\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/media?parent=1643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/categories?post=1643"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/tags?post=1643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}