<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><![CDATA[programming (and other) musings - math]]></title>
<description><![CDATA[programming (and other) musings - math]]></description>
<link>https://jao.io/blog//tag-math.html</link>
<atom:link href="https://jao.io/blog/math-rss.xml" rel="self" type="application/rss+xml" />
<lastBuildDate>Mon, 04 May 2026 20:18:56 +0100</lastBuildDate>
<item>
  <title><![CDATA[gödel's incompleteness illustrated]]></title>
  <description><![CDATA[
<p>
I am having a great time reading Smullyan's <a href="https://global.oup.com/academic/product/gdels-incompleteness-theorems-9780195046724?cc=es&amp;lang=en&amp;">Gödel's Incompleteness
Theorems</a>, 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 <i>demonstration</i> 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.
</p>

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

<ul class="org-ul">
<li><code>P(X)</code></li>
<li><code>~P(X)</code></li>
<li><code>PN(X)</code></li>
<li><code>~PN(X)</code></li>
</ul>

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

<p>
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 <code>X</code> is <i>printable</i> if our machine can print it.
</p>

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

<ul class="org-ul">
<li><code>P(X)</code> means that the expression <code>X</code> is printable</li>
<li><code>PN(X)</code> means that <code>X</code>'s norm (i.e., <code>X(X)</code>) is printable</li>
<li><code>~P(X)</code> means that the expression <code>X</code> is <b>not</b> printable</li>
<li><code>~PN(X)</code> means that <code>X</code>'s norm (i.e., <code>X(X)</code>) is <b>not</b> printable</li>
</ul>

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

<p>
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?
</p>

<p>
Think about it for a bit.
</p>

<p>
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.
</p>

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

<p>
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!
</p>

<p>
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.
</p>
<div class="taglist"><a href="https://jao.io/blog/tags.html">Tags</a>: <a href="https://jao.io/blog/tag-math.html">math</a> </div>]]></description>
  <category><![CDATA[math]]></category>
  <link>https://jao.io/blog/godel-s-incompleteness-illustrated.html</link>
  <guid>https://jao.io/blog/godel-s-incompleteness-illustrated.html</guid>
  <pubDate>Sat, 06 May 2017 02:51:30 +0100</pubDate>
</item>
<item>
  <title><![CDATA[categories and the lambda calculus]]></title>
  <description><![CDATA[
<p>
The <a href="http://golem.ph.utexas.edu/category/">n-Category Café</a> 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, <a href="http://math.ucr.edu/home/baez/">John Baez</a> (of
<a href="http://math.ucr.edu/home/baez/TWF.html">This Week's Finds in Mathematical Physics</a> fame), is very interested in
the connection between categories and lambda calculus, and has
recently posted an article entitled <a href="http://golem.ph.utexas.edu/category/2006/08/cartesian_closed_categories_an_1.html#more">CCCs and the λ-calculus</a> over at
the Café.
</p>

<p>
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 <a href="http://en.wikipedia.org/wiki/Knights_of_the_Lambda_Calculus">Knights of the Lambda Calculus</a>, and is
very fond of the fact that Abelson and Sussman's work is known as <i>the
wizard book</i>, for he has a very funny (and totally unrelated) intro to
general relativity called <a href="http://math.ucr.edu/home/baez/gr/oz1.html">Oz and The Wizard</a>. 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 <a href="http://goodmath.blogspot.com/2006/06/lamda-calculus-index.html">lambda calculus</a> and <a href="http://scienceblogs.com/goodmath/goodmath/category_theory/">category theory</a>.
</p>

<p>
But the <i>real</i> reason of this post is that i've found in there a
delicious article that i had lost track of: David Keenan's <a href="http://users.bigpond.net.au/d.keenan/Lambda/">To Dissect
a Mockingbird</a> is the nicest introduction to lambda calculus and SKI
combinators i've ever read. David takes as inspiration <a href="http://www-history.mcs.st-andrews.ac.uk/Biographies/Smullyan.html">Raymond
Smullyan</a>'s classic <a href="http://www.amazon.com/gp/redirect.html%3FASIN=0192801422%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0192801422%253FSubscriptionId=02ZH6J1W0649DTNS6002">To Mock a Mockingbird</a> (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, <a href="http://www-cs-faculty.stanford.edu/~knuth/smullyan.html">here's an excerpt</a>
from his book <i>This book needs not title</i>, put on-line by no other than
Donald Knuth). In David's words:
</p>

<blockquote>
<p>
[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 <i>To mock a mockingbird</i>, Smullyan chooses
birds for his combinators, in memory of Haskell Curry, an early
pioneer in the theory of combinators and an avid bird-watcher. [&#x2026;]
Smullyan also notes in his preface,
</p>

<p>
"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."
</p>

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

<p>
and he goes on developing a sort of lambda calculus by pictures, or by
<i>movies</i>. John Baez gives more details of the math involved in his
follow-up post <a href="http://golem.ph.utexas.edu/category/2006/08/categorifying_cccs_seeing_comp.html#more">Categorifying CCCs: computation as a process</a>, again at
the n-Category Café. Too fun and instructive to let it pass, if you
ask me.
</p>


<figure id="orgbaa5bb3">
<img src="https://jao.io/img/graphical-lambda.png" alt="graphical-lambda.png">

</figure>
<div class="taglist"><a href="https://jao.io/blog/tags.html">Tags</a>: <a href="https://jao.io/blog/tag-math.html">math</a> </div>]]></description>
  <category><![CDATA[math]]></category>
  <link>https://jao.io/blog/categories-and-the-lambda-calculus.html</link>
  <guid>https://jao.io/blog/categories-and-the-lambda-calculus.html</guid>
  <pubDate>Sun, 03 Sep 2006 03:13:00 +0100</pubDate>
</item>
</channel>
</rss>
