Using Thermonuclear Pennies to Embed Complex Numbers as Types

Embed Size (px)

Citation preview

  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    1/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 1/12

    0Share More Next Blog [email protected] New Post Design Sign Out

    A Neighborhood of Infinity

    Saturday, October 20, 2007

    Using Thermonuclear Pennies to Embed Complex Numbersas Types

    Forget about types for now.

    The Game of Thermonuclear Pennies

    The game of Thermonuclear Pennies is a lot like the game ofNuclear Pennies. It's played on asemi-infinite strip of cells, extending to infinity on the right, with a bunch ofpennies in each cell(and a finite number in total). Instead of a single penny fissioning into two pe nnies, it now splitsinto three adjacent pennies. And conversely, three neighbouring pennies may be fused into one.

    Here are examples of legal moves:

    http://bp1.blogger.com/_UdKHLrHa05M/Rxtlyd1_3GI/AAAAAAAAAGE/vsVFhM_S94Y/s1600-h/legal1.pnghttp://bp1.blogger.com/_UdKHLrHa05M/Rxtlyd1_3GI/AAAAAAAAAGE/vsVFhM_S94Y/s1600-h/legal1.pnghttp://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.htmlhttp://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.htmlhttp://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.htmlhttp://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.htmlhttp://bp1.blogger.com/_UdKHLrHa05M/Rxtlyd1_3GI/AAAAAAAAAGE/vsVFhM_S94Y/s1600-h/legal1.pnghttp://sigfpe.blogspot.com/2007/09/arboreal-isomorphisms-from-nuclear.htmlhttp://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.htmlhttp://blog.sigfpe.com/http://www.blogger.com/http://blog.sigfpe.com/logout?d=http://www.blogger.com/logout-redirect.g?blogID%3D11295132%26postID%3D7006108276900271122http://www.blogger.com/blogger.g?blogID=11295132#templatehttp://www.blogger.com/blogger.g?blogID=11295132#editorhttp://www.blogger.com/next-blog?navBar=true&blogID=11295132
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    2/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 2/12

    and

    Again the puzzles consist of trying to get from a start position to a target position. Here's a nice

    example:

    Just as with Nuclear Pennies we can assign numerical values to positions in this game in such asway that if there is a legal sequence of moves from A to B then the value of A equals the value ofB. In this case we assign the values very slightly differently. Each cell is assigned a value asfollows:

    http://bp2.blogger.com/_UdKHLrHa05M/Rxtmet1_3II/AAAAAAAAAGU/caWSpJbioXU/s1600-h/legal2.png
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    3/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 3/12

    Where i is the usual square root of -1. The value of a position is simply the sum of the values ofthe pennies where each penny takes on the value of the cell it sits in. So

    As before, we say that moving from A to B is paralegal if A and B have the same value. Because i

    satisfies i=1+i+i2 it should be clear that legal implies paralegal again. But here's a surprisingfact: if both A and B have pennies not on the leftmost cell, then a move from A to B is legal if it isparalegal. In other words, we can tell if a sequence of moves is possible just by looking at thenumerical value of the start and end points. What's more, the corresponding result also holdsfor Nuclear Pennies and a wide variety of related games besides. Before proving that I want totalk about the algebraic structure of these types of games. (And I just figured out how toprocedurally generate diagrams with Omnigraffle using Applescript so it's an excuse to draw

    lots of diagrams.)

    (BTW If we're allowed to have a negative number of pennies in a cell then you can simply treat aposition in these games as polynomials with integer coefficients. You can then use standardtheorems about polynomials to prove the result in a straightforward way. But those theoremsrely on subtraction, and without negative numbers those methods fail.)

    Firstly, we can add positions in Thermonuclear pennies (which I'll now call TNP). Simply addthe numbers of pennies in each cell:

    http://bp1.blogger.com/_UdKHLrHa05M/Rxpjpt1_3AI/AAAAAAAAAFU/qQcb1XpaKY8/s1600-h/powers.pnghttp://www.omnigroup.com/applications/omnigraffle/http://sigfpe.blogspot.com/2007/09/arboreal-isomorphisms-from-nuclear.html
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    4/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 4/12

    We can also multiply positions. We do this by making a 'multiplication table' from the originalpositions and then summing along the lower-left to upper-right diagonals. I hope this examplemakes it unambiguous:

    http://bp1.blogger.com/_UdKHLrHa05M/Rxpk4t1_3CI/AAAAAAAAAFk/qdu5TcplNJY/s1600-h/sum.png
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    5/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 5/12

    Exercises. Convince yourself that A+B=B+A, A*(B+C) = A*B+A*C, (A+B)*C = A*C+B*C, A*(B*C)

    = (A*B)*C.

    If you did the exercises, you've now shown that TNP positions form a commutative semiring, orrig, with the empty board serving as 0.

    Now we're ready to use a proof from Objects of Categories as Complex Numbers by Fiore andLeinster. If we define

    http://bp2.blogger.com/_UdKHLrHa05M/Rx4WB91_3JI/AAAAAAAAAGc/t8SMaw2tLvM/s1600-h/Product.pnghttp://arxiv.org/pdf/math.CT/0212377.pdfhttp://en.wikipedia.org/wiki/Semiring
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    6/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 6/12

    then every position is a polynomial, with non-negative integer coefficients, in x. We can also

    interpret the equation x=1+x+x2 as saying that fission and fusion are legal moves. Moregenerally, we consider two positions equivalent if there is a sequence of legal moves going from

    one to the other where each move maps f(x)+x to f(x)+1+x2 or the converse. If we define p1(x)=x

    and p2(x)=1+x2 then equation (3) in that paper defines exactly what we mean by a sequence oflegal moves. (BTW For those wondering about the order in which I wrote this, I read thatdefinition after inventing the game :-) So now we can apply Theorem 5.1 to find

    Corollary

    Let q1(x) and q2(x) represent TNP positions with at least one penny somewhere other than the

    far left, then if x^2+1=0q1(x)=q2(x) ring-theoretically, then there is a legal sequence of moves

    from q1(x) to q1(x).

    "x^2+1=0q1(x)=q2(x)" is just another way of saying q1(i)=q2(i). So we have a simple way to

    tell whether there is a legal way of getting from one position to another. The puzzle example I

    gave above is soluble because i5=i.

    Actually, the corollary isn't too hard to prove without the theorem. Here's a hint for how to do

    it. If we allow negative numbers of pennies the puzzle is fairly easy to solve. But we don't neednegative pennies because if there is at least one penny, we can saturate as many positions as we

    http://bp2.blogger.com/_UdKHLrHa05M/Rxpzl91_3FI/AAAAAAAAAF8/mKkfH2jDEXo/s1600-h/gens.png
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    7/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 7/12

    like with as many pennies as we like simply by madly fissioning pennies all over the place in a

    big chain reaction. So we start by doing the chain reaction to borrow lots of pennies, thencarrying out the solution using negative numbers (which won't actually ever go negative if ourchain reaction was big enough) and then reversing the chain reaction to pay back what we

    borrowed. (It's a bit like real l ife. In a financial market without negative numbers there aremany transactions that can't be performed. But as soon as we allow borrowing we open up manymore possibilities.)

    Embedding Complex Numbers as Types

    So back to types. People have frequently found the need to embed the natural numbers as types.A popular scheme is something (in Haskell) like

    > data Zero> data S a = S a> type Two = S One> type Three = S Two

    and so on. Then we can go on to define addition and multiplication. But types already have anatural addition and multiplication: the type constructors Either and (,). The problem is that,for example, Either One Three isn't the same type as (Two,Two). We could relax things a bit andallow isomorphism instead of equality. But even then, these types aren't isomorphic. Instead wecould define:

    > data Zero> data Unit = Unit> type S a = Either Unit a> type One = S Zero> type Two = S One> type Three = S Two

    Now we can use Either and (,) as addition and multiplication.

    http://haskell.org/haskellwiki/Type_arithmetic
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    8/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 8/12

    But if you're content to live with isomorphism then maybe we could embed other types.

    Consider the type

    > data Tree = Leaf | Trunk Tree | Fork Tree Tree

    It's easy to write an isomorphism Tree -> Either One (Either Tree (Tree,Tree)). In otherwords, up to isomorphism we have Tree=1+Tree+Tree2. If you remember my earlier post itshould be clear that legal sequences of moves in TNP give rise to isomorphisms of typesconstructed from Tree. In other words, theorems about TNP apply to Tree. Therefore given twopolynomials, p1 and p2, p1(Tree)=p2(Tree) if and only if p1(i)=p2(i), as long as the pi contain non-

    constant terms. Looked at another way, given anyGaussian integer, a+bi, we can embed this as atype in such a way that the embedding respects Either and (,). In fact the type

    aTree+bTree2+cTree3+dTree4

    embeds (d-b)+(a-c)i. For example, abusing Haskell notation,

    > type Zero = Tree+Tree3

    really does act like zero in that (Zero,p(Tree)) has an isomorphism with Zero for any non-constant polynomial p.

    As far as I can see, this fact is completely and utterly useless...

    NB When I say isomorphism above I mean "particularly nice isomorphism", which in this casemeans an isomorphism that takes time O(1). Otherwise all countable tree structures wouldtrivially be isomorphic.Posted by Dan Piponi at Saturday, October 20, 2007

    http://www.blogger.com/post-edit.g?blogID=11295132&postID=7006108276900271122&from=pencilhttp://www.blogger.com/email-post.g?blogID=11295132&postID=7006108276900271122http://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.htmlhttp://en.wikipedia.org/wiki/Gaussian_integer
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    9/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 9/12

    6 comments:

    Fritz Ruehr said...

    Quick question: is there a "typo" in legal2.png, the graphic showing the fusion style of move? Specifically, Ithink there should be two pennies stacked on the second cell, since there was one there already and then asecond one would be added from the fusion. Right? (Or else I misunderstand the rules, or perhaps I am justtaking the stacking count a little too seriously.)

    (By the way, is there a pithy term like "typo" for a minor error in a graphic? "grapho" doesn't ring true ... .)

    Saturday, 20 October, 2007

    Anonymous said...

    Your move descriptions and diagrams don't seem to quite match up. It looks like you're using x = 1 + 2x +x^2 for the diagrams, as the central cell goes from 1 to 2 pennies.

    Sunday, 21 October, 2007

    sigfpe said...

    Well spotted guys, there was definitely a 'picto' there :-)

    Sunday, 21 October, 2007

    David said...

    Same for the picture explaining multiplication, I believe. The two penny configurations to the left andabove the multiplication table don't seem to match up with the operands to the multiplication at the top ofthe image.

    Tuesday, 23 October, 2007

    http://www.blogger.com/delete-comment.g?blogID=11295132&postID=6762428881758388821http://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html?showComment=1193152320000#c6762428881758388821http://www.blogger.com/profile/03396164169951516460http://www.blogger.com/delete-comment.g?blogID=11295132&postID=6138106328539707539http://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html?showComment=1192978080000#c6138106328539707539http://www.blogger.com/profile/08096190433222340957http://www.blogger.com/delete-comment.g?blogID=11295132&postID=8369777153477769722http://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html?showComment=1192959780000#c8369777153477769722http://www.blogger.com/delete-comment.g?blogID=11295132&postID=465207125954908468http://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html?showComment=1192943760000#c465207125954908468http://www.blogger.com/profile/07287120856377258774
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    10/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 10/12

    Newer Post Older Post

    Post a Comment

    Links to this post

    Create a Link

    Home

    Subscribe to: Post Comments (Atom)

    Blog Archive 2013 (2)

    2012 (8)

    sigfpe said...

    I like writing posts in literate Haskell. The code is the text and that helps guarantee correctness. But whenthere's no code to check, there's no compiler or executable to check what you've written...

    Tuesday, 23 October, 2007

    Tom Leinster said...

    Hi Sigfpe. Regarding your last couple of paragraphs, you might be interested in a couple of papers thatMarcelo Fiore and I wrote. One of them is specifically about the equation Tree = 1 + Tree + Tree^2:

    here

    and the other explores the general principle behind this kind of calculation:

    here

    Friday, 21 December, 2007

    http://www.blogger.com/delete-comment.g?blogID=11295132&postID=7873933272884445279http://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html?showComment=1198283340000#c7873933272884445279http://arxiv.org/abs/math.CT/0212377http://arxiv.org/abs/math.RA/0211454http://www.maths.gla.ac.uk/~tlhttp://www.blogger.com/delete-comment.g?blogID=11295132&postID=6928432096173248862http://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html?showComment=1193154180000#c6928432096173248862http://www.blogger.com/profile/08096190433222340957http://blog.sigfpe.com/search?updated-min=2012-01-01T00:00:00-08:00&updated-max=2013-01-01T00:00:00-08:00&max-results=8http://void%280%29/http://blog.sigfpe.com/search?updated-min=2013-01-01T00:00:00-08:00&updated-max=2014-01-01T00:00:00-08:00&max-results=2http://void%280%29/http://blog.sigfpe.com/feeds/7006108276900271122/comments/defaulthttp://blog.sigfpe.com/http://www.blogger.com/blog-this.ghttp://www.blogger.com/comment.g?blogID=11295132&postID=7006108276900271122http://blog.sigfpe.com/2007/10/how-can-it-possibly-be-that-we-can.htmlhttp://blog.sigfpe.com/2007/11/blobby-language.html
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    11/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 11/12

    2011 (13)

    2010 (20)

    2009 (21)

    2008 (35)

    2007 (37)

    December (1)

    November (5)

    October (2)

    Using Thermonuclear Pennies to Embed Complex Numbe...

    How can it possibly be that we can exhaustively se...

    September (3)

    July(3)

    June (2)

    May(1) April (3)

    March (7)

    February(6)

    January(4)

    2006 (92)

    2005 (53)

    Some Links

    The Comonad.ReaderRubricationRichard Borcherds: Mathematics and physicsThe n-Category Cafe

    Ars Mathematica

    http://www.arsmathematica.net/http://golem.ph.utexas.edu/category/http://borcherds.wordpress.com/http://www.rubrication.net/http://comonad.com/reader/http://blog.sigfpe.com/search?updated-min=2005-01-01T00:00:00-08:00&updated-max=2006-01-01T00:00:00-08:00&max-results=50http://void%280%29/http://blog.sigfpe.com/search?updated-min=2006-01-01T00:00:00-08:00&updated-max=2007-01-01T00:00:00-08:00&max-results=50http://void%280%29/http://blog.sigfpe.com/2007_01_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007_02_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007_03_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007_04_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007_05_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007_06_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007_07_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007_09_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007/10/how-can-it-possibly-be-that-we-can.htmlhttp://blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.htmlhttp://blog.sigfpe.com/2007_10_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007_11_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/2007_12_01_archive.htmlhttp://void%280%29/http://blog.sigfpe.com/search?updated-min=2007-01-01T00:00:00-08:00&updated-max=2008-01-01T00:00:00-08:00&max-results=37http://void%280%29/http://blog.sigfpe.com/search?updated-min=2008-01-01T00:00:00-08:00&updated-max=2009-01-01T00:00:00-08:00&max-results=35http://void%280%29/http://blog.sigfpe.com/search?updated-min=2009-01-01T00:00:00-08:00&updated-max=2010-01-01T00:00:00-08:00&max-results=21http://void%280%29/http://blog.sigfpe.com/search?updated-min=2010-01-01T00:00:00-08:00&updated-max=2011-01-01T00:00:00-08:00&max-results=20http://void%280%29/http://blog.sigfpe.com/search?updated-min=2011-01-01T00:00:00-08:00&updated-max=2012-01-01T00:00:00-08:00&max-results=13http://void%280%29/
  • 7/28/2019 Using Thermonuclear Pennies to Embed Complex Numbers as Types

    12/12

    9/27/13 A Neighborhood of Infinity: Using Thermonuclear Pennies to Embed Complex Numbers as Types

    blog.sigfpe.com/2007/10/using-thermonuclear-pennies-to-embed.html 12/12

    About MeDan Piponi

    1.5kFollow

    Blog:A Neighborhood of InfinityCode: Github

    Twitter: sigfpeHome page:www.sigfpe.com

    View my complete profile

    https://plus.google.com/107913314994758123748http://www.sigfpe.com/https://twitter.com/#!/sigfpehttps://github.com/dpiponi/http://blog.sigfpe.com/https://plus.google.com/107913314994758123748