Theory of Computation Recursion theory Self

Recusrion theory - (adv)
Recusrion theory - (adv)
COMP3310/3610: Theory of Computation
1
University of Sydney
Taso Viglas
[email protected]
Recusrion theory - (adv)
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
August 28, 2007
University of Sydney
Recusrion theory - (adv)
COMP3310/3610: Theory of Computation
University of Sydney
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
Recursion theory
Recusrion theory - (adv)
COMP3310/3610: Theory of Computation
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
Self-reference
mathematical logic and computability
proving undecidability:
self reference leading to a paradox
Is it possible for a (finite) object to contain a description of
itself ?
Can you have a picture that contains itself in it ?
A finite way to describe infinite detail
University of Sydney
COMP3310/3610: Theory of Computation
University of Sydney
COMP3310/3610: Theory of Computation
Recusrion theory - (adv)
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
M printing < M >
Recusrion theory - (adv)
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
M printing < M >
design a TM SELF that prints its own description
design the machine SELF to have two parts, A and B
or, write a program in Java that prints out itself
such that < SELF >=< AB >
a straightforward approach would cause an infinite ’recursion’
think of A printing out B and B printing out A
define Pw the TM that ignores its input and simply prints the
string w and then halts.
denote the description of Pw by q(w ) =< Pw >
University of Sydney
Recusrion theory - (adv)
define A to be P<B>
A prints out < B >
we cannot define B as P<A>
this would give a circular definition and infinite recursion
COMP3310/3610: Theory of Computation
University of Sydney
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
M printing < M >
Recusrion theory - (adv)
COMP3310/3610: Theory of Computation
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
M printing < M >
SELF : run A first, then B
A is P<B> . writes < B > on the tape
B prints out < A >, the description of a machine that prints
< B >.
what is < B > ??
< B > is written on the tape after A finishes
therefore < B > is: read w from the tape, which is a TM
computation description, and write down the description of
the TM that prints w concatenated with w
A = P<B>
B = on input < M >
1
2
compute q(< M >), the description of P<M>
combine it with < M > to get a TM and print its description
this completely defines B and therefore A
University of Sydney
COMP3310/3610: Theory of Computation
University of Sydney
COMP3310/3610: Theory of Computation
Recusrion theory - (adv)
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
The program SELF
A = P<B> = P<1.compute
B = on input < M >
1
2
Recusrion theory - (adv)
self-reference ”without” self-reference
q(<M>)···>
compute q(< M >), the description of P<M>
combine it with < M > to get a TM and print its description
self-reference:
print out this sentence
”this” is a self-reference
no self-reference:
print out two copies of the following, the second in quotes:
”print out two copies of the following, the second in quotes:”
self-reference is built-in the program
A writes < B >=< 1.compute q(< M >) · · · > on the tape
B reads its own description, and writes < P<B> >< B > or
P<1.compute q(<M>)···> < 1.compute q(< M >) · · · >
University of Sydney
Recusrion theory - (adv)
mixing description and meaning
COMP3310/3610: Theory of Computation
University of Sydney
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
Recursion theorem
Recusrion theory - (adv)
COMP3310/3610: Theory of Computation
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
Using the recursion theorem
(theorem 6.3p220) let t : Σ∗ × Σ∗ → Σ∗ be a computable
function. There is a TM R that computes r : Σ∗ → Σ∗ such
that
r (w ) = t(< R >, w )
SELF was an application of the recursion theorem
t(x, y ) = x
proof: similar to SELF construction
R has three parts A, B, T
A = P<BT > , on input w , print out w < BT >
B obtains a description of < ABT >=< R > writes < R, w >
on the tape and runs T
University of Sydney
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
COMP3310/3610: Theory of Computation
recursion theorem implies that you can use
”obtain own description”
in your algorithms or TM design
SELF = on any input
1
2
obtain own description < SELF >
print out < SELF >
”obtain own description” is implemented by the recursion
theorem
for SELF program, use T : on input < M, w > print < M >
University of Sydney
COMP3310/3610: Theory of Computation
Recusrion theory - (adv)
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
recursion theorem
Recusrion theory - (adv)
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
More on the recursion theorem
Effective enumeration of computable functions
to make a TM that obtains its own description
design a machine T that takes this description as extra input
then produce a new machine R
R operates exactly like T
and has R’s description filled in automatically
Any computation t(·, ·) has a corresponding TM R
r (w ) = t(< R >, w )
University of Sydney
Recusrion theory - (adv)
φ1 , φ2 , . . . , φm , . . .
S-m-n theorem: for every computable function φ = φm (n, x)
there exists a computable function S such that
φSm,n (x) = φm (n, x)
theorem: for each computable function f there exists i ∈ N
such that
(n)
(n)
φi = φf (i)
COMP3310/3610: Theory of Computation
University of Sydney
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
using the recursion theorem
Recusrion theory - (adv)
COMP3310/3610: Theory of Computation
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
Minimal TMs
(theorem 6.5p222) ATM is undecidable
A TM M is called minimal if there is no TM equivalent to M
with shorter description < M >
proof: by the recursion theorem
define B = on input w
proof: use the recursion theorem
obtain own description < B >
use ATM on < B, w > and
if B(w ) halts, loop for ever
otherwise, halt
(theorem 6.5p222) MINTM is not TM-recognizable
assume E enumerates MINTM
define C = on input w
1
2
3
University of Sydney
COMP3310/3610: Theory of Computation
obtain own description < C >
run the enumerator E until a machine D appears with longer
description than C
simulate D on w
University of Sydney
COMP3310/3610: Theory of Computation
Recusrion theory - (adv)
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
Minimal TMs
Recusrion theory - (adv)
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
A fixed point theorem
x is a fixed point of f if f (x) = x
MINTM is infinite, must contain a longer TM than C
C always simulates D so it is equivalent to it
C is shorter that D so D is not minimal
contradiction: D shouldn’t be on the enumerator’s list
TM encodings: assume that any string that is not a proper
TM encoding, corresponds to a TM that rejects everything
(theorem 6.8p223) let t : Σ∗ → Σ∗ be a computable
function. Then there is a TM F such that t(< F >) =< G >
and G is equivalent to F .
proof: use the recursion theorem
University of Sydney
Recusrion theory - (adv)
COMP3310/3610: Theory of Computation
University of Sydney
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
A fixed point theorem
Recusrion theory - (adv)
COMP3310/3610: Theory of Computation
self-reference
the recursion theorem
minimal turing machines
Rice’s theorem again
Rice’s theorem
(theorem 6.8p223) let t : Σ∗ → Σ∗ be a computable
function. Then there is a TM F such that t(< F >) =< G >
and G is equivalent to F .
All non-trivial properties P of languages of TMs are
undecidable
proof: use the recursion theorem
define F = on input w
proof using the recursion theorem
1
2
3
obtain own description < F >
compute t(< F >) =< G >
simulate G on w
clearly < G > and < F > are equivalent
University of Sydney
COMP3310/3610: Theory of Computation
P is non-trivial: exist < A >∈ P and < B >∈ P
Assume X decides P
define R = on input w :
obtain own description < R >
using the recursion theorem
Run X on < R >
if X accepts, simulate B, else simulate A
University of Sydney
COMP3310/3610: Theory of Computation