Sunday, March 31, 2013

The Circle Computer

I was investigating G. Spencer-Brown's Laws of Form by implementing it in Python, and I found a very interesting interpretation in terms of the SK combinator calculus.

You can represent the "marks" of LoF as data-structures in Python composed entirely of tuples. For example:
  • A mark: ()
  • A mark next to a mark: (), ()
  • A mark within a mark: ((),)
  • and so on...


It is known that the propositional calculus can be represented by the "arithmetic of the mark". The two rules suffice:

((),) == nothing
() == (), ()

There are details, but essentially math and logic can be derived from the behaviour of "the mark".


After reading "Every Bit Counts" I spent some time trying to come up with an EBC coding for the circle language (Laws of Form expressed as tuples, See Burnett-Stuart's "The Markable Mark")

With a little skull-sweat I found the following encoding:

  1. For the empty state (no mark) write '0'.
  2. Start at the left, if you encounter a boundary (one "side" of a mark, or  the left, opening, parenthesis) write a '1'.
  3. Repeat for the contents of the mark, then the neighbors.

     _ = 0
    () = 100
(), () = 10100
 ((),) = 11000
and so on...


I recognized these numbers as the patterns of the language called 'Iota'.

Briefly, the SK combinators:

S = λx.λy.λz.xz(yz)
K = λx.λy.x

Or, in Python:

S = lambda x: lambda y: lambda z: x(z)(y(z))
K = lambda x: lambda y: x

can be used to define the combinator used to implement Iota:

i = λc.cSK

or,

i = lambda c: c(S)(K)


And the bitstrings are decoded like so: if you encounter '0' return i, otherwise decode two terms and apply the first to the second.

In other words, the empty space, or '0', corresponds to i:

_ = 0 = i

and the mark () corresponds to i applied to itself:

() = 100 = i(i)

which is an Identity function I.

The S and K combinators can be "recovered" by application of i to itself like so (this is Python code, note that I am able to use 'is' instead of the weaker '==' operator. The i combinator is actually recovering the very same lambda functions used to create it.  Neat, eh?):

K is i(i(i(i))) is decode('1010100')
S is i(i(i(i(i)))) is decode('101010100')

Where decode is defined (in Python) as:

decode = lambda path: _decode(path)[0]

def _decode(path):
  bit, path = path[0], path[1:]
  if bit == '0':
    return i, path
  A, path = _decode(path)
  B, path = _decode(path)
  return A(B), path


(I should note that there is an interesting possibility of encoding the tuples two ways: contents before neighbors (depth-first) or neighbors before content (breadth-first). Here we look at the former.)

So, in "Laws of Form" K is ()()() and S is ()()()() and, amusingly, the identity function I is ().

The term '(())foo' applies the identity function to foo, which matches the behaviour of the (()) form in the Circle Arithmetic (()) == _ ("nothing".)

(())A =  i(i)(A) = I(A) = A


I just discovered this (that the Laws of Form have a direct mapping to the combinator calculus by means of λc.cSK) and I haven't found anyone else mentioning yet (although this article might, I haven't worked my way all the way through it yet.)

There are many interesting avenues to explore from here, and I personally am just beginning, but this seems like something worth reporting.

Saturday, March 16, 2013

Lord Kelvin's Thunderstorm

One of my very favorite mechanisms is the wonderful device of Lord Kelvin for separating electric charge. It is the second simplest electric generator (the simplest electric generator is the hydroelectrostatic generator described by Gurdjieff in "All and Everything" constructed in a cave in the middle of nowhere and otherwise unknown to science) and a cybernetic system to boot.

Lord Kelvin's Thunderstorm consist of a means for splitting a flow of water into two stream of droplets and arranging each stream so as to fall each into a separate bucket.

Conductors are lead from each bucket to the vicinity of the emitting nozzle of the opposite stream of droplets.

That is all.

Operation is simple:
  1. As the droplets flow they carry electric charge from the upper water to the separate buckets.
  2. There will be a tiny imbalance in the electrical charge of the two buckets.
  3. The conductor from one bucket will conduct the charge from that bucket to the nozzle feeding the opposite bucket, and vice-versa.
  4. This charge near the nozzle will attract the opposite charge in the nozzle, and thus in the droplets carrying charge to the bucket below it, and vice-versa.
  5. When these charged drops fall into the buckets they increase the charge in the buckets and the strength of the charge near the nozzles and thus the charge on the droplets that they then carry to the buckets.
A feedback loop is established that rapidly divides the charge on the water into positive and negative, uh, charge.

There are lots of videos on the Internet if you want to see this in action. It's pretty dramatic.

I wonder what would happen if you hooked up three dropper-and-bucket arrangements?  Wouldn't that be neat if there was some undiscovered "triune force"?

Thursday, March 14, 2013

The General Program, Part ()

A fellow named G. Spencer-Brown wrote a book called "The Laws of Form". In it he begins with the most fundamental, indeed metaphysical, logical "step" or "unit": the act of distinguishing ...

(Quite literally the first page of "Laws of Form" and the first verse of the "Tao Te Ching" are expressing the same thing.)

From there he goes on to derive all of logic and mathematics. He uses a simple formalism of "marks" that captures the behaviour of logic and equations.

Then, in "The Markable Mark", a fellow named G. Burnett-Stuart has created an interactive circle-based rendering of the "Logic of the "Mark" and illustrated the build up of higher-order systems of reasoning rigorously from that basis.

Check them out, they're very cool. (I'm working on a system that uses them as a basis for reasoning programs.)