{"id":1902,"date":"2014-07-04T10:16:46","date_gmt":"2014-07-04T14:16:46","guid":{"rendered":"https:\/\/scottaaronson.blog\/?p=1902"},"modified":"2016-12-10T04:37:32","modified_gmt":"2016-12-10T09:37:32","slug":"the-power-of-the-digi-comp-ii-my-first-conscious-paperlet","status":"publish","type":"post","link":"https:\/\/scottaaronson.blog\/?p=1902","title":{"rendered":"The Power of the Digi-Comp II: My First Conscious Paperlet"},"content":{"rendered":"<p><em><strong>Foreword:<\/strong> Right now, I have a painfully-large stack of unwritten research papers. \u00a0Many of these are &#8220;paperlets&#8221;: cool things I noticed\u00a0that I want\u00a0to tell people\u00a0about, but\u00a0that would require a lot more development before they became\u00a0competitive for any major\u00a0theoretical computer science conference. \u00a0And what with the baby, I simply don&#8217;t have time anymore for the kind of obsessive, single-minded, all-nighter-filled effort needed to bulk\u00a0my paperlets up. \u00a0So starting today, I&#8217;m going to try turning some of my paperlets into blog posts. \u00a0I don&#8217;t mean advertisements or sneak previews for papers, but <strong>replacements<\/strong> for papers: blog posts that constitute the entirety of what I have\u00a0to say for now about some research topic. \u00a0&#8220;Peer reviewing&#8221; (whether signed or\u00a0anonymous) can take place in the comments section, and &#8220;citation&#8221; can be done by URL. \u00a0The hope is that, much like with 17<sup>th<\/sup>-century scientists who communicated results by letter, this will make it easier to get my\u00a0paperlets done: after all, I&#8217;m not writing Official Papers, just blogging for\u00a0colleagues and\u00a0friends.<\/em><\/p>\n<p><em>Of course, I&#8217;ve often basically\u00a0done this before&#8212;as have many other academic bloggers&#8212;but now I&#8217;m going to go about it more consciously. \u00a0I&#8217;ve thought\u00a0for years\u00a0that the Internet would\u00a0eventually change the norms of scientific\u00a0publication much\u00a0more radically than it so far has: that yes, instant-feedback tools like blogs and StackExchange and MathOverflow\u00a0might have another decade or two at the periphery of progress, but their eventual destiny is at the center. \u00a0And now that I have tenure, it hit\u00a0me that I can do more than prognosticate about such things. \u00a0I&#8217;ll start small: I won&#8217;t go direct-to-blog\u00a0for big papers, papers that cry out for\u00a0LaTeX formatting, or joint papers. \u00a0I\u00a0certainly won&#8217;t do it\u00a0for papers\u00a0with students who need official publications for their professional advancement. \u00a0But for things like today&#8217;s post&#8212;on the power of a wooden mechanical computer now installed in the lobby of the building\u00a0where I work&#8212;I hope you agree that the Science-by-Blog Plan fits well.<\/em><\/p>\n<p><em>Oh, by the way, happy July 4<sup>th<\/sup> to American readers! \u00a0I hope you find that a paperlet about the logspace-interreducibility of a few\u00a0not-very-well-known computational models captures everything that the holiday is about.<\/em><\/p>\n<hr \/>\n<h2><strong>The Power of the Digi-Comp II<\/strong><\/h2>\n<p>by Scott Aaronson<\/p>\n<h3><strong>Abstract<\/strong><\/h3>\n<p>I study the Digi-Comp II, a wooden mechanical computer whose only moving parts are balls, switches, and toggles. \u00a0I show that the problem of simulating (a natural abstraction of) the Digi-Comp, with a polynomial number of balls, is complete for <a href=\"http:\/\/en.wikipedia.org\/wiki\/CC_(complexity)\"><strong>CC<\/strong><\/a> (Comparator Circuit), a complexity class defined by Subramanian in 1990 that sits between <strong>NL<\/strong> and <strong>P<\/strong>. \u00a0This explains why the Digi-Comp is capable of addition, multiplication, division, and other arithmetical tasks, and also\u00a0implies new tasks of which the Digi-Comp is\u00a0capable (and that indeed are complete for it), including the Stable Marriage Problem, finding a lexicographically-first perfect matching, and the\u00a0simulation of other Digi-Comps. \u00a0However, it also suggests that the Digi-Comp is <em>not<\/em> a universal computer (not even in the circuit sense), making it a very interesting way to fall short of Turing-universality. \u00a0I observe that even with an exponential number of balls, simulating the Digi-Comp remains in <strong>P<\/strong>, but I leave open the problem of pinning down its complexity more precisely.<\/p>\n<h3><strong>Introduction<\/strong><\/h3>\n<p>To celebrate\u00a0his 60<sup>th<\/sup> birthday, my colleague <a href=\"http:\/\/people.csail.mit.edu\/cel\/\">Charles Leiserson<\/a>\u00a0(who some of you might know as the &#8220;L&#8221; in the <a href=\"http:\/\/www.amazon.com\/Introduction-Algorithms-Thomas-H-Cormen\/dp\/0262033844\">CLRS<\/a>\u00a0algorithms textbook) had a striking contraption installed in the lobby of the MIT Stata Center. \u00a0That contraption, pictured below,\u00a0is a custom-built, supersized version of a wooden mechanical computer from the 1960s called the <a href=\"http:\/\/digicompii.com\/\">Digi-Comp II<\/a>, now manufactured and sold by a company called <a href=\"http:\/\/www.evilmadscientist.com\/\">Evil Mad Scientist<\/a>.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/c2.staticflickr.com\/8\/7438\/11021911356_fce7862821_z.jpg\" alt=\"\" \/><\/p>\n<p><a href=\"http:\/\/www.scottaaronson.com\/talks\/digicomp.mp4\">Click here<\/a> for a short video showing the Digi-Comp&#8217;s operation (and <a href=\"http:\/\/cdn2.evilmadscience.com\/KitInstrux\/DCII-manual.pdf\">here<\/a> for the user&#8217;s manual). \u00a0Basically, the way it works is this: a bunch of balls (little steel balls in the original version, pool balls in the supersized version) start at the top and roll to the bottom, one by one. \u00a0On their way down, the balls may encounter black toggles, which route each incoming ball either left or right. \u00a0Whenever this happens, the weight of the ball flips the toggle\u00a0to the opposite setting: so for example, if a ball goes\u00a0left, then the next ball to encounter the same toggle\u00a0will go right, and the ball after that will go left, and so on. \u00a0The toggles thus\u00a0maintain a &#8220;state&#8221; for the computer, with each toggle\u00a0storing one bit.<\/p>\n<p>Besides the toggles, there are\u00a0also &#8220;switches,&#8221; which the user can set at the beginning to route every incoming ball either left or right, and whose settings aren&#8217;t changed by the balls. \u00a0And then there are various wooden tunnels and ledges, whose function is simply to direct the balls in a desired way as they roll down. \u00a0A ball could reach different locations,\u00a0or even the same\u00a0location in different\u00a0ways, depending on the settings of the toggles and switches\u00a0above that location. \u00a0On the other hand, once we fix\u00a0the toggles and switches, a ball&#8217;s motion\u00a0is completely determined: there&#8217;s no random or chaotic element.<\/p>\n<p>&#8220;Programming&#8221; is done by configuring the toggles and switches\u00a0in some desired\u00a0way, then loading a desired number of balls at the top and letting them go. \u00a0&#8220;Reading the output&#8221; can be done by looking at the final configuration of some subset of the toggles.<\/p>\n<p>Whenever a ball reaches the bottom, it hits a lever\u00a0that causes\u00a0the next ball to be released from the top. \u00a0This ensures that the balls go through the device one at a time, rather than all at once. \u00a0As we&#8217;ll see, however, this is mainly\u00a0for aesthetic reasons, and maybe also for the mechanical reason that the toggles wouldn&#8217;t work properly if two or more\u00a0balls hit them at once. \u00a0The actual logic of the machine doesn&#8217;t care about the\u00a0<em>timing<\/em> of the balls; the sheer <em>number<\/em> of balls that go through is all\u00a0that matters.<\/p>\n<p>The Digi-Comp II, as sold, contains a few other features:\u00a0most notably, toggles that can be controlled by other toggles (or switches). \u00a0But I&#8217;ll defer discussion of that feature to later. \u00a0As we&#8217;ll see, we already get a quite interesting model of computation without it.<\/p>\n<p>One final note: of course the machine that&#8217;s sold has a fixed size and a fixed geometry. \u00a0But for theoretical purposes, it&#8217;s much more interesting to consider an <em>arbitrary<\/em> network of toggles and switches (not necessarily even planar!), with arbitrary size, and with an arbitrary number of balls fed into it. \u00a0(I&#8217;ll give a more formal definition in the next section.)<\/p>\n<h3><strong>The Power of the Digi-Comp<\/strong><\/h3>\n<p>So, what exactly can the Digi-Comp <em>do<\/em>? \u00a0As a first exercise, you should\u00a0convince yourself that, by simply putting a bunch of toggles in a line and initializing them all to &#8220;L&#8221; (that is, Left), it&#8217;s easy to set up\u00a0a <em>binary counter<\/em>. \u00a0In other words, starting from\u00a0the configuration, say, LLL (in which three toggles all point left), as successive balls pass through we can enter the\u00a0configurations RLL, LRL, RRL, etc. \u00a0If we interpret L as 0 and R as 1, and treat the first bit as the least significant, then we&#8217;re simply counting from 0 to 7 in binary. \u00a0With 20 toggles, we could instead count to 1,048,575.<\/p>\n<p><a href=\"https:\/\/scottaaronson.blog\/wp-content\/uploads\/2014\/07\/counter.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1917\" src=\"https:\/\/scottaaronson.blog\/wp-content\/uploads\/2014\/07\/counter-300x110.png\" alt=\"counter\" width=\"300\" height=\"110\" \/><\/a><\/p>\n<p>But counting is not the most interesting\u00a0thing we can do. \u00a0As Charles eagerly demonstrated to me, we can also set up the Digi-Comp to perform binary addition, binary multiplication, sorting, and even long division. \u00a0(<em>Excruciatingly<\/em> <em>slowly<\/em>, of course: the Digi-Comp might need even more work\u00a0to multiply 3\u00d75, than existing quantum computers need\u00a0to factor the result!)<\/p>\n<p>To me, these demonstrations served only as proof that, while Charles might <em>call<\/em> himself a theoretical computer scientist, he&#8217;s really a practical person at heart. \u00a0Why? \u00a0Because a theorist would know that the real question is not what the Digi-Comp can do, but rather what it <em>can&#8217;t<\/em> do! \u00a0In particular, do we have a universal computer on our hands here, or not?<\/p>\n<p>If the answer is\u00a0yes, then it&#8217;s amazing that such a simple contraption of balls and toggles could already take\u00a0us over the threshold of universality. \u00a0Universality would immediately explain <em>why<\/em> the Digi-Comp is capable of multiplication, division, sorting, and so on. \u00a0If, on the other hand, we don&#8217;t have universality, that too is extremely interesting&#8212;for we&#8217;d then face the challenge of explaining how the Digi-Comp can do so\u00a0many things <em>without<\/em> being universal.<\/p>\n<p>It might be said\u00a0that the Digi-Comp is <em>certainly<\/em>\u00a0not a universal computer, since if nothing else, it&#8217;s incapable of infinite loops. \u00a0Indeed, the number of steps that a given Digi-Comp can execute\u00a0is bounded by\u00a0the number of balls, while the number of bits it can store is bounded by\u00a0the number of toggles: clearly we don&#8217;t have a Turing machine. \u00a0This is true, but doesn&#8217;t really\u00a0tell us what we want to know. \u00a0For, as discussed\u00a0in my <a href=\"https:\/\/scottaaronson.blog\/?p=1896\">last post<\/a>, we can consider not only\u00a0Turing-machine universality, but also\u00a0the weaker (but still interesting) notion of <em>circuit-universality<\/em>. \u00a0The latter means the ability to simulate, with reasonable efficiency, any Boolean circuit of AND, OR, and NOT gates&#8212;and hence, in particular, to\u00a0compute any Boolean function on any fixed number of input bits (given enough resources), or to simulate any polynomial-time Turing machine (given polynomial resources).<\/p>\n<p>The formal way to ask whether something is circuit-universal, is to ask whether the problem of simulating the thing is <a href=\"http:\/\/en.wikipedia.org\/wiki\/P-complete\"><strong>P<\/strong>-complete<\/a>. \u00a0Here <strong>P<\/strong>-complete (not to be confused with <strong>NP<\/strong>-complete!) basically means the following:<\/p>\n<p style=\"padding-left: 30px;\"><em>There exists a polynomial p such that any S-step Turing machine computation&#8212;or equivalently, any Boolean circuit with at most S gates&#8212;can be embedded\u00a0into our system if we allow the use of poly(S) computing elements (in our case, balls, toggles, and switches).<\/em><\/p>\n<p>Of course, I need to tell you what I mean by the weasel phrase &#8220;can be embedded into.&#8221; \u00a0After all,\u00a0it wouldn&#8217;t be too\u00a0impressive\u00a0if the Digi-Comp could &#8220;solve&#8221; linear programming, primality testing, or other highly-nontrivial problems, but only via &#8220;embeddings&#8221; in which <em>we<\/em> had to do essentially all the work, just to decide how to configure the toggles and switches! \u00a0The standard way to handle this issue\u00a0is to demand that the embedding be &#8220;computationally simple&#8221;: that is, we should be able to carry out the embedding in <a href=\"http:\/\/en.wikipedia.org\/wiki\/L_(complexity)\"><strong>L<\/strong><\/a> (logarithmic space), or some other complexity class believed to be much smaller than the class (<strong>P<\/strong>, in this case) for which we&#8217;re trying to prove completeness. \u00a0That way, we&#8217;ll be able to say that our\u00a0device really <em>was<\/em> &#8220;doing something essential&#8221;&#8212;i.e., something that our\u00a0embedding procedure couldn&#8217;t efficiently do for itself&#8212;<em>unless<\/em> the larger complexity class collapses with the smaller one (i.e., unless <strong>L<\/strong>=<strong>P<\/strong>).<\/p>\n<p>So then, our question is whether simulating the Digi-Comp II is a\u00a0<strong>P<\/strong>-complete problem under <strong>L<\/strong>-reductions, or alternatively, whether the problem is in some complexity class believed to be smaller than <strong>P<\/strong>. \u00a0The one last thing we need is a formal definition of &#8220;the problem of simulating the Digi-Comp II.&#8221; \u00a0Thus, let DIGICOMP be the following problem:<\/p>\n<p style=\"padding-left: 30px;\">We&#8217;re given as inputs:<\/p>\n<ul style=\"padding-left: 30px;\">\n<li>A directed acyclic graph G, with n vertices. \u00a0There is a designated vertex with indegree 0 and outdegree 1 called the &#8220;source,&#8221; and a designated\u00a0vertex with indegree 1 and outdegree 0 called the &#8220;sink.&#8221; \u00a0Every internal vertex v (that is, every vertex with both incoming and outgoing edges) has exactly two outgoing edges, labeled &#8220;L&#8221; (left) and &#8220;R&#8221; (right), as well as one bit of internal state s(v)\u2208{L,R}.<\/li>\n<li>For each vertex v, an &#8220;initial&#8221; value for its internal state s(v).<\/li>\n<li>A positive integer T (encoded in unary notation), representing the number of balls dropped successively from the source vertex.<\/li>\n<\/ul>\n<p style=\"padding-left: 30px;\">Computation proceeds as follows: each time a ball appears at the source vertex, it traverses the path induced by the L and R states of the vertices that it encounters, until it reaches a terminal vertex, which might or might not be the sink. \u00a0As the ball traverses the path, it flips s(v) for each vertex v that it encounters: L goes to R and R goes to L. \u00a0Then the next ball is dropped in.<\/p>\n<p style=\"padding-left: 30px;\">The problem is to decide whether any balls reach\u00a0the sink.<\/p>\n<p>Here the internal vertices represent\u00a0toggles, and the source represents the chute at the top from which the balls drop. \u00a0Switches aren&#8217;t included, since (by definition) the reduction can simply fix their values to &#8220;L&#8221; to &#8220;R&#8221; and thereby simplify the graph.<\/p>\n<p>Of course we could consider other problems: for example, the problem of deciding whether\u00a0an <em>odd<\/em> number of balls\u00a0reach the sink, or of <em>counting<\/em>\u00a0how many balls reach the sink, or of computing the final value of every state-variable s(v). \u00a0However, it&#8217;s not hard to show that all of these problems are interreducible with the DIGICOMP problem as defined above.<\/p>\n<h3><strong>The Class CC<\/strong><\/h3>\n<p>My main result, in this paperlet, is to pin down the complexity of the\u00a0DIGICOMP problem in terms of a complexity class called <a href=\"http:\/\/en.wikipedia.org\/wiki\/CC_(complexity)\"><strong>CC<\/strong><\/a> (Comparator Circuit): a class that&#8217;s\u00a0obscure enough <em>not<\/em> to be in the Complexity Zoo (!), but that&#8217;s\u00a0been studied in several papers. \u00a0<strong>CC<\/strong> was defined by Subramanian in his 1990 Stanford PhD thesis; around the same time\u00a0<a href=\"http:\/\/www.researchgate.net\/publication\/223226677_The_complexity_of_circuit_value_and_network_stability\/file\/e0b4952868dc5df6c7.pdf\">Mayr and Subramanian<\/a> showed the inclusion\u00a0<strong>NL<\/strong> \u2286\u00a0<strong>CC<\/strong> (the inclusion <strong>CC<\/strong> \u2286\u00a0<strong>P<\/strong> is immediate). \u00a0Recently Cook, Filmus, and L\u00ea revived interest in <strong>CC<\/strong>\u00a0with their paper <a href=\"http:\/\/arxiv.org\/abs\/1208.2721\">The Complexity of the Comparator Circuit Value Problem<\/a>, which is probably the best current source of information about this class.<\/p>\n<p>OK, so what <em>is<\/em> <strong>CC<\/strong>? \u00a0Informally, it&#8217;s the class of problems that you can solve using a\u00a0<em>comparator circuit<\/em>, which is a circuit that maps n bits of input to n bits of output, and whose only allowed operation is to <em>sort<\/em>\u00a0any desired pair of\u00a0bits. \u00a0That is, a comparator circuit can repeatedly apply the transformation (x,y)\u2192(x\u2227y,x\u2228y), in which 00, 01, and 11 all get mapped to themselves, while 10 gets mapped to 01. \u00a0Note that\u00a0there&#8217;s no facility in the circuit for <em>copying<\/em> bits (i.e., for fanout), so sorting could irreversibly destroy information about the input. \u00a0In the <em>comparator circuit value problem<\/em> (or CCV), we&#8217;re given as input a description of a comparator circuit C, along with an input x\u2208{0,1}<sup>n<\/sup> and an index i\u2208[n]; then the problem is to determine the final value of the i<sup>th<\/sup> bit when C is applied to x. \u00a0Then <strong>CC<\/strong>\u00a0is\u00a0simply the class of all languages\u00a0that are <strong>L<\/strong>-reducible to CCV.<\/p>\n<p><a href=\"https:\/\/scottaaronson.blog\/wp-content\/uploads\/2014\/07\/sort.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1918\" src=\"https:\/\/scottaaronson.blog\/wp-content\/uploads\/2014\/07\/sort-163x300.png\" alt=\"sort\" width=\"163\" height=\"300\" srcset=\"https:\/\/scottaaronson.blog\/wp-content\/uploads\/2014\/07\/sort-163x300.png 163w, https:\/\/scottaaronson.blog\/wp-content\/uploads\/2014\/07\/sort.png 357w\" sizes=\"auto, (max-width: 163px) 100vw, 163px\" \/><\/a><\/p>\n<p>As Cook et al. discuss, there are various other characterizations of <strong>CC<\/strong>: for example, rather than using a complete problem, we can define <strong>CC<\/strong> directly as the class of languages computed by uniform families of comparator circuits. \u00a0More strikingly, Mayr and Subramanian showed that <strong>CC<\/strong> has <em>natural complete problems<\/em>, which include (decision versions of) the famous <a href=\"http:\/\/en.wikipedia.org\/wiki\/Stable_marriage_problem\">Stable Marriage Problem<\/a>, as well as\u00a0finding the lexicographically first perfect matching in a bipartite graph. \u00a0So perhaps the most appealing definition of <strong>CC<\/strong> is that it&#8217;s &#8220;the class of problems that can be easily mapped to\u00a0the Stable Marriage Problem.&#8221;<\/p>\n<p>It&#8217;s a wide-open problem whether <strong>CC<\/strong>=<strong>NL<\/strong> or\u00a0<strong>CC<\/strong>=<strong>P<\/strong>: as usual, one can give oracle separations, but as far as anyone knows, either equality could\u00a0hold without any dramatic implications for &#8220;standard&#8221; complexity classes. \u00a0(Of course, the conjunction of these equalities <em>would<\/em> have a dramatic implication.) \u00a0What got Cook et al. interested was that <strong>CC<\/strong>\u00a0isn&#8217;t even known to contain (or be contained in)\u00a0the class <a href=\"http:\/\/en.wikipedia.org\/wiki\/NC_(complexity)\"><strong>NC<\/strong><\/a> of parallelizable problems. \u00a0In particular, linear-algebra problems in <strong>NC<\/strong>, like determinant, matrix inversion, and iterated matrix multiplication&#8212;not to mention other problems in <strong>P<\/strong>, like linear programming and\u00a0greatest common divisor&#8212;might all be examples of problems that are efficiently solvable by Boolean circuits, but <em>not<\/em> by comparator circuits.<\/p>\n<p>One final note about <strong>CC<\/strong>. \u00a0Cook et al. showed the existence of a <em>universal comparator circuit<\/em>: that is, a single comparator circuit C able to simulate any other comparator circuit C&#8217; of some fixed size, given a description of C&#8217; as part of its input.<\/p>\n<h3><strong>DIGICOMP is CC-Complete<\/strong><\/h3>\n<p>I can now proceed to my result: that, rather surprisingly, the Digi-Comp II can solve exactly the problems\u00a0in\u00a0<strong>CC<\/strong>, giving us another characterization of that class.<\/p>\n<p>I&#8217;ll prove this using yet another model of computation, which I call the <em>pebbles model<\/em>. \u00a0In the pebbles model, you start out with a pile of x pebbles; the positive integer x is the &#8220;input&#8221; to your computation. \u00a0Then you&#8217;re allowed to\u00a0apply a straight-line program that consists entirely\u00a0of the following two operations:<\/p>\n<ol>\n<li>Given any pile of y pebbles, you can split it into two piles consisting of \u2308y\/2\u2309 and \u230ay\/2\u230b pebbles\u00a0respectively.<\/li>\n<li>Given any two piles, consisting of y and z pebbles\u00a0respectively, you can combine them into a single pile consisting of y+z pebbles.<\/li>\n<\/ol>\n<p>Your program &#8220;accepts&#8221; if and only if some designated output pile contains at least one\u00a0pebble (or, in a variant that can be shown to be equivalent, if it contains an odd number of pebbles).<\/p>\n<p><a href=\"https:\/\/scottaaronson.blog\/wp-content\/uploads\/2014\/07\/piles.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1916\" src=\"https:\/\/scottaaronson.blog\/wp-content\/uploads\/2014\/07\/piles-274x300.png\" alt=\"piles\" width=\"274\" height=\"300\" \/><\/a><\/p>\n<p>As suggested by the imagery, you don&#8217;t get to make &#8220;backup copies&#8221; of the piles before splitting or combining them: if, for example, you merge y with z to create y+z, then y isn&#8217;t <em>also<\/em> available to be split into \u2308y\/2\u2309 and \u230ay\/2\u230b.<\/p>\n<p>Note that the ceiling and floor functions are the only &#8220;nonlinear&#8221; elements of the pebbles\u00a0model: if not for them, we&#8217;d simply be applying\u00a0a sequence of linear transformations.<\/p>\n<p>I can now divide my <strong>CC<\/strong>-completeness proof into two parts: first, that DIGICOMP (i.e., the problem of simulating the Digi-Comp II) is equivalent to the pebbles\u00a0model, and second, that the pebbles\u00a0model is equivalent to comparator circuits.<\/p>\n<p>Let&#8217;s first show\u00a0the equivalence between DIGICOMP and pebbles. \u00a0The reduction\u00a0is simply this: in a given Digi-Comp,\u00a0each edge will be associated to a pile, with <em>the number of pebbles\u00a0in the pile equal to the total number of balls that ever traverse that edge<\/em>. \u00a0Thus, we have T balls dropped in to the edge incident to the source vertex, corresponding to an initial pile with T pebbles. \u00a0Multiple edges pointing to the same vertex (i.e., fan-in) can be modeled by combining the associated piles into a single pile. \u00a0Meanwhile, a toggle has the effect of <em>splitting<\/em> a pile: if y balls enter the toggle in total, then\u00a0\u2308y\/2\u2309 balls will ultimately exit in whichever\u00a0direction the toggle was pointing initially (whether left or right), and \u230ay\/2\u230b balls will ultimately exit in the other direction. \u00a0It&#8217;s clear that this equivalence works in both directions: not only does it let us simulate any given Digi-Comp by a pebble\u00a0program, it also lets us simulate any\u00a0pebble\u00a0program by a suitably-designed Digi-Comp.<\/p>\n<p>OK, next let&#8217;s show the equivalence between pebbles and comparator circuits. \u00a0As a first step, given any comparator circuit, I claim that we can simulate it by a pebble\u00a0program. \u00a0The way to do it is simply to use a pile of 0 pebbles\u00a0to represent each &#8220;0&#8221; bit, and a pile of 1 pebble\u00a0to represent each &#8220;1&#8221; bit. \u00a0Then, any time we want to sort two bits, we simply merge their corresponding piles, then split the result back into two piles. \u00a0The result? \u00a000 gets mapped to\u00a000, 11 gets mapped to\u00a011, and 01 and 10 both get mapped to one pebble\u00a0in the \u2308y\/2\u2309 pile and zero pebbles\u00a0in the \u230ay\/2\u230b pile. \u00a0At the end, a given pile will have a\u00a0pebble in it\u00a0if and only if the corresponding output bit in the comparator circuit is 1.<\/p>\n<p>One might worry that the input to a comparator circuit is a sequence of bits, whereas I said before that the input to a pebble\u00a0program is just a <em>single<\/em> pile. \u00a0However, it&#8217;s not hard to see that we can deal with this, without leaving the world of logspace reductions, by breaking up an initial pile of n pebbles\u00a0into n piles each of zero pebbles\u00a0or one pebble, corresponding to any desired n-bit string\u00a0(along with some extra pebbles, which we subsequently ignore). \u00a0Alternatively, we could generalize the pebbles\u00a0model so that the input can consist of multiple piles. \u00a0One can show, by a similar &#8220;breaking-up&#8221; trick, that this wouldn&#8217;t affect the pebbles\u00a0model&#8217;s equivalence to the DIGICOMP problem.<\/p>\n<p>Finally, given a pebble\u00a0program, I need to show how to simulate it by a comparator circuit. \u00a0The reduction works as follows:<span style=\"color: #222222;\">\u00a0let T be the number of pebbles we&#8217;re dealing with (or even just an upper bound on that number).\u00a0 Then each pile will\u00a0<\/span><span style=\"color: #222222;\">be represented by its own group\u00a0of T wires in the comparator\u00a0<\/span><span style=\"color: #222222;\">circuit. \u00a0The Hamming weight of those T wires&#8212;i.e., the number of\u00a0<\/span><span style=\"color: #222222;\">them that contain a &#8216;1&#8217; bit&#8212;will equal the number of pebbles in the\u00a0<\/span><span style=\"color: #222222;\">corresponding pile.<\/span><\/p>\n<p><span style=\"color: #222222;\">To merge two piles, we first merge the corresponding groups\u00a0of T wires. \u00a0We t<\/span><span style=\"color: #222222;\">hen use comparator gates to sort the bits in those 2T wires, until\u00a0<\/span><span style=\"color: #222222;\">all the &#8216;1&#8217; bits have been moved into the first T wires. \u00a0Finally, we\u00a0ignore\u00a0<\/span><span style=\"color: #222222;\">the remaining T wires for the remainder of the computation.<\/span><\/p>\n<p><span style=\"color: #222222;\">To split a pile, we first use comparator gates to sort the bits in the T\u00a0<\/span><span style=\"color: #222222;\">wires, until all the &#8216;1&#8217; bits have been moved to the left. \u00a0We then route\u00a0<\/span><span style=\"color: #222222;\">all the odd-numbered wires into &#8220;Pile A&#8221; (the one that&#8217;s supposed to\u00a0<\/span><span style=\"color: #222222;\">get \u2308y\/2\u2309\u00a0pebbles), and route all the even-numbered wires into\u00a0<\/span><span style=\"color: #222222;\">&#8220;Pile B&#8221; (the one that&#8217;s supposed to get \u230ay\/2\u230b\u00a0pebbles). \u00a0<\/span><span style=\"color: #222222;\">Finally, we introduce T additional wires with 0&#8217;s in them, so that piles\u00a0<\/span><span style=\"color: #222222;\">A and B have T wires each.<\/span><\/p>\n<p>At the end, by examining the leftmost wire in the group of wires corresponding to the output pile, we can decide whether that pile ends up with any pebbles in it.<\/p>\n<p>Since it&#8217;s clear that all of the above transformations can be carried out in logspace (or even smaller complexity classes), this completes the proof that DIGICOMP is <strong>CC<\/strong>-complete under <strong>L<\/strong>-reductions. \u00a0As corollaries, the Stable Marriage and lexicographically-first perfect matching problems are <strong>L<\/strong>-reducible to DIGICOMP&#8212;or informally, are solvable by easily-described, polynomial-size Digi-Comp machines (and indeed, characterize the power of such\u00a0machines). \u00a0Combining my result with the universality result of Cook et al., a second corollary is that there exists a &#8220;universal Digi-Comp&#8221;: that is, a single Digi-Comp D that can simulate <em>any other Digi-Comp D&#8217;<\/em> of some polynomially-smaller size, so long as we initialize some subset of the toggles in D to encode a description of D&#8217;.<\/p>\n<h3><strong>How Does the Digi-Comp Avoid Universality?<\/strong><\/h3>\n<p>Let&#8217;s now step back and ask: given that the Digi-Comp is able to do so many things&#8212;division, Stable Marriage, bipartite matching&#8212;how does it <em>fail<\/em> to be a universal computer, at least a circuit-universal one? \u00a0Is the Digi-Comp a counterexample to the oft-repeated claims of people like Stephen Wolfram, about the ubiquity of universal computation and the difficulty of avoiding it in any sufficiently complex system? \u00a0What would need to be added to the Digi-Comp to <em>make<\/em> it circuit-universal? \u00a0Of course, we can ask the same questions about pebble programs\u00a0and comparator circuits, now that we know that they&#8217;re all computationally equivalent.<\/p>\n<p>The reason for the failure of universality is perhaps easiest to see in the case of comparator circuits. \u00a0As Steve Cook pointed out in a talk, comparator circuits are &#8220;1-<a href=\"http:\/\/en.wikipedia.org\/wiki\/Lipschitz_continuity\">Lipschitz<\/a>&#8220;: that is, if you have a comparator circuit acting on n input bits, and you change one of the input bits, your change can affect at most one output bit. \u00a0Why? \u00a0Well, trace through the circuit and use induction. \u00a0So in particular, there&#8217;s no amplification of small effects in comparator circuits, no chaos, no sensitive dependence on initial conditions, no whatever you want to call it. \u00a0Now, while chaos doesn&#8217;t suffice\u00a0for computational universality, at least na\u00efvely it&#8217;s a <em>necessary<\/em> condition, since there exist computations that are chaotic. \u00a0Of course, this simpleminded argument can&#8217;t be all there is to it, since otherwise we would&#8217;ve proved\u00a0<strong>CC<\/strong>\u2260<strong>P<\/strong>. \u00a0What the argument\u00a0<em>does<\/em> show is that, if <strong>CC<\/strong>=<strong>P<\/strong>, then the encoding of a\u00a0Boolean\u00a0circuit into a comparator circuit (or maybe into a collection of such circuits) would need to be subtle and non-obvious: it would need to take computations with the potential for chaos, and reduce them to computations without that potential.<\/p>\n<p>Once we understand this 1-Lipschitz business, we can also see it at work in the pebbles model. \u00a0Given a pebble program, suppose someone surreptitiously\u00a0removed a single pebble from one of the initial piles. \u00a0For want of that pebble, could the whole kingdom be lost? \u00a0Not really. \u00a0Indeed, you can convince yourself that the output will be exactly the same as before, <em>except<\/em> that one output pile will have one fewer pebble than it would have otherwise. \u00a0The reason is again an induction: if you change x by 1, that affects\u00a0at most one of \u2308x\/2\u2309 and\u00a0\u230ax\/2\u230b (and likewise, merging two piles affects at most one pile).<\/p>\n<p>We now see the importance of the point I made earlier, about there being no facility in the piles model for &#8220;copying&#8221; a pile. \u00a0If we could copy piles, then the 1-Lipschitz property would fail. \u00a0And indeed, it&#8217;s not hard to show that in that case, we <em>could<\/em> implement AND, OR, and NOT gates with arbitrary fanout, and would therefore have a circuit-universal computer. \u00a0Likewise, if we could copy bits, then comparator circuits&#8212;which, recall, map (x,y) to (x\u2227y,x\u2228y)&#8212;would implement AND, OR, and NOT with arbitrary fanout, and would be circuit-universal. \u00a0(If you&#8217;re wondering how to implement NOT: one way to do it is to use what&#8217;s known in quantum computing as the &#8220;dual-rail representation,&#8221; where each bit b is encoded by <em>two<\/em> bits, one for b and the other for \u00acb. \u00a0Then a NOT can be accomplished simply by swapping those bits. \u00a0And it&#8217;s not hard to check that comparator gates in a comparator circuit, and combining and splitting two piles in a pebble program, can achieve the desired updates to both the b rails and the \u00acb rails when an AND or OR gate is applied. \u00a0However, we could also just omit NOT gates entirely, and use the fact that computing the output of even a <em>monotone<\/em> Boolean circuit is a <strong>P<\/strong>-complete problem under <strong>L<\/strong>-reductions.)<\/p>\n<p>In summary, then, the <em>inability to amplify small effects<\/em>\u00a0seems like an excellent candidate for the central reason why the power of comparator circuits and pebble programs hits a ceiling at <strong>CC<\/strong>, and doesn&#8217;t go all the way up to <strong>P<\/strong>. \u00a0It&#8217;s interesting, in this connection, that while transistors (and before them, vacuum tubes) can be used to construct logic gates, the original purpose of both of them was simply to <em>amplify information<\/em>: to transform a small signal into a large one. \u00a0Thus, we might say, comparator circuits and pebble programs fail to be computationally universal because they lack transistors or other amplifiers.<\/p>\n<p>I&#8217;d like to apply exactly the same analysis to the Digi-Comp itself: that is, I&#8217;d like to say that the reason the Digi-Comp fails to be universal (unless <strong>CC<\/strong>=<strong>P<\/strong>) is that it, too, lacks the ability to amplify small effects (wherein, for example, the drop of a single ball would unleash a cascade of other balls). \u00a0In correspondence, however, David Deutsch pointed out a problem: namely, if we just watch a Digi-Comp in action, then it certainly <em>looks like<\/em> it has an amplification capability! \u00a0Consider, for\u00a0example, the binary counter discussed earlier. \u00a0Suppose a column of ten toggles is\u00a0in the configuration RRRRRRRRRR, representing the integer 1023. \u00a0Then the next ball to fall down\u00a0will hit all ten toggles in sequence, resetting them to LLLLLLLLLL (and thus, resetting the counter to 0). \u00a0Why isn&#8217;t this precisely the amplification of a small effect that we were looking for?<\/p>\n<p>Well, maybe it&#8217;s\u00a0amplification, but it&#8217;s not of a kind that <em>does what we want<\/em> computationally. \u00a0One way to see the difficulty is that we can&#8217;t take\u00a0all those &#8220;L&#8221; settings we&#8217;ve produced as output, and feed them as inputs to further\u00a0gates in an arbitrary way. \u00a0We could do it if the toggles were arranged in parallel, but they&#8217;re arranged serially, so that flipping\u00a0any one toggle inevitably has the potential also to flip the toggles below it. \u00a0Deutsch describes this as a &#8220;failure of composition&#8221;: in some sense, we <em>do<\/em> have a fan-out or copying operation, but the design of the Digi-Comp prevents us from composing the fan-out operation with other operations in arbitrary ways, and in particular, in the ways that would be needed to simulate any Boolean circuit.<\/p>\n<p>So, what features could we add to the Digi-Comp to <em>make<\/em> it universal? \u00a0Here&#8217;s the simplest possibility I was able to come up with: suppose that, scattered throughout the device, there were balls precariously perched on ledges, in such a way that whenever one was hit by another ball, it would get dislodged, and <em>both<\/em> balls would continue downward. \u00a0We could, of course, chain several of these together, so that the two balls would in turn dislodge four balls, the four would dislodge eight, and so on. \u00a0I invite you to check that <em>this<\/em> would provide the desired fan-out gate, which, when combined with AND, OR, and NOT gates that we know how to implement (e.g., in the dual-rail representation described previously), would allow us to simulate arbitrary Boolean circuits. \u00a0In effect, the precariously perched balls would function as &#8220;transistors&#8221; (of course, painfully\u00a0<em>slow<\/em> transistors, and ones that have to be laboriously reloaded with a ball after every use).<\/p>\n<p>As a\u00a0second\u00a0possibility, Charles Leiserson points out to me that the Digi-Comp, as sold, has a few switches and toggles that can be controlled by other toggles. \u00a0Depending on exactly how one modeled\u00a0this feature, it&#8217;s possible that it, too, could let us implement arbitrary fan-out gates, and thereby boost the Digi-Comp up to circuit-universality.<\/p>\n<h3><strong>Open Problems<\/strong><\/h3>\n<p>My personal favorite open problem is this:<\/p>\n<p style=\"padding-left: 30px;\"><em>What is the complexity of simulating a Digi-Comp II if the total number of balls dropped in is exponential, rather than polynomial? \u00a0(In other words, if the positive integer T, representing the number of balls, is encoded in binary rather than in unary?)<\/em><\/p>\n<p>From the equivalence between the Digi-Comp and pebble programs, we can already derive a conclusion about the above problem that&#8217;s not intuitively obvious: namely, that it&#8217;s in <strong>P<\/strong>. \u00a0Or to say it another way: <em>it&#8217;s possible to predict the exact state of a Digi-Comp with n toggles, after T balls have passed through it, using poly(n, log T) computation steps.<\/em> \u00a0The reason is simply that, if there are T balls, then the total number of balls\u00a0that pass through any given\u00a0edge (the only variable we need to track) can be specified using log<sub>2<\/sub>T bits. \u00a0This, incidentally, gives us a <em>second<\/em> sense in which the Digi-Comp is not a universal computer: namely, even if we let the machine\u00a0&#8220;run for exponential time&#8221; (that is, drop exponentially many\u00a0balls into it), unlike a conventional\u00a0digital computer it can&#8217;t possibly solve all problems in <strong>PSPACE<\/strong>, unless <strong>P<\/strong>=<strong>PSPACE<\/strong>.<\/p>\n<p>However, this situation also presents us with a puzzle: if we let DIGICOMP<sub>EXP<\/sub> be the problem of simulating a Digi-Comp with an exponential number of balls, then it&#8217;s clear that DIGICOMP<sub>EXP<\/sub> is hard for <strong>CC<\/strong> and contained in <strong>P<\/strong>, but we lack any information about its difficulty more precise than that. \u00a0At present, I regard both extremes&#8212;that DIGICOMP<sub>EXP<\/sub>\u00a0is in <strong>CC<\/strong> (and hence, no harder than ordinary DIGICOMP), and that it&#8217;s <strong>P<\/strong>-complete&#8212;as within the realm of possibility (along with the possibility that DIGICOMP<sub>EXP<\/sub>\u00a0is intermediate between the two).<\/p>\n<p>By analogy, one can also consider comparator circuits where the entities\u00a0that get\u00a0compared are integers from 1 to T rather than bits&#8212;and one can then consider the power of such circuits, when T is allowed to grow exponentially. \u00a0In email correspondence, however, Steve Cook sent me a proof\u00a0that such circuits have the same power as standard, Boolean comparator circuits. \u00a0It&#8217;s not clear whether this tells us anything about the power of a Digi-Comp with exponentially many balls.<\/p>\n<p>A second open problem is to formalize the feature of Digi-Comp that Charles mentioned&#8212;namely, toggles and switches controlled by other toggles&#8212;and see whether, under some reasonable formalization, that feature bumps us up to <strong>P<\/strong>-completeness (i.e., to circuit-universality). \u00a0Personally, though, I confess I&#8217;d be even more interested if there were some feature we could add to the machine that gave us a larger class\u00a0than <strong>CC<\/strong>, but that <em>still<\/em> wasn&#8217;t all of <strong>P<\/strong>.<\/p>\n<p>A third problem is to pin down the power of Digi-Comps (or pebble programs, or comparator circuits) that are required to be <em>planar<\/em>. \u00a0While my experience with woodcarving is limited, I\u00a0<em>imagine<\/em>\u00a0that planar or near-planar graphs are a lot easier to carve than arbitrary\u00a0graphs\u00a0(even if the latter present no problems of principle).<\/p>\n<p>A fourth\u00a0problem has to do with the class\u00a0<strong>CC<\/strong> in general, rather than the Digi-Comp in particular, but I can&#8217;t resist mentioning it. \u00a0Let <strong>CC<sub>EXP<\/sub><\/strong>\u00a0be the complexity class that&#8217;s just like <strong>CC<\/strong>, but where the comparator circuit (or pebble program, or Digi-Comp) is exponentially large and specified only implicitly (that is, by a Boolean circuit that, given as input a binary encoding of an integer i, tells you the i<sup>th<\/sup> bit of the comparator circuit&#8217;s description). \u00a0Then it&#8217;s easy to see that <strong>PSPACE<\/strong>\u00a0\u2286 <strong>CC<sub>EXP<\/sub><\/strong>\u00a0\u2286 <strong>EXP<\/strong>. \u00a0Do we have <strong>CC<sub>EXP<\/sub><\/strong>\u00a0= <strong>PSPACE<\/strong> or <strong>CC<sub>EXP<\/sub><\/strong>\u00a0= <strong>EXP<\/strong>? \u00a0If not, then <strong>CC<sub>EXP<\/sub><\/strong>\u00a0would be the first example I&#8217;ve ever seen of a natural complexity class intermediate between <strong>PSPACE<\/strong>\u00a0and <strong>EXP<\/strong>.<\/p>\n<h3><strong>Acknowledgments<\/strong><\/h3>\n<p>I thank Charles Leiserson for bringing the Digi-Comp II to MIT, and thereby inspiring this &#8220;research.&#8221; \u00a0I also thank Steve Cook, both for giving a talk that first brought the complexity class <strong>CC<\/strong> to my attention, and for helpful correspondence. \u00a0Finally I thank David Deutsch for the point about composition.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Foreword: Right now, I have a painfully-large stack of unwritten research papers. \u00a0Many of these are &#8220;paperlets&#8221;: cool things I noticed\u00a0that I want\u00a0to tell people\u00a0about, but\u00a0that would require a lot more development before they became\u00a0competitive for any major\u00a0theoretical computer science conference. \u00a0And what with the baby, I simply don&#8217;t have time anymore for the kind [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_feature_clip_id":0,"_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},"_wpas_customize_per_network":false},"categories":[5],"tags":[],"class_list":["post-1902","post","type-post","status-publish","format-standard","hentry","category-complexity"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=\/wp\/v2\/posts\/1902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1902"}],"version-history":[{"count":19,"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=\/wp\/v2\/posts\/1902\/revisions"}],"predecessor-version":[{"id":2019,"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=\/wp\/v2\/posts\/1902\/revisions\/2019"}],"wp:attachment":[{"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scottaaronson.blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}