{"id":594,"date":"2008-02-10T21:28:08","date_gmt":"2008-02-10T21:28:08","guid":{"rendered":"http:\/\/scientopia.org\/blogs\/goodmath\/2008\/02\/10\/abstract-algebra-and-computation-monoids\/"},"modified":"2008-02-10T21:28:08","modified_gmt":"2008-02-10T21:28:08","slug":"abstract-algebra-and-computation-monoids","status":"publish","type":"post","link":"http:\/\/www.goodmath.org\/blog\/2008\/02\/10\/abstract-algebra-and-computation-monoids\/","title":{"rendered":"Abstract Algebra and Computation &#8211; Monoids"},"content":{"rendered":"<p> In the last couple of posts, I showed how we can start looking at group<br \/>\ntheory from a categorical perspective. The categorical approach gives us a<br \/>\ndifferent view of symmetry that we get from the traditional algebraic<br \/>\napproach: in category theory, we see symmetry from the viewpoint of<br \/>\ngroupoids &#8211; where a group, the exemplar of symmetry, is seen as an<br \/>\nexpression of the symmetries of a simpler structure.<\/p>\n<p> We can see similar things as we climb up the stack of abstract algebraic<br \/>\nconstructions. If we start looking for the next step up in algebraic<br \/>\nconstructions, the <a href=\"http:\/\/scientopia.org\/blogs\/goodmath\/2007\/12\/building-up-more-from-groups-to-rings\">rings<\/a>, we can see a very different view of<br \/>\nwhat a ring is.<\/p>\n<p> Before we can understand the categorical construction of rings, we need<br \/>\nto take a look at some simpler constructions. Rings are expressed in<br \/>\ncategories via monoids. Monoids are wonderful things in their own right, not<br \/>\njust as a stepping stone to rings in abstract algebra. <\/p>\n<p> What makes them so interesting? Well, first, they&#8217;re a solid bridge<br \/>\nbetween the categorical and algebraic views of things. We saw how the<br \/>\ncategory theoretic construction of groupoids put group theory on a nice<br \/>\nfooting in category theory. Monoids can do the same in the other direction:<br \/>\nthey&#8217;re in some sense the abstract algebraic equivalent of categories.<br \/>\nBeyond that, monoids actually have down-to-earth practical applications &#8211;<br \/>\nyou can use monoids to describe computation, and in fact, many of the<br \/>\nfundamental automatons that we use in computer science are, semantically,<br \/>\nmonoids.<\/p>\n<p><!--more--><\/p>\n<p> Let&#8217;s start with the algebraic view &#8211; we&#8217;ll look at that, and then we&#8217;ll<br \/>\nshift gears and see how it looks categorically. In terms of abstract<br \/>\nalgebra, a monoid is an algebraic structure which captures the basic idea of<br \/>\n<em>function composition<\/em>. That should be ringing some bells &#8211; the<br \/>\nfundamental concept of category theory is an abstract view of function<br \/>\ncomposition!<\/p>\n<p> A monoid is, like a group, a set of values with a single binary<br \/>\noperation. The monoid is a simpler construct though &#8211; since all it captures<br \/>\nis the idea of composition, it doesn&#8217;t need inverses. For a monoid, we say<br \/>\nthat it&#8217;s a set of values, M, and a binary operation &ordm;, with three<br \/>\nproperties:<\/p>\n<ol>\n<li> <em>Closure<\/em>: &forall;a,m&isin;M: a&ordm;b &isin; M<\/li>\n<li> <em>Identity<\/em>: &exist; i&isin;M : &forall;f&isin;M : i&ordm;f = f&ordm;i = f.<\/li>\n<li> <em>Associativity<\/em>: &forall; a,b,c&isin;M: (a&ordm;b)&ordm;c = a&ordm;(b&ordm;c).<\/li>\n<\/ol>\n<p> That&#8217;s really it. If you think of those properties in terms of functions<br \/>\nand function composition, they all make really good sense. They&#8217;re looking<br \/>\nat the most canonical form of functions &#8211; so all functions are treated as<br \/>\nbeing, roughly, functions from natural numbers to natural numbers. Closure<br \/>\nsays that if I&#8217;ve got two simple total functions a and b, then composing a<br \/>\nand b is also a simple total function. Identity says that there&#8217;s a function<br \/>\nf(x)=x which composes properly. And associativity says shifting the order in<br \/>\nwhich I evaluate compositions doesn&#8217;t change the resulting composed<br \/>\nfunction. Those are all very natural properties of function composition.<\/p>\n<p> What happens if we treat a monoid like a group, and try to use it as an<br \/>\naction? The answer is near and dear to the hearts of computer science folks<br \/>\nlike me: what you get is basically a finite state machine!<\/p>\n<p> Take a monoid, (M,&ordm;). We can define an <em>action<\/em> of the<br \/>\nmonoid on a set S. The action is an operation *:M&times;S&rarr;S &#8211; that is,<br \/>\nfrom a value in M and a value in S to a value in S. This <em>monoid<br \/>\naction<\/em> of M on S has two properties &#8211; which are basically just<br \/>\nextensions of the monoid properties through the action:<\/p>\n<ol>\n<li> <em>Identity<\/em>: &forall;s&isin;S, i*s=s.<\/li>\n<li> <em> Associativity<\/em>: &forall;a,b&isin;M, &forall;s&isin;S: a*(b*s) = (a&ordm;b)*s.<\/li>\n<\/ol>\n<p> What&#8217;s that mean? What we&#8217;ve done is add <em>function application<\/em><br \/>\nto the monoid. The monoidal operation is the application of the functions in<br \/>\nM. <\/p>\n<p> So, what do we get if we have a collection of related composable<br \/>\nfunctions that can be applied to particular set of values?<\/p>\n<p> An automaton &#8211; that is, a mathematical model of a computing device.<\/p>\n<p> How&#8217;s that an automaton?<\/p>\n<p><p> With the monoidal operator, each member of the monoid is a<br \/>\n<em>function<\/em>, which maps a values to values. Monoidal composition<br \/>\nchains those functions together. In terms of automata, each member of the<br \/>\nmonoid is a <em>step<\/em> in a computation. Monoidal composition is chaining<br \/>\nthe steps of a computation in the automaton together in sequence. It&#8217;s not<br \/>\nquite full computation yet &#8211; but it&#8217;s a huge step towards it, in an<br \/>\nextremely simple form.<\/p>\n<p> Think about it just a tad more. Remember <a href=\"http:\/\/scienceblogs.com\/goodmath\/2006\/08\/a_lambda_calculus_rerun_1.php\">lambda<br \/>\ncalculus<\/a>? Lambda calculus is a tool from logic for describing<br \/>\ncomputation in terms of nothing but functions. Guess what? We&#8217;ve just<br \/>\nrecreated a substantial part of lambda calculus coming at it from the<br \/>\ndirection of abstract algebra.<\/p>\n<p> I&#8217;ll have more to say about that in future posts &#8211; but first I&#8217;ll need<br \/>\nto show you what this all looks like in terms of category theory &#8211; because<br \/>\nthe next big step is clearest in category land.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last couple of posts, I showed how we can start looking at group theory from a categorical perspective. The categorical approach gives us a different view of symmetry that we get from the traditional algebraic approach: in category theory, we see symmetry from the viewpoint of groupoids &#8211; where a group, the exemplar [&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":[69],"tags":[],"class_list":["post-594","post","type-post","status-publish","format-standard","hentry","category-abstract-algebra"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4lzZS-9A","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/594","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=594"}],"version-history":[{"count":0,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/594\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/media?parent=594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/categories?post=594"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/tags?post=594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}