programming musings

Posts tagged "math":

06 May 2017

gödel's incompleteness illustrated

I am having a great time reading Smullyan's Gödel's Incompleteness Theorems, a thin volume with the most elegant description of Gödel's and Tarski's work i've read so far. It's also the most succint, and it starts with a very nice and very clear demonstration of indecidability that is the simplest i have ever seen. I like it a lot, and it's short enough for a quick blog post. Here it goes.

Imagine you have a machine that knows how to print strings composed of finite combinations of the characters P, N, (, ) and ~. We'll call any string composed of any number of these characters an expression. Thus P~, (P~) or ~PN(P) are expressions. But only some expressions are valid. Valid expressions are called sentences and our machine can only print sentences. Sentences must have one of the following forms:

where X is any expression. So, for instance, P(N), ~PN(~P(NNP)) are sentences, but N(P) or (P(NP)) are not.

Everything our machine prints is a sentence, but we don't know whether our machine is capable of printing all possible sentences. We'll say that the sentence X is printable if our machine can print it.

Our sentences can be assigned a meaning. Let's define the norm of an expression X as the expression X(X), and with that give the following interpreations to our sentences:

With those meanings associated to sentences, we can actually say whether a sentence is true or false, and our little machine becomes self-referential: it prints sentences that say what the machine can or cannot print!

Now, let's assume that our machine never lies: it only prints true sentences. The question is: will our machine be able to print all true sentences? Or is there a sentence that is true but our machine cannot print?

Think about it for a bit.

The trick is to find a sentence that is self-referential, and says out loud "i cannot be printed". If a sentence that means "this sentence cannot be printed" were printable, that sentence would be false, but we are supposing that our machine never lies. Therefore, our machine cannot print the sentence "this sentence cannot be printed", which is then a true sentence.

In symbols, our sentence is ~PN(~PN). This sentence says that the norm of ~PN is not printable, but remember that the norm of X is X(X), so the norm of ~PN is ~PN(~PN).

So you see, as soon as you have a system that is capable of self-reference, you'll be able to prove that the system is incomplete, in the sense that, if it is accurate, it won't be able to express all truths about itself. Gödel was able to find a way of expression arithmetic propositions as numbers, and that opened the door to self-reference. And the fun began!

This is just an appetizer: if you are not scared by a bit of math (and it's only a bit), by all means give Smullyan's book a try. It's much, much better than any of his famous puzzle collections.

Tags: math
03 Sep 2006

categories and the lambda calculus

The n-Category Café is a blog written by mathematical physicists with a focus on the world of Category Theory and its, so to speak, applications. Not the usual recommendation in a programming musing, except for the fact that one of the Café's regulars, John Baez (of This Week's Finds in Mathematical Physics fame), is very interested in the connection between categories and lambda calculus, and has recently posted an article entitled CCCs and the λ-calculus over at the Café.

In case you're wondering, CCC stands for Cartesian-closed category: you'll find a lot of links in John's post explaining what does it exactly mean. He also mentions prominently our beloved SICP, including the emblem of the Knights of the Lambda Calculus, and is very fond of the fact that Abelson and Sussman's work is known as the wizard book, for he has a very funny (and totally unrelated) intro to general relativity called Oz and The Wizard. But there are many more interesting links in John's article. For instance, if you're still wondering what on Earth a Cartesian-closed category is, you can read Mark Chu-Carroll's introductions to lambda calculus and category theory.

But the real reason of this post is that i've found in there a delicious article that i had lost track of: David Keenan's To Dissect a Mockingbird is the nicest introduction to lambda calculus and SKI combinators i've ever read. David takes as inspiration Raymond Smullyan's classic To Mock a Mockingbird (wholeheartedly recommended, as anything written by Smullyan, for that matter), who explains combinators by means of an enchanted forest inhabited by peculiar birds (if you've never read anything by Smullyan, here's an excerpt from his book This book needs not title, put on-line by no other than Donald Knuth). In David's words:

[T]he theory of combinators is an abstract science dealing with objects whose only important property is how they act upon each other. We are free to choose other properties of these objects in any way we like. In his delightful book To mock a mockingbird, Smullyan chooses birds for his combinators, in memory of Haskell Curry, an early pioneer in the theory of combinators and an avid bird-watcher. […] Smullyan also notes in his preface,

"This remarkable subject is currently playing an important role in computer science and artificial intelligence Despite the profundity of the subject, it is no more difficult to learn than high school algebra or geometry."

In the hope of making it even easier I introduce the following graphical notation by extending Smullyan's bird metaphor.

and he goes on developing a sort of lambda calculus by pictures, or by movies. John Baez gives more details of the math involved in his follow-up post Categorifying CCCs: computation as a process, again at the n-Category Café. Too fun and instructive to let it pass, if you ask me.

Tags: math
Other posts
Creative Commons License by jao is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.