Skip to content

Instantly share code, notes, and snippets.

@johnynek
Created February 6, 2014 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnynek/8850549 to your computer and use it in GitHub Desktop.
Save johnynek/8850549 to your computer and use it in GitHub Desktop.
You can swap with only two registers if they point to elements of a group:
a = a + b
b = a - b
a = a - b
proof:
a1 = a + b
b1 = a1 - b = a
a2 = -b1 + a1 = (-a) + a + b
So it is sufficient to have a group. Can we show anything about what is neccesary to swap any two elements using say only two binary operators?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment