Thore Husfeldt

Archive for June 2012

The Freeze App Does Not Exist

with 8 comments

Turing’s proof of the undecidability of the Halting problem explained in terms of phone applications (“apps”), 100 years after his birthday.

Some apps can freeze your phone

There are apps that will freeze your phone, either out of malice or negligence from the app developer. For example, the app might try to perform some undefined mathematical operation, such as dividing 5 by 0. Your maths teacher will have told you that “5/0” does not make sense, and when a modern computer encounters this expression it will indeed crash; in the worst case taking the rest of the operating system with it. Your phone will lock down or “freeze”, and there is nothing else you can do about it, short of restarting the device. After that you are well advised to remove the app.

Why does it have to come so far? Why do such bad apps exist in the first place? Can’t one test for such behaviour beforehand?

The Freeze app

Imagine a really clever software company did just that. Imagine there was an app, Freeze, that would test a suspicious app and determine if it will freeze your phone or not.

Freeze might work by performing experiments of the suspicious app in a simulated environment without actually freezing your phone, or it might deduce the input app’s behaviour from inspecting its source code, — it’s not important for us just how Freeze accomplishes what it promises.

Freeze is really simple to use. First, you select the suspicious app from a list of installed apps on your phone:

Then Freeze does its analysis, which might take a few minutes, and presents you with the result. Nifty.

The Paradox app

As soon as Freeze hits the store, I will build a new app, which I will call Paradox. It will take me all of 3 minutes to develop, because my own programming effort will be tiny. Paradox mainly works by calling Freeze in a nefarious fashion.

Here is the source code for Paradox (in English, not in a real programming language):

  1. Run Freeze and ask it to inspect Paradox.
  2. If Freeze returned “OK” then freeze the phone, for example by computing 5/0.
  3. If Freeze returned “Not OK” then announce “Freeze detected that Paradox freezes” and terminate gracefully.

In a real programming language, the code would look more like this:

set Result to 
    tell application "Freeze" to
        check application "Paradox"
    end tell
if Result is "OK" then
    display 5/0
else display "Freeze detected that Paradox freezes"
end if

That’s it. I’ll publish my Paradox app and invite you to download it to your phone. Go ahead, nothing bad can happen—after all, you have the Freeze app, don’t you?

Why the Freeze app can’t exist

Is the Paradox app malicious?

There are two possibilities. Either Paradox is a malicious app that freezes the phone, or it is not. We will show that both of these cases is a logical impossibility.

Assume Paradox does freeze the phone. Freeze will have detected this, thus, in Paradox’s code, computation proceeds from line 1 to 3 and Paradox will return “Freeze detected that Paradox freezes” and terminate gracefully. The phone did not in fact freeze, contradicting our assumption. Thus, this case is absurd and we can reject it.

So assume that Paradox does not freeze the phone. Freeze will determine this, so Paradox’s computation will proceed to line 2 and freeze the phone. This, again, contradicts our assumption.

Since both of these cases lead to contradictions, we must go back in our argument we conclude that our initial assumption was wrong. (This is called a proof of contradiction.) Thus, an app like Freeze cannot exist.

“There’s no app for that.”

This is Turing’s main result, from his famous 1936 paper. Instead of a phone he used a fictional computational device that we today call a Turing machine. But phones are just special cases of Turing machines.


I think this is a great way of explaining Turing’s proof to a general audience. It’s not mine. I saw it two days ago in a Norwegian newspaper, in a splendid article about Alan Turing for his centenary written by Pål Grønås Drange and Jan Arne Telle from the CS department of Bergen University. This is a great piece of popular science writing; kudos for including a proof of the Halting problem!

Written by thorehusfeldt

June 25, 2012 at 13:48

Posted in Uncategorized

Shouryya Ray Closing Remarks

with 4 comments

This is a brief update on the Shouryya Ray affair mentioned in the previous post on this blog.

As of 5 June 2012, the Wikipedia article for Ray has now been deleted. If you care about how this process works, the discussion is preserved for posterity.

Two professors at TU Dresden have released a statement about the affair,

This splendid document contains a well explained, careful and readable explanation of Ray’s work, accessible to readers with basic knowledge of differential equations. Recommended. The document includes an assessment of the quality of Ray’s contribution.

The work is without doubt exceptional for a high school student and it merits the attention that it received in a national science competition for high school students. […] Given the level of prerequisites that [Ray] had, he made great progress. Nevertheless all his steps are basically known to experts, and we emphasize that he did not solve an open problem posed by Newton.

Of course, none of the involved journalists cares about this anymore, or would be able to absorb the result. Lucky for them, a fresh variant of the meme just hit the anglosphere: This time, a 10-year solved a fundamental mystery of chemistry. (The background is that Sven Hovmöller, a chemistry professor at Stockholm University, has added his son as a co-author of a paper accepted to Philosophical Transactions of the Royal Society A. [Paper at PubMed].)

Written by thorehusfeldt

June 5, 2012 at 13:54

Posted in Uncategorized