Encoding
Much of the power of Turing machines (and in fact, all computers) comes
from the fact that almost everything in the world can be represented
and maniuplated as a string of 0s and 1s.
We have already seen how numbers can be represented as 0s and 1s by
using the binary system. Here are some things that can be profitably
represented by numbers:
- Letters. For example, you could set "A" = 1, "B = 2", ... Most modern
computer systems use ASCII (the American Standard Code for Information
Exchange) which encodes upper and lower case letters, all the decimal
digits, punctuation marks, etc. into a number between 0 and 127. Recently,
there has been a move towards UNICODE, which incorporates foreign
language symbols (like accents), Chinese ideograms, etc. into a number
between 0 and 65535.
- Once we have encoded letters, then sequences of letters (for example,
War and Peace) become just sequences of numbers.
- Pictures and sounds can be encoded by overlaying them with a grid
and then representing their behaviour (e.g., color or volume) in a single
grid square as a number.
- One of the most powerful ideas in computer science is that computer
programs themselves can be encoded into one giant number. For example,
if I encode "write 0" as 00, "write 1" as 01, "write blank" as 10,
"move left" as 00, "move right" as 01, "don't move" as 10, and
"goto state n" as n's representation in binary, then the action
"write 0, don't move, goto state 5" becomes 0010101 and my Turing
machine program for incrementing a binary number becomes
01100
01100
00011
- What makes encoding a program as a number so cool is that it can
then become the input of another program. For example, there is a Turing
machine program (called the "Universal Turing machine program") that
takes as its input the number of another Turing machine, and then
simulates that other Turing machine!
Next slide