b) An algorithm for a problem isdef
a procedure for solving the problem
that is: (i) unambiguous
&: (ii) effective, which means:
* correct
* halts
c) Since algorithms are implemented in
(i.e., expressed by) programming
languages,
it follows that a problem
is computable
just in case there is a
computer program
that solves it.
* it takes
a Pascal program as I/P
* it compiles
that program into P88
assembly language
* then
it runs the P88 program on the
simulated P88 computer
- which is simulated on another,
real, computer (say, a Pentium)
b) But: that P88 simulation is written
(probably)
in Pascal!
And then that Pascal program
is compiled into
a machine-language program
for the Pentium
processor.
e.g.) Pascal program:
program multiply;
var x, y, z : integer;
begin
readln(x); readln(y);
z := x * y;
writeln(z)
end.
is compiled into (something like):
IN AX
COPY X, AX
IN AX
MUL AX, X
OUT AX
which,
in turn, is interpreted by another
Pascal program (the P88 simulator),
which,
in its turn, is then compiled into
Pentium machine (or assembly) language.
i.e.) Pascal program for *
|
v
P88 program
for *
|
v
Pascal program
for P88
|
v
Pentium program
for P88
b) How many computers?
c) Which one is "really" doing the multiplication?
d) If the answer to (c) is: the Pentium processor,
then note that it's not
doing it the way it
would if we just wanted
to multiply:
*
Instead, it's simulating a P88 computer
that is simulating a Pascal program
for multiplication!
a) Two logicians, Alonzo
Church and Alan Turing,
proposed the following thesis:
A problem is computable just
in case
there is a Turing-machine
program that
computes it.
b) Recall what a Turing machine (TM) is from
Lecture
Notes #3:
It's a model of computation
consisting
of an infinite tape divided
into squares,
each of which is either
blank or has a 0 or 1
printed on it; at any given
time, the TM is
scanning (or "reading")
just one square.
The TM has 5 basic instructions:
moveleft
moveright
print-1
print-2
erase
which can be combined by
sequence,
selection, and repetition.
We can implement a TM using
Karel the Robot;
to see how, take a look
at the Webpage
Karel
the Robot as a Turing Machine
c) But now that we have 4 different models of
computation:
TM
Karel
P88
Pascal
there might be some things to worry about:
* Are there
problems that can be computed
by a TM (or by Karel) but not in Pascal?
* Are there
problems that can be computed
in Pascal, but not by a TM (or by Karel)?
* Are there
problems that can be computed
by a P88, but not by Pascal, TM, or Karel?
* Are there
problems that can be computed
by Pascal, TM, or Karel, but not by P88?
d) The answer to all of these is: NO!
* All TM,
Karel, and P88 programs can be
expressed in Pascal.
proof:
For
P88 & Karel: The existence of
the Karel and Comp1 software
(which, for the sake of argument,
we can assume are written in Pascal)
shows that all Karel and P88 programs
can be handled by Pascal
For TM: There are TM simulators
written in Pascal. Or: translate TM
into Karel (as shown in the above-cited
webpage), and then use the Karel
simulator written in Pascal.
* All Pascal
programs can be expressed in
TM, Karel, and P88.
proof: This is a bit
harder to show. The best
I can do here is sketch a plausibility
proof:
To translate Pascal into P88: Easy: Just
use Comp1, which compiles Pascal
programs into P88. The only thing it
can't handle is strings, but we can code
strings into ASCII numerals, and then
just use arithmetic to handle substrings,
index, etc.
To translate Pascal into TM: Encode
everything into binary code (by Great
Insight #I), and then use the 1s and 0s
on a TM tape to represent them.
To translate Pascal into Karel: First
translate Pascal into TM, as above,
and then translate TM into Karel, as
above. How do you do arithmetic in
TM or Karel? Easy: represent numbers
either in binary, or, even easier (for the
representation, not the computation!)
in "unary Roman numerals", where, say,
the number 6 is represented as: 111111
(or by 6 beepers in a row)
So: any problem computable
by Pascal is
also computable by TM (and vice versa)
and by Karel (and vice versa)
and by P88 (and vice versa):
They are all equivalent!
e) What about other programming languages,
like C++ or Java?
Are there programs computable
in C++ or Java,
but not in Pascal?
Answer: No!
proof:
All C++, Java, Pascal, etc., programs
can be run on Unix (or on Windows)
computers; therefore they can all be
translated into the same machine
language. So they're all equivalent!
Note: This doesn't
mean that they are all
equally easy to use, or all equally
appropriate for different problems.
But they are all equally "powerful".
f) Therefore, any problem that is computable in
any given programming language
is also
computable in any other
programming language.
g) Are there any problems that intuitively "ought"
to be considered computable,
but that aren't
TM-computable?
Answer:
No!
Evidence:
This can't be proved, but there is
empirical evidence that so far
no problem has been found that
is intuitively computable but that
is not TM-computable.
Answer: Yes!
e.g.) The
Post Correspondence Problem
The Halting Problem (see Biermann, Ch. 14)
b) Is intelligence/cognition/thinking computable?
Answer:
We don't know
* See
Biermann, Ch. 15
* See
Lecture
Notes #35