2011-04-26

Life, Intelligence and the Second Law of Thermodynamics

[On how life locally creates order in a universe that is only supposed to increase in entropy over time]

The Second Law of Thermodynamics states that entropy in a closed system cannot decrease, and that this irreversible increase in entropy is somehow intimately interrelated with the arrow of time. However the unique, and perhaps the defining, characteristic of intelligence specifically and of life in general is the seeming ability to counter entropy [1] locally or temporarily by creating order in its own environment while it is alive. Furthermore, life posesses the unique ability to counter entropy on an ongoing basis -- “permanently” except perhaps at the limit [2] -- by reproducing or making multiple copies of itself: every offspring produced by an organism is also then able to counter entropy locally in its own sphere. Therefore if the hallmark of life is to locally counter entropy, then a branching, tree-like family pedigree structure is the hallmark of all intelligent life, and the continuation of intelligent species through reproduction is itself the guarantee of overcoming entropy beyond the lifetime of an organism [3][4].

Note that all this is also true of the organism's unconscious construction of its own ordered body: it is a system of high order and low entropy (and the development process produces waste heat through respiration etc.). As soon as the organism dies, it is by definition no longer alive, or its body no longer acts “intelligently” in creating order. Its ability to focus energy to maintain its own ordered structure is lost, and it will immediately begin to decay.

Also note that from the point of view of an organism, past work is at best a memory and so amounts to a sunk cost, and organisms are not typically aware of the waste heat lost in doing work to increase order, therefore they will typcially only trade off effort involved in doing work today with the apparent reward of increasing order as a direct result of that work. When the perceived reward outweighs the cost, the organism will tend to do the work to obtain the reward. Psychology and biochemical reward systems like dopamine have therefore typically evolved to reward organisms for making local decisions that seem rewarding while actually accomplishing a broader purpose, such as the propagation and continuation of the species.

--

[1] Note that we are using a very loose definition of “countering entropy” here -- in fact, the second law of thermodynamics cannot be violated, even locally, so what is actually happening is that the organism is focusing energy to do work to “pile up order” in one local region. However doing work produces waste heat, which is effectively how the second law of thermodynamics is satisfied even in this case: the waste heat produces an overall increase in entropy. Nevertheless with a constant energy source external to the system (the sun), and an unbroken chain of life across the generations, individual workers can continue to increase order within the system: they effectively channel and focus the energy from the external source to locally increase structure and order in some sort of "meaningful" way.

[2] i.e. the heat death of the universe, the extinction of the species due to extinction-level events / resource exhaustion, etc.

[3] (Incidentally, this is a rather glaring indictment against the decidedly unintelligent behavior of every sufficiently developed nation, in letting the birthrate fall below replacement rate of 2.1 children per couple-lifetime -- since this trend, if continued to its only mathematically-possible end with no future change in birthrate, is extinction of the species and the final victory of the Second Law of Thermodynamics.)

[4] This is probably true in a fractal sense right up to the scale of entire universes, if the theory (proposed by Andrei Linde and others) that universes “bud off” in hierarchical tree-like structures to create new universes is to be believed.

--

PS this is only orthogonally related, but I highly recommend the following article in the latest American Scientist magazine: The Man Behind the Curtain -- physics is not always the seamless subject that it pretends to be.

Also orthogonally related, but I love the following quote: "There is only one thing which is more unreasonable than the unreasonable effectiveness of mathematics in physics, and this is the unreasonable ineffectiveness of mathematics in biology. — Israel Gelfand" -- cited in the Wikipedia article for Unreasonable Effectiveness.


2011-04-14

Source Code Symmetry and Transcendent Programming Tools

The more experienced you become as a coder, the more you look at patterns and shapes and symmetry, rather than just reading code a character or token at a time to understand a piece of code.  This is an extremely desirable programming skill, because:
  1. The bandwidth and pattern recognition capabilities of the subconscious layers of the human visual system far exceed those of the conscious reasoning brain.
  2. Cross-checking code symmetries can effectively ensure completeness and correctness of code in many situations.
By analogy, when a beginning chess player is evaluating their next best move, they search the space of moves in the immediate neighborhood of the current board configuration. A really good chess player however does not spend much time thinking of individual moves, but rather thinks at a much higher level of abstraction, dealing with patterns and strategies.  The advanced player is in effect able to compress a huge amount of information into a relatively small number of concepts, and is able to employ much more powerful reasoning tools over these concepts.

A really simple example of source code symmetry is:

a[i].x += a[i - 1].x;
a[i].y += a[i - 1].y;

The visual symmetry here is that 'x' and 'y' run across the rows, but 'i' and 'i - 1' run down the columns. If you know that's what you're expecting and you don't see those things lining up without even thinking about what they mean, then you probably have a copy/paste error.

There are many complex abstract examples of code symmetry, and very few advanced programmers would even be able to enunciate the subconscious tools they employ daily to analyze visual and logical symmetries when writing code.  Some vague examples include:
  • Symmetries in the wavy line of indentation (indicating symmetries in scope and control flow);
  • Relative differences in the structure of nested function call applications between two expressions;
  • Differences in Boolean operators used between a block of related but different complex Boolean expressions.
In general, the presence of visual symmetry indicates the presence of underlying structural symmetry in the program. The converse is not necessarily true however -- programming language syntax may obfuscate the underlying symmetry of a program if the syntax is not designed to render functional symmetries in a visually symmetric way.

I have believed for a long time that one day we will be able to write really, really good programming tools that alert you to broken symmetries (e.g. copy/paste errors where you copied code for x but forgot to change the x to a y for the second version) -- or even suggest code or write code for you based on predicted symmetries or symmetries that are detected to be incomplete. This sort of power could catch a lot of the sorts of bugs you get from confusing two similarly-named variables etc. And I suspect programming with this level of integration between syntax, logical structure and IDE functionality would take programming to a completely new, transcendent level.

In the general case, detecting all reasonable symmetries for an arbitrary programming language may be uncomputable or at least intractable. A better approach would be to bend a language's syntax to support symmetry explicitly as a top-level feature of the language. This would involve identifying the types of symmetry you typically find in a program and finding syntactic ways of binding the symmetrical parts together in useful ways. Functions are already a weak form of this, since they allow for the common parts of a symmetry to be abstracted away and parameterized. But I think it could go a lot deeper than that.