Introducing HaltPy 01-04-2012

Several hours ago, I realized that I had a significant problem. Over the course of a life time, I had written all of this code for all of these projects and no matter how diverse the various codebases were, they all suffered from the same problem: I had no way of knowing, definitively, with a single utility, whether they were in fact terminable. I had no algorithm that I could apply which would tell me if any of my arbitrary programs would eventually terminate. And that seemed wrong.

So I decided to scratch my own itch and, after much consternation and elbow sweat, HaltPy was born. HaltPy is a very simple script which takes in the file name of an arbitrary program's bootstrap source code and returns a boolean value corresponding to whether or not the program eventually terminates. True, and you've got a winner on your hands. False, and, well... let's not go down that route. Could be hard to come back from.

The best way to get a feel for HaltPy is to use it yourself. But I'll show off an example to give you a quick synopsis of its almighty power. Imagine that you wish to write a program which is both consistent and complete in its ability to provide an answer to any arbitrary question about natural numbers. Sounds easy enough, but it could get tricky. Let's see what a first stab at what that program might look like:

Looks good from here. Save that code into principia.py and run it. But wait... something's not quite right. I'm not getting any output. If only we had a way of knowing whether the program will terminate or not. HaltPy to the rescue!

So HaltPy tells us that no, in fact, our program does NOT terminate. Let's fix that:

There we go! Running principia.py gives the output 42, which, as any number theorist can tell you, is the answer to any question that can be asked about natural numbers. But, just to be sure, let's query HaltPy to make sure that our extremely complex system will eventually terminate. 

That--that right there--is the value of HaltPy. We wrote some dense, nigh impenetrable logic and we needed to quickly verify that it was not prone to that most gruesome fate of everlasting life. With a single call to our API, we know for certain that it will terminate at some point in the distant future. And because HaltPy is RESTful, we can use this API as the basis for a powerful and flexible platform. That statement sounds so authoritative, how can it possibly be incorrect?

So now that you've been completely convinced of HaltPy's might and infallibility, you might be asking yourself: does HaltPy... you know... halt? Well splash some acid on your face and get ready for a truth bomb, because HaltPy has the answer:

Yes, that is a cat wearing a crown. I think that answers that. Jump on over to Github and try out HaltPy. Today.