Beruflich Dokumente
Kultur Dokumente
RE
EPORTS DIVISION
;
,
NAVA
.ViE
SCHOOL
NPS52-83-010
Monterey, California
Bruce
MacLennan
August 1983
FEDDOCS
D 208.14/2:NPS-52-83-010
A. Schrady Provost
D.
The work reported herein was supported in part by the Foundation Research Program of the Naval Postgraduate School with funds provided by the Chief of Naval Research.
is
authorized.
/7
//
&
/?
UNCLASSIFIED
SECURITY CLASSIFICATION OF THIS PAGE (Whan Data
Entered)
REPORT NUMBER
2.
GOVT ACCESSION NO
NPS52-83-010
4.
TITLE
(and Subtttla)
5.
TYPE Or REPORT
PERIOO COVERED
Technical Report
PERFORMING ORG. REPORT NUMBER
7.
AUTHORfsJ
Bruce J. MacLennan
9.
10.
REPORT OATE
Auaust 1983
11.
NUMBER OF
.OES
(ol thtm raport)
ADDRESSfif
13.
15 SECURITY CLASS,
Unclassified
ISa.
SCHEDULE
16.
DECLASSIFICATION/ DOWNGRADING
DISTRIBUTION ST ATEMEN T
17.
DISTRIBUTION STATEMENT
Block 20.
II
18.
SUPPLEMENTARY NOTES
19.
KEY WORDS
II
Godel's Theorem, halting problem, incompleteness theorem, computabil ity formalism, decidability, paradoxes, decision problems, foundations of mathematics, logic
ABSTRACT
20.
II
We present a simplified proof of Godel's theorem by appealing to wellThe significance of Godel's result to computer known programming concepts. science, mathematics and logic is discussed.
DD
JAN
73
1473
EDITION OF
NOV
65
IS
OBSOLETE
UNCLASSIFIED
SECURITY CLASSIFICATION OF THIS PAGE (When Dmtm
nto*e*t}
of Gbdel's
Theorem
MacLennan
Monterey, CA 93940
Abstract:
We present a
theorem by appealing
to
well-known program-
of Gbdel's result to
discussed.
1.
Introduction
of Gbdel's
many
generally presented,
somehow been
been
It is
told that
theorem
is
that
it
Theorem
is
a theorem about
computers which was formulated before there were many computers. 3y using ideas
familiar to any
easily understandable.
There
is
Gbdel's
gramming.
some wider
-1-
2.
input,
is
there
is
way
of
will
when given
T
that input?"
For
many
programs
basis.
.Vhat
is
wanted
is
a general pro-
x, will tell us
whether
halts
when given
x.
In particular,
we want a program
that
question.
Before embarking on a search for a decision procedure for the halting problem,
wise to ask
if
it is
such a procedure
possible or not
is
possible.
its
tc
determine whether
something
is
assumes
The proof
I'll
discuss
is
is
lie.
Is
If
we assume
it's true,
that
if
we assume
this
it's false,
true
(since
it's
not a
lie).
Put simply,
false,
statement contradicts
it
makes no
It
was considerations
of
paradoxes
proofs.
In the
statement
L.
of the
theorem and
will
its
prcof we
will
language called
You
see,
language used, and remains true for any realistic programming language.
Definition:
A procedure,
if,
called 'Halts',
is
problem in L
given
(l)
P
if
in L,
and
(2)
any
P{x)
halts,
and
Haltsfp.j:) = false
infinite loop.
problem
in
is
impossible.
Assume
Haltsip.x)
tells
described by
to
will halt
when
applied to
is
itself a string,
and we want
know what
will
happen when P
if
were applied to
x-p. This
is
call Halts(p,j>).
procedure Q
in L:
procedure Q(p)
is
definition of Halts
begin
if
label:
goto label
else return;
endQ;
The meaning
of
"
'definition of Halts"
is
is
to be placed at
to
make
use of Halts.
The behavior
is
as follows:
if
P(p)
halts,
infinite loop;
otherwise Q immedi-
ately returns.
-},
Is
program
in L.
Call
character string
q:
procedure 0(p)
end
is
Q;'
Since q
is
a string representing a
program
in L,
it
cedure
first
Q.
of Q{q).
Q{q)
it
asks
Halts(g,gr).
Since Halts
is
returns a Boolean (true or Taise) result indicating whether the procedure represented
-3-
by g
will halt
when applied
to g.
is
itself,
so
it
doesn't.
If
it
halts,
infinite
loop.
Therefore, let's suppose the opposite, that Q(q) doesn't halt. Then, Halts(g,?) returns
false
i.e.,
halts.
doesn't)
to a con-
possible,
was
OED.
theorem. In view
of
remarkable nature, we
of
will
the assumptions
contradictory;
it is
it
doesn't
tell
us which one.
that
it is
possible to write
in L.
and
isn't legal in
the language L.
''/nil
have
said that L
istic
we prove about L
language.
we only need
be
Call
another procedure
test.
(e.g. Halts).
Do a conditional
Go
into
an
infinite loop.
Return immediately
(i.e.,
not go into an
infinite loop).
These are things that can be done in any realistic programming language. Hence we
is
programming language.
Are there any other hidden assumptions in our proof? Yes, we have also assumed
that our language can handle arbitrarily long character strings.
is
necessary
if
we are
programs.
strings?
The proof
still
goes through
is
is
just a string
any resource,
Since
all
real
computers have
to idealized
3.
is
almost any property you care to name. Suppose you want to write a decision prothat, for
cedure Does_D(p,x)
any behavior D,
definition:
tells
you
if
p does D when
applied to x.
Then consider
this
procedure
is
procedure Q(p)
definition of Does_D
begin
if
Does_D(p,p) then
don't do
else do
end
Q;
Problem D was
'halts',
so don't do
D was accomplished by
goto
label'
as before
if
and only
if
Q{q) doesn't do D. Hence we have a contradiction. The only way the proof
-5-
can
fail
to go
through
is if
the language
is
so
weak that
it is
that does
D and
doesn't do D.
of interest, it will
For
if
which determines
when applied
just
Intuitively
it
it
seems
like
we ought
to be able
to write
such a function: we
first.
run P{x)
until
ever occurs
we may
less
if it
HaltsJ3uickly(p ,p)
true,
we
go into an
will
procedure Q(p)
...
is
definition of Halts_Quickly
...
begin
if
else return;
end
Q;
New consider
it
Suppose Q{q) halts within 100 years; then, Halts_Quickly(g,g) returns Lma, and
Q{q) loops forever. This contradicts our assumption that Q(q) halts quickly.
is
false,
Does
This
it
would be
if
we implemented
it
in the naive
way
is
no contradiction.
mean we can
same way
it
tradiction in the
as Halts.
it is
any property
ally)
of all
halts eventu-
decidable.
4.
Symbolic Logic
that Gbdel's
you
may
sets
have
programs can
tell
logic, it will
in the
foundations of mathematics.
A major concern
of
mathematicians
in the
proof by which mathematicians could ensure that their theorems were true. Mathematicians
were anxious
to
of
Mathematicians divided
themselves into several, often antagonistic, schools depending on the approach to foundations that they took.
One
FJ
of
of
famous mathematician
It
had long been observed that deductive reasoning was often formal; that
of the
is,
the
form
is
of
the
argument
it.
This
particularly true cf
for-
mula
ments
into
of
new formulas.
symbols.
For
we
chese
transformations
x + l = 5 =>
(x + l)-l = (4+l)-l
x+Q x-4
= 4+0
=>
ail
to
formal systems. A
(l)
and
(2)
finite set of
comput-
a formal system generates a set of derived strings. As you can see, a formal system
a primitive sort of program, in which (i) the transformation rules are the operations
and statements
of
the program, (2) the initial strings are the input data, and (3) the
derived strings are the intermediate and output data that result from applying the pro-
gram to
The formalists believed that they could make mathematics rigorous by reducing
to a
it
initial strings
of
mathematical axioms, and the transformation rules represent the deductive rules
inference,
the derived strings would represent just those theorems that could be
it
seemed
that
of intuition
from
mathematical proofs.
Another important goal
of the formalist
it is
program was
and
its
negation 'not P\ In other words, consistency means that there are no contrad-
The set
string is
be recursive,
i.e.,
an
-8-
of their axioms:
how
if
all
true,
it
should
be possible to derive
from the
initial strings
Formal systems gave the formalists hope that they would be able
sistency and completeness of
some formalization
of
mathematics. This
Therefore,
it is
because
for-
objects.
possible to prove
of
of
to use
that
is,
A formal system
essentially a
to
decide
if
much
Hence,
we conceive
(i.e.,
programming language),
decide (prove)
itself.
it
to
much
it's
of
Hence,
not
of
mathematics. This
Let's consider
tins result
more
carefully.
mathematical language
any program p
(in
halts
on
a:',
for
any input
x.
Then we know
x.
This would
is
-9-
'p halts
onx'.
Next
ful
'p halts
in
In
we can
about integers,
'p
on x'
is
it
must be
possible to
talk about
always be written as a
sequence
of
a mathematical
outputs,
programs can
also
sequences
to represent the
'p
Teat
this
means
is
that
if
is
applied to x then
,
some output y
of
will result.
Now,
if
,ve
(p,x)' that
applying
p toi
(assuming
halts)
'p halts
onx' mathematically:
halts
on x
is
if
and only
if
just a
of integers.
is
programming language.
will realize
Can one
define
an interpreter using
is
"yes," because
programming
pure LISP
in
is
essentially programlines
ming
in
about twenty-five
convincing.
of LISP.
little
more
of its
execution
it
takes the
10-
values of a
number
of variables
set of variables.
tion being
executed
program.
Now, the
so the
memory
that contains
all
is
just
an array
of bits,
memory can
be represented as a sequence
program
to execute,
is
just a
sequence
this
of bits, so it
of this
sequence
of integers.
Notice that
sequence
of integers,
which we
call
the state
of
the program,
is all
that changes
of the
program
to the next.
have
to skip
some
of
program p
execute
it is
is
pointer part
.)
replace a few elements of the sequence of integers representing the state. Control-flow
instructions
pointer.
(e.g.,
goto) just change the part of the state representing the instruction-
it is
This just
means
that
possible to get
from
by
i.e.,
s to s'
zero or
more
applications of Next-State.
This
is
recursive definition:
3 to s'
if
and only
if
-11-
or there
is
It is
now simple
to
,x):
y - apply(p
and only
if
x'
toy
where
x' is
x with the
initial
halting
in a reason-
ably powerful
mathematical system,
consistent,
must
also be incomplete.
5.
Relevance
Gbdel's Incompleteness
Theorem
is
it
is
In
some quarters
it is
used as an excuse
for irrationality
it is
impor-
and mathemat-
computer
science. In its
form
as the Halting
Problem and
infallibly
its
extensions,
it
tells
Yftiat
is
theorem
to logic in
and mathematics?
It's
major
of of
effect has
been
program
that
program was
and completeness
cannot be done.
many
ether formal logical systems, such as three-valued logic, also suffer from the incompleteness property. This should not surprise us, since any reasonably powerful formal
system
ity
is
equivalent to a
suffers
theorems.
-1
"?.-
Does
this
then indicate
if
logic
and
for-
mathematics? Only
you are a
all of
In essence, Gbdel's
the power
mathematics and
logic.
an example
some n>2, x n +y n =z n
is
This
evi-
ample empirical
true.
How can
this
were
false.
exist integers a, b, c,
Now, in
all
a valid
deduction:
1.
Jfc>2
2.
a k +b k =c k
Therefore, there exists x, y z
,
3.
and
n>2 such
that x n
+y n =z n
Hence,
is
if
is
then
it
will
for-
if
undecidable
in
any
reasonably powerful formal mathematical system, then the theorem must be true.
QED.
It
More
Sometimes
land of proof
is
"meta-mathematical" or "metaof
used the
plain, old,
garden- variety,
been known
-13-
Thus, there
is
It -.vould
be
more accurate
deductions
of
is
be deduced from other propositions without regard for the meanings of the terms in
those propositions. One of the premises of formalism
is
that
all
mathematical truths
of
this
axioms
(ini-
there
is little
an interminable
The problem
is
purely deductive science in which theorems are deduced from given axioms and
definitions.
them
arbitrary.
of
of
the edifice
mathematics.
is
mathematics
like
nor arbitrary.
Rather, they are the result of a lengthy process of scientific investigation. They are not
In fact
mathematics
is
more
like the
is
generally acknowledged.
For eons
man
terms
of the
more basic
mass and
still
gravity.
man
has
known
of
proposing explanations
of this fact in
terms
more
basic ideas.
Mathematics,
like the
of
is
mathematics;
It
of
of
mathematics or
logic.
mon
of reason,
it
actually a sterling
example
S.
Bibliography
1.
Nagel, E.
and Newman,
the
J.
This
is
most readable
slaps
many
of
programming ought
to be able to
see
filled in.
2.
Hoare,
R, and Allison
1972), 169-178.
D. C. 3.,
Incomputability,
4,
(September
This
is
am
aware
of that
makes use
3.
programming concepts
Kline, M.,
In this
cul-
-1 Fv-
Office of Research Administration Code 012A Naval Postgraduate School Monterey, CA 93943
Chairman, Code 52Hq Department of Computer Science Naval Postgraduate School Monterey, CA 93943
40
Professor Bruce J. MacLennan, Code 52M1 Department of Computer Science Naval Postgraduate School Monterey, CA 93943
Dr. Robert Grafton Code 433 Office of Naval Research 800 N. Quincy Arlington, VA 22217
A.
12
Dain Samples Computer Science Division - EECS University of California at Berkeley Berkeley, CA 94720
16-
2082 02
mW|
KN0X LIBRARV
'
RESEARCH REPORTS
5 6853 01060339 2
U2G8302