Sunday, April 3, 2011

Free will?

In philosophy and psychology a new interpretation of current neurological knowledge has found fertile grounds: The end of free will. The logic is a bit like this: "If all our choices are governed completely by our brain neurons, we are slaves of this structure, without independent freedom of thought". By figuring out the exact rules behind our brains, it becomes possible to (pre-)determine every coming choice and reaction. Part of the argument is being strengthened by observations that many choices are being made before the person is actually aware of the choice. And everybody who has experienced either pregnancy, sex and/or the adverse effects of certain medicine, knows how many of our choices can be influenced by the chemical state of our body.

Interestingly common experience does tell a different story too: One of the defining aspects of (human) intelligence is the freedom of choice, independent of context. Many defining choices in our lives are only taken after careful deliberation. And we tend to hold ourselves and others responsible for these choices.

Where do these seemingly incompatible experiences come from? How do they work?

A couple of observations:
- it is important to consider that these experiences come from a different abstraction level. The working of our brain is mostly understood at a neuron level, with some consideration of global effects, but mostly focussed on the mechanics of bundles of neurons. On the other end, our understanding of behaviour, intelligence and free will lies on a global (entire person) scale. It's like looking from two sides at the same (complex) coin.

- the emergence of complex behaviour from relative simple underlying mechanisms is a relative new, unexplored field. Especially if the number of underlying elements is large, it is difficult (to impossible according to complexity theory) to create a deterministic model, which might allow you to describe the expected behaviour on a large scale based only on the underlying elements.

-in the example of the human brain there are billions of underlying elements, with many interactions on various combinatory levels. There is also a large level of feedback between these elements at these levels. The resulting complexity leads to all sorts of non-deterministic mechanisms at the global scale.

This brings me back to my earlier argument for life as emergent behaviour. Your brain might contain many deterministic elements, but on the emergent scale it has reached a life of its own. The feedback loops at these higher levels of abstraction allow for freedom of choice, not entirely independent of the underlying mechanisms, but with a co-shared level of control.

Saturday, January 8, 2011

Feedback in software engineering

Sometimes you encounter clear examples of how the timing of feedback can lead to  problems. Yesterday I encountered an interesting bug in our software platform, due to a strangely implemented PHP function. Due to an incorrect choice by a core PHP developer, a bug on our side was hidden for a few years, becoming apparent on January 1st, 2011.

Some background:
The "mktime" function within PHP (which is a modified copy of the C-code mktime function) can be used to do various smart calculations on dates and time. One of its parameters is the year. This parameters has two ranges of valid values: 00 to 99 and the four character full year (e.g. 2011). The C-code version has a different definition: it takes the amount of years since 1900. Effectively this means that up until the year 2000 these two variant had overlapping valid input. To make things worse, a standard usage off this function in C would be to feed the result of the "localtime()" function into mktime. Localtime() uses the same years since 1900 as mktime in C. In PHP localtime() is also available. (Identical to C, years since 1900) The standard way of using this in C therefore worked correctly in PHP up until the year 2000. In many ways a standard millenium problem: code that worked correctly would brake on January 1st 2000.

Most PHP code in the world will have fixed in that period. (for example by adding 1900 to the result of localtime() before feeding it into mktime)

But then, in 2005, for reasons I can't really imagine, a core PHP developer decided to change the implementation of mktime by allowing 3 number dates (years since 1900). So far, so good, this would not be a big problem, but he did this only by allowing values up until 110 instead of the more logical 999! Effectively he reintroduced the same millenium bug for the year 2011.

Back to the concept of feedback:
What this change did was to hide (for a few years) incorrect implementations. Instead of calling out, spectacularly crashing, or some other obvious feedback, it didn't provide information for the developers that they did something wrong. No, at some inconvenient moment (by definition in the middle of the night) it just stopped producing valid output, creating a potential dangerous situation. (Murphy's law 2.0: All software ever developed will be used in some life critical situation)
Through the lack of correctly timed feedback this created an unstable situation. Especially the timing of the moment at which the problem would become known has been moved from during development and testing, to during production.

Sunday, January 2, 2011

Feedback to create order

Interference by itself is not a very complete model of reality and complexity. It doesn't account for the difference between "random" structures and the stable, highly complex entities that have emerged. The interference between two sound waves can easily lead to some random noise, without any musically appealing structure. The main difference between random emergence and complex, emergent entities, lies in the concept of feedback. Without some form of feedback the emergent patterns are semi-static: They might be random or might be highly repetitive.

Feedback is a term commonly found in the field of control systems engineering. It stands for the effect of using the current result of a system to control the future results of the system. In general this is as 'simple' as putting a sensor in the system, which measures the result and compares this result with the requested demand. If the result is not equal to the request, this difference (the error signal) can be used to steer the system to the required output. There are some well known examples of such systems, like the thermostat at home, car cruise control, but also our own sense of balance, allowing us to stand.

If an emergent entity would 'want' to have a longer existence (longer than just the random appearance due to interference) it needs to provide feedback to the separate entities that form it. In most complex structures in the world around us, this form of feedback is easily discernible:
  • In evolutionary systems this feedback would be called the reward function. 
  • In astronomy this feedback is provided in the form of gravity, in which the emergent system (stars, planets, rocks, etc) are formed by separate atoms, which through their own mass keep the emergent system stable.
  • In social environments, this feedback is formed by social control, laws, norms, etc.
It is important to note (and this is a subject I'm still contemplating) that it is not clear yet why an emergent entity would 'need' or 'want' to exist. It seems there is some sort of 'existential urge' behind everything, as strong and fundamental as the laws of physics. (I tend towards believing that this urge is actually part of the laws of physics and/or is formed by it) More on this later:)